add


Description:

public void add (string wire_name, Type handler, string path, string verb, string method_name, Type request_type, Type response_type) throws Error

Register one HTTP route under a verb.

Does not call Request.add_class. Use when the method/sig is already registered, or for a late/test-only path. Prefer routes from service rpc_register(). A trailing /{id} is stripped from the stored path and sets Route.variable (optional id on that one method).

Example

OLLMrpc.Request.add_class("Alarm", typeof(Service), "ping", "");
OLLMrpc.Http.add("Alarm", typeof(Service),
"/v1/alarms/ping", "GET", "ping", typeof(void), typeof(void)
);

Parameters:

wire_name

wire object prefix (e.g. Alarm)

handler

handler GType (same as add_class)

path

path key (e.g. /v1/alarms or /v1/alarms/{id})

verb

HTTP verb (GET, POST, …)

method_name

short method (e.g. get)

request_type

body GType, or typeof(void)

response_type

retval GType

Exceptions:

GLib.IOError.EXISTS

when verb+path is already registered


Namespace: OLLMrpc.Http
Package: ollmchat