RestProxyCall

RestProxyCall

Synopsis

                    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);
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 *param,
                                                         const gchar *value);
void                rest_proxy_call_add_params          (RestProxyCall *call,
                                                         ...);
void                rest_proxy_call_add_params_from_valist
                                                        (RestProxyCall *call,
                                                         va_list params);
const gchar *       rest_proxy_call_lookup_param        (RestProxyCall *call,
                                                         const gchar *param);
void                rest_proxy_call_remove_param        (RestProxyCall *call,
                                                         const gchar *param);
GHashTable *        rest_proxy_call_get_params          (RestProxyCall *call);
gboolean            rest_proxy_call_run                 (RestProxyCall *call,
                                                         GMainLoop **loop,
                                                         GError **error);
void                (*RestProxyCallAsyncCallback)       (RestProxyCall *call,
                                                         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);

Object Hierarchy

  GObject
   +----RestProxyCall
         +----OAuthProxyCall
         +----FlickrProxyCall
         +----FacebookProxyCall

Properties

  "proxy"                    RestProxy*            : Read / Write / Construct Only

Description

Details

RestProxyCall

typedef struct _RestProxyCall RestProxyCall;

RestProxyCall has no publicly available members.


REST_PROXY_CALL_ERROR

#define REST_PROXY_CALL_ERROR rest_proxy_call_error_quark ()

enum RestProxyCallError

typedef enum {
  REST_PROXY_CALL_FAILED
} RestProxyCallError;

rest_proxy_call_set_method ()

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.

call :

The RestProxyCall

method :

The HTTP method to use

rest_proxy_call_get_method ()

const char *        rest_proxy_call_get_method          (RestProxyCall *call);

Get the HTTP method to use when making the call, for example GET or POST.

call :

The RestProxyCall

rest_proxy_call_set_function ()

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

call :

The RestProxyCall

function :

The function to call

rest_proxy_call_add_header ()

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.

call :

The RestProxyCall

header :

The name of the header to set

value :

The value of the header

rest_proxy_call_add_headers ()

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.

call :

The RestProxyCall

... :

Header name and value pairs, followed by NULL.

rest_proxy_call_add_headers_from_valist ()

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.

call :

The RestProxyCall

headers :

Header name and value pairs, followed by NULL.

rest_proxy_call_lookup_header ()

const gchar *       rest_proxy_call_lookup_header       (RestProxyCall *call,
                                                         const gchar *header);

Get the value of the header called header.

call :

The RestProxyCall

header :

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.

rest_proxy_call_remove_header ()

void                rest_proxy_call_remove_header       (RestProxyCall *call,
                                                         const gchar *header);

Remove the header named header from the call.

call :

The RestProxyCall

header :

The header name

rest_proxy_call_add_param ()

void                rest_proxy_call_add_param           (RestProxyCall *call,
                                                         const gchar *param,
                                                         const gchar *value);

Add a query parameter called param with the value value to the call. If a parameter with this name already exists, the new value will replace the old.

call :

The RestProxyCall

param :

The name of the parameter to set

value :

The value of the parameter

rest_proxy_call_add_params ()

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.

call :

The RestProxyCall

... :

Parameter name and value pairs, followed by NULL.

rest_proxy_call_add_params_from_valist ()

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.

call :

The RestProxyCall

params :

Parameter name and value pairs, followed by NULL.

rest_proxy_call_lookup_param ()

const gchar *       rest_proxy_call_lookup_param        (RestProxyCall *call,
                                                         const gchar *param);

Get the value of the parameter called name.

call :

The RestProxyCall

param :

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.

rest_proxy_call_remove_param ()

void                rest_proxy_call_remove_param        (RestProxyCall *call,
                                                         const gchar *param);

Remove the parameter named param from the call.

call :

The RestProxyCall

param :

The paramter name

rest_proxy_call_get_params ()

GHashTable *        rest_proxy_call_get_params          (RestProxyCall *call);

Get the parameters as a GHashTable of parameter names to values. The caller should call g_hash_table_unref() when they have finished using it.

call :

The RestProxyCall

Returns :

A GHashTable.

rest_proxy_call_run ()

gboolean            rest_proxy_call_run                 (RestProxyCall *call,
                                                         GMainLoop **loop,
                                                         GError **error);

RestProxyCallAsyncCallback ()

void                (*RestProxyCallAsyncCallback)       (RestProxyCall *call,
                                                         GError *error,
                                                         GObject *weak_object,
                                                         gpointer userdata);

rest_proxy_call_async ()

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.

call :

The RestProxyCall

callback :

a RestProxyCallAsyncCallback to invoke on completion of the call

weak_object :

The GObject to weakly reference and tie the lifecycle too

userdata :

data to pass to callback

error_out :

a GError, or NULL

rest_proxy_call_cancel ()

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.

call :

The RestProxyCall

rest_proxy_call_sync ()

gboolean            rest_proxy_call_sync                (RestProxyCall *call,
                                                         GError **error_out);

rest_proxy_call_lookup_response_header ()

const gchar *       rest_proxy_call_lookup_response_header
                                                        (RestProxyCall *call,
                                                         const gchar *header);

call: The RestProxyCall header: The name of the header to lookup.

Returns :

The string value of the header header or NULL if that header is not present or there are no headers.

rest_proxy_call_get_response_headers ()

GHashTable *        rest_proxy_call_get_response_headers
                                                        (RestProxyCall *call);

call: The RestProxyCall

Returns :

A 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.

rest_proxy_call_get_payload_length ()

goffset             rest_proxy_call_get_payload_length  (RestProxyCall *call);

Get the length of the return payload.

call :

The RestProxyCall

Returns :

the length of the payload in bytes.

rest_proxy_call_get_payload ()

const gchar *       rest_proxy_call_get_payload         (RestProxyCall *call);

Get the return payload.

call :

The RestProxyCall

Returns :

A pointer to the payload. This is owned by RestProxyCall and should not be freed.

rest_proxy_call_get_status_code ()

guint               rest_proxy_call_get_status_code     (RestProxyCall *call);

Get the HTTP status code for the call.

call :

The RestProxyCall

rest_proxy_call_get_status_message ()

const gchar *       rest_proxy_call_get_status_message  (RestProxyCall *call);

Get the human-readable HTTP status message for the call.

call :

The RestProxyCall

Returns :

The status message. This string is owned by RestProxyCall and should not be freed.

Property Details

The "proxy" property

  "proxy"                    RestProxy*            : Read / Write / Construct Only

Proxy for this call.