Concord - C Discord API library
A Discord API wrapper library written in C
discord-response.h
Go to the documentation of this file.
1
8#ifndef DISCORD_RESPONSE_H
9#define DISCORD_RESPONSE_H
10
14 void *data;
16 const void *keep;
19};
20
21/******************************************************************************
22 * Templates for generating type-safe return handles for async requests
23 ******************************************************************************/
24
29#define DISCORD_RET_DEFAULT_FIELDS \
30 \
31 void *data; \
32 \
34 void (*cleanup)(struct discord * client, void *data); \
35 \
36 const void *keep; \
37 \
39 bool high_priority; \
40 \
41 void (*fail)(struct discord * client, struct discord_response * resp)
42
43#define DISCORD_RETURN(_type) \
44 \
45 struct discord_ret_##_type { \
46 DISCORD_RET_DEFAULT_FIELDS; \
47 \
48 void (*done)(struct discord * client, \
49 struct discord_response *resp, \
50 const struct discord_##_type *ret); \
51 \
55 struct discord_##_type *sync; \
56 }
62 void (*done)(struct discord *client, struct discord_response *resp);
64 bool sync;
65};
66
68#define DISCORD_SYNC_FLAG ((void *)-1)
69
72DISCORD_RETURN(application);
73DISCORD_RETURN(auth_response);
78DISCORD_RETURN(audit_log);
83DISCORD_RETURN(auto_moderation_rule);
84DISCORD_RETURN(auto_moderation_rules);
91DISCORD_RETURN(message);
92DISCORD_RETURN(messages);
93DISCORD_RETURN(followed_channel);
94DISCORD_RETURN(thread_members);
95DISCORD_RETURN(thread_response_body);
100DISCORD_RETURN(emoji);
108DISCORD_RETURN(guild_preview);
109DISCORD_RETURN(guild_member);
110DISCORD_RETURN(guild_members);
111DISCORD_RETURN(guild_widget);
112DISCORD_RETURN(guild_widget_settings);
115DISCORD_RETURN(role);
116DISCORD_RETURN(roles);
117DISCORD_RETURN(welcome_screen);
118DISCORD_RETURN(integrations);
119DISCORD_RETURN(prune_count);
124DISCORD_RETURN(guild_scheduled_event);
125DISCORD_RETURN(guild_scheduled_events);
126DISCORD_RETURN(guild_scheduled_event_users);
131DISCORD_RETURN(guild_template);
132DISCORD_RETURN(guild_templates);
137DISCORD_RETURN(invite);
143DISCORD_RETURN(stage_instance);
148DISCORD_RETURN(sticker);
149DISCORD_RETURN(stickers);
150DISCORD_RETURN(list_nitro_sticker_packs);
155DISCORD_RETURN(user);
156DISCORD_RETURN(users);
157DISCORD_RETURN(connections);
162DISCORD_RETURN(voice_regions);
167DISCORD_RETURN(webhook);
168DISCORD_RETURN(webhooks);
174DISCORD_RETURN(application_command);
175DISCORD_RETURN(application_commands);
176DISCORD_RETURN(application_command_permission);
177DISCORD_RETURN(application_command_permissions);
178DISCORD_RETURN(guild_application_command_permissions);
184DISCORD_RETURN(interaction_response);
187#endif /* DISCORD_RESPONSE_H */
#define DISCORD_RETURN(_type)
Definition: discord-response.h:41
#define DISCORD_RET_DEFAULT_FIELDS
Macro containing common fields for struct discord_ret* datatypes.
Definition: discord-response.h:29
CCORDcode
Definition: error.h:10
The response for the completed request.
Definition: discord-response.h:12
const void * keep
Definition: discord-response.h:16
void * data
Definition: discord-response.h:14
CCORDcode code
Definition: discord-response.h:18
Request's return context.
Definition: discord-response.h:54
bool sync
Definition: discord-response.h:59
void(* done)(struct discord *client, struct discord_response *resp)
Definition: discord-response.h:57
The Discord client handler.
Definition: discord-internal.h:1180