summaryrefslogtreecommitdiff
path: root/src/client.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.h')
-rw-r--r--src/client.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/client.h b/src/client.h
new file mode 100644
index 0000000..1e24f6f
--- /dev/null
+++ b/src/client.h
@@ -0,0 +1,30 @@
+//
+// Created by Anshul Gupta on 6/10/25.
+//
+
+#ifndef CLIENT_H
+#define CLIENT_H
+
+#include <cjson/cJSON.h>
+#include <curl/curl.h>
+
+#include "buffer.h"
+
+typedef void gql_client;
+
+struct gql_ctx {
+ const char *endpoint;
+ const char *token;
+ const char *user_agent;
+};
+
+gql_client *gql_client_new(struct gql_ctx ctx);
+gql_client *gql_client_dup(gql_client *client);
+void gql_client_free(gql_client *client);
+
+CURLcode gql_client_send(const gql_client *client, const char *query,
+ cJSON *args, buffer_t *buf);
+
+int gql_handle_error(const cJSON *root);
+
+#endif // CLIENT_H