summaryrefslogtreecommitdiff
path: root/src/client.h
blob: 1e24f6fe284169c483de11d361f3912ae88d1c7a (plain) (blame)
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
//
// 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