forked from cee-studio/orca
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub-internal.h
52 lines (44 loc) · 1.29 KB
/
github-internal.h
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
42
43
44
45
46
47
48
49
50
51
52
#ifndef GITHUB_INTERNAL_H
#define GITHUB_INTERNAL_H
#include "user-agent.h"
#include "cee-utils.h"
#include "json-actor.h"
struct github_presets {
char *owner;
char *username;
char *token;
char *repo;
char *default_branch;
};
struct github_request_attr {
/** the object itself */
void *obj;
/** size of `obj` in bytes */
size_t size;
/** initialize `obj` fields */
void (*init)(void *obj);
/** callback for filling `obj` with JSON values */
void (*from_json)(char *json, size_t len, void *obj);
/** perform a cleanup on `obj` */
void (*cleanup)(void *obj);
};
struct github_adapter {
/** GITHUB_HTTP logging module */
struct logconf conf;
struct user_agent *ua;
};
void github_adapter_init(struct github_adapter *adapter,
struct logconf *conf,
struct github_presets *presets);
ORCAcode github_adapter_run(struct github_adapter *adapter,
struct github_request_attr *attr,
struct sized_buffer *body,
enum http_method method,
char endpoint_fmt[],
...);
struct github {
struct logconf conf;
struct github_adapter adapter;
struct github_presets presets;
};
#endif /* GITHUB_INTERNAL_H */