Top | ![]() |
![]() |
![]() |
![]() |
RestProxy * | rest_proxy_new () |
gboolean | rest_proxy_bind () |
gboolean | rest_proxy_bind_valist () |
void | rest_proxy_set_user_agent () |
const gchar * | rest_proxy_get_user_agent () |
void | rest_proxy_add_soup_feature () |
RestProxyCall * | rest_proxy_new_call () |
gboolean | rest_proxy_simple_run () |
gboolean | rest_proxy_simple_run_valist () |
gboolean | binding-required | Read / Write |
gboolean | disable-cookies | Read / Write / Construct Only |
gchar * | password | Read / Write |
gchar * | ssl-ca-file | Read / Write |
gboolean | ssl-strict | Read / Write |
gchar * | url-format | Read / Write |
gchar * | user-agent | Read / Write |
gchar * | username | Read / Write |
struct | RestProxy |
struct | RestProxyClass |
#define | REST_PROXY_ERROR |
enum | RestProxyError |
GObject ╰── RestProxy ├── FlickrProxy ├── LastfmProxy ├── OAuth2Proxy ╰── OAuthProxy
RestProxy * rest_proxy_new (const gchar *url_format
,gboolean binding_required
);
Create a new RestProxy for the specified endpoint url_format
, using the
"GET" method.
Set binding_required
to TRUE
if the URL contains string formatting
operations (for example "http://foo.com/%s". These must be expanded
using rest_proxy_bind()
before invoking the proxy.
void rest_proxy_set_user_agent (RestProxy *proxy
,const char *user_agent
);
void rest_proxy_add_soup_feature (RestProxy *proxy
,SoupSessionFeature *feature
);
This method can be used to add specific features to the SoupSession objects that are used by librest for its HTTP connections. For example, if one needs extensive control over the cookies which are used for the REST HTTP communication, it's possible to get full access to libsoup cookie API by using
RestProxy *proxy = g_object_new(REST_TYPE_PROXY, "url-format", url, "disable-cookies", TRUE, NULL); SoupSessionFeature *cookie_jar = SOUP_SESSION_FEATURE(soup_cookie_jar_new ()); rest_proxy_add_soup_feature(proxy, cookie_jar);
Since: 0.7.92
RestProxyCall *
rest_proxy_new_call (RestProxy *proxy
);
Create a new RestProxyCall for making a call to the web service. This call is one-shot and should not be re-used for making multiple calls.
gboolean rest_proxy_simple_run (RestProxy *proxy
,gchar **payload
,goffset *len
,GError **error
,...
);
struct RestProxyClass { gboolean (*bind_valist)(RestProxy *proxy, va_list params); RestProxyCall *(*new_call)(RestProxy *proxy); gboolean (*simple_run_valist)(RestProxy *proxy, gchar **payload, goffset *len, GError **error, va_list params); gboolean (*authenticate)(RestProxy *proxy, RestProxyAuth *auth, gboolean retrying); };
Class structure for RestProxy for subclasses to implement specialised behaviour.
Typically subclasses will override new_call
to construct a subclass of
RestProxyCall.
Virtual function called to bind parameters. |
||
Virtual function called to construct a new RestProxyCall. |
||
Virtual function called when making a "simple" call. |
||
class handler for the “authenticate” signal |
Error domain used when returning errors from a RestProxy.
Cancelled |
||
Resolution |
||
Connection |
||
SSL |
||
Input/Output |
||
Failure |
||
HTTP/Multiple choices |
||
HTTP/Moved permanently |
||
HTTP/Found |
||
HTTP/See other |
||
HTTP/Not modified |
||
HTTP/Use proxy |
||
HTTP/306 |
||
HTTP/Temporary redirect |
||
HTTP/Bad request |
||
HTTP/Unauthorized |
||
HTTP/402 |
||
HTTP/Forbidden |
||
HTTP/Not found |
||
HTTP/Method not allowed |
||
HTTP/Not acceptable |
||
HTTP/Proxy authentication required |
||
HTTP/Request timeout |
||
HTTP/Conflict |
||
HTTP/Gone |
||
HTTP/Length required |
||
HTTP/Precondition failed |
||
HTTP/Request entity too large |
||
HTTP/Request URI too long |
||
HTTP/Unsupported media type |
||
HTTP/Requested range not satisfiable |
||
HTTP/Expectation failed |
||
HTTP/Internal server error |
||
HTTP/Not implemented |
||
HTTP/Bad gateway |
||
HTTP/Service unavailable |
||
HTTP/Gateway timeout |
||
HTTP/Version not supported |
“binding-required”
property“binding-required” gboolean
Whether the URL format requires binding.
Flags: Read / Write
Default value: FALSE
“disable-cookies”
property“disable-cookies” gboolean
Whether to disable cookie support.
Flags: Read / Write / Construct Only
Default value: FALSE
“password”
property“password” gchar *
The password for authentication.
Flags: Read / Write
Default value: NULL
“ssl-ca-file”
property“ssl-ca-file” gchar *
File containing SSL CA certificates.
Flags: Read / Write
Default value: NULL
“ssl-strict”
property“ssl-strict” gboolean
Whether certificate errors should be considered a connection error.
Flags: Read / Write
Default value: TRUE
“url-format”
property“url-format” gchar *
Format string for the RESTful url.
Flags: Read / Write
Default value: NULL
“user-agent”
property“user-agent” gchar *
The User-Agent of the client.
Flags: Read / Write
Default value: NULL
“username”
property“username” gchar *
The username for authentication.
Flags: Read / Write
Default value: NULL
“authenticate”
signalgboolean user_function (RestProxy *proxy, RestProxyAuth *auth, gboolean retrying, gpointer user_data)
Emitted when the proxy requires authentication. If
credentials are available, set the 'username' and 'password'
properties on proxy
and return TRUE
from the callback.
This will cause the signal emission to stop, and librest will
try to connect with these credentials
If these credentials fail, the signal will be
emitted again, with retrying
set to TRUE
, which will
continue until FALSE
is returned from the callback.
If you call rest_proxy_auth_pause()
on auth
before
returning, then you can the authentication credentials on
the RestProxy object asynchronously. You have to make sure
that auth
does not get destroyed with g_object_ref()
.
You can then unpause the authentication with
rest_proxy_auth_unpause()
when everything is ready for it
to continue.
proxy |
the proxy |
|
auth |
authentication state |
|
retrying |
|
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last