summaryrefslogtreecommitdiff
path: root/shopify.h
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2022-09-18 21:14:36 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2022-09-18 21:14:36 +0800
commit7a47bb74f8cf5780200126deb010df77f0090a37 (patch)
treecf86e156f0d5b0fa1742a0e7b443a562f87d9d8a /shopify.h
parent20232131dbb00468fa55df70916db1abc5a720fb (diff)
Move MHD access handler to the library
so the code on the app side is much simpler. Also prepare for accessing the GraphQL Admin API.
Diffstat (limited to 'shopify.h')
-rw-r--r--shopify.h29
1 files changed, 13 insertions, 16 deletions
diff --git a/shopify.h b/shopify.h
index 0c6f4e7..02ac22a 100644
--- a/shopify.h
+++ b/shopify.h
@@ -1,28 +1,25 @@
#ifndef SHOPIFY_H
#define SHOPIFY_H
-#include <stdbool.h>
-#include <microhttpd.h>
-
-struct shopify_param {
- char *key;
- char *val;
+struct shopify_api {
+ char *url;
+ char *method;
+ void (*cb)();
+ void *arg;
};
+struct shopify_session;
+
#ifdef __cplusplus
extern "C" {
#endif
-void shopify_init();
-bool shopify_valid(struct MHD_Connection *conn, const char *url,
- const char *redir_url, const char *key,
- struct shopify_param *params[]);
-enum MHD_Result shopify_respond(const struct shopify_param params[],
- const char *url, const char *redir_url, const char *app_url,
- const char *app_id, const char *key, const char *secret_key,
- const char *toml_path, const char *html_path,
- struct MHD_Connection *conn, struct MHD_Response **resp);
-void shopify_cleanup();
+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 *scope, const char *index,
+ const struct shopify_api apis[]);
+void shopify_graphql(const char *query, const struct shopify_session *session,
+ char **json);
#ifdef __cplusplus
}