summaryrefslogtreecommitdiff
path: root/libgs/src/client.h
blob: d24b1ff93cf21dd13e900dc104a4a2c711fc5945 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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