From d747aa1cca59430ad5b22f75112a712394c2d67a Mon Sep 17 00:00:00 2001 From: Benedetta Date: Wed, 24 Apr 2024 09:58:14 +0200 Subject: [PATCH] more --- pam/bin/main.ml | 11 ++++++++++- pam/bin/utils.ml | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pam/bin/main.ml b/pam/bin/main.ml index 04e6f1e..336e3ae 100644 --- a/pam/bin/main.ml +++ b/pam/bin/main.ml @@ -1,4 +1,5 @@ open Pam.Datatypes +open Pam.Issue_parser open Batteries open Utils @@ -11,14 +12,22 @@ let _HTTP_CLIENT = "http_client" **) let http_client (repos: Config.repo_data list) = let http_actor = Httpclient.init repos in + let _ = print_endline "Initialized http client" in + let rec loop () = let _ = match Riot.receive () with | ListIssues -> Httpclient.make_get_request http_actor - |> Result.map Pam.Datatypes.forgejo_issues + (* |> Result.map Pam.Datatypes.forgejo_issues *) + |> Result.bind (fun issue -> + match to_datetime issue with + | Error e -> Error e |> Option.some + | Ok None -> None + | Ok (Some times) -> failwith "dunno" + ) |> Result.map_error Pam.Datatypes.internal_failure |> Result.fold ~ok:identity ~error:(fun e -> [e]) |> List.map (Riot.send_by_name ~name:_MQ_CLIENT) diff --git a/pam/bin/utils.ml b/pam/bin/utils.ml index c0656c9..747326e 100644 --- a/pam/bin/utils.ml +++ b/pam/bin/utils.ml @@ -20,3 +20,5 @@ let one_second = 1_000_000L let exit2 msg = let _ = print_endline msg in exit 2 module StringMap = Map.Make (String) + +let rec all acc = function [] -> Ok acc | Ok x::xs -> all (x::acc) xs | Error e::_ -> Error e