8#ifndef DISCORD_REQUEST_H
9#define DISCORD_REQUEST_H
15typedef struct reflectc_wrap *(*cast_init)(
struct reflectc *,
17 struct reflectc_wrap *);
24#define _RET_COPY_TYPED(_dest, _src) \
26 memcpy(&(_dest), &(_src), sizeof(discord_ret_default_fields)); \
27 (_dest).has_type = true; \
28 (_dest).done.typed = (cast_done_typed)(_src).done; \
29 (_dest).sync = (_src).sync; \
32#define _RET_COPY_TYPELESS(_dest, _src) \
34 memcpy(&(_dest), &(_src), sizeof(discord_ret_default_fields)); \
35 (_dest).has_type = false; \
36 (_dest).done.typeless = (_src).done; \
37 (_dest).sync = (void *)(_src).sync; \
48#define DISCORD_ATTR_INIT(_attr, _type, _ret, _reason) \
50 (_attr).response.size = sizeof(struct _type); \
51 (_attr).response.init = (cast_init)reflectc_from_##_type; \
52 (_attr).reason = _reason; \
53 if (_ret) _RET_COPY_TYPED((_attr).dispatch, *(_ret)); \
64#define DISCORD_ATTR_BLANK_INIT(_attr, _ret, _reason) \
66 (_attr).reason = _reason; \
67 if (_ret) _RET_COPY_TYPELESS((_attr).dispatch, *(_ret)); \
75#define DISCORD_ATTACHMENTS_IDS_INIT(_attchs) \
77 for (int i = 0; i < (_attchs)->size; ++i) { \
78 (_attchs)->array[i].id = (u64snowflake)i; \
void(* cast_done_typed)(struct discord *, struct discord_response *, const void *)
Definition: discord-request.h:12
The response for the completed request.
Definition: discord-response.h:12
Definition: discord-request.h:20
DISCORD_RET_DEFAULT_FIELDS
Definition: discord-request.h:21
The Discord client handler.
Definition: discord-internal.h:1206