package gitlab

  1. Overview
  2. Docs

Source file gitlab_json.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
(*
   Adapters used by atdgen to turn GitLab's representation of variants
   into an ATD-compatible representation.
*)
module Adapter = struct
  module WebhookEvent = Atdgen_runtime.Json_adapter.Type_field.Make (struct
    let type_field_name = "object_kind"
  end)

end

module Date  = struct
  type t = float

  let wrap str =
    try ISO8601.Permissive.date str
    with Failure _ ->
        raise 
          (Ezjsonm.Parse_error
             ( `String str,
               Format.sprintf "%s: Date.wrap can't parse date format YYYY-MM-DD" str))

  let unwrap = ISO8601.Permissive.string_of_date
end

module DateTime = struct
  type t = float

  let wrap str = 
    try ISO8601.Permissive.datetime str
      with Failure _ ->
      raise
        (Ezjsonm.Parse_error
           ( `String str,
             Format.sprintf "%s: DateTime.wrap can't parse ISO8601 date" str ))

  let unwrap date =
      ISO8601.Permissive.string_of_datetimezone(date, 0.)
end
OCaml

Innovation. Community. Security.