Delta Chat Core C Interface
|
Opaque object for using the json rpc api from the cffi bindings. More...
#include <deltachat.h>
Public Member Functions | |
char * | dc_jsonrpc_blocking_call (dc_jsonrpc_instance_t *jsonrpc_instance, const char *input) |
Make a JSON-RPC call and return a response. | |
char * | dc_jsonrpc_next_response (dc_jsonrpc_instance_t *jsonrpc_instance) |
Get the next json_rpc response, blocks until there is a new event, so call this in a loop from a thread. | |
void | dc_jsonrpc_request (dc_jsonrpc_instance_t *jsonrpc_instance, const char *request) |
Makes an asynchronous jsonrpc request, returns immediately and once the result is ready it can be retrieved via dc_jsonrpc_next_response() the jsonrpc specification defines an invocation id that can then be used to match request and response. | |
void | dc_jsonrpc_unref (dc_jsonrpc_instance_t *jsonrpc_instance) |
Free a jsonrpc instance. | |
Opaque object for using the json rpc api from the cffi bindings.
char * dc_jsonrpc_blocking_call | ( | dc_jsonrpc_instance_t * | jsonrpc_instance, |
const char * | input ) |
Make a JSON-RPC call and return a response.
See dc_jsonrpc_request() for an overview of possible calls and for more information.
jsonrpc_instance | jsonrpc instance as returned from dc_jsonrpc_init(). |
input | JSON-RPC request. |
char * dc_jsonrpc_next_response | ( | dc_jsonrpc_instance_t * | jsonrpc_instance | ) |
Get the next json_rpc response, blocks until there is a new event, so call this in a loop from a thread.
jsonrpc_instance | jsonrpc instance as returned from dc_jsonrpc_init(). |
void dc_jsonrpc_request | ( | dc_jsonrpc_instance_t * | jsonrpc_instance, |
const char * | request ) |
Makes an asynchronous jsonrpc request, returns immediately and once the result is ready it can be retrieved via dc_jsonrpc_next_response() the jsonrpc specification defines an invocation id that can then be used to match request and response.
An overview of JSON-RPC calls is available at https://js.jsonrpc.delta.chat/classes/RawClient.html. Note that the page describes only the rough methods. Calling convention, casing etc. does vary, this is a known flaw, and at some point we will get to improve that :)
Also, note that most calls are more high-level than this CFFI, require more database calls and are slower. They're more suitable for an environment that is totally async and/or cannot use CFFI, which might not be true for native apps.
Notable exceptions that exist only as JSON-RPC and probably never get a CFFI counterpart:
jsonrpc_instance | jsonrpc instance as returned from dc_jsonrpc_init(). |
request | JSON-RPC request as string |
void dc_jsonrpc_unref | ( | dc_jsonrpc_instance_t * | jsonrpc_instance | ) |
Free a jsonrpc instance.
jsonrpc_instance | jsonrpc instance as returned from dc_jsonrpc_init(). If NULL is given, nothing is done and an error is logged. |