Proxy


Object Hierarchy:

Rest.Proxy Rest.Proxy Rest.Proxy GLib.Object GLib.Object GLib.Object->Rest.Proxy

Description:

[ CCode ( type_id = "rest_proxy_get_type ()" ) ]
public class Proxy : Object

Proxy has no publicly available members.

Example: Read raw data, async:

public static int main (string[] args) {
try {
MainLoop loop = new MainLoop ();

Rest.Proxy proxy = new Rest.Proxy ("http://www.flickr.com/services/rest/", false);
Rest.ProxyCall call = proxy.new_call ();
call.add_params (
"method", "flickr.test.echo",
"api_key", "314691be2e63a4d58994b2be01faacfb",
"format", "json"
);

call.run_async ((call, error, obj) => {
string payload = call.get_payload ();
int64 len = call.get_payload_length ();

// We interpret the result as data:
unowned uint8[] arr = (uint8[]) payload;
arr.length = (int) len;
stdout.write (arr, sizeof (uint8));

loop.quit ();
}, null);

loop.run ();
} catch (Error e) {
stderr.puts (e.message);
stderr.putc ('\n');
}
return 0;
}

valac --pkg rest-0.7 test-raw-async.vala

Example: Read raw data, sync:

public static int main (string[] args) {
MainLoop loop = new MainLoop ();
try {
Rest.Proxy proxy = new Rest.Proxy ("http://www.flickr.com/services/rest/", false);
Rest.ProxyCall call = proxy.new_call ();
call.add_params (
"method", "flickr.test.echo",
"api_key", "314691be2e63a4d58994b2be01faacfb",
"format", "json"
);

call.run ();
string payload = call.get_payload ();
int64 len = call.get_payload_length ();

// We interpret the result as data:
unowned uint8[] arr = (uint8[]) payload;
arr.length = (int) len;
stdout.write (arr, sizeof (uint8));
} catch (Error e) {
stderr.puts (e.message);
stderr.putc ('\n');
}
loop = null;
return 0;
}

valac --pkg rest-0.7 test-raw-sync.vala

All known sub-classes:

Namespace: Rest
Package: rest-0.7

Content:

Properties:

Creation methods:

Methods:

Signals:

Inherited Members: