aboutsummaryrefslogtreecommitdiff
path: root/lib/models/id/guild_id_t.ml
blob: b2fd202bbedfefe17b904d9c78fad8c1df07414e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
open Core

type t = [ `Guild_id of Snowflake.t ] [@@deriving sexp]

let compare (`Guild_id t) (`Guild_id t') = Int64.compare t t'

let of_yojson a : (t, string) result =
    match Snowflake.of_yojson a with
    | Ok id -> Ok (`Guild_id id)
    | Error err -> Error err

let of_yojson_exn a : t = `Guild_id (Snowflake.of_yojson_exn a)
let to_yojson (`Guild_id id) = (Snowflake.to_yojson id)

let get_id (`Guild_id id) = id