Orca
A bot framework that is easy to reason about, easy to debug, and easy to use.
gateway.h
Go to the documentation of this file.
1 /* This file is generated from specs/discord/gateway.json, Please don't edit it. */
12 enum discord_gateway_close_opcodes {
13  DISCORD_GATEWAY_CLOSE_REASON_UNKNOWN_ERROR = 4000,
14  DISCORD_GATEWAY_CLOSE_REASON_UNKNOWN_OPCODE = 4001,
15  DISCORD_GATEWAY_CLOSE_REASON_DECODE_ERROR = 4002,
16  DISCORD_GATEWAY_CLOSE_REASON_NOT_AUTHENTICATED = 4003,
17  DISCORD_GATEWAY_CLOSE_REASON_AUTHENTICATION_FAILED = 4004,
18  DISCORD_GATEWAY_CLOSE_REASON_ALREADY_AUTHENTICATED = 4005,
19  DISCORD_GATEWAY_CLOSE_REASON_INVALID_SEQUENCE = 4007,
20  DISCORD_GATEWAY_CLOSE_REASON_RATE_LIMITED = 4008,
21  DISCORD_GATEWAY_CLOSE_REASON_SESSION_TIMED_OUT = 4009,
22  DISCORD_GATEWAY_CLOSE_REASON_INVALID_SHARD = 4010,
23  DISCORD_GATEWAY_CLOSE_REASON_SHARDING_REQUIRED = 4011,
24  DISCORD_GATEWAY_CLOSE_REASON_INVALID_API_VERSION = 4012,
25  DISCORD_GATEWAY_CLOSE_REASON_INVALID_INTENTS = 4013,
26  DISCORD_GATEWAY_CLOSE_REASON_DISALLOWED_INTENTS = 4014,
27 };
28 extern char* discord_gateway_close_opcodes_to_string(enum discord_gateway_close_opcodes);
29 extern enum discord_gateway_close_opcodes discord_gateway_close_opcodes_from_string(char*);
30 extern bool discord_gateway_close_opcodes_has(enum discord_gateway_close_opcodes, char*);
31 
32 
33 enum discord_gateway_intents {
34  DISCORD_GATEWAY_GUILDS = 1, // 1 << 0
35  DISCORD_GATEWAY_GUILD_MEMBERS = 2, // 1 << 1
36  DISCORD_GATEWAY_GUILD_BANS = 4, // 1 << 2
37  DISCORD_GATEWAY_GUILD_EMOJIS = 8, // 1 << 3
38  DISCORD_GATEWAY_GUILD_INTEGRATIONS = 16, // 1 << 4
39  DISCORD_GATEWAY_GUILD_WEBHOOKS = 32, // 1 << 5
40  DISCORD_GATEWAY_GUILD_INVITES = 64, // 1 << 6
41  DISCORD_GATEWAY_GUILD_VOICE_STATES = 128, // 1 << 7
42  DISCORD_GATEWAY_GUILD_PRESENCES = 256, // 1 << 8
43  DISCORD_GATEWAY_GUILD_MESSAGES = 512, // 1 << 9
44  DISCORD_GATEWAY_GUILD_MESSAGE_REACTIONS = 1024, // 1 << 10
45  DISCORD_GATEWAY_GUILD_MESSAGE_TYPING = 2048, // 1 << 11
46  DISCORD_GATEWAY_DIRECT_MESSAGES = 4096, // 1 << 12
47  DISCORD_GATEWAY_DIRECT_MESSAGE_REACTIONS = 8192, // 1 << 13
48  DISCORD_GATEWAY_DIRECT_MESSAGE_TYPING = 16384, // 1 << 14
49 };
50 extern char* discord_gateway_intents_to_string(enum discord_gateway_intents);
51 extern enum discord_gateway_intents discord_gateway_intents_from_string(char*);
52 extern bool discord_gateway_intents_has(enum discord_gateway_intents, char*);
53 
54 
55 enum discord_gateway_opcodes {
56  DISCORD_GATEWAY_DISPATCH = 0,
57  DISCORD_GATEWAY_HEARTBEAT = 1,
58  DISCORD_GATEWAY_IDENTIFY = 2,
59  DISCORD_GATEWAY_PRESENCE_UPDATE = 3,
60  DISCORD_GATEWAY_VOICE_STATE_UPDATE = 4,
61  DISCORD_GATEWAY_RESUME = 6,
62  DISCORD_GATEWAY_RECONNECT = 7,
63  DISCORD_GATEWAY_REQUEST_GUILD_MEMBERS = 8,
64  DISCORD_GATEWAY_INVALID_SESSION = 9,
65  DISCORD_GATEWAY_HELLO = 10,
66  DISCORD_GATEWAY_HEARTBEAT_ACK = 11,
67 };
68 extern char* discord_gateway_opcodes_to_string(enum discord_gateway_opcodes);
69 extern enum discord_gateway_opcodes discord_gateway_opcodes_from_string(char*);
70 extern bool discord_gateway_opcodes_has(enum discord_gateway_opcodes, char*);
71 
72 
73 enum discord_gateway_events {
74  DISCORD_GATEWAY_EVENTS_NONE = 0,
75  DISCORD_GATEWAY_EVENTS_GUILD_CREATE = 1,
76  DISCORD_GATEWAY_EVENTS_GUILD_UPDATE = 2,
77  DISCORD_GATEWAY_EVENTS_GUILD_DELETE = 3,
78  DISCORD_GATEWAY_EVENTS_GUILD_ROLE_CREATE = 4,
79  DISCORD_GATEWAY_EVENTS_GUILD_ROLE_UPDATE = 5,
80  DISCORD_GATEWAY_EVENTS_GUILD_ROLE_DELETE = 6,
81  DISCORD_GATEWAY_EVENTS_GUILD_MEMBER_ADD = 7,
82  DISCORD_GATEWAY_EVENTS_GUILD_MEMBER_UPDATE = 8,
83  DISCORD_GATEWAY_EVENTS_GUILD_MEMBER_REMOVE = 9,
84  DISCORD_GATEWAY_EVENTS_GUILD_BAN_ADD = 10,
85  DISCORD_GATEWAY_EVENTS_GUILD_BAN_REMOVE = 11,
86  DISCORD_GATEWAY_EVENTS_GUILD_EMOJIS_UPDATE = 12,
87  DISCORD_GATEWAY_EVENTS_GUILD_INTEGRATIONS_UPDATE = 13,
88  DISCORD_GATEWAY_EVENTS_CHANNEL_CREATE = 14,
89  DISCORD_GATEWAY_EVENTS_CHANNEL_UPDATE = 15,
90  DISCORD_GATEWAY_EVENTS_CHANNEL_DELETE = 16,
91  DISCORD_GATEWAY_EVENTS_CHANNEL_PINS_UPDATE = 17,
92  DISCORD_GATEWAY_EVENTS_INVITE_CREATE = 18,
93  DISCORD_GATEWAY_EVENTS_INVITE_DELETE = 19,
94  DISCORD_GATEWAY_EVENTS_MESSAGE_CREATE = 20,
95  DISCORD_GATEWAY_EVENTS_MESSAGE_UPDATE = 21,
96  DISCORD_GATEWAY_EVENTS_MESSAGE_DELETE = 22,
97  DISCORD_GATEWAY_EVENTS_MESSAGE_DELETE_BULK = 23,
98  DISCORD_GATEWAY_EVENTS_MESSAGE_REACTION_ADD = 24,
99  DISCORD_GATEWAY_EVENTS_MESSAGE_REACTION_REMOVE = 25,
100  DISCORD_GATEWAY_EVENTS_MESSAGE_REACTION_REMOVE_ALL = 26,
101  DISCORD_GATEWAY_EVENTS_MESSAGE_REACTION_REMOVE_EMOJI = 27,
102  DISCORD_GATEWAY_EVENTS_WEBHOOKS_UPDATE = 28,
103  DISCORD_GATEWAY_EVENTS_VOICE_STATE_UPDATE = 29,
104  DISCORD_GATEWAY_EVENTS_VOICE_SERVER_UPDATE = 30,
105  DISCORD_GATEWAY_EVENTS_PRESENCE_UPDATE = 31,
106  DISCORD_GATEWAY_EVENTS_TYPING_START = 32,
107  DISCORD_GATEWAY_EVENTS_READY = 33,
108  DISCORD_GATEWAY_EVENTS_RESUMED = 34,
109 };
110 extern char* discord_gateway_events_to_string(enum discord_gateway_events);
111 extern enum discord_gateway_events discord_gateway_events_from_string(char*);
112 extern bool discord_gateway_events_has(enum discord_gateway_events, char*);
113 
121  /* specs/discord/gateway.json:119:19
122  '{ "name":"token","type":{"base":"char", "dec":"*"}}' */
123  char *token;
124 
125  /* specs/discord/gateway.json:120:19
126  '{ "name":"properties","type":{"base":"struct discord_gateway_identify_connection", "dec":"*"}}' */
127  struct discord_gateway_identify_connection *properties;
128 
129  /* specs/discord/gateway.json:121:19
130  '{ "name":"compress","type":{"base":"bool"}}' */
131  bool compress;
132 
133  /* specs/discord/gateway.json:122:19
134  '{ "name":"large_threshold","type":{"base":"int"}}' */
135  int large_threshold;
136 
137  /* specs/discord/gateway.json:123:19
138  '{ "name":"guild_subscriptions","type":{"base":"bool"}}' */
139  bool guild_subscriptions;
140 
141  /* specs/discord/gateway.json:124:19
142  '{ "name":"shard","type":{"base":"int", "dec":"*"}, "todo":true}' */
144 
145  /* specs/discord/gateway.json:125:19
146  '{ "name":"presence","type":{"base":"struct discord_gateway_status_update", "dec":"*"}}' */
148 
149  /* specs/discord/gateway.json:126:19
150  '{ "name":"intents","type":{"base":"int"}}' */
151  int intents;
152 
153  // The following is metadata used to
154  // 1. control which field should be extracted/injected
155  // 2. record which field is presented(defined) in JSON
156  // 3. record which field is null in JSON
158  struct {
159  bool enable_arg_switches;
160  bool enable_record_defined;
161  bool enable_record_null;
162  void *arg_switches[8];
163  void *record_defined[8];
164  void *record_null[8];
165  } __M; // metadata
167 };
168 extern void discord_gateway_identify_cleanup_v(void *p);
169 extern void discord_gateway_identify_cleanup(struct discord_gateway_identify *p);
170 extern void discord_gateway_identify_init_v(void *p);
171 extern void discord_gateway_identify_init(struct discord_gateway_identify *p);
172 extern struct discord_gateway_identify * discord_gateway_identify_alloc();
173 extern void discord_gateway_identify_free_v(void *p);
174 extern void discord_gateway_identify_free(struct discord_gateway_identify *p);
175 extern void discord_gateway_identify_from_json_v(char *json, size_t len, void *p);
176 extern void discord_gateway_identify_from_json(char *json, size_t len, struct discord_gateway_identify *p);
177 extern size_t discord_gateway_identify_to_json_v(char *json, size_t len, void *p);
178 extern size_t discord_gateway_identify_to_json(char *json, size_t len, struct discord_gateway_identify *p);
179 extern size_t discord_gateway_identify_to_query_v(char *json, size_t len, void *p);
180 extern size_t discord_gateway_identify_to_query(char *json, size_t len, struct discord_gateway_identify *p);
181 extern void discord_gateway_identify_list_free_v(void **p);
182 extern void discord_gateway_identify_list_free(struct discord_gateway_identify **p);
183 extern void discord_gateway_identify_list_from_json_v(char *str, size_t len, void *p);
184 extern void discord_gateway_identify_list_from_json(char *str, size_t len, struct discord_gateway_identify ***p);
185 extern size_t discord_gateway_identify_list_to_json_v(char *str, size_t len, void *p);
186 extern size_t discord_gateway_identify_list_to_json(char *str, size_t len, struct discord_gateway_identify **p);
187 
195  /* specs/discord/gateway.json:135:19
196  '{ "name":"since","type":{"base":"char", "dec":"*", "converter":"iso8601"},
197  "option":true, "inject_if_not":0 }' */
198  u64_unix_ms_t since;
199 
200  /* specs/discord/gateway.json:137:19
201  '{ "name":"activities","type":{"base":"struct discord_gateway_activity", "dec":"ntl"},
202  "option":true, "inject_if_not":null}' */
203  struct discord_gateway_activity **activities;
204 
205  /* specs/discord/gateway.json:139:19
206  '{ "name":"status","type":{"base":"char", "dec":"[16]"}}' */
207  char status[16];
208 
209  /* specs/discord/gateway.json:140:19
210  '{ "name":"afk","type":{"base":"bool"}}' */
211  bool afk;
212 
213  // The following is metadata used to
214  // 1. control which field should be extracted/injected
215  // 2. record which field is presented(defined) in JSON
216  // 3. record which field is null in JSON
218  struct {
219  bool enable_arg_switches;
220  bool enable_record_defined;
221  bool enable_record_null;
222  void *arg_switches[4];
223  void *record_defined[4];
224  void *record_null[4];
225  } __M; // metadata
227 };
228 extern void discord_gateway_status_update_cleanup_v(void *p);
229 extern void discord_gateway_status_update_cleanup(struct discord_gateway_status_update *p);
230 extern void discord_gateway_status_update_init_v(void *p);
231 extern void discord_gateway_status_update_init(struct discord_gateway_status_update *p);
232 extern struct discord_gateway_status_update * discord_gateway_status_update_alloc();
233 extern void discord_gateway_status_update_free_v(void *p);
234 extern void discord_gateway_status_update_free(struct discord_gateway_status_update *p);
235 extern void discord_gateway_status_update_from_json_v(char *json, size_t len, void *p);
236 extern void discord_gateway_status_update_from_json(char *json, size_t len, struct discord_gateway_status_update *p);
237 extern size_t discord_gateway_status_update_to_json_v(char *json, size_t len, void *p);
238 extern size_t discord_gateway_status_update_to_json(char *json, size_t len, struct discord_gateway_status_update *p);
239 extern size_t discord_gateway_status_update_to_query_v(char *json, size_t len, void *p);
240 extern size_t discord_gateway_status_update_to_query(char *json, size_t len, struct discord_gateway_status_update *p);
241 extern void discord_gateway_status_update_list_free_v(void **p);
242 extern void discord_gateway_status_update_list_free(struct discord_gateway_status_update **p);
243 extern void discord_gateway_status_update_list_from_json_v(char *str, size_t len, void *p);
244 extern void discord_gateway_status_update_list_from_json(char *str, size_t len, struct discord_gateway_status_update ***p);
245 extern size_t discord_gateway_status_update_list_to_json_v(char *str, size_t len, void *p);
246 extern size_t discord_gateway_status_update_list_to_json(char *str, size_t len, struct discord_gateway_status_update **p);
247 
255  /* specs/discord/gateway.json:150:19
256  '{ "name":"$os", "type":{"base":"char", "dec":"*"}}' */
257  char *$os;
258 
259  /* specs/discord/gateway.json:151:19
260  '{ "name":"$browser", "type":{"base":"char", "dec":"*"}}' */
261  char *$browser;
262 
263  /* specs/discord/gateway.json:152:19
264  '{ "name":"$device", "type":{"base":"char", "dec":"*"}}' */
265  char *$device;
266 
267  // The following is metadata used to
268  // 1. control which field should be extracted/injected
269  // 2. record which field is presented(defined) in JSON
270  // 3. record which field is null in JSON
272  struct {
273  bool enable_arg_switches;
274  bool enable_record_defined;
275  bool enable_record_null;
276  void *arg_switches[3];
277  void *record_defined[3];
278  void *record_null[3];
279  } __M; // metadata
281 };
282 extern void discord_gateway_identify_connection_cleanup_v(void *p);
283 extern void discord_gateway_identify_connection_cleanup(struct discord_gateway_identify_connection *p);
284 extern void discord_gateway_identify_connection_init_v(void *p);
285 extern void discord_gateway_identify_connection_init(struct discord_gateway_identify_connection *p);
286 extern struct discord_gateway_identify_connection * discord_gateway_identify_connection_alloc();
287 extern void discord_gateway_identify_connection_free_v(void *p);
288 extern void discord_gateway_identify_connection_free(struct discord_gateway_identify_connection *p);
289 extern void discord_gateway_identify_connection_from_json_v(char *json, size_t len, void *p);
290 extern void discord_gateway_identify_connection_from_json(char *json, size_t len, struct discord_gateway_identify_connection *p);
291 extern size_t discord_gateway_identify_connection_to_json_v(char *json, size_t len, void *p);
292 extern size_t discord_gateway_identify_connection_to_json(char *json, size_t len, struct discord_gateway_identify_connection *p);
293 extern size_t discord_gateway_identify_connection_to_query_v(char *json, size_t len, void *p);
294 extern size_t discord_gateway_identify_connection_to_query(char *json, size_t len, struct discord_gateway_identify_connection *p);
295 extern void discord_gateway_identify_connection_list_free_v(void **p);
296 extern void discord_gateway_identify_connection_list_free(struct discord_gateway_identify_connection **p);
297 extern void discord_gateway_identify_connection_list_from_json_v(char *str, size_t len, void *p);
298 extern void discord_gateway_identify_connection_list_from_json(char *str, size_t len, struct discord_gateway_identify_connection ***p);
299 extern size_t discord_gateway_identify_connection_list_to_json_v(char *str, size_t len, void *p);
300 extern size_t discord_gateway_identify_connection_list_to_json(char *str, size_t len, struct discord_gateway_identify_connection **p);
301 
309  /* specs/discord/gateway.json:161:19
310  '{ "name":"name","type":{"base":"char", "dec":"[512]"}}' */
311  char name[512];
312 
313  /* specs/discord/gateway.json:162:19
314  '{ "name":"type","type":{"base":"int"}}' */
315  int type;
316 
317  /* specs/discord/gateway.json:163:19
318  '{ "name":"url","type":{"base":"char", "dec":"*"},
319  "option":true, "inject_if_not":""}' */
320  char *url;
321 
322  /* specs/discord/gateway.json:165:19
323  '{ "name":"created_at","type":{"base":"char", "dec":"*", "converter":"iso8601"},
324  "option":true, "inject_if_not":0 }' */
325  u64_unix_ms_t created_at;
326 
327  /* specs/discord/gateway.json:167:19
328  '{ "name":"application_id","type":{"base":"char", "dec":"*", "converter":"snowflake" },
329  "option":true, "inject_if_not":0 }' */
330  u64_snowflake_t application_id;
331 
332  /* specs/discord/gateway.json:169:19
333  '{ "name":"details","type":{"base":"char", "dec":"*"},
334  "option":true, "inject_if_not":null}' */
335  char *details;
336 
337  /* specs/discord/gateway.json:171:19
338  '{ "name":"state","type":{"base":"char", "dec":"*"},
339  "option":true, "inject_if_not":null}' */
340  char *state;
341 
342  /* specs/discord/gateway.json:173:19
343  '{ "name":"instance","type":{"base":"bool"},
344  "option":true, "inject_if_not":false}' */
345  bool instance;
346 
347  // The following is metadata used to
348  // 1. control which field should be extracted/injected
349  // 2. record which field is presented(defined) in JSON
350  // 3. record which field is null in JSON
352  struct {
353  bool enable_arg_switches;
354  bool enable_record_defined;
355  bool enable_record_null;
356  void *arg_switches[8];
357  void *record_defined[8];
358  void *record_null[8];
359  } __M; // metadata
361 };
362 extern void discord_gateway_activity_cleanup_v(void *p);
363 extern void discord_gateway_activity_cleanup(struct discord_gateway_activity *p);
364 extern void discord_gateway_activity_init_v(void *p);
365 extern void discord_gateway_activity_init(struct discord_gateway_activity *p);
366 extern struct discord_gateway_activity * discord_gateway_activity_alloc();
367 extern void discord_gateway_activity_free_v(void *p);
368 extern void discord_gateway_activity_free(struct discord_gateway_activity *p);
369 extern void discord_gateway_activity_from_json_v(char *json, size_t len, void *p);
370 extern void discord_gateway_activity_from_json(char *json, size_t len, struct discord_gateway_activity *p);
371 extern size_t discord_gateway_activity_to_json_v(char *json, size_t len, void *p);
372 extern size_t discord_gateway_activity_to_json(char *json, size_t len, struct discord_gateway_activity *p);
373 extern size_t discord_gateway_activity_to_query_v(char *json, size_t len, void *p);
374 extern size_t discord_gateway_activity_to_query(char *json, size_t len, struct discord_gateway_activity *p);
375 extern void discord_gateway_activity_list_free_v(void **p);
376 extern void discord_gateway_activity_list_free(struct discord_gateway_activity **p);
377 extern void discord_gateway_activity_list_from_json_v(char *str, size_t len, void *p);
378 extern void discord_gateway_activity_list_from_json(char *str, size_t len, struct discord_gateway_activity ***p);
379 extern size_t discord_gateway_activity_list_to_json_v(char *str, size_t len, void *p);
380 extern size_t discord_gateway_activity_list_to_json(char *str, size_t len, struct discord_gateway_activity **p);
381 
382 
383 enum discord_gateway_activity_types {
384  DISCORD_GATEWAY_ACTIVITY_GAME = 0,
385  DISCORD_GATEWAY_ACTIVITY_STREAMING = 1,
386  DISCORD_GATEWAY_ACTIVITY_LISTENING = 2,
387  DISCORD_GATEWAY_ACTIVITY_CUSTOM = 4,
388  DISCORD_GATEWAY_ACTIVITY_COMPETING = 5,
389 };
390 extern char* discord_gateway_activity_types_to_string(enum discord_gateway_activity_types);
391 extern enum discord_gateway_activity_types discord_gateway_activity_types_from_string(char*);
392 extern bool discord_gateway_activity_types_has(enum discord_gateway_activity_types, char*);
discord_gateway_identify_connection
Identify Connection Properties.
Definition: gateway.h:254
discord_gateway_status_update
Gateway Status Update Structure.
Definition: gateway.h:194
discord_gateway_activity
Activity Structure.
Definition: gateway.h:308
u64_unix_ms_t
uint64_t u64_unix_ms_t
unix time in ms
Definition: discord.h:26
u64_snowflake_t
uint64_t u64_snowflake_t
snowflake datatype
Definition: discord.h:32
discord_gateway_identify::presence
struct discord_gateway_status_update * presence
<
Definition: gateway.h:147
discord_gateway_identify
Identify Structure.
Definition: gateway.h:120