summaryrefslogtreecommitdiff
path: root/shopify.h
blob: f50157c3126fca6c76dc869f04c8dbf73e3b74a9 (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
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef SHOPIFY_H
#define SHOPIFY_H

struct shopify_session {
	char *shop;
	char *nonce;
	char *access_token;
	char *scopes;
};

struct shopify_api {
	char *url;
	char *method;
	void (*cb)(const char *, const struct shopify_session *, char **);
	void *arg;
};

struct shopify_carrierservice {
	char *url;
	char *name;
	char *(*rates)(const char *, const char *, long,
			const struct shopify_session *);
};

#ifdef __cplusplus
extern "C" {
#endif

void shopify_app(const char *api_key, const char *api_secret_key,
		const char *app_url, const char *redir_url, const char *app_id,
		const char *scopes, char *(*html)(const char *host),
		const char *js_dir, const struct shopify_api apis[],
		const struct shopify_carrierservice carrierservices[]);
void shopify_graphql(const char *query, const struct shopify_session *session,
		char **json);

#ifdef __cplusplus
}
#endif

#endif