From 23cc7c6ea03ac6ad92c8da3101eb878daeb3bc2e Mon Sep 17 00:00:00 2001 From: Adelyn Breelove Date: Mon, 4 Feb 2019 13:59:23 -0700 Subject: Update to latest master on ppx_deriving_yojson --- .gitlab-ci.yml | 5 ++-- lib/models/channel/channel_t.ml | 14 ++++----- lib/models/channel/channel_t.mli | 14 ++++----- lib/models/channel/message/attachment.ml | 2 +- lib/models/channel/message/attachment.mli | 2 +- lib/models/channel/message/embed.ml | 14 ++++----- lib/models/channel/message/embed.mli | 14 ++++----- lib/models/channel/message/message_t.ml | 2 +- lib/models/channel/message/message_t.mli | 2 +- lib/models/channel/message/reaction_t.ml | 4 +-- lib/models/channel/message/reaction_t.mli | 4 +-- lib/models/emoji.ml | 4 +-- lib/models/emoji.mli | 4 +-- lib/models/event_models.ml | 50 +++++++++++++++---------------- lib/models/guild/ban_t.ml | 2 +- lib/models/guild/ban_t.mli | 2 +- lib/models/guild/guild_t.ml | 6 ++-- lib/models/guild/guild_t.mli | 6 ++-- lib/models/guild/member_t.ml | 10 +++---- lib/models/guild/member_t.mli | 10 +++---- lib/models/guild/role_t.ml | 4 +-- lib/models/guild/role_t.mli | 4 +-- lib/models/id/channel_id_t.mli | 2 +- lib/models/id/guild_id_t.mli | 2 +- lib/models/id/message_id.mli | 2 +- lib/models/id/role_id.mli | 2 +- lib/models/id/user_id_t.mli | 2 +- lib/models/snowflake.mli | 2 +- lib/models/user/activity.ml | 2 +- lib/models/user/activity.mli | 2 +- lib/models/user/presence.ml | 2 +- lib/models/user/presence.mli | 2 +- lib/models/user/user_t.ml | 4 +-- lib/models/user/user_t.mli | 4 +-- 34 files changed, 103 insertions(+), 104 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9dd36cd..c4aa195 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,13 +5,12 @@ before_script: - opam init - eval `opam config env` - opam update - - opam pin add ppx_deriving_yojson https://github.com/ocaml-ppx/ppx_deriving_yojson.git#82bc0b8 - - opam pin add -d disml . + - opam pin add disml . build: stage: build script: - - echo "Build successful" + - opam pin add odoc --dev-repo only: - master diff --git a/lib/models/channel/channel_t.ml b/lib/models/channel/channel_t.ml index 1705bdf..8611d9c 100644 --- a/lib/models/channel/channel_t.ml +++ b/lib/models/channel/channel_t.ml @@ -10,13 +10,13 @@ type group = { name: string option [@default None]; owner_id: User_id_t.t; recipients: User_t.t list [@default []]; -} [@@deriving sexp, yojson { strict = false}] +} [@@deriving sexp, yojson { strict = false; exn = true }] type dm = { id: Channel_id_t.t; last_message_id: Message_id.t option [@default None]; last_pin_timestamp: string option [@default None]; -} [@@deriving sexp, yojson { strict = false}] +} [@@deriving sexp, yojson { strict = false; exn = true }] type guild_text = { id: Channel_id_t.t; @@ -29,7 +29,7 @@ type guild_text = { topic: string option [@default None]; nsfw: bool; slow_mode_timeout: int option [@default None]; -} [@@deriving sexp, yojson { strict = false}] +} [@@deriving sexp, yojson { strict = false; exn = true }] type guild_voice = { id: Channel_id_t.t; @@ -39,14 +39,14 @@ type guild_voice = { position: int; user_limit: int [@default -1]; bitrate: int option [@default None]; -} [@@deriving sexp, yojson { strict = false}] +} [@@deriving sexp, yojson { strict = false; exn = true }] type category = { id: Channel_id_t.t; guild_id: Guild_id_t.t option [@default None]; position: int; name: string; -} [@@deriving sexp, yojson { strict = false}] +} [@@deriving sexp, yojson { strict = false; exn = true }] type t = | Group of group @@ -54,7 +54,7 @@ type t = | GuildText of guild_text | GuildVoice of guild_voice | Category of category -[@@deriving sexp, yojson { strict = false}] +[@@deriving sexp, yojson { strict = false; exn = true }] type channel_wrapper = { id: Channel_id_t.t; @@ -74,7 +74,7 @@ type channel_wrapper = { application_id: Snowflake.t option [@default None]; category_id: Channel_id_t.t option [@default None][@key "parent_id"]; last_pin_timestamp: string option [@default None]; -} [@@deriving sexp, yojson { strict = false}] +} [@@deriving sexp, yojson { strict = false; exn = true }] let unwrap_as_guild_text {id;guild_id;position;name;topic;nsfw;last_message_id;slow_mode_timeout;category_id;last_pin_timestamp;_} = let position = Option.value_exn position in diff --git a/lib/models/channel/channel_t.mli b/lib/models/channel/channel_t.mli index 30c90a5..313939f 100644 --- a/lib/models/channel/channel_t.mli +++ b/lib/models/channel/channel_t.mli @@ -9,14 +9,14 @@ type group = { name: string option; owner_id: User_id_t.t; recipients: User_t.t list; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** Represents a private channel with a single user. *) type dm = { id: Channel_id_t.t; last_message_id: Message_id.t option; last_pin_timestamp: string option; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** Represents a text channel in a guild. *) type guild_text = { @@ -30,7 +30,7 @@ type guild_text = { topic: string option; nsfw: bool; slow_mode_timeout: int option; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** Represents a voice channel in a guild. *) type guild_voice = { @@ -41,7 +41,7 @@ type guild_voice = { position: int; user_limit: int; bitrate: int option; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** Represents a guild category. *) type category = { @@ -49,7 +49,7 @@ type category = { guild_id: Guild_id_t.t option; position: int; name: string; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** Wrapper variant for all channel types. *) type t = @@ -58,7 +58,7 @@ type t = | GuildText of guild_text | GuildVoice of guild_voice | Category of category -[@@deriving sexp, yojson] +[@@deriving sexp, yojson { exn = true }] (** Intermediate used internally. *) type channel_wrapper = { @@ -79,7 +79,7 @@ type channel_wrapper = { application_id: Snowflake.t option; category_id: Channel_id_t.t option; last_pin_timestamp: string option; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] val unwrap_as_guild_text : channel_wrapper -> guild_text diff --git a/lib/models/channel/message/attachment.ml b/lib/models/channel/message/attachment.ml index c56b389..d720a81 100644 --- a/lib/models/channel/message/attachment.ml +++ b/lib/models/channel/message/attachment.ml @@ -8,4 +8,4 @@ type t = { proxy_url: string; height: int [@default -1]; width: int [@default -1]; -} [@@deriving sexp, yojson { strict = false}] \ No newline at end of file +} [@@deriving sexp, yojson { strict = false; exn = true }] \ No newline at end of file diff --git a/lib/models/channel/message/attachment.mli b/lib/models/channel/message/attachment.mli index f935471..56006dc 100644 --- a/lib/models/channel/message/attachment.mli +++ b/lib/models/channel/message/attachment.mli @@ -6,4 +6,4 @@ type t = { proxy_url: string; height: int; width: int; -} [@@deriving sexp, yojson] \ No newline at end of file +} [@@deriving sexp, yojson { exn = true }] \ No newline at end of file diff --git a/lib/models/channel/message/embed.ml b/lib/models/channel/message/embed.ml index 584d3c7..f66aa3f 100644 --- a/lib/models/channel/message/embed.ml +++ b/lib/models/channel/message/embed.ml @@ -4,38 +4,38 @@ type footer = { text: string; icon_url: string option [@default None]; proxy_icon_url: string option [@default None]; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] type image = { url: string option [@default None]; proxy_url: string option [@default None]; height: int option [@default None]; width: int option [@default None]; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] type video = { url: string option [@default None]; height: int option [@default None]; width: int option [@default None]; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] type provider = { name: string option [@default None]; url: string option [@default None]; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] type author = { name: string option [@default None]; url: string option [@default None]; icon_url: string option [@default None]; proxy_icon_url: string option [@default None]; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] type field = { name: string; value: string; inline: bool [@default false]; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] type t = { title: string option [@default None]; @@ -51,7 +51,7 @@ type t = { provider: provider option [@default None]; author: author option [@default None]; fields: field list [@default []]; -} [@@deriving sexp, yojson { strict = false }] +} [@@deriving sexp, yojson { strict = false; exn = true }] let default = { title = None; diff --git a/lib/models/channel/message/embed.mli b/lib/models/channel/message/embed.mli index d30d015..fb86c94 100644 --- a/lib/models/channel/message/embed.mli +++ b/lib/models/channel/message/embed.mli @@ -3,7 +3,7 @@ type footer = { text: string; icon_url: string option; proxy_icon_url: string option; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** An image object belonging to an embed. *) type image = { @@ -11,20 +11,20 @@ type image = { proxy_url: string option; height: int option; width: int option; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** A video object belonging to an embed. *) type video = { url: string option; height: int option; width: int option; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** A provider object belonging to an embed. *) type provider = { name: string option; url: string option; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** An author object belonging to an embed. *) type author = { @@ -32,14 +32,14 @@ type author = { url: string option; icon_url: string option; proxy_icon_url: string option; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** A field object belonging to an embed. *) type field = { name: string; value: string; inline: bool; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** An embed object. See this {{:https://leovoel.github.io/embed-visualizer/}embed visualiser} if you need help understanding each component. *) type t = { @@ -56,7 +56,7 @@ type t = { provider: provider option; author: author option; fields: field list [@default []]; -} [@@deriving sexp, yojson { strict = false }] +} [@@deriving sexp, yojson { strict = false; exn = true }] (** An embed where all values are empty. *) val default : t diff --git a/lib/models/channel/message/message_t.ml b/lib/models/channel/message/message_t.ml index 34ff64e..31fc88c 100644 --- a/lib/models/channel/message/message_t.ml +++ b/lib/models/channel/message/message_t.ml @@ -20,4 +20,4 @@ type t = { pinned: bool; webhook_id: Snowflake.t option [@default None]; kind: int [@key "type"]; -} [@@deriving sexp, yojson { strict = false}] \ No newline at end of file +} [@@deriving sexp, yojson { strict = false; exn = true }] \ No newline at end of file diff --git a/lib/models/channel/message/message_t.mli b/lib/models/channel/message/message_t.mli index ba8c62a..907565c 100644 --- a/lib/models/channel/message/message_t.mli +++ b/lib/models/channel/message/message_t.mli @@ -19,4 +19,4 @@ type t = { pinned: bool; (** Whether the message is pinned. *) webhook_id: Snowflake.t option; (** The webhook ID, if the message was sent by a webhook. *) kind: int; (** See {{:https://discordapp.com/developers/docs/resources/channel#message-object-message-types}the discord docs} for message type enumeration. *) -} [@@deriving sexp, yojson] \ No newline at end of file +} [@@deriving sexp, yojson { exn = true }] \ No newline at end of file diff --git a/lib/models/channel/message/reaction_t.ml b/lib/models/channel/message/reaction_t.ml index 7c78baf..e8ec5a0 100644 --- a/lib/models/channel/message/reaction_t.ml +++ b/lib/models/channel/message/reaction_t.ml @@ -6,9 +6,9 @@ type reaction_event = { message_id: Message_id.t; guild_id: Guild_id_t.t option [@default None]; emoji: Emoji.partial_emoji; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] type t = { count: int; emoji: Emoji.t; -} [@@deriving sexp, yojson { strict = false}] \ No newline at end of file +} [@@deriving sexp, yojson { strict = false; exn = true }] \ No newline at end of file diff --git a/lib/models/channel/message/reaction_t.mli b/lib/models/channel/message/reaction_t.mli index ace8f55..f9b2a98 100644 --- a/lib/models/channel/message/reaction_t.mli +++ b/lib/models/channel/message/reaction_t.mli @@ -5,10 +5,10 @@ type reaction_event = { message_id: Message_id.t; guild_id: Guild_id_t.t option; emoji: Emoji.partial_emoji; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** Represents a number of emojis used as a reaction on a message. *) type t = { count: int; emoji: Emoji.t; -} [@@deriving sexp, yojson] \ No newline at end of file +} [@@deriving sexp, yojson { exn = true }] \ No newline at end of file diff --git a/lib/models/emoji.ml b/lib/models/emoji.ml index 63318a5..09a51ab 100644 --- a/lib/models/emoji.ml +++ b/lib/models/emoji.ml @@ -3,7 +3,7 @@ open Core type partial_emoji = { id: Snowflake.t option [@default None]; name: string; -} [@@deriving sexp, yojson { strict = false }] +} [@@deriving sexp, yojson { strict = false; exn = true }] type t = { id: Snowflake.t option [@default None]; @@ -13,4 +13,4 @@ type t = { require_colons: bool [@default false]; managed: bool [@default false]; animated: bool [@default false]; -} [@@deriving sexp, yojson { strict = false}] \ No newline at end of file +} [@@deriving sexp, yojson { strict = false; exn = true }] \ No newline at end of file diff --git a/lib/models/emoji.mli b/lib/models/emoji.mli index c159a0e..935c13a 100644 --- a/lib/models/emoji.mli +++ b/lib/models/emoji.mli @@ -2,7 +2,7 @@ type partial_emoji = { id: Snowflake.t option; name: string; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** A full emoji object. *) type t = { @@ -13,4 +13,4 @@ type t = { require_colons: bool; (** Whether the emoji must be wrapped in colons. Is false for unicode emojis. *) managed: bool; (** Whether the emoji is managed by an integration. *) animated: bool; (** Whether the emoji is animated. *) -} [@@deriving sexp, yojson] \ No newline at end of file +} [@@deriving sexp, yojson { exn = true }] \ No newline at end of file diff --git a/lib/models/event_models.ml b/lib/models/event_models.ml index 43717ee..2dba4a4 100644 --- a/lib/models/event_models.ml +++ b/lib/models/event_models.ml @@ -34,7 +34,7 @@ module ChannelPinsUpdate = struct type t = { channel_id: Channel_id.t; last_pin_timestamp: string option [@default None]; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -43,7 +43,7 @@ module ChannelRecipientAdd = struct type t = { channel_id: Channel_id.t; user: User_t.t; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -52,7 +52,7 @@ module ChannelRecipientRemove = struct type t = { channel_id: Channel_id.t; user: User_t.t; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -61,7 +61,7 @@ module GuildBanAdd = struct type t = { guild_id: Guild_id.t; user: User_t.t; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -70,7 +70,7 @@ module GuildBanRemove = struct type t = { guild_id: Guild_id.t; user: User_t.t; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -88,7 +88,7 @@ end module GuildDelete = struct type t = { id: Guild_id.t; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -107,7 +107,7 @@ module GuildEmojisUpdate = struct type t = { emojis: Emoji.t list; guild_id: Guild_id.t - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -124,7 +124,7 @@ module GuildMemberRemove = struct type t = { guild_id: Guild_id.t; user: User_t.t; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -135,7 +135,7 @@ module GuildMemberUpdate = struct nick: string option; roles: Role_id.t list; user: User_t.t; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -144,7 +144,7 @@ module GuildMembersChunk = struct type t = { guild_id: Guild_id.t; members: (Snowflake.t * Member_t.t) list; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -153,7 +153,7 @@ module GuildRoleCreate = struct type t = { guild_id: Guild_id.t; role: Role_t.role; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -162,7 +162,7 @@ module GuildRoleDelete = struct type t = { guild_id: Guild_id.t; role_id: Role_id.t; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -171,7 +171,7 @@ module GuildRoleUpdate = struct type t = { guild_id: Guild_id.t; role: Role_t.role; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -180,7 +180,7 @@ end module GuildUnavailable = struct type t = { guild_id: Guild_id.t; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -200,7 +200,7 @@ module MessageDelete = struct id: Message_id.t; channel_id: Channel_id.t; guild_id: Guild_id.t option [@default None]; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -226,7 +226,7 @@ module MessageUpdate = struct pinned: bool option [@default None]; webhook_id: Snowflake.t option [@default None]; kind: int option [@default None][@key "type"]; - } [@@deriving sexp, yojson { strict = false}] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -236,7 +236,7 @@ module MessageDeleteBulk = struct guild_id: Guild_id.t option [@default None]; channel_id: Channel_id.t; ids: Message_id.t list; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -260,7 +260,7 @@ module ReactionAdd = struct message_id: Message_id.t; guild_id: Guild_id.t option [@default None]; emoji: Emoji.partial_emoji; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -272,7 +272,7 @@ module ReactionRemove = struct message_id: Message_id.t; guild_id: Guild_id.t option [@default None]; emoji: Emoji.partial_emoji; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -282,7 +282,7 @@ module ReactionRemoveAll = struct channel_id: Channel_id.t; message_id: Message_id.t; guild_id: Guild_id.t option [@default None]; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -294,7 +294,7 @@ module Ready = struct private_channels: Channel_id.t list; guilds: Guild_t.unavailable list; session_id: string; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -302,7 +302,7 @@ end module Resumed = struct type t = { trace: string option list [@key "_trace"]; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -313,7 +313,7 @@ module TypingStart = struct guild_id: Guild_id.t option [@default None]; timestamp: int; user_id: User_id.t; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end @@ -321,7 +321,7 @@ end module UserUpdate = struct type t = { user: User_t.t; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize ev = let user = User_t.of_yojson_exn ev in @@ -332,7 +332,7 @@ module WebhookUpdate = struct type t = { channel_id: Channel_id.t; guild_id: Guild_id.t; - } [@@deriving sexp, yojson { strict = false }] + } [@@deriving sexp, yojson { strict = false; exn = true }] let deserialize = of_yojson_exn end diff --git a/lib/models/guild/ban_t.ml b/lib/models/guild/ban_t.ml index 7923b58..2ebc91d 100644 --- a/lib/models/guild/ban_t.ml +++ b/lib/models/guild/ban_t.ml @@ -3,4 +3,4 @@ open Core type t = { reason: string option [@default None]; user: User_t.t; -} [@@deriving sexp, yojson { strict = false}] \ No newline at end of file +} [@@deriving sexp, yojson { strict = false; exn = true }] \ No newline at end of file diff --git a/lib/models/guild/ban_t.mli b/lib/models/guild/ban_t.mli index 37e5cfa..63d8ca8 100644 --- a/lib/models/guild/ban_t.mli +++ b/lib/models/guild/ban_t.mli @@ -1,4 +1,4 @@ type t = { reason: string option; (** The reason for the ban. *) user: User_t.t; (** The banned user. *) -} [@@deriving sexp, yojson] \ No newline at end of file +} [@@deriving sexp, yojson { exn = true }] \ No newline at end of file diff --git a/lib/models/guild/guild_t.ml b/lib/models/guild/guild_t.ml index 9ad7cb9..fa9673a 100644 --- a/lib/models/guild/guild_t.ml +++ b/lib/models/guild/guild_t.ml @@ -2,7 +2,7 @@ open Core type unavailable = { id: Guild_id_t.t; -} [@@deriving sexp, yojson { strict = false }] +} [@@deriving sexp, yojson { strict = false; exn = true }] type pre = { id: Guild_id_t.t; @@ -31,7 +31,7 @@ type pre = { member_count: int option [@default None]; members: Member_t.member list; channels: Channel_t.channel_wrapper list; -} [@@deriving sexp, yojson { strict = false }] +} [@@deriving sexp, yojson { strict = false; exn = true }] type t = { id: Guild_id_t.t; @@ -60,7 +60,7 @@ type t = { member_count: int option [@default None]; members: Member_t.t list; channels: Channel_t.t list; -} [@@deriving sexp, yojson { strict = false }] +} [@@deriving sexp, yojson { strict = false; exn = true }] let wrap ({id;name;icon;splash;owner_id;region;afk_channel_id;afk_timeout;embed_enabled;embed_channel_id;verification_level;default_message_notifications;explicit_content_filter;roles;emojis;features;mfa_level;application_id;widget_enabled;widget_channel_id;system_channel_id;large;unavailable;member_count;members;channels}:pre) = let `Guild_id id = id in diff --git a/lib/models/guild/guild_t.mli b/lib/models/guild/guild_t.mli index 7296372..89cf9a2 100644 --- a/lib/models/guild/guild_t.mli +++ b/lib/models/guild/guild_t.mli @@ -1,6 +1,6 @@ type unavailable = { id: Guild_id_t.t; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** Used internally. *) type pre = { @@ -30,7 +30,7 @@ type pre = { member_count: int option; members: Member_t.member list; channels: Channel_t.channel_wrapper list; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** A Guild object *) type t = { @@ -60,7 +60,7 @@ type t = { member_count: int option; (** Total number of members in the guild. *) members: Member_t.t list; (** List of guild members. *) channels: Channel_t.t list; (** List of guild channels. *) -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] val wrap : pre -> t val get_id : t -> Snowflake.t \ No newline at end of file diff --git a/lib/models/guild/member_t.ml b/lib/models/guild/member_t.ml index ae6b894..4e01b9a 100644 --- a/lib/models/guild/member_t.ml +++ b/lib/models/guild/member_t.ml @@ -6,7 +6,7 @@ type partial_member = { joined_at: string; deaf: bool; mute: bool; -} [@@deriving sexp, yojson { strict = false}] +} [@@deriving sexp, yojson { strict = false; exn = true }] type member = { nick: string option [@default None]; @@ -15,19 +15,19 @@ type member = { deaf: bool; mute: bool; user: User_t.t; -} [@@deriving sexp, yojson { strict = false}] +} [@@deriving sexp, yojson { strict = false; exn = true }] type member_wrapper = { guild_id: Guild_id_t.t; user: User_t.t; -} [@@deriving sexp, yojson { strict = false }] +} [@@deriving sexp, yojson { strict = false; exn = true }] type member_update = { guild_id: Guild_id_t.t; roles: Role_id.t list [@default []]; user: User_t.t; nick: string option [@default None]; -} [@@deriving sexp, yojson { strict = false}] +} [@@deriving sexp, yojson { strict = false; exn = true }] type t = { nick: string option [@default None]; @@ -37,7 +37,7 @@ type t = { mute: bool; user: User_t.t; guild_id: Guild_id_t.t; -} [@@deriving sexp, yojson { strict = false}] +} [@@deriving sexp, yojson { strict = false; exn = true }] let wrap ~guild_id ({nick;roles;joined_at;deaf;mute;user}:member) = {nick;roles;joined_at;deaf;mute;user;guild_id = `Guild_id guild_id} \ No newline at end of file diff --git a/lib/models/guild/member_t.mli b/lib/models/guild/member_t.mli index 170504f..abfc1af 100644 --- a/lib/models/guild/member_t.mli +++ b/lib/models/guild/member_t.mli @@ -4,7 +4,7 @@ type partial_member = { joined_at: string; deaf: bool; mute: bool; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] type member = { nick: string option; @@ -13,19 +13,19 @@ type member = { deaf: bool; mute: bool; user: User_t.t; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] type member_wrapper = { guild_id: Guild_id_t.t; user: User_t.t; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] type member_update = { guild_id: Guild_id_t.t; roles: Role_id.t list; user: User_t.t; nick: string option; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** A member object. *) type t = { @@ -36,6 +36,6 @@ type t = { mute: bool; (** Whether the user is muted. *) user: User_t.t; (** The underlying user object for the member. *) guild_id: Guild_id_t.t; (** The guild ID in which the member exists. *) -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] val wrap : guild_id:Snowflake.t -> member -> t \ No newline at end of file diff --git a/lib/models/guild/role_t.ml b/lib/models/guild/role_t.ml index cc461f3..d518b13 100644 --- a/lib/models/guild/role_t.ml +++ b/lib/models/guild/role_t.ml @@ -9,7 +9,7 @@ type role = { permissions: int; managed: bool; mentionable: bool; -} [@@deriving sexp, yojson { strict = false}] +} [@@deriving sexp, yojson { strict = false; exn = true }] type t = { id: Role_id.t; @@ -21,7 +21,7 @@ type t = { managed: bool; mentionable: bool; guild_id: Guild_id_t.t; -} [@@deriving sexp, yojson { strict = false}] +} [@@deriving sexp, yojson { strict = false; exn = true }] let wrap ~guild_id ({id;name;colour;hoist;position;permissions;managed;mentionable}:role) = {id;name;colour;hoist;position;permissions;managed;mentionable;guild_id = `Guild_id guild_id} \ No newline at end of file diff --git a/lib/models/guild/role_t.mli b/lib/models/guild/role_t.mli index 1b69e25..d9caf7a 100644 --- a/lib/models/guild/role_t.mli +++ b/lib/models/guild/role_t.mli @@ -8,7 +8,7 @@ type role = { permissions: int; managed: bool; mentionable: bool; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** A role object. *) type t = { @@ -21,7 +21,7 @@ type t = { managed: bool; (** Whether the guild is managed by an integration. *) mentionable: bool; (** Whether the role can be mentioned. *) guild_id: Guild_id_t.t; (** The guild ID this role belongs to. *) -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** Convenience method to produce {!t} from {!role} and a snowflake. *) val wrap : guild_id:Snowflake.t -> role -> t \ No newline at end of file diff --git a/lib/models/id/channel_id_t.mli b/lib/models/id/channel_id_t.mli index 2e7c76f..df0d518 100644 --- a/lib/models/id/channel_id_t.mli +++ b/lib/models/id/channel_id_t.mli @@ -1,3 +1,3 @@ -type t = [ `Channel_id of Snowflake.t ] [@@deriving sexp, yojson] +type t = [ `Channel_id of Snowflake.t ] [@@deriving sexp, yojson { exn = true }] val get_id : t -> Snowflake.t \ No newline at end of file diff --git a/lib/models/id/guild_id_t.mli b/lib/models/id/guild_id_t.mli index 9c92d6c..4605d34 100644 --- a/lib/models/id/guild_id_t.mli +++ b/lib/models/id/guild_id_t.mli @@ -1,3 +1,3 @@ -type t = [ `Guild_id of Snowflake.t ] [@@deriving sexp, yojson] +type t = [ `Guild_id of Snowflake.t ] [@@deriving sexp, yojson { exn = true }] val get_id : t -> Snowflake.t \ No newline at end of file diff --git a/lib/models/id/message_id.mli b/lib/models/id/message_id.mli index 90107b5..77a228a 100644 --- a/lib/models/id/message_id.mli +++ b/lib/models/id/message_id.mli @@ -1,3 +1,3 @@ -type t = [ `Message_id of Snowflake.t ] [@@deriving sexp, yojson] +type t = [ `Message_id of Snowflake.t ] [@@deriving sexp, yojson { exn = true }] val get_id : t -> Snowflake.t \ No newline at end of file diff --git a/lib/models/id/role_id.mli b/lib/models/id/role_id.mli index 701e4a9..e28e300 100644 --- a/lib/models/id/role_id.mli +++ b/lib/models/id/role_id.mli @@ -1,3 +1,3 @@ -type t = [ `Role_id of Snowflake.t ] [@@deriving sexp, yojson] +type t = [ `Role_id of Snowflake.t ] [@@deriving sexp, yojson { exn = true }] val get_id : t -> Snowflake.t \ No newline at end of file diff --git a/lib/models/id/user_id_t.mli b/lib/models/id/user_id_t.mli index 0893a34..194951b 100644 --- a/lib/models/id/user_id_t.mli +++ b/lib/models/id/user_id_t.mli @@ -1,3 +1,3 @@ -type t = [ `User_id of Snowflake.t ] [@@deriving sexp, yojson] +type t = [ `User_id of Snowflake.t ] [@@deriving sexp, yojson { exn = true }] val get_id : t -> Snowflake.t \ No newline at end of file diff --git a/lib/models/snowflake.mli b/lib/models/snowflake.mli index 475b94c..0c42e4a 100644 --- a/lib/models/snowflake.mli +++ b/lib/models/snowflake.mli @@ -1,6 +1,6 @@ open Core -type t = Int.t [@@deriving sexp, yojson] +type t = Int.t [@@deriving sexp, yojson { exn = true }] (** Convert a snowflake into a {!Core.Time.t} *) val time_of_t : t -> Time.t diff --git a/lib/models/user/activity.ml b/lib/models/user/activity.ml index c9b73d8..926c899 100644 --- a/lib/models/user/activity.ml +++ b/lib/models/user/activity.ml @@ -4,4 +4,4 @@ type t = { name: string; kind: int [@key "type"]; url: string option [@default None]; -} [@@deriving sexp, yojson { strict = false}] \ No newline at end of file +} [@@deriving sexp, yojson { strict = false; exn = true }] \ No newline at end of file diff --git a/lib/models/user/activity.mli b/lib/models/user/activity.mli index 1ddd4e7..2757f54 100644 --- a/lib/models/user/activity.mli +++ b/lib/models/user/activity.mli @@ -3,4 +3,4 @@ type t = { name: string; (** The name of the activity. *) kind: int; (** 0 = Playing, 1 = Streaming, 2 = Listening, 3 = Watching *) url: string option; (** Stream URL. Only validated for kind = 1. *) -} [@@deriving sexp, yojson] \ No newline at end of file +} [@@deriving sexp, yojson { exn = true }] \ No newline at end of file diff --git a/lib/models/user/presence.ml b/lib/models/user/presence.ml index 0b18a49..0b83000 100644 --- a/lib/models/user/presence.ml +++ b/lib/models/user/presence.ml @@ -7,4 +7,4 @@ type t = { guild_id: Guild_id_t.t; status: string; activities: Activity.t list; -} [@@deriving sexp, yojson { strict = false}] \ No newline at end of file +} [@@deriving sexp, yojson { strict = false; exn = true }] \ No newline at end of file diff --git a/lib/models/user/presence.mli b/lib/models/user/presence.mli index d75d408..2df252b 100644 --- a/lib/models/user/presence.mli +++ b/lib/models/user/presence.mli @@ -6,4 +6,4 @@ type t = { guild_id: Guild_id_t.t; (** The guild ID in which this presence exists. *) status: string; (** One of [online], [idle], [offline], or [dnd]. *) activities: Activity.t list; (** A list of all of the user's current activities. *) -} [@@deriving sexp, yojson] \ No newline at end of file +} [@@deriving sexp, yojson { exn = true }] \ No newline at end of file diff --git a/lib/models/user/user_t.ml b/lib/models/user/user_t.ml index 8958e84..f001e4a 100644 --- a/lib/models/user/user_t.ml +++ b/lib/models/user/user_t.ml @@ -2,7 +2,7 @@ open Core type partial_user = { id: User_id_t.t; -} [@@deriving sexp, yojson { strict = false}] +} [@@deriving sexp, yojson { strict = false; exn = true }] type t = { id: User_id_t.t; @@ -10,4 +10,4 @@ type t = { discriminator: string; avatar: string option [@default None]; bot: bool [@default false]; -} [@@deriving sexp, yojson { strict = false }] \ No newline at end of file +} [@@deriving sexp, yojson { strict = false; exn = true }] \ No newline at end of file diff --git a/lib/models/user/user_t.mli b/lib/models/user/user_t.mli index 645df3e..7b8f6b6 100644 --- a/lib/models/user/user_t.mli +++ b/lib/models/user/user_t.mli @@ -1,7 +1,7 @@ (** A partial user. Used internally. *) type partial_user = { id: User_id_t.t; -} [@@deriving sexp, yojson] +} [@@deriving sexp, yojson { exn = true }] (** A user object. *) type t = { @@ -10,4 +10,4 @@ type t = { discriminator: string; (** The 4 digits, as a string, that come after the '#' in a Discord username. *) avatar: string option; (** The hash of the user avatar, if they have one set. See {!User.face} to get the avatar URL. *) bot: bool; (** Whether the user is a bot. *) -} [@@deriving sexp, yojson] \ No newline at end of file +} [@@deriving sexp, yojson { exn = true }] \ No newline at end of file -- cgit v1.2.3