Orca
A bot framework that is easy to reason about, easy to debug, and easy to use.
user.h
Go to the documentation of this file.
1 /* This file is generated from specs/discord/user.json, Please don't edit it. */
12 enum discord_user_flags {
13  DISCORD_USER_DISCORD_EMPLOYEE = 1, // 1 << 0
14  DISCORD_USER_PARTNERED_SERVER_OWNER = 2, // 1 << 2
15  DISCORD_USER_HYPESQUAD_EVENTS = 4, // 1 << 3
16  DISCORD_USER_BUG_HUNTER_LEVEL_1 = 8, // 1 << 4
17  DISCORD_USER_HOUSE_BRAVERY = 32, // 1 << 6
18  DISCORD_USER_HOUSE_BRILLIANCE = 64, // 1 << 7
19  DISCORD_USER_HOUSE_BALANCE = 128, // 1 << 8
20  DISCORD_USER_EARLY_SUPPORTER = 256, // 1 << 9
21  DISCORD_USER_TEAM_USER = 512, // 1 << 10
22  DISCORD_USER_SYSTEM = 4096, // 1 << 12
23  DISCORD_USER_BUG_HUNTER_LEVEL_2 = 16384, // 1 << 14
24  DISCORD_USER_VERIFIED_BOT = 65536, // 1 << 16
25  DISCORD_USER_EARLY_VERIFIED_BOT_DEVELOPER = 131072, // 1 << 17
26 };
27 extern char* discord_user_flags_to_string(enum discord_user_flags);
28 extern enum discord_user_flags discord_user_flags_from_string(char*);
29 extern bool discord_user_flags_has(enum discord_user_flags, char*);
30 
31 
32 enum discord_user_premium_types {
33  DISCORD_USER_NITRO_CLASSIC = 0,
34  DISCORD_USER_NITRO = 1,
35 };
36 extern char* discord_user_premium_types_to_string(enum discord_user_premium_types);
37 extern enum discord_user_premium_types discord_user_premium_types_from_string(char*);
38 extern bool discord_user_premium_types_has(enum discord_user_premium_types, char*);
39 
45 struct discord_user {
46  /* specs/discord/user.json:45:24
47  '{ "name": "id", "type":{ "base":"char", "dec":"*", "converter":"snowflake"} }' */
48  u64_snowflake_t id;
49 
50  /* specs/discord/user.json:46:24
51  '{ "name": "username", "type":{ "base":"char", "dec":"[MAX_USERNAME_LEN]"}}' */
52  char username[MAX_USERNAME_LEN];
53 
54  /* specs/discord/user.json:47:24
55  '{ "name": "discriminator", "type":{ "base":"char", "dec":"[MAX_DISCRIMINATOR_LEN]" }}' */
56  char discriminator[MAX_DISCRIMINATOR_LEN];
57 
58  /* specs/discord/user.json:48:24
59  '{ "name": "avatar", "type":{ "base":"char", "dec":"[MAX_SHA256_LEN]" }}' */
60  char avatar[MAX_SHA256_LEN];
61 
62  /* specs/discord/user.json:49:24
63  '{ "name": "bot", "type":{ "base":"bool" }}' */
64  bool bot;
65 
66  /* specs/discord/user.json:50:24
67  '{ "name": "System", "json_key": "system", "type":{ "base":"bool" }}' */
68  bool System;
69 
70  /* specs/discord/user.json:51:24
71  '{ "name": "mfa_enabled", "type":{ "base":"bool" }}' */
72  bool mfa_enabled;
73 
74  /* specs/discord/user.json:52:24
75  '{ "name": "locale", "type":{ "base":"char", "dec":"[MAX_LOCALE_LEN]" }}' */
76  char locale[MAX_LOCALE_LEN];
77 
78  /* specs/discord/user.json:53:24
79  '{ "name": "verified", "type":{ "base":"bool" }}' */
80  bool verified;
81 
82  /* specs/discord/user.json:54:24
83  '{ "name": "email", "type":{ "base":"char", "dec":"[MAX_EMAIL_LEN]" }}' */
84  char email[MAX_EMAIL_LEN];
85 
86  /* specs/discord/user.json:55:24
87  '{ "name": "flags", "type":{ "base":"int", "int_alias": "enum discord_user_flags" }}' */
88  enum discord_user_flags flags;
89 
90  /* specs/discord/user.json:56:24
91  '{ "name": "premium_type", "type":{ "base":"int", "int_alias": "enum discord_user_premium_types" }}' */
92  enum discord_user_premium_types premium_type;
93 
94  /* specs/discord/user.json:57:24
95  '{ "name": "public_flags", "type":{ "base":"int", "int_alias": "enum discord_user_flags" }}' */
96  enum discord_user_flags public_flags;
97 
98  // The following is metadata used to
99  // 1. control which field should be extracted/injected
100  // 2. record which field is presented(defined) in JSON
101  // 3. record which field is null in JSON
103  struct {
104  bool enable_arg_switches;
105  bool enable_record_defined;
106  bool enable_record_null;
107  void *arg_switches[13];
108  void *record_defined[13];
109  void *record_null[13];
110  } __M; // metadata
112 };
113 extern void discord_user_cleanup_v(void *p);
114 extern void discord_user_cleanup(struct discord_user *p);
115 extern void discord_user_init_v(void *p);
116 extern void discord_user_init(struct discord_user *p);
117 extern struct discord_user * discord_user_alloc();
118 extern void discord_user_free_v(void *p);
119 extern void discord_user_free(struct discord_user *p);
120 extern void discord_user_from_json_v(char *json, size_t len, void *p);
121 extern void discord_user_from_json(char *json, size_t len, struct discord_user *p);
122 extern size_t discord_user_to_json_v(char *json, size_t len, void *p);
123 extern size_t discord_user_to_json(char *json, size_t len, struct discord_user *p);
124 extern size_t discord_user_to_query_v(char *json, size_t len, void *p);
125 extern size_t discord_user_to_query(char *json, size_t len, struct discord_user *p);
126 extern void discord_user_list_free_v(void **p);
127 extern void discord_user_list_free(struct discord_user **p);
128 extern void discord_user_list_from_json_v(char *str, size_t len, void *p);
129 extern void discord_user_list_from_json(char *str, size_t len, struct discord_user ***p);
130 extern size_t discord_user_list_to_json_v(char *str, size_t len, void *p);
131 extern size_t discord_user_list_to_json(char *str, size_t len, struct discord_user **p);
132 
133 
134 enum discord_user_connection_visibility_types {
135  DISCORD_USER_CONNECTION_NONE = 0,
136  DISCORD_USER_CONNECTION_EVERYONE = 1,
137 };
138 extern char* discord_user_connection_visibility_types_to_string(enum discord_user_connection_visibility_types);
139 extern enum discord_user_connection_visibility_types discord_user_connection_visibility_types_from_string(char*);
140 extern bool discord_user_connection_visibility_types_has(enum discord_user_connection_visibility_types, char*);
141 
149  /* specs/discord/user.json:77:24
150  '{ "name": "id", "type":{ "base":"char", "dec":"*" }, "comment":"@todo fixed size limit"}' */
151  char *id; // @todo fixed size limit
152 
153  /* specs/discord/user.json:78:24
154  '{ "name": "name", "type":{ "base":"char", "dec":"*"}}' */
155  char *name;
156 
157  /* specs/discord/user.json:79:24
158  '{ "name": "type", "type":{ "base":"char", "dec":"*"}}' */
159  char *type;
160 
161  /* specs/discord/user.json:80:24
162  '{ "name": "revoked", "type":{ "base":"bool"}}' */
163  bool revoked;
164 
165  /* specs/discord/user.json:81:24
166  '{ "name": "integrations", "type": {"base":"struct discord_guild_integration", "dec":"ntl"}}' */
167  struct discord_guild_integration **integrations;
168 
169  /* specs/discord/user.json:82:24
170  '{ "name": "verified", "type":{ "base":"bool" }}' */
171  bool verified;
172 
173  /* specs/discord/user.json:83:24
174  '{ "name": "friend_sync", "type":{ "base":"bool" }}' */
175  bool friend_sync;
176 
177  /* specs/discord/user.json:84:24
178  '{ "name": "show_activity", "type":{ "base":"bool" }}' */
179  bool show_activity;
180 
181  /* specs/discord/user.json:85:24
182  '{ "name": "visibility", "type":{ "base":"int", "int_alias":"enum discord_user_connection_visibility_types" }}' */
183  enum discord_user_connection_visibility_types visibility;
184 
185  // The following is metadata used to
186  // 1. control which field should be extracted/injected
187  // 2. record which field is presented(defined) in JSON
188  // 3. record which field is null in JSON
190  struct {
191  bool enable_arg_switches;
192  bool enable_record_defined;
193  bool enable_record_null;
194  void *arg_switches[9];
195  void *record_defined[9];
196  void *record_null[9];
197  } __M; // metadata
199 };
200 extern void discord_connection_cleanup_v(void *p);
201 extern void discord_connection_cleanup(struct discord_connection *p);
202 extern void discord_connection_init_v(void *p);
203 extern void discord_connection_init(struct discord_connection *p);
204 extern struct discord_connection * discord_connection_alloc();
205 extern void discord_connection_free_v(void *p);
206 extern void discord_connection_free(struct discord_connection *p);
207 extern void discord_connection_from_json_v(char *json, size_t len, void *p);
208 extern void discord_connection_from_json(char *json, size_t len, struct discord_connection *p);
209 extern size_t discord_connection_to_json_v(char *json, size_t len, void *p);
210 extern size_t discord_connection_to_json(char *json, size_t len, struct discord_connection *p);
211 extern size_t discord_connection_to_query_v(char *json, size_t len, void *p);
212 extern size_t discord_connection_to_query(char *json, size_t len, struct discord_connection *p);
213 extern void discord_connection_list_free_v(void **p);
214 extern void discord_connection_list_free(struct discord_connection **p);
215 extern void discord_connection_list_from_json_v(char *str, size_t len, void *p);
216 extern void discord_connection_list_from_json(char *str, size_t len, struct discord_connection ***p);
217 extern size_t discord_connection_list_to_json_v(char *str, size_t len, void *p);
218 extern size_t discord_connection_list_to_json(char *str, size_t len, struct discord_connection **p);
discord_connection
Connection Structure.
Definition: user.h:148
discord_guild_integration
Integration Structure.
Definition: guild.h:593
u64_snowflake_t
uint64_t u64_snowflake_t
snowflake datatype
Definition: discord.h:32
discord_user
User Structure.
Definition: user.h:45