summaryrefslogtreecommitdiff
path: root/main.c
blob: 2b09e96a5c50ce51c309f7be9687a3aaa478e100 (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
#include <string.h>
#include <stdio.h>
#include <shopify.h>

int main(int argc, char *argv[])
{
	const size_t app_dir_len = strlen(APP_DIR);
	static const char *scopes_rel = "/shopify.app.toml";
	char scopes[app_dir_len + strlen(scopes_rel) + 1];
	sprintf(scopes, "%s%s", APP_DIR, scopes_rel);
	static const char *index_rel = "/frontend/index.html";
	char index[app_dir_len + strlen(index_rel) + 1];
	sprintf(index, "%s%s", APP_DIR, index_rel);
	shopify_app(API_KEY, API_SECRET_KEY, APP_URL, "/auth", APP_ID, scopes, index,
			(struct shopify_api[]){
			{
				"/products",
				"GET",
				shopify_graphql,
				"{"\
				"  productCreate() {"\
				"    product {"\
				"      id"\
				"    }"\
				"  }"\
				"}"
			},
			{}
		}
	);
	return 0;
}