![]() |
![]() |
![]() |
librest Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
RestProxyCall; #define REST_PROXY_CALL_ERROR enum RestProxyCallError; void rest_proxy_call_set_method (RestProxyCall *call
,const gchar *method
); const char * rest_proxy_call_get_method (RestProxyCall *call
); void rest_proxy_call_set_function (RestProxyCall *call
,const gchar *function
); const char * rest_proxy_call_get_function (RestProxyCall *call
); void rest_proxy_call_add_header (RestProxyCall *call
,const gchar *header
,const gchar *value
); void rest_proxy_call_add_headers (RestProxyCall *call
,...
); void rest_proxy_call_add_headers_from_valist (RestProxyCall *call
,va_list headers
); const gchar * rest_proxy_call_lookup_header (RestProxyCall *call
,const gchar *header
); void rest_proxy_call_remove_header (RestProxyCall *call
,const gchar *header
); void rest_proxy_call_add_param (RestProxyCall *call
,const gchar *name
,const gchar *value
); void rest_proxy_call_add_param_full (RestProxyCall *call
,RestParam *param
); void rest_proxy_call_add_params (RestProxyCall *call
,...
); void rest_proxy_call_add_params_from_valist (RestProxyCall *call
,va_list params
); RestParam * rest_proxy_call_lookup_param (RestProxyCall *call
,const gchar *name
); void rest_proxy_call_remove_param (RestProxyCall *call
,const gchar *name
); RestParams * rest_proxy_call_get_params (RestProxyCall *call
); gboolean rest_proxy_call_run (RestProxyCall *call
,GMainLoop **loop
,GError **error
); void (*RestProxyCallAsyncCallback) (RestProxyCall *call
,const GError *error
,GObject *weak_object
,gpointer userdata
); gboolean rest_proxy_call_async (RestProxyCall *call
,RestProxyCallAsyncCallback callback
,GObject *weak_object
,gpointer userdata
,GError **error
); gboolean rest_proxy_call_cancel (RestProxyCall *call
); gboolean rest_proxy_call_sync (RestProxyCall *call
,GError **error_out
); const gchar * rest_proxy_call_lookup_response_header (RestProxyCall *call
,const gchar *header
); GHashTable * rest_proxy_call_get_response_headers (RestProxyCall *call
); goffset rest_proxy_call_get_payload_length (RestProxyCall *call
); const gchar * rest_proxy_call_get_payload (RestProxyCall *call
); guint rest_proxy_call_get_status_code (RestProxyCall *call
); const gchar * rest_proxy_call_get_status_message (RestProxyCall *call
);
GObject +----RestProxyCall +----FlickrProxyCall +----LastfmProxyCall +----OAuth2ProxyCall +----OAuthProxyCall
typedef struct _RestProxyCall RestProxyCall;
RestProxyCall has no publicly available members.
typedef enum { REST_PROXY_CALL_FAILED } RestProxyCallError;
Error domain used when returning errors from RestProxyCall.
void rest_proxy_call_set_method (RestProxyCall *call
,const gchar *method
);
Set the HTTP method to use when making the call, for example GET or POST.
|
The RestProxyCall |
|
The HTTP method to use |
const char * rest_proxy_call_get_method (RestProxyCall *call
);
Get the HTTP method to use when making the call, for example GET or POST.
|
The RestProxyCall |
void rest_proxy_call_set_function (RestProxyCall *call
,const gchar *function
);
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 function
test
would actually access the URL
http://www.example.com/test
|
The RestProxyCall |
|
The function to call |
const char * rest_proxy_call_get_function (RestProxyCall *call
);
Get the REST function that is going to be called on the proxy.
|
The RestProxyCall |
Returns : |
The REST "function" for the current call, see also
rest_proxy_call_set_function() . This string is owned by the RestProxyCall
and should not be freed. |
Since 0.7.92
void rest_proxy_call_add_header (RestProxyCall *call
,const gchar *header
,const gchar *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.
|
The RestProxyCall |
|
The name of the header to set |
|
The value of the header |
void rest_proxy_call_add_headers (RestProxyCall *call
,...
);
Add the specified header name and value pairs to the call. If a header already exists, the new value will replace the old.
|
The RestProxyCall |
|
Header name and value pairs, followed by NULL . |
void rest_proxy_call_add_headers_from_valist (RestProxyCall *call
,va_list headers
);
Add the specified header name and value pairs to the call. If a header already exists, the new value will replace the old.
|
The RestProxyCall |
|
Header name and value pairs, followed by NULL . |
const gchar * rest_proxy_call_lookup_header (RestProxyCall *call
,const gchar *header
);
Get the value of the header called header
.
|
The RestProxyCall |
|
The header name |
Returns : |
The header value, or NULL if it does not exist. This string is
owned by the RestProxyCall and should not be freed. |
void rest_proxy_call_remove_header (RestProxyCall *call
,const gchar *header
);
Remove the header named header
from the call.
|
The RestProxyCall |
|
The header name |
void rest_proxy_call_add_param (RestProxyCall *call
,const gchar *name
,const gchar *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.
|
The RestProxyCall |
|
The name of the parameter to set |
|
The value of the parameter |
void rest_proxy_call_add_param_full (RestProxyCall *call
,RestParam *param
);
void rest_proxy_call_add_params (RestProxyCall *call
,...
);
Add the specified parameter name and value pairs to the call. If a parameter already exists, the new value will replace the old.
|
The RestProxyCall |
|
Parameter name and value pairs, followed by NULL . |
void rest_proxy_call_add_params_from_valist (RestProxyCall *call
,va_list params
);
Add the specified parameter name and value pairs to the call. If a parameter already exists, the new value will replace the old.
|
The RestProxyCall |
|
Parameter name and value pairs, followed by NULL . |
RestParam * rest_proxy_call_lookup_param (RestProxyCall *call
,const gchar *name
);
Get the value of the parameter called name
.
|
The RestProxyCall |
|
The paramter name |
Returns : |
The parameter value, or NULL if it does not exist. This string is
owned by the RestProxyCall and should not be freed. |
void rest_proxy_call_remove_param (RestProxyCall *call
,const gchar *name
);
Remove the parameter named name
from the call.
|
The RestProxyCall |
|
The paramter name |
RestParams * rest_proxy_call_get_params (RestProxyCall *call
);
Get the parameters as a RestParams of parameter names to values. The returned value is owned by the RestProxyCall instance and should not be freed by the caller.
|
The RestProxyCall |
Returns : |
A RestParams. [transfer none] |
gboolean rest_proxy_call_run (RestProxyCall *call
,GMainLoop **loop
,GError **error
);
void (*RestProxyCallAsyncCallback) (RestProxyCall *call
,const GError *error
,GObject *weak_object
,gpointer userdata
);
gboolean rest_proxy_call_async (RestProxyCall *call
,RestProxyCallAsyncCallback callback
,GObject *weak_object
,gpointer userdata
,GError **error
);
Asynchronously invoke call
.
When the call has finished, callback
will be called. 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.
|
The RestProxyCall |
|
a RestProxyCallAsyncCallback to invoke on completion of the call |
|
The GObject to weakly reference and tie the lifecycle too |
|
data to pass to callback
|
|
a GError, or NULL
|
gboolean rest_proxy_call_cancel (RestProxyCall *call
);
Cancel this call. It may be too late to not actually send the message, but the callback will not be invoked.
N.B. this method should only be used with rest_proxy_call_async()
and NOT
rest_proxy_call_invoke_async()
.
|
The RestProxyCall |
const gchar * rest_proxy_call_lookup_response_header (RestProxyCall *call
,const gchar *header
);
Get the string value of the header header
or NULL
if that header is not
present or there are no headers.
|
The RestProxyCall |
|
The name of the header to lookup. |
GHashTable * rest_proxy_call_get_response_headers
(RestProxyCall *call
);
|
The RestProxyCall |
Returns : |
pointer to a hash table of
headers. This hash table must not be changed. You should call
g_hash_table_unref() when you have finished with it. [transfer container]
|
goffset rest_proxy_call_get_payload_length (RestProxyCall *call
);
Get the length of the return payload.
|
The RestProxyCall |
Returns : |
the length of the payload in bytes. |
const gchar * rest_proxy_call_get_payload (RestProxyCall *call
);
Get the return payload.
|
The RestProxyCall |
Returns : |
A pointer to the payload. This is owned by RestProxyCall and should not be freed. |
guint rest_proxy_call_get_status_code (RestProxyCall *call
);
Get the HTTP status code for the call.
|
The RestProxyCall |
const gchar * rest_proxy_call_get_status_message (RestProxyCall *call
);
Get the human-readable HTTP status message for the call.
|
The RestProxyCall |
Returns : |
The status message. This string is owned by RestProxyCall and should not be freed. |