From 477e1ba2977435ae7bb75c7dbd95cf28247f89bd Mon Sep 17 00:00:00 2001 From: nirav Date: Thu, 28 Mar 2019 09:10:52 +0530 Subject: Move APIs into libgs dir --- libgs/src/client.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 libgs/src/client.h (limited to 'libgs/src/client.h') diff --git a/libgs/src/client.h b/libgs/src/client.h new file mode 100644 index 0000000..d24b1ff --- /dev/null +++ b/libgs/src/client.h @@ -0,0 +1,29 @@ +#ifndef __GS_CLIENT_H +#define __GS_CLIENT_H + +typedef struct { + char *server; + char *client_id; + char *client_secret; + char *access_token; +} GSClient; + +/* + * Create new GSClient with server url, client_id and client_secret returned + * from gs_register call. + * It will add `http://` prefix to server if it doesn't exists. + */ +GSClient *gs_client_new(const char *server, const char *client_id, + const char *client_secret); + +/* Generic helper fuction to make http calls */ +void *gs_client_do_api(GSClient *c, int method, const char *url, + const char *req); + +/* Set user access_token */ +void gs_client_set_token(GSClient *c, const char *access_token); + +/* Free GSClient */ +void gs_client_free(GSClient *c); + +#endif -- cgit v1.2.3