aboutsummaryrefslogtreecommitdiff
path: root/lib/models/id/guild_id_t.ml
blob: cd8eb589d58e9facdbd959e5ee25122a7d3ff589 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
type t = [ `Guild_id of Snowflake.t ] [@@deriving sexp]

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