Concord - C Discord API library
A Discord API wrapper library written in C
webhook.h
Go to the documentation of this file.
1
6#ifndef API_WEBHOOK_H
7#define API_WEBHOOK_H
8/* Allow symbols usage without GENCODECS_ prefix */
9#include <stddef.h>
10#include <stdbool.h>
11#include <inttypes.h>
12#include "carray.h"
13#include "cog-utils.h"
14#include "types.h"
15/* Custom JSON encoding macros */
16/* Custom JSON decoding macros */
17/* Custom field macros */
18/* if GENCODECS_READ is not specified then generate for all files */
19/*****************************************************************************
20 * Webhook Datatypes
21 * **************************************************************************/
30};
38
47
49 char * name;
51 char * token;
58
61 char * url;
62};
65 struct discord_webhook *array; int realsize; };
67/*****************************************************************************
68 * Webhook REST parameters
69 * **************************************************************************/
73 char * reason;
75 char * name;
76 /* TODO: base64 conv */
79 char * avatar;
80
81};
85 char * reason;
87 char * name;
88 /* TODO: base64 conv */
91 char * avatar;
92
95};
98 char * reason;
99};
103 char * name;
104 /* TODO: base64 conv */
107 char * avatar;
108
109};
112 /* QUERY FIELDS */
116 bool wait;
120 /* JSON FIELDS */
122 char * content;
124 char * username;
128 bool tts;
132
136
140
144
149
150};
155
156};
159 /* QUERY FIELDS */
162 /* JSON FIELDS */
164 char * content;
168
172
176
180
181};
186
187};
188#include <stddef.h>
189#include <stdbool.h>
190#define JSMN_STRICT
191#define JSMN_HEADER
192#include "jsmn.h"
193#include "jsmn-find.h"
194#define JSONB_HEADER
195#include "json-build.h"
196#include <inttypes.h>
197#include "carray.h"
198#include "cog-utils.h"
199#include "types.h"
200
201
202
203
204
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
224
225
227
228
229
230
231
232
234
235
236
237
238
239
240
241
242
243
245
246
247
248
249
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299long discord_webhook_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_webhook *self); size_t discord_webhook_from_json(const char buf[], size_t size, struct discord_webhook *self);
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317long discord_webhooks_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_webhooks *self); size_t discord_webhooks_from_json(const char buf[], size_t size, struct discord_webhooks *self);
318
319
320long discord_create_webhook_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_create_webhook *self); size_t discord_create_webhook_from_json(const char buf[], size_t size, struct discord_create_webhook *self);
321
322
323
324
325
326long discord_modify_webhook_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_modify_webhook *self); size_t discord_modify_webhook_from_json(const char buf[], size_t size, struct discord_modify_webhook *self);
327
328
329
330
331
332
333long discord_modify_webhook_with_token_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_modify_webhook_with_token *self); size_t discord_modify_webhook_with_token_from_json(const char buf[], size_t size, struct discord_modify_webhook_with_token *self);
334
335
336
337
338
339long discord_execute_webhook_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_execute_webhook *self); size_t discord_execute_webhook_from_json(const char buf[], size_t size, struct discord_execute_webhook *self);
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360long discord_edit_webhook_message_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_edit_webhook_message *self); size_t discord_edit_webhook_message_from_json(const char buf[], size_t size, struct discord_edit_webhook_message *self);
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375jsonbcode discord_webhook_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_webhook *self); size_t discord_webhook_to_json(char buf[], size_t size, const struct discord_webhook *self);
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393jsonbcode discord_webhooks_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_webhooks *self); size_t discord_webhooks_to_json(char buf[], size_t size, const struct discord_webhooks *self);
394
395
396jsonbcode discord_create_webhook_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_create_webhook *self); size_t discord_create_webhook_to_json(char buf[], size_t size, const struct discord_create_webhook *self);
397
398
399
400
401
402jsonbcode discord_modify_webhook_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_modify_webhook *self); size_t discord_modify_webhook_to_json(char buf[], size_t size, const struct discord_modify_webhook *self);
403
404
405
406
407
408
410
411
412
413
414
415jsonbcode discord_execute_webhook_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_execute_webhook *self); size_t discord_execute_webhook_to_json(char buf[], size_t size, const struct discord_execute_webhook *self);
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436jsonbcode discord_edit_webhook_message_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_edit_webhook_message *self); size_t discord_edit_webhook_message_to_json(char buf[], size_t size, const struct discord_edit_webhook_message *self);
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451#endif /* API_WEBHOOK_H */
size_t discord_execute_webhook_to_json(char buf[], size_t size, const struct discord_execute_webhook *self)
void discord_execute_webhook_init(struct discord_execute_webhook *self)
jsonbcode discord_webhooks_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_webhooks *self)
long discord_create_webhook_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_create_webhook *self)
size_t discord_webhooks_from_json(const char buf[], size_t size, struct discord_webhooks *self)
jsonbcode discord_modify_webhook_with_token_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_modify_webhook_with_token *self)
size_t discord_create_webhook_from_json(const char buf[], size_t size, struct discord_create_webhook *self)
size_t discord_webhook_from_json(const char buf[], size_t size, struct discord_webhook *self)
void discord_edit_webhook_message_cleanup(struct discord_edit_webhook_message *self)
void discord_modify_webhook_cleanup(struct discord_modify_webhook *self)
void discord_webhook_cleanup(struct discord_webhook *self)
jsonbcode discord_create_webhook_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_create_webhook *self)
size_t discord_webhooks_to_json(char buf[], size_t size, const struct discord_webhooks *self)
long discord_execute_webhook_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_execute_webhook *self)
size_t discord_webhook_to_json(char buf[], size_t size, const struct discord_webhook *self)
void discord_create_webhook_init(struct discord_create_webhook *self)
long discord_modify_webhook_with_token_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_modify_webhook_with_token *self)
void discord_modify_webhook_init(struct discord_modify_webhook *self)
size_t discord_edit_webhook_message_from_json(const char buf[], size_t size, struct discord_edit_webhook_message *self)
size_t discord_execute_webhook_from_json(const char buf[], size_t size, struct discord_execute_webhook *self)
long discord_modify_webhook_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_modify_webhook *self)
long discord_webhooks_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_webhooks *self)
void discord_webhook_init(struct discord_webhook *self)
void discord_execute_webhook_cleanup(struct discord_execute_webhook *self)
discord_webhook_types
Definition: webhook.h:22
@ DISCORD_WEBHOOK_INCOMING
Definition: webhook.h:24
@ DISCORD_WEBHOOK_APPLICATION
Definition: webhook.h:29
@ DISCORD_WEBHOOK_CHANNEL_FOLLOWER
Definition: webhook.h:27
long discord_edit_webhook_message_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_edit_webhook_message *self)
void discord_modify_webhook_with_token_cleanup(struct discord_modify_webhook_with_token *self)
size_t discord_modify_webhook_with_token_from_json(const char buf[], size_t size, struct discord_modify_webhook_with_token *self)
void discord_edit_webhook_message_init(struct discord_edit_webhook_message *self)
void discord_modify_webhook_with_token_init(struct discord_modify_webhook_with_token *self)
size_t discord_create_webhook_to_json(char buf[], size_t size, const struct discord_create_webhook *self)
size_t discord_edit_webhook_message_to_json(char buf[], size_t size, const struct discord_edit_webhook_message *self)
size_t discord_modify_webhook_with_token_to_json(char buf[], size_t size, const struct discord_modify_webhook_with_token *self)
long discord_webhook_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_webhook *self)
size_t discord_modify_webhook_from_json(const char buf[], size_t size, struct discord_modify_webhook *self)
jsonbcode discord_modify_webhook_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_modify_webhook *self)
jsonbcode discord_webhook_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_webhook *self)
void discord_create_webhook_cleanup(struct discord_create_webhook *self)
jsonbcode discord_edit_webhook_message_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_edit_webhook_message *self)
jsonbcode discord_execute_webhook_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_execute_webhook *self)
size_t discord_modify_webhook_to_json(char buf[], size_t size, const struct discord_modify_webhook *self)
void discord_webhooks_cleanup(struct discord_webhooks *self)
uint64_t u64snowflake
Snowflake datatype.
Definition: types.h:28
uint64_t u64bitmask
Bitmask primitive.
Definition: types.h:35
jsonbcode
json-builder return codes
Definition: json-build.h:34
Definition: channel.h:561
Definition: channel.h:393
Definition: channel.h:122
Definition: message_components.h:101
Definition: webhook.h:71
char * name
Definition: webhook.h:75
char * avatar
Definition: webhook.h:79
char * reason
Definition: webhook.h:73
Definition: webhook.h:182
u64snowflake thread_id
Definition: webhook.h:185
Definition: webhook.h:96
char * reason
Definition: webhook.h:98
Definition: webhook.h:158
char * content
Definition: webhook.h:164
struct discord_embeds * embeds
Definition: webhook.h:167
u64snowflake thread_id
Definition: webhook.h:161
struct discord_allowed_mention * allowed_mentions
Definition: webhook.h:171
struct discord_attachments * attachments
Definition: webhook.h:179
struct discord_components * components
Definition: webhook.h:175
Definition: channel.h:441
Definition: webhook.h:111
struct discord_allowed_mention * allowed_mentions
Definition: webhook.h:135
u64snowflake thread_id
Definition: webhook.h:119
char * content
Definition: webhook.h:122
struct discord_components * components
Definition: webhook.h:139
bool wait
Definition: webhook.h:116
char * avatar_url
Definition: webhook.h:126
struct discord_embeds * embeds
Definition: webhook.h:131
char * username
Definition: webhook.h:124
struct discord_attachments * attachments
Definition: webhook.h:143
bool tts
Definition: webhook.h:128
u64bitmask flags
Definition: webhook.h:148
Definition: webhook.h:151
u64snowflake thread_id
Definition: webhook.h:154
Definition: webhook.h:101
char * name
Definition: webhook.h:103
char * avatar
Definition: webhook.h:107
Definition: webhook.h:83
char * name
Definition: webhook.h:87
char * reason
Definition: webhook.h:85
u64snowflake channel_id
Definition: webhook.h:94
char * avatar
Definition: webhook.h:91
Definition: user.h:69
Definition: webhook.h:32
struct discord_user * user
Definition: webhook.h:46
char * url
Definition: webhook.h:61
u64snowflake application_id
Definition: webhook.h:53
u64snowflake channel_id
Definition: webhook.h:42
u64snowflake guild_id
Definition: webhook.h:40
struct discord_channel * source_channel
Definition: webhook.h:57
u64snowflake id
Definition: webhook.h:34
enum discord_webhook_types type
Definition: webhook.h:37
char * name
Definition: webhook.h:49
char * token
Definition: webhook.h:51
Definition: webhook.h:64
int size
Definition: webhook.h:64
struct discord_webhook * array
Definition: webhook.h:65
Handle for building a JSON string.
Definition: json-build.h:61