Files
cosmopolite/clients/c/cosmopolite.h

47 lines
1.6 KiB
C
Raw Permalink Normal View History

2015-06-06 10:44:46 -07:00
#ifndef _COSMOPOLITE_H
#define _COSMOPOLITE_H
#include <jansson.h>
2015-06-28 11:18:05 -07:00
#include "promise.h"
2015-06-06 10:44:46 -07:00
#define COSMO_UUID_SIZE 37
2015-06-07 15:30:08 -07:00
typedef struct {
void (*client_id_change)(void *, const char *);
2015-06-18 04:27:17 +00:00
void (*connect)(void *);
2015-06-18 05:43:05 +00:00
void (*disconnect)(void *);
2015-06-19 22:27:28 +00:00
void (*login)(void *);
2015-06-15 03:26:41 +00:00
void (*logout)(void *);
void (*message)(const json_t *, void *);
2015-06-07 15:30:08 -07:00
} cosmo_callbacks;
typedef struct {
int placeholder;
} cosmo_options;
typedef struct cosmo cosmo;
2015-06-06 10:44:46 -07:00
void cosmo_uuid(char *uuid);
2015-06-06 10:44:46 -07:00
cosmo *cosmo_create(const char *base_url, const char *client_id, const cosmo_callbacks *callbacks, const cosmo_options *options, void *passthrough);
void cosmo_shutdown(cosmo *instance);
2015-06-06 10:44:46 -07:00
void cosmo_get_profile(cosmo *instance, promise *promise_obj);
json_t *cosmo_current_profile(cosmo *instance);
2015-06-06 15:32:13 -07:00
2015-06-06 10:44:46 -07:00
json_t *cosmo_subject(const char *name, const char *readable_only_by, const char *writeable_only_by);
2015-06-28 11:18:05 -07:00
void cosmo_subscribe(cosmo *instance, json_t *subjects, const json_int_t messages, const json_int_t last_id, promise *promise_obj);
void cosmo_unsubscribe(cosmo *instance, json_t *subject, promise *promise_obj);
void cosmo_send_message(cosmo *instance, json_t *subject, json_t *message, promise *promise_obj);
2015-06-06 10:44:46 -07:00
json_t *cosmo_get_messages(cosmo *instance, json_t *subject);
json_t *cosmo_get_last_message(cosmo *instance, json_t *subject);
2015-06-06 16:05:11 -07:00
// TODO
2015-06-28 11:18:05 -07:00
json_t *cosmo_get_pins(cosmo *instance, json_t *subject, promise *promise_obj);
void cosmo_pin(cosmo *instance, json_t *subject, json_t *message, promise *promise_obj);
void cosmo_unpin(cosmo *instance, json_t *subject, json_t *message, promise *promise_obj);
2015-06-06 16:05:11 -07:00
2015-06-06 10:44:46 -07:00
#endif