#ifndef NCDC_API_H #define NCDC_API_H #include #include #include #include #include #include #include struct dc_api_; typedef struct dc_api_ *dc_api_t; dc_api_t dc_api_new(void); void dc_api_set_curl_multi(dc_api_t api, CURLM *curl); void dc_api_set_event_base(dc_api_t api, struct event_base *base); /* call this function in case the MULTI has told us that some * transfer has finished. */ void dc_api_signal(dc_api_t api, CURL *easy, int code); /* internal curl stuff */ dc_api_sync_t dc_api_call(dc_api_t api, char const *token, char const *verb, char const *method, json_t *j); json_t *dc_api_call_sync(dc_api_t api, char const *token, char const *verb, char const *method, json_t *j); /** * Authenticate a given user account. The user account should have * email, and password set. If the auth succeeds the account will have * a login token, and will from now on be the "login account". You * will have to pass that account to various other functions for * authentication. */ bool dc_api_authenticate(dc_api_t api, dc_account_t account); /** * Retrieve basic user information for the given account. The first * parameter is the user account holding login info, while the second * is the account you wish to retrieve information about. */ bool dc_api_get_userinfo(dc_api_t api, dc_account_t login, dc_account_t user); /** * Fetch a list of guilds fro the specified login user. Warning if you * unref the pointer array, you will also unref all the dc_guild_t objects. */ bool dc_api_get_userguilds(dc_api_t api, dc_account_t login, GPtrArray **guilds); /** * Fetch a list of friends of the login account "login". Returns a GPtrArray * of dc_account_t which automatically cleans itself up. */ bool dc_api_get_friends(dc_api_t api, dc_account_t login, GPtrArray **friends); #endif