Delta Chat Core C Interface
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dc_jsonrpc_instance_t Class Reference

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.
 

Detailed Description

Opaque object for using the json rpc api from the cffi bindings.

Member Function Documentation

◆ dc_jsonrpc_blocking_call()

char * dc_jsonrpc_blocking_call ( dc_jsonrpc_instance_t * jsonrpc_instance,
const char * input )

Make a JSON-RPC call and return a response.

Parameters
jsonrpc_instancejsonrpc instance as returned from dc_jsonrpc_init().
inputJSON-RPC request.
Returns
JSON-RPC response as string, must be freed using dc_str_unref() after usage. If there is no response, NULL is returned.

◆ dc_jsonrpc_next_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.

Parameters
jsonrpc_instancejsonrpc instance as returned from dc_jsonrpc_init().
Returns
JSON-RPC response as string, must be freed using dc_str_unref() after usage. If NULL is returned, the accounts_t belonging to the jsonrpc instance is unref'd and no more events will come; in this case, free the jsonrpc instance using dc_jsonrpc_unref().

◆ dc_jsonrpc_request()

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.

Parameters
jsonrpc_instancejsonrpc instance as returned from dc_jsonrpc_init().
requestJSON-RPC request as string

◆ dc_jsonrpc_unref()

void dc_jsonrpc_unref ( dc_jsonrpc_instance_t * jsonrpc_instance)

Free a jsonrpc instance.

Parameters
jsonrpc_instancejsonrpc instance as returned from dc_jsonrpc_init(). If NULL is given, nothing is done and an error is logged.

The documentation for this class was generated from the following file: