The name of the method
The length of the method string
Optional the document to use as the parameter
The length of the document parameter
The resulting hirpc as a document
The length of the resulting document
import tagion.api.hibon; import tagion.api.document; ubyte* doc_param_ptr = new ubyte; size_t doc_param_len; { HiBONT* hibon = new HiBONT; int rc = tagion_hibon_create(hibon); assert(rc == 0); scope(exit) tagion_hibon_free(hibon); const char[] key = "a"; rc = tagion_hibon_add_int32(hibon, &key[0], key.length, 7); assert(rc == 0); rc = tagion_hibon_get_document(hibon, &doc_param_ptr, &doc_param_len); assert(rc == 0); } string method = "some_method"; ubyte* result_doc_ptr = new ubyte; size_t result_doc_len; int rc = tagion_hirpc_create_sender(&method[0], method.length, doc_param_ptr, doc_param_len, &result_doc_ptr, &result_doc_len); assert(rc == 0); const doc = Document(result_doc_ptr[0 .. result_doc_len].idup); assert(doc.isInorder);
Create a hirpc from a document