Concord - C Discord API library
A Discord API wrapper library written in C
message_components.h
Go to the documentation of this file.
1
6#ifndef API_MESSAGE_COMPONENTS_H
7#define API_MESSAGE_COMPONENTS_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 * Message Components Datatypes
21 * **************************************************************************/
31};
33 /* button styles */
44 /* text styles */
49};
55
57 char * custom_id;
63
65 char * label;
69
71 char * url;
75
82
86
90
98 char * value;
99};
102 struct discord_component *array; int realsize; };
106 char * label;
108 char * value;
114
117};
120 struct discord_select_option *array; int realsize; };
122#include <stddef.h>
123#include <stdbool.h>
124#define JSMN_STRICT
125#define JSMN_HEADER
126#include "jsmn.h"
127#include "jsmn-find.h"
128#define JSONB_HEADER
129#include "json-build.h"
130#include <inttypes.h>
131#include "carray.h"
132#include "cog-utils.h"
133#include "types.h"
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
182
183
184
185
186
187
188
189
190
191
192
194
195
196long discord_component_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_component *self); size_t discord_component_from_json(const char buf[], size_t size, struct discord_component *self);
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228long discord_components_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_components *self); size_t discord_components_from_json(const char buf[], size_t size, struct discord_components *self);
229
230
231
232
233
234
235
236
237
238
239
240long discord_select_options_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_select_options *self); size_t discord_select_options_from_json(const char buf[], size_t size, struct discord_select_options *self);
241
242
243jsonbcode discord_component_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_component *self); size_t discord_component_to_json(char buf[], size_t size, const struct discord_component *self);
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275jsonbcode discord_components_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_components *self); size_t discord_components_to_json(char buf[], size_t size, const struct discord_components *self);
276
277
278
279
280
281
282
283
284
285
286
287jsonbcode discord_select_options_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_select_options *self); size_t discord_select_options_to_json(char buf[], size_t size, const struct discord_select_options *self);
288
289
290#endif /* API_MESSAGE_COMPONENTS_H */
jsonbcode
json-builder return codes
Definition: json-build.h:34
jsonbcode discord_component_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_component *self)
size_t discord_select_options_from_json(const char buf[], size_t size, struct discord_select_options *self)
size_t discord_select_options_to_json(char buf[], size_t size, const struct discord_select_options *self)
void discord_component_cleanup(struct discord_component *self)
discord_component_styles
Definition: message_components.h:32
@ DISCORD_BUTTON_SECONDARY
Definition: message_components.h:37
@ DISCORD_TEXT_PARAGRAPH
Definition: message_components.h:48
@ DISCORD_BUTTON_LINK
Definition: message_components.h:43
@ DISCORD_BUTTON_DANGER
Definition: message_components.h:41
@ DISCORD_TEXT_SHORT
Definition: message_components.h:46
@ DISCORD_BUTTON_SUCCESS
Definition: message_components.h:39
@ DISCORD_BUTTON_PRIMARY
Definition: message_components.h:35
size_t discord_components_from_json(const char buf[], size_t size, struct discord_components *self)
size_t discord_component_from_json(const char buf[], size_t size, struct discord_component *self)
size_t discord_component_to_json(char buf[], size_t size, const struct discord_component *self)
long discord_select_options_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_select_options *self)
jsonbcode discord_select_options_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_select_options *self)
void discord_component_init(struct discord_component *self)
void discord_select_options_cleanup(struct discord_select_options *self)
discord_component_types
Definition: message_components.h:22
@ DISCORD_COMPONENT_BUTTON
Definition: message_components.h:26
@ DISCORD_COMPONENT_ACTION_ROW
Definition: message_components.h:24
@ DISCORD_COMPONENT_SELECT_MENU
Definition: message_components.h:28
@ DISCORD_COMPONENT_TEXT_INPUT
Definition: message_components.h:30
void discord_components_cleanup(struct discord_components *self)
jsonbcode discord_components_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_components *self)
long discord_components_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_components *self)
long discord_component_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_component *self)
size_t discord_components_to_json(char buf[], size_t size, const struct discord_components *self)
Definition: message_components.h:51
char * value
Definition: message_components.h:98
struct discord_components * components
Definition: message_components.h:89
int max_length
Definition: message_components.h:94
enum discord_component_types type
Definition: message_components.h:54
int max_values
Definition: message_components.h:85
struct discord_select_options * options
Definition: message_components.h:74
struct discord_emoji * emoji
Definition: message_components.h:68
bool required
Definition: message_components.h:96
char * label
Definition: message_components.h:65
char * custom_id
Definition: message_components.h:57
enum discord_component_styles style
Definition: message_components.h:62
char * placeholder
Definition: message_components.h:77
int min_values
Definition: message_components.h:81
bool disabled
Definition: message_components.h:59
char * url
Definition: message_components.h:71
int min_length
Definition: message_components.h:92
Definition: message_components.h:101
struct discord_component * array
Definition: message_components.h:102
int size
Definition: message_components.h:101
Definition: emoji.h:23
Definition: message_components.h:104
bool Default
Definition: message_components.h:116
char * description
Definition: message_components.h:110
char * label
Definition: message_components.h:106
struct discord_emoji * emoji
Definition: message_components.h:113
char * value
Definition: message_components.h:108
Definition: message_components.h:119
struct discord_select_option * array
Definition: message_components.h:120
int size
Definition: message_components.h:119
JSON object.
Definition: jsmn-find.h:21
Handle for building a JSON string.
Definition: json-build.h:61