-
-
Save liampwll/fde28265753ecb55601c43e9c5f37513 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "trees.h" | |
#include <string.h> | |
json_tree tree_channel = { | |
.type = JSON_OBJECT, | |
.obj.count = 17, | |
.obj.path_len = (size_t[]){ | |
strlen("id"), | |
strlen("icon"), | |
strlen("name"), | |
strlen("nsfw"), | |
strlen("type"), | |
strlen("topic"), | |
strlen("bitrate"), | |
strlen("guild_id"), | |
strlen("owner_id"), | |
strlen("position"), | |
strlen("parent_id"), | |
strlen("recipients"), | |
strlen("user_limit"), | |
strlen("application_id"), | |
strlen("last_message_id"), | |
strlen("last_pin_timestamp"), | |
strlen("permission_overwrites") | |
}, | |
.obj.path = (char*[]){ | |
"id", | |
"icon", | |
"name", | |
"nsfw", | |
"type", | |
"topic", | |
"bitrate", | |
"guild_id", | |
"owner_id", | |
"position", | |
"parent_id", | |
"recipients", | |
"user_limit", | |
"application_id", | |
"last_message_id", | |
"last_pin_timestamp", | |
"permission_overwrites" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_channel, id) | |
}, | |
{ /* icon */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_channel, icon) | |
}, | |
{ /* name */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_channel, name) | |
}, | |
{ /* nsfw */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_channel, nsfw) | |
}, | |
{ /* type */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_channel, type) | |
}, | |
{ /* topic */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_channel, topic) | |
}, | |
{ /* bitrate */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_channel, bitrate) | |
}, | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_channel, guild_id) | |
}, | |
{ /* owner_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_channel, owner_id) | |
}, | |
{ /* position */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_channel, position) | |
}, | |
{ /* parent_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_channel, parent_id) | |
}, | |
{ /* recipients */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_channel, recipients), | |
.array.len = offsetof(seecord_channel, recipients_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_user), | |
.array.tree = &tree_user | |
}, | |
{ /* user_limit */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_channel, user_limit) | |
}, | |
{ /* application_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_channel, application_id) | |
}, | |
{ /* last_message_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_channel, last_message_id) | |
}, | |
{ /* last_pin_timestamp */ | |
.type = JSON_TIMESTAMP, | |
.atom.offset = offsetof(seecord_channel, last_pin_timestamp) | |
}, | |
{ /* permission_overwrites */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_channel, overwrites), | |
.array.len = offsetof(seecord_channel, overwrites_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_overwrite), | |
.array.tree = &tree_overwrite | |
} | |
} | |
}; | |
json_tree tree_message = { | |
.type = JSON_OBJECT, | |
.obj.count = 17, | |
.obj.path_len = (size_t[]){ | |
strlen("id"), | |
strlen("tts"), | |
strlen("type"), | |
strlen("nonce"), | |
strlen("author"), | |
strlen("embeds"), | |
strlen("pinned"), | |
strlen("content"), | |
strlen("mentions"), | |
strlen("timestamp"), | |
strlen("reactions"), | |
strlen("channel_id"), | |
strlen("webhook_id"), | |
strlen("attachments"), | |
strlen("mention_roles"), | |
strlen("edited_timestamp"), | |
strlen("mention_everyone") | |
}, | |
.obj.path = (char*[]){ | |
"id", | |
"tts", | |
"type", | |
"nonce", | |
"author", | |
"embeds", | |
"pinned", | |
"content", | |
"mentions", | |
"timestamp", | |
"reactions", | |
"channel_id", | |
"webhook_id", | |
"attachments", | |
"mention_roles", | |
"edited_timestamp", | |
"mention_everyone" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_message, id) | |
}, | |
{ /* tts */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_message, tts) | |
}, | |
{ /* type */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_message, type) | |
}, | |
{ /* nonce */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_message, nonce) | |
}, | |
{ /* author */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_message, author), | |
.off_obj.tree = &tree_user | |
}, | |
{ /* embeds */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_message, embeds), | |
.array.len = offsetof(seecord_message, embeds_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_embed), | |
.array.tree = &tree_embed | |
}, | |
{ /* pinned */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_message, pinned) | |
}, | |
{ /* content */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_message, content) | |
}, | |
{ /* mentions */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_message, mentions), | |
.array.len = offsetof(seecord_message, mentions_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_user), | |
.array.tree = &tree_user | |
}, | |
{ /* timestamp */ | |
.type = JSON_TIMESTAMP, | |
.atom.offset = offsetof(seecord_message, timestamp) | |
}, | |
{ /* reactions */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_message, reactions), | |
.array.len = offsetof(seecord_message, reactions_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_reaction), | |
.array.tree = &tree_reaction | |
}, | |
{ /* channel_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_message, channel_id) | |
}, | |
{ /* webhook_id */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_message, webhook_id) | |
}, | |
{ /* attachments */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_message, attachments), | |
.array.len = offsetof(seecord_message, attachments_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_attachment), | |
.array.tree = &tree_attachment | |
}, | |
{ /* mention_roles */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_message, mention_roles), | |
.array.len = offsetof(seecord_message, mention_roles_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_role), | |
.array.tree = &tree_role | |
}, | |
{ /* edited_timestamp */ | |
.type = JSON_TIMESTAMP, | |
.atom.offset = offsetof(seecord_message, edited_timestamp) | |
}, | |
{ /* mention_everyone */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_message, mention_everyone) | |
} | |
} | |
}; | |
json_tree tree_reaction = { | |
.type = JSON_OBJECT, | |
.obj.count = 3, | |
.obj.path_len = (size_t[]){ | |
strlen("me"), | |
strlen("count"), | |
strlen("emoji") | |
}, | |
.obj.path = (char*[]){ | |
"me", | |
"count", | |
"emoji" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* me */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_reaction, me) | |
}, | |
{ /* count */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_reaction, count) | |
}, | |
{ /* emoji */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_reaction, emoji), | |
.off_obj.tree = &tree_emoji | |
} | |
} | |
}; | |
json_tree tree_overwrite = { | |
.type = JSON_OBJECT, | |
.obj.count = 4, | |
.obj.path_len = (size_t[]){ | |
strlen("id"), | |
strlen("deny"), | |
strlen("type"), | |
strlen("allow") | |
}, | |
.obj.path = (char*[]){ | |
"id", | |
"deny", | |
"type", | |
"allow" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_overwrite, id) | |
}, | |
{ /* deny */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_overwrite, deny) | |
}, | |
{ /* type */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_overwrite, type) | |
}, | |
{ /* allow */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_overwrite, allow) | |
} | |
} | |
}; | |
static json_tree tree_embed_thumbnail = { | |
.type = JSON_OBJECT, | |
.obj.count = 4, | |
.obj.path_len = (size_t[]){ | |
strlen("url"), | |
strlen("width"), | |
strlen("height"), | |
strlen("proxy_url") | |
}, | |
.obj.path = (char*[]){ | |
"url", | |
"width", | |
"height", | |
"proxy_url" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_thumbnail, url) | |
}, | |
{ /* width */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_embed_thumbnail, width) | |
}, | |
{ /* height */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_embed_thumbnail, height) | |
}, | |
{ /* proxy_url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_thumbnail, proxy_url) | |
} | |
} | |
}; | |
static json_tree tree_embed_video = { | |
.type = JSON_OBJECT, | |
.obj.count = 3, | |
.obj.path_len = (size_t[]){ | |
strlen("url"), | |
strlen("width"), | |
strlen("height") | |
}, | |
.obj.path = (char*[]){ | |
"url", | |
"width", | |
"height" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_video, url) | |
}, | |
{ /* width */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_embed_video, width) | |
}, | |
{ /* height */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_embed_video, height) | |
} | |
} | |
}; | |
static json_tree tree_embed_image = { | |
.type = JSON_OBJECT, | |
.obj.count = 4, | |
.obj.path_len = (size_t[]){ | |
strlen("url"), | |
strlen("width"), | |
strlen("height"), | |
strlen("proxy_url") | |
}, | |
.obj.path = (char*[]){ | |
"url", | |
"width", | |
"height", | |
"proxy_url" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_image, url) | |
}, | |
{ /* width */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_embed_image, width) | |
}, | |
{ /* height */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_embed_image, height) | |
}, | |
{ /* proxy_url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_image, proxy_url) | |
} | |
} | |
}; | |
static json_tree tree_embed_provider = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("url"), | |
strlen("name") | |
}, | |
.obj.path = (char*[]){ | |
"url", | |
"name" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_provider, url) | |
}, | |
{ /* name */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_provider, name) | |
} | |
} | |
}; | |
static json_tree tree_embed_author = { | |
.type = JSON_OBJECT, | |
.obj.count = 4, | |
.obj.path_len = (size_t[]){ | |
strlen("url"), | |
strlen("name"), | |
strlen("icon_url"), | |
strlen("proxy_icon_url") | |
}, | |
.obj.path = (char*[]){ | |
"url", | |
"name", | |
"icon_url", | |
"proxy_icon_url" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_author, url) | |
}, | |
{ /* name */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_author, name) | |
}, | |
{ /* icon_url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_author, icon_url) | |
}, | |
{ /* proxy_icon_url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_author, proxy_icon_url) | |
} | |
} | |
}; | |
static json_tree tree_embed_footer = { | |
.type = JSON_OBJECT, | |
.obj.count = 3, | |
.obj.path_len = (size_t[]){ | |
strlen("text"), | |
strlen("icon_url"), | |
strlen("proxy_icon_url") | |
}, | |
.obj.path = (char*[]){ | |
"text", | |
"icon_url", | |
"proxy_icon_url" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* text */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_footer, text) | |
}, | |
{ /* icon_url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_footer, icon_url) | |
}, | |
{ /* proxy_icon_url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_footer, proxy_icon_url) | |
} | |
} | |
}; | |
static json_tree tree_embed_field = { | |
.type = JSON_OBJECT, | |
.obj.count = 3, | |
.obj.path_len = (size_t[]){ | |
strlen("name"), | |
strlen("value"), | |
strlen("inline") | |
}, | |
.obj.path = (char*[]){ | |
"name", | |
"value", | |
"inline" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* name */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_field, name) | |
}, | |
{ /* value */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed_field, value) | |
}, | |
{ /* inline */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_embed_field, is_inline) | |
} | |
} | |
}; | |
json_tree tree_embed = { | |
.type = JSON_OBJECT, | |
.obj.count = 13, | |
.obj.path_len = (size_t[]){ | |
strlen("url"), | |
strlen("type"), | |
strlen("image"), | |
strlen("video"), | |
strlen("title"), | |
strlen("color"), | |
strlen("author"), | |
strlen("footer"), | |
strlen("fields"), | |
strlen("provider"), | |
strlen("thumbnail"), | |
strlen("timestamp"), | |
strlen("description") | |
}, | |
.obj.path = (char*[]){ | |
"url", | |
"type", | |
"image", | |
"video", | |
"title", | |
"color", | |
"author", | |
"footer", | |
"fields", | |
"provider", | |
"thumbnail", | |
"timestamp", | |
"description" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed, url) | |
}, | |
{ /* type */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed, type) | |
}, | |
{ /* image */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_embed, image), | |
.off_obj.tree = &tree_embed_image | |
}, | |
{ /* video */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_embed, video), | |
.off_obj.tree = &tree_embed_video | |
}, | |
{ /* title */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed, title) | |
}, | |
{ /* color */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_embed, color) | |
}, | |
{ /* author */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_embed, author), | |
.off_obj.tree = &tree_embed_author | |
}, | |
{ /* footer */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_embed, footer), | |
.off_obj.tree = &tree_embed_footer | |
}, | |
{ /* fields */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_embed, fields), | |
.array.len = offsetof(seecord_embed, fields_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_embed_field), | |
.array.tree = &tree_embed_field | |
}, | |
{ /* provider */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_embed, provider), | |
.off_obj.tree = &tree_embed_provider | |
}, | |
{ /* thumbnail */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_embed, thumbnail), | |
.off_obj.tree = &tree_embed_thumbnail | |
}, | |
{ /* timestamp */ | |
.type = JSON_TIMESTAMP, | |
.atom.offset = offsetof(seecord_embed, timestamp) | |
}, | |
{ /* description */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_embed, description) | |
} | |
} | |
}; | |
json_tree tree_attachment = { | |
.type = JSON_OBJECT, | |
.obj.count = 7, | |
.obj.path_len = (size_t[]){ | |
strlen("id"), | |
strlen("url"), | |
strlen("size"), | |
strlen("width"), | |
strlen("height"), | |
strlen("filename"), | |
strlen("proxy_url") | |
}, | |
.obj.path = (char*[]){ | |
"id", | |
"url", | |
"size", | |
"width", | |
"height", | |
"filename", | |
"proxy_url" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_attachment, id) | |
}, | |
{ /* url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_attachment, url) | |
}, | |
{ /* size */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_attachment, size) | |
}, | |
{ /* width */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_attachment, width) | |
}, | |
{ /* height */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_attachment, height) | |
}, | |
{ /* filename */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_attachment, filename) | |
}, | |
{ /* proxy_url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_attachment, proxy_url) | |
} | |
} | |
}; | |
json_tree tree_emoji = { | |
.type = JSON_OBJECT, | |
.obj.count = 6, | |
.obj.path_len = (size_t[]){ | |
strlen("id"), | |
strlen("name"), | |
strlen("user"), | |
strlen("roles"), | |
strlen("managed"), | |
strlen("require_colons") | |
}, | |
.obj.path = (char*[]){ | |
"id", | |
"name", | |
"user", | |
"roles", | |
"managed", | |
"require_colons" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_emoji, id) | |
}, | |
{ /* name */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_emoji, name) | |
}, | |
{ /* user */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_emoji, user), | |
.off_obj.tree = &tree_user | |
}, | |
{ /* roles */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_emoji, roles), | |
.array.len = offsetof(seecord_emoji, roles_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_role), | |
.array.tree = &tree_role | |
}, | |
{ /* managed */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_emoji, managed) | |
}, | |
{ /* require_colons */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_emoji, require_colons) | |
} | |
} | |
}; | |
json_tree tree_guild = { | |
.type = JSON_OBJECT, | |
.obj.count = 31, | |
.obj.path_len = (size_t[]){ | |
strlen("id"), | |
strlen("name"), | |
strlen("icon"), | |
strlen("roles"), | |
strlen("owner"), | |
strlen("large"), | |
strlen("splash"), | |
strlen("emojis"), | |
strlen("region"), | |
strlen("members"), | |
strlen("channels"), | |
strlen("features"), | |
strlen("owner_id"), | |
strlen("presences"), | |
strlen("joined_at"), | |
strlen("mfa_level"), | |
strlen("permissions"), | |
strlen("afk_timeout"), | |
strlen("unavailable"), | |
strlen("member_count"), | |
strlen("voice_states"), | |
strlen("embed_enabled"), | |
strlen("afk_channel_id"), | |
strlen("application_id"), | |
strlen("widget_enabled"), | |
strlen("embed_channel_id"), | |
strlen("system_channel_id"), | |
strlen("widget_channel_id"), | |
strlen("verification_level"), | |
strlen("explicit_content_filter"), | |
strlen("default_message_notifications") | |
}, | |
.obj.path = (char*[]){ | |
"id", | |
"name", | |
"icon", | |
"roles", | |
"owner", | |
"large", | |
"splash", | |
"emojis", | |
"region", | |
"members", | |
"channels", | |
"features", | |
"owner_id", | |
"presences", | |
"joined_at", | |
"mfa_level", | |
"permissions", | |
"afk_timeout", | |
"unavailable", | |
"member_count", | |
"voice_states", | |
"embed_enabled", | |
"afk_channel_id", | |
"application_id", | |
"widget_enabled", | |
"embed_channel_id", | |
"system_channel_id", | |
"widget_channel_id", | |
"verification_level", | |
"explicit_content_filter", | |
"default_message_notifications" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_guild, id) | |
}, | |
{ /* name */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_guild, name) | |
}, | |
{ /* icon */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_guild, icon) | |
}, | |
{ /* roles */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_guild, roles), | |
.array.len = offsetof(seecord_guild, roles_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_role), | |
.array.tree = &tree_role | |
}, | |
{ /* owner */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_guild, owner) | |
}, | |
{ /* large */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_guild, large) | |
}, | |
{ /* splash */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_guild, splash) | |
}, | |
{ /* emojis */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_guild, emojis), | |
.array.len = offsetof(seecord_guild, emojis_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_emoji), | |
.array.tree = &tree_emoji | |
}, | |
{ /* region */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_guild, region) | |
}, | |
{ /* members */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_guild, members), | |
.array.len = offsetof(seecord_guild, members_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_guild_member), | |
.array.tree = &tree_guild_member | |
}, | |
{ /* channels */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_guild, channels), | |
.array.len = offsetof(seecord_guild, channels_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_channel), | |
.array.tree = &tree_channel | |
}, | |
{ /* features */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_guild, features), | |
.array.len = offsetof(seecord_guild, features_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_str), | |
.array.tree = &(json_tree){ | |
.type = JSON_STRING, | |
.atom.offset = 0 | |
} | |
}, | |
{ /* owner_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_guild, owner_id) | |
}, | |
{ /* presences */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_guild, presences), | |
.array.len = offsetof(seecord_guild, presences_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_presence), | |
.array.tree = &tree_gw_presence_update | |
}, | |
{ /* joined_at */ | |
.type = JSON_TIMESTAMP, | |
.atom.offset = offsetof(seecord_guild, joined_at) | |
}, | |
{ /* mfa_level */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_guild, mfa_level) | |
}, | |
{ /* permissions */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_guild, permissions) | |
}, | |
{ /* afk_timeout */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_guild, afk_timeout) | |
}, | |
{ /* unavailable */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_guild, unavailable) | |
}, | |
{ /* member_count */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_guild, member_count) | |
}, | |
{ /* voice_states */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_guild, voice_states), | |
.array.len = offsetof(seecord_guild, voice_states_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_voice_state), | |
.array.tree = &tree_voice_state | |
}, | |
{ /* embed_enabled */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_guild, embed_enabled) | |
}, | |
{ /* afk_channel_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_guild, afk_channel_id) | |
}, | |
{ /* application_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_guild, application_id) | |
}, | |
{ /* widget_enabled */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_guild, widget_enabled) | |
}, | |
{ /* embed_channel_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_guild, embed_channel_id) | |
}, | |
{ /* system_channel_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_guild, system_channel_id) | |
}, | |
{ /* widget_channel_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_guild, widget_channel_id) | |
}, | |
{ /* verification_level */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_guild, verification_level) | |
}, | |
{ /* explicit_content_filter */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_guild, explicit_content_filter) | |
}, | |
{ /* default_message_notifications */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_guild, default_message_notifications) | |
} | |
} | |
}; | |
json_tree tree_guild_embed = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("enabled"), | |
strlen("channel_id") | |
}, | |
.obj.path = (char*[]){ | |
"enabled", | |
"channel_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* enabled */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_guild_embed, enabled) | |
}, | |
{ /* channel_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_guild_embed, channel_id) | |
} | |
} | |
}; | |
json_tree tree_guild_member = { | |
.type = JSON_OBJECT, | |
.obj.count = 7, | |
.obj.path_len = (size_t[]){ | |
strlen("user"), | |
strlen("nick"), | |
strlen("mute"), | |
strlen("deaf"), | |
strlen("roles"), | |
strlen("guild_id"), | |
strlen("joined_at") | |
}, | |
.obj.path = (char*[]){ | |
"user", | |
"nick", | |
"mute", | |
"deaf", | |
"roles", | |
"guild_id", | |
"joined_at" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* user */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_guild_member, user), | |
.off_obj.tree = &tree_user | |
}, | |
{ /* nick */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_guild_member, nick) | |
}, | |
{ /* mute */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_guild_member, mute) | |
}, | |
{ /* deaf */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_guild_member, deaf) | |
}, | |
{ /* roles */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_guild_member, roles), | |
.array.len = offsetof(seecord_guild_member, roles_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_role), | |
.array.tree = &tree_role | |
}, | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_guild_member, user.guild_id) | |
}, | |
{ /* joined_at */ | |
.type = JSON_TIMESTAMP, | |
.atom.offset = offsetof(seecord_guild_member, joined_at) | |
} | |
} | |
}; | |
json_tree tree_integration = { | |
.type = JSON_OBJECT, | |
.obj.count = 11, | |
.obj.path_len = (size_t[]){ | |
strlen("id"), | |
strlen("name"), | |
strlen("type"), | |
strlen("user"), | |
strlen("role_id"), | |
strlen("syncing"), | |
strlen("account"), | |
strlen("enabled"), | |
strlen("synced_at"), | |
strlen("expire_behavior"), | |
strlen("expire_grace_period") | |
}, | |
.obj.path = (char*[]){ | |
"id", | |
"name", | |
"type", | |
"user", | |
"role_id", | |
"syncing", | |
"account", | |
"enabled", | |
"synced_at", | |
"expire_behavior", | |
"expire_grace_period" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_integration, id) | |
}, | |
{ /* name */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_integration, name) | |
}, | |
{ /* type */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_integration, type) | |
}, | |
{ /* user */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_integration, user), | |
.off_obj.tree = &tree_user | |
}, | |
{ /* role_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_integration, role_id) | |
}, | |
{ /* syncing */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_integration, syncing) | |
}, | |
{ /* account */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_integration, account), | |
.off_obj.tree = &tree_integration_account | |
}, | |
{ /* enabled */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_integration, enabled) | |
}, | |
{ /* synced_at */ | |
.type = JSON_TIMESTAMP, | |
.atom.offset = offsetof(seecord_integration, synced_at) | |
}, | |
{ /* expire_behavior */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_integration, expire_behavior) | |
}, | |
{ /* expire_grace_period */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_integration, expire_grace_period) | |
} | |
} | |
}; | |
json_tree tree_integration_account = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("id"), | |
strlen("name") | |
}, | |
.obj.path = (char*[]){ | |
"id", | |
"name" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* id */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_integration_account, id) | |
}, | |
{ /* name */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_integration_account, name) | |
} | |
} | |
}; | |
json_tree tree_ban = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("user"), | |
strlen("reason") | |
}, | |
.obj.path = (char*[]){ | |
"user", | |
"reason" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* user */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_ban, user), | |
.off_obj.tree = &tree_user | |
}, | |
{ /* reason */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_ban, reason) | |
} | |
} | |
}; | |
json_tree tree_invite = { | |
.type = JSON_OBJECT, | |
.obj.count = 3, | |
.obj.path_len = (size_t[]){ | |
strlen("code"), | |
strlen("guild"), | |
strlen("channel") | |
}, | |
.obj.path = (char*[]){ | |
"code", | |
"guild", | |
"channel" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* code */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_invite, code) | |
}, | |
{ /* guild */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_invite, guild), | |
.off_obj.tree = &tree_user | |
}, | |
{ /* channel */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_invite, channel), | |
.off_obj.tree = &tree_user | |
} | |
} | |
}; | |
json_tree tree_invite_metadata = { | |
.type = JSON_OBJECT, | |
.obj.count = 7, | |
.obj.path_len = (size_t[]){ | |
strlen("uses"), | |
strlen("revoked"), | |
strlen("max_age"), | |
strlen("inviter"), | |
strlen("max_uses"), | |
strlen("temporary"), | |
strlen("created_at") | |
}, | |
.obj.path = (char*[]){ | |
"uses", | |
"revoked", | |
"max_age", | |
"inviter", | |
"max_uses", | |
"temporary", | |
"created_at" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* uses */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_invite_metadata, uses) | |
}, | |
{ /* revoked */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_invite_metadata, revoked) | |
}, | |
{ /* max_age */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_invite_metadata, max_age) | |
}, | |
{ /* inviter */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_invite_metadata, inviter), | |
.off_obj.tree = &tree_user | |
}, | |
{ /* max_uses */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_invite_metadata, max_uses) | |
}, | |
{ /* temporary */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_invite_metadata, temporary) | |
}, | |
{ /* created_at */ | |
.type = JSON_TIMESTAMP, | |
.atom.offset = offsetof(seecord_invite_metadata, created_at) | |
} | |
} | |
}; | |
json_tree tree_user = { | |
.type = JSON_OBJECT, | |
.obj.count = 9, | |
.obj.path_len = (size_t[]){ | |
strlen("id"), | |
strlen("bot"), | |
strlen("email"), | |
strlen("avatar"), | |
strlen("guild_id"), | |
strlen("verified"), | |
strlen("username"), | |
strlen("mfa_enabled"), | |
strlen("discriminator") | |
}, | |
.obj.path = (char*[]){ | |
"id", | |
"bot", | |
"email", | |
"avatar", | |
"guild_id", | |
"verified", | |
"username", | |
"mfa_enabled", | |
"discriminator" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_user, id) | |
}, | |
{ /* bot */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_user, bot) | |
}, | |
{ /* email */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_user, email) | |
}, | |
{ /* avatar */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_user, avatar) | |
}, | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_user, guild_id) | |
}, | |
{ /* verified */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_user, verified) | |
}, | |
{ /* username */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_user, username) | |
}, | |
{ /* mfa_enabled */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_user, mfa_enabled) | |
}, | |
{ /* discriminator */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_user, discriminator) | |
} | |
} | |
}; | |
json_tree tree_connection = { | |
.type = JSON_OBJECT, | |
.obj.count = 5, | |
.obj.path_len = (size_t[]){ | |
strlen("id"), | |
strlen("type"), | |
strlen("name"), | |
strlen("revoked"), | |
strlen("integrations") | |
}, | |
.obj.path = (char*[]){ | |
"id", | |
"type", | |
"name", | |
"revoked", | |
"integrations" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* id */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_connection, id) | |
}, | |
{ /* type */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_connection, type) | |
}, | |
{ /* name */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_connection, name) | |
}, | |
{ /* revoked */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_connection, revoked) | |
}, | |
{ /* integrations */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_connection, integrations), | |
.array.len = offsetof(seecord_connection, integrations_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_integration), | |
.array.tree = &tree_integration | |
} | |
} | |
}; | |
json_tree tree_voice_state = { | |
.type = JSON_OBJECT, | |
.obj.count = 9, | |
.obj.path_len = (size_t[]){ | |
strlen("mute"), | |
strlen("deaf"), | |
strlen("user_id"), | |
strlen("guild_id"), | |
strlen("suppress"), | |
strlen("self_deaf"), | |
strlen("self_mute"), | |
strlen("session_id"), | |
strlen("channel_id") | |
}, | |
.obj.path = (char*[]){ | |
"mute", | |
"deaf", | |
"user_id", | |
"guild_id", | |
"suppress", | |
"self_deaf", | |
"self_mute", | |
"session_id", | |
"channel_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* mute */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_voice_state, mute) | |
}, | |
{ /* deaf */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_voice_state, deaf) | |
}, | |
{ /* user_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_voice_state, user_id) | |
}, | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_voice_state, guild_id) | |
}, | |
{ /* suppress */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_voice_state, suppress) | |
}, | |
{ /* self_deaf */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_voice_state, self_deaf) | |
}, | |
{ /* self_mute */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_voice_state, self_mute) | |
}, | |
{ /* session_id */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_voice_state, session_id) | |
}, | |
{ /* channel_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_voice_state, channel_id) | |
} | |
} | |
}; | |
json_tree tree_voice_region = { | |
.type = JSON_OBJECT, | |
.obj.count = 8, | |
.obj.path_len = (size_t[]){ | |
strlen("id"), | |
strlen("vip"), | |
strlen("name"), | |
strlen("custom"), | |
strlen("optimal"), | |
strlen("deprecated"), | |
strlen("sample_port"), | |
strlen("sample_hostname") | |
}, | |
.obj.path = (char*[]){ | |
"id", | |
"vip", | |
"name", | |
"custom", | |
"optimal", | |
"deprecated", | |
"sample_port", | |
"sample_hostname" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* id */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_voice_region, id) | |
}, | |
{ /* vip */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_voice_region, vip) | |
}, | |
{ /* name */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_voice_region, name) | |
}, | |
{ /* custom */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_voice_region, custom) | |
}, | |
{ /* optimal */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_voice_region, optimal) | |
}, | |
{ /* deprecated */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_voice_region, deprecated) | |
}, | |
{ /* sample_port */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_voice_region, sample_port) | |
}, | |
{ /* sample_hostname */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_voice_region, sample_hostname) | |
} | |
} | |
}; | |
json_tree tree_webhook = { | |
.type = JSON_OBJECT, | |
.obj.count = 7, | |
.obj.path_len = (size_t[]){ | |
strlen("id"), | |
strlen("user"), | |
strlen("name"), | |
strlen("token"), | |
strlen("avatar"), | |
strlen("guild_id"), | |
strlen("channel_id"), | |
}, | |
.obj.path = (char*[]){ | |
"id", | |
"user", | |
"name", | |
"token", | |
"avatar", | |
"guild_id", | |
"channel_id", | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_webhook, id) | |
}, | |
{ /* user */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_webhook, user), | |
.off_obj.tree = &tree_user | |
}, | |
{ /* name */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_webhook, name) | |
}, | |
{ /* token */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_webhook, token) | |
}, | |
{ /* avatar */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_webhook, avatar) | |
}, | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_webhook, guild_id) | |
}, | |
{ /* channel_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_webhook, channel_id) | |
}, | |
} | |
}; | |
json_tree tree_gw_hello = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("_trace"), | |
strlen("heartbeat_interval") | |
}, | |
.obj.path = (char*[]){ | |
"_trace", | |
"heartbeat_interval" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* _trace */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_gw_hello, trace), | |
.array.len = offsetof(seecord_gw_hello, trace_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_str), | |
.array.tree = &(json_tree){ | |
.type = JSON_STRING, | |
.atom.offset = 0 | |
} | |
}, | |
{ /* heartbeat_interval */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_gw_hello, heartbeat_interval) | |
} | |
} | |
}; | |
json_tree tree_gw_ready = { | |
.type = JSON_OBJECT, | |
.obj.count = 6, | |
.obj.path_len = (size_t[]){ | |
strlen("v"), | |
strlen("user"), | |
strlen("guilds"), | |
strlen("_trace"), | |
strlen("session_id"), | |
strlen("private_channels") | |
}, | |
.obj.path = (char*[]){ | |
"v", | |
"user", | |
"guilds", | |
"_trace", | |
"session_id", | |
"private_channels" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* v */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_gw_ready, v) | |
}, | |
{ /* user */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_gw_ready, user), | |
.off_obj.tree = &tree_user | |
}, | |
{ /* guilds */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_gw_ready, guilds), | |
.array.len = offsetof(seecord_gw_ready, guilds_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_guild), | |
.array.tree = &tree_guild | |
}, | |
{ /* _trace */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_gw_ready, trace), | |
.array.len = offsetof(seecord_gw_ready, trace_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_str), | |
.array.tree = &(json_tree){ | |
.type = JSON_STRING, | |
.atom.offset = 0 | |
} | |
}, | |
{ /* session_id */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_gw_ready, session_id) | |
}, | |
{ /* private_channels */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_gw_ready, private_channels), | |
.array.len = offsetof(seecord_gw_ready, private_channels_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_channel), | |
.array.tree = &tree_channel | |
} | |
} | |
}; | |
json_tree tree_gw_resume = { | |
.type = JSON_OBJECT, | |
.obj.count = 1, | |
.obj.path_len = (size_t[]){ | |
strlen("_trace"), | |
}, | |
.obj.path = (char*[]){ | |
"_trace" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* _trace */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_gw_resume, trace), | |
.array.len = offsetof(seecord_gw_resume, trace_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_str), | |
.array.tree = &(json_tree){ | |
.type = JSON_STRING, | |
.atom.offset = 0 | |
} | |
} | |
} | |
}; | |
json_tree tree_gw_guild_emojis = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("emojis"), | |
strlen("guild_id") | |
}, | |
.obj.path = (char*[]){ | |
"emojis", | |
"guild_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* emojis */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_gw_guild_emojis, emojis), | |
.array.len = offsetof(seecord_gw_guild_emojis, emojis_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_emoji), | |
.array.tree = &tree_emoji | |
}, | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_guild_emojis, guild_id) | |
} | |
} | |
}; | |
json_tree tree_gw_guild_integration = { | |
.type = JSON_OBJECT, | |
.obj.count = 1, | |
.obj.path_len = (size_t[]){ | |
strlen("guild_id") | |
}, | |
.obj.path = (char*[]){ | |
"guild_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_guild_integration, guild_id) | |
} | |
} | |
}; | |
json_tree tree_gw_guild_member_remove = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("user"), | |
strlen("guild_id") | |
}, | |
.obj.path = (char*[]){ | |
"user", | |
"guild_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* user */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_gw_guild_member_remove, user), | |
.off_obj.tree = &tree_user | |
}, | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_guild_member_remove, guild_id) | |
} | |
} | |
}; | |
json_tree tree_gw_guild_member_update = { | |
.type = JSON_OBJECT, | |
.obj.count = 4, | |
.obj.path_len = (size_t[]){ | |
strlen("nick"), | |
strlen("user"), | |
strlen("roles"), | |
strlen("guild_id") | |
}, | |
.obj.path = (char*[]){ | |
"nick", | |
"user", | |
"roles", | |
"guild_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* nick */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_gw_guild_member_update, nick) | |
}, | |
{ /* user */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_gw_guild_member_update, user), | |
.off_obj.tree = &tree_user | |
}, | |
{ /* roles */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_gw_guild_member_update, roles), | |
.array.len = offsetof(seecord_gw_guild_member_update, roles_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(uint64_t), | |
.array.tree = &(json_tree){ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = 0 | |
} | |
}, | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_guild_member_update, guild_id) | |
} | |
} | |
}; | |
json_tree tree_gw_guild_member_chunk = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("members"), | |
strlen("guild_id") | |
}, | |
.obj.path = (char*[]){ | |
"members", | |
"guild_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* members */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_gw_guild_member_chunk, members), | |
.array.len = offsetof(seecord_gw_guild_member_chunk, members_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(seecord_guild_member), | |
.array.tree = &tree_guild_member | |
}, | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_guild_member_update, guild_id) | |
} | |
} | |
}; | |
json_tree tree_gw_guild_role_update = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("role"), | |
strlen("guild_id") | |
}, | |
.obj.path = (char*[]){ | |
"role", | |
"guild_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* role */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_gw_guild_role_update, role), | |
.off_obj.tree = &tree_role | |
}, | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_guild_role_update, guild_id) | |
} | |
} | |
}; | |
json_tree tree_gw_guild_role_delete = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("role_id"), | |
strlen("guild_id") | |
}, | |
.obj.path = (char*[]){ | |
"role_id", | |
"guild_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* role_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_guild_role_delete, role_id) | |
}, | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_guild_role_delete, guild_id) | |
} | |
} | |
}; | |
json_tree tree_gw_guild_message_delete = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("id"), | |
strlen("channel_id") | |
}, | |
.obj.path = (char*[]){ | |
"id", | |
"channel_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_guild_message_delete, id) | |
}, | |
{ /* channel_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_guild_message_delete, channel_id) | |
} | |
} | |
}; | |
json_tree tree_gw_guild_role_delete_bulk = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("ids"), | |
strlen("channel_id") | |
}, | |
.obj.path = (char*[]){ | |
"ids", | |
"channel_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* ids */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_gw_guild_message_delete_bulk, ids), | |
.array.len = offsetof(seecord_gw_guild_message_delete_bulk, ids_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(uint64_t), | |
.array.tree = &(json_tree){ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = 0 | |
} | |
}, | |
{ /* channel_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_guild_message_delete_bulk, channel_id) | |
} | |
} | |
}; | |
json_tree tree_gw_message_reaction_add = { | |
.type = JSON_OBJECT, | |
.obj.count = 4, | |
.obj.path_len = (size_t[]){ | |
strlen("emoji"), | |
strlen("user_id"), | |
strlen("channel_id"), | |
strlen("message_id") | |
}, | |
.obj.path = (char*[]){ | |
"emoji", | |
"user_id", | |
"channel_id", | |
"message_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* emoji */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_gw_message_reaction_add, emoji), | |
.off_obj.tree = &tree_emoji | |
}, | |
{ /* user_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_message_reaction_add, user_id) | |
}, | |
{ /* channel_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_message_reaction_add, channel_id) | |
}, | |
{ /* message_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_message_reaction_add, message_id) | |
} | |
} | |
}; | |
json_tree tree_gw_message_reaction_remove_all = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("channel_id"), | |
strlen("message_id") | |
}, | |
.obj.path = (char*[]){ | |
"channel_id", | |
"message_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* channel_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_message_reaction_remove_all, channel_id) | |
}, | |
{ /* message_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_message_reaction_remove_all, message_id) | |
} | |
} | |
}; | |
json_tree tree_gw_presence_update = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("game"), | |
strlen("user"), | |
strlen("roles"), | |
strlen("status"), | |
strlen("guild_id") | |
}, | |
.obj.path = (char*[]){ | |
"game", | |
"user", | |
"roles", | |
"status", | |
"guild_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* game */ | |
.type = JSON_OBJECT, | |
.obj.count = 3, | |
.obj.path_len = (size_t[]){ | |
strlen("url"), | |
strlen("name"), | |
strlen("type") | |
}, | |
.obj.path = (char*[]){ | |
"url", | |
"name", | |
"type" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* url */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_presence, game.url) | |
}, | |
{ /* name */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_presence, game.name) | |
}, | |
{ /* type */ | |
.type = JSON_INT, | |
.atom.offset = offsetof(seecord_presence, game.type) | |
} | |
} | |
}, | |
{ /* user */ | |
.type = JSON_OFFSET_OBJECT, | |
.off_obj.offset = offsetof(seecord_presence, user), | |
.off_obj.tree = &tree_user | |
}, | |
{ /* roles */ | |
.type = JSON_ARRAY, | |
.array.data = offsetof(seecord_presence, roles), | |
.array.len = offsetof(seecord_presence, roles_len), | |
.array.max_len_guess = 0, | |
.array.member_size = sizeof(uint64_t), | |
.array.tree = &(json_tree){ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = 0 | |
} | |
}, | |
{ /* status */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_presence, status) | |
}, | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_presence, guild_id) | |
} | |
} | |
}; | |
json_tree tree_typing_start = { | |
.type = JSON_OBJECT, | |
.obj.count = 3, | |
.obj.path_len = (size_t[]){ | |
strlen("user_id"), | |
strlen("timestamp"), | |
strlen("channel_id") | |
}, | |
.obj.path = (char*[]){ | |
"user_id", | |
"timestamp", | |
"channel_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* user_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_typing_start, user_id) | |
}, | |
{ /* timestamp */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_gw_typing_start, timestamp) | |
}, | |
{ /* channel_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_typing_start, channel_id) | |
} | |
} | |
}; | |
json_tree tree_voice_server_update = { | |
.type = JSON_OBJECT, | |
.obj.count = 3, | |
.obj.path_len = (size_t[]){ | |
strlen("token"), | |
strlen("endpoint"), | |
strlen("guild_id") | |
}, | |
.obj.path = (char*[]){ | |
"token", | |
"endpoint", | |
"guild_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* token */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_gw_voice_server_update, token) | |
}, | |
{ /* endpoint */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_gw_voice_server_update, endpoint) | |
}, | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_voice_server_update, guild_id) | |
} | |
} | |
}; | |
json_tree tree_webhook_update = { | |
.type = JSON_OBJECT, | |
.obj.count = 2, | |
.obj.path_len = (size_t[]){ | |
strlen("guild_id"), | |
strlen("channel_id") | |
}, | |
.obj.path = (char*[]){ | |
"guild_id", | |
"channel_id" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* guild_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_webhook_update, guild_id) | |
}, | |
{ /* channel_id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_gw_webhook_update, channel_id) | |
} | |
} | |
}; | |
json_tree tree_role = { | |
.type = JSON_OBJECT, | |
.obj.count = 8, | |
.obj.path_len = (size_t[]){ | |
strlen("id"), | |
strlen("name"), | |
strlen("hoist"), | |
strlen("color"), | |
strlen("managed"), | |
strlen("position"), | |
strlen("mentionable"), | |
strlen("permissions") | |
}, | |
.obj.path = (char*[]){ | |
"id", | |
"name", | |
"hoist", | |
"color", | |
"managed", | |
"position", | |
"mentionable", | |
"permissions" | |
}, | |
.obj.tree = (json_tree[]){ | |
{ /* id */ | |
.type = JSON_SNOWFLAKE, | |
.atom.offset = offsetof(seecord_role, id) | |
}, | |
{ /* name */ | |
.type = JSON_STRING, | |
.atom.offset = offsetof(seecord_role, name) | |
}, | |
{ /* hoist */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_role, hoist) | |
}, | |
{ /* color */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_role, color) | |
}, | |
{ /* managed */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_role, managed) | |
}, | |
{ /* position */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_role, position) | |
}, | |
{ /* mentionable */ | |
.type = JSON_BOOLEAN, | |
.atom.offset = offsetof(seecord_role, mentionable) | |
}, | |
{ /* permissions */ | |
.type = JSON_UINT64, | |
.atom.offset = offsetof(seecord_role, permissions) | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment