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;
24};
25
26/******************************************************************************
27 * Templates for generating type-safe return handles for async requests
28 ******************************************************************************/
29
34#define DISCORD_RET_DEFAULT_FIELDS \
35 \
36 void *data; \
37 \
39 void (*cleanup)(struct discord * client, void *data); \
40 \
41 const void *keep; \
42 \
44 bool high_priority; \
45 \
46 void (*fail)(struct discord * client, struct discord_response * resp)
47
48#define DISCORD_RETURN(_type) \
49 \
50 struct discord_ret_##_type { \
51 DISCORD_RET_DEFAULT_FIELDS; \
52 \
53 void (*done)(struct discord * client, \
54 struct discord_response *resp, \
55 const struct discord_##_type *ret); \
56 \
60 struct discord_##_type *sync; \
61 }
67 void (*done)(struct discord *client, struct discord_response *resp);
69 bool sync;
70};
71
73#define DISCORD_SYNC_FLAG ((void *)-1)
74
77DISCORD_RETURN(application);
78DISCORD_RETURN(auth_response);
83DISCORD_RETURN(audit_log);
88DISCORD_RETURN(auto_moderation_rule);
89DISCORD_RETURN(auto_moderation_rules);
96DISCORD_RETURN(message);
97DISCORD_RETURN(messages);
98DISCORD_RETURN(followed_channel);
99DISCORD_RETURN(thread_members);
100DISCORD_RETURN(thread_response_body);
105DISCORD_RETURN(emoji);
113DISCORD_RETURN(guild_preview);
114DISCORD_RETURN(guild_member);
115DISCORD_RETURN(guild_members);
116DISCORD_RETURN(guild_widget);
117DISCORD_RETURN(guild_widget_settings);
120DISCORD_RETURN(role);
121DISCORD_RETURN(roles);
122DISCORD_RETURN(welcome_screen);
123DISCORD_RETURN(integrations);
124DISCORD_RETURN(prune_count);
129DISCORD_RETURN(guild_scheduled_event);
130DISCORD_RETURN(guild_scheduled_events);
131DISCORD_RETURN(guild_scheduled_event_users);
136DISCORD_RETURN(guild_template);
137DISCORD_RETURN(guild_templates);
142DISCORD_RETURN(invite);
148DISCORD_RETURN(stage_instance);
153DISCORD_RETURN(sticker);
154DISCORD_RETURN(stickers);
155DISCORD_RETURN(list_nitro_sticker_packs);
160DISCORD_RETURN(user);
161DISCORD_RETURN(users);
162DISCORD_RETURN(connections);
167DISCORD_RETURN(voice_regions);
172DISCORD_RETURN(webhook);
173DISCORD_RETURN(webhooks);
179DISCORD_RETURN(application_command);
180DISCORD_RETURN(application_commands);
181DISCORD_RETURN(application_command_permission);
182DISCORD_RETURN(application_command_permissions);
183DISCORD_RETURN(guild_application_command_permissions);
189DISCORD_RETURN(interaction_response);
192#endif /* DISCORD_RESPONSE_H */
#define DISCORD_RETURN(_type)
Definition: discord-response.h:46
#define DISCORD_RET_DEFAULT_FIELDS
Macro containing common fields for struct discord_ret* datatypes.
Definition: discord-response.h:34
int CCORDcode
Concord error codes.
Definition: concord-error.h:11
Read-only generic sized buffer.
Definition: types.h:57
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
struct ccord_szbuf_readonly json
Definition: discord-response.h:23
Request's return context.
Definition: discord-response.h:59
bool sync
Definition: discord-response.h:64
void(* done)(struct discord *client, struct discord_response *resp)
Definition: discord-response.h:62
The Discord client handler.
Definition: discord-internal.h:1206