aboutsummaryrefslogtreecommitdiff
path: root/lib/models/id/guild_id_t.ml
blob: a39c07decd2977425f161b02202fe8b65dc184b5 (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') = Int.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