Concord - C Discord API library
A Discord API wrapper library written in C
user.h
Go to the documentation of this file.
1
6#ifndef API_USER_H
7#define API_USER_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 * User Datatypes
21 * **************************************************************************/
27#define DISCORD_USER_NONE 0
29#define DISCORD_USER_STAFF 1 << 0
31#define DISCORD_USER_PARTNER 1 << 1
33#define DISCORD_USER_HYPESQUAD 1 << 2
35#define DISCORD_USER_BUG_HUNTER_LEVEL_1 1 << 3
37#define DISCORD_USER_HYPESQUAD_ONLINE_HOUSE_1 1 << 6
39#define DISCORD_USER_HYPESQUAD_ONLINE_HOUSE_2 1 << 7
41#define DISCORD_USER_HYPESQUAD_ONLINE_HOUSE_3 1 << 8
43#define DISCORD_USER_PREMIUM_EARLY_SUPPORTER 1 << 9
45#define DISCORD_USER_TEAM_PSEUDO_USER 1 << 10
47#define DISCORD_USER_BUG_HUNTER_LEVEL_2 1 << 14
49#define DISCORD_USER_VERIFIED_BOT 1 << 16
51#define DISCORD_USER_VERIFIED_DEVELOPER 1 << 17
53#define DISCORD_USER_CERTIFIED_MODERATOR 1 << 18
55#define DISCORD_USER_BOT_HTTP_INTERACTIONS 1 << 19
61};
67};
73 char * username;
77 char * avatar;
79 bool bot;
82 bool System;
86 char * banner;
91 char * locale;
95 char * email;
102};
104struct discord_users { int size;
105 struct discord_user *array; int realsize; };
111 char * name;
113 char * type;
119
129};
132 struct discord_connection *array; int realsize; };
134/*****************************************************************************
135 * User REST parameters
136 * **************************************************************************/
142 char * username;
143
146 char * avatar;
147
148};
153
157
160 int limit;
161
162};
168
169};
175
178 struct strings * nicks;
179
180};
181#include <stddef.h>
182#include <stdbool.h>
183#define JSMN_STRICT
184#define JSMN_HEADER
185#include "jsmn.h"
186#include "jsmn-find.h"
187#define JSONB_HEADER
188#include "json-build.h"
189#include <inttypes.h>
190#include "carray.h"
191#include "cog-utils.h"
192#include "types.h"
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
251
252
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
273
274
275
276
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300long discord_user_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_user *self); size_t discord_user_from_json(const char buf[], size_t size, struct discord_user *self);
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317long discord_users_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_users *self); size_t discord_users_from_json(const char buf[], size_t size, struct discord_users *self);
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333long discord_connections_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_connections *self); size_t discord_connections_from_json(const char buf[], size_t size, struct discord_connections *self);
334
335
336long discord_modify_current_user_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_modify_current_user *self); size_t discord_modify_current_user_from_json(const char buf[], size_t size, struct discord_modify_current_user *self);
337
338
339
340
341
342
343
344long discord_create_dm_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_create_dm *self); size_t discord_create_dm_from_json(const char buf[], size_t size, struct discord_create_dm *self);
345
346
347
348
349long discord_create_group_dm_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_create_group_dm *self); size_t discord_create_group_dm_from_json(const char buf[], size_t size, struct discord_create_group_dm *self);
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372jsonbcode discord_user_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_user *self); size_t discord_user_to_json(char buf[], size_t size, const struct discord_user *self);
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389jsonbcode discord_users_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_users *self); size_t discord_users_to_json(char buf[], size_t size, const struct discord_users *self);
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405jsonbcode discord_connections_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_connections *self); size_t discord_connections_to_json(char buf[], size_t size, const struct discord_connections *self);
406
407
409
410
411
412
413
414
415
416jsonbcode discord_create_dm_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_create_dm *self); size_t discord_create_dm_to_json(char buf[], size_t size, const struct discord_create_dm *self);
417
418
419
420
421jsonbcode discord_create_group_dm_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_create_group_dm *self); size_t discord_create_group_dm_to_json(char buf[], size_t size, const struct discord_create_group_dm *self);
422
423
424
425
426
427
428
429#endif /* API_USER_H */
size_t discord_modify_current_user_to_json(char buf[], size_t size, const struct discord_modify_current_user *self)
size_t discord_modify_current_user_from_json(const char buf[], size_t size, struct discord_modify_current_user *self)
size_t discord_users_to_json(char buf[], size_t size, const struct discord_users *self)
size_t discord_create_dm_to_json(char buf[], size_t size, const struct discord_create_dm *self)
void discord_modify_current_user_init(struct discord_modify_current_user *self)
size_t discord_create_group_dm_to_json(char buf[], size_t size, const struct discord_create_group_dm *self)
size_t discord_connections_to_json(char buf[], size_t size, const struct discord_connections *self)
discord_visibility_types
Definition: user.h:62
@ DISCORD_VISIBILITY_NONE
Definition: user.h:64
@ DISCORD_VISIBILITY_EVERYONE
Definition: user.h:66
discord_premium_types
Definition: user.h:57
@ DISCORD_PREMIUM_NITRO
Definition: user.h:60
@ DISCORD_PREMIUM_NITRO_CLASSIC
Definition: user.h:59
@ DISCORD_PREMIUM_NONE
Definition: user.h:58
long discord_users_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_users *self)
jsonbcode discord_modify_current_user_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_modify_current_user *self)
size_t discord_create_dm_from_json(const char buf[], size_t size, struct discord_create_dm *self)
void discord_create_group_dm_init(struct discord_create_group_dm *self)
size_t discord_user_from_json(const char buf[], size_t size, struct discord_user *self)
long discord_modify_current_user_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_modify_current_user *self)
size_t discord_user_to_json(char buf[], size_t size, const struct discord_user *self)
jsonbcode discord_user_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_user *self)
void discord_user_cleanup(struct discord_user *self)
void discord_modify_current_user_cleanup(struct discord_modify_current_user *self)
size_t discord_connections_from_json(const char buf[], size_t size, struct discord_connections *self)
void discord_create_dm_cleanup(struct discord_create_dm *self)
jsonbcode discord_connections_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_connections *self)
void discord_create_dm_init(struct discord_create_dm *self)
size_t discord_users_from_json(const char buf[], size_t size, struct discord_users *self)
size_t discord_create_group_dm_from_json(const char buf[], size_t size, struct discord_create_group_dm *self)
void discord_user_init(struct discord_user *self)
long discord_connections_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_connections *self)
jsonbcode discord_users_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_users *self)
jsonbcode discord_create_dm_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_create_dm *self)
void discord_create_group_dm_cleanup(struct discord_create_group_dm *self)
long discord_create_group_dm_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_create_group_dm *self)
long discord_create_dm_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_create_dm *self)
void discord_connections_cleanup(struct discord_connections *self)
void discord_users_cleanup(struct discord_users *self)
long discord_user_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_user *self)
jsonbcode discord_create_group_dm_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_create_group_dm *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: user.h:107
bool friend_sync
Definition: user.h:123
char * name
Definition: user.h:111
bool verified
Definition: user.h:121
struct discord_integrations * integrations
Definition: user.h:118
char * type
Definition: user.h:113
u64snowflake id
Definition: user.h:109
enum discord_visibility_types visibility
Definition: user.h:128
bool revoked
Definition: user.h:115
bool show_activity
Definition: user.h:126
Definition: user.h:131
struct discord_connection * array
Definition: user.h:132
int size
Definition: user.h:131
Definition: user.h:164
u64snowflake recipient_id
Definition: user.h:167
Definition: user.h:171
struct snowflakes * access_tokens
Definition: user.h:174
struct strings * nicks
Definition: user.h:178
Definition: user.h:149
u64snowflake before
Definition: user.h:152
int limit
Definition: user.h:160
u64snowflake after
Definition: user.h:156
Definition: guild.h:371
Definition: user.h:138
char * avatar
Definition: user.h:146
char * username
Definition: user.h:142
Definition: user.h:69
u64bitmask flags
Definition: user.h:97
bool System
Definition: user.h:82
int accent_color
Definition: user.h:89
char * avatar
Definition: user.h:77
enum discord_premium_types premium_type
Definition: user.h:99
bool bot
Definition: user.h:79
bool mfa_enabled
Definition: user.h:84
u64snowflake id
Definition: user.h:71
bool verified
Definition: user.h:93
char * username
Definition: user.h:73
u64bitmask public_flags
Definition: user.h:101
char * locale
Definition: user.h:91
char * email
Definition: user.h:95
char * banner
Definition: user.h:86
char * discriminator
Definition: user.h:75
Definition: user.h:104
int size
Definition: user.h:104
struct discord_user * array
Definition: user.h:105
Handle for building a JSON string.
Definition: json-build.h:61
Definition: custom.h:28
Definition: custom.h:20
int size
Definition: custom.h:20