@@ -20,19 +20,25 @@ module Github : Api.Github = struct
20
20
| Ok file -> Lwt. return @@ Ok (Github_j. api_commit_of_string file)
21
21
end
22
22
23
+ module Slack_base : Api .Slack = struct
24
+ let send_notification ~ctx :_ ~msg :_ = Lwt. return @@ Error " undefined for local setup"
25
+
26
+ let access_token_of_code ~ctx :_ ~code :_ = Lwt. return @@ Error " undefined for local setup"
27
+ end
28
+
23
29
module Slack : Api .Slack = struct
24
30
let send_notification ~ctx :_ ~msg =
25
31
let json = msg |> Slack_j. string_of_post_message_req |> Yojson.Basic. from_string |> Yojson.Basic. pretty_to_string in
26
32
Stdio. printf " will notify #%s\n " msg.channel;
27
33
Stdio. printf " %s\n " json;
28
34
Lwt. return @@ Ok ()
29
35
30
- let update_access_token_of_context ~ctx :_ ~code :_ =
31
- Stdio. printf " will generate token\n " ;
32
- Lwt. return @@ Ok ()
36
+ let access_token_of_code ~ctx :_ ~code = Lwt. return @@ Ok (Printf. sprintf " token of code %s" code)
33
37
end
34
38
35
39
module Slack_simple : Api .Slack = struct
40
+ include Slack_base
41
+
36
42
let log = Log. from " slack"
37
43
38
44
let send_notification ~ctx :_ ~(msg : Slack_t.post_message_req ) =
@@ -42,11 +48,11 @@ module Slack_simple : Api.Slack = struct
42
48
| Some s -> Printf. sprintf " with %S" s
43
49
);
44
50
Lwt. return @@ Ok ()
45
-
46
- let update_access_token_of_context ~ctx :_ ~code :_ = Lwt. return @@ Error " undefined for local setup"
47
51
end
48
52
49
53
module Slack_json : Api .Slack = struct
54
+ include Slack_base
55
+
50
56
let log = Log. from " slack"
51
57
52
58
let send_notification ~ctx :_ ~msg =
@@ -57,6 +63,4 @@ module Slack_json : Api.Slack = struct
57
63
log#info " %s" (Uri. to_string url);
58
64
log#info " %s" json;
59
65
Lwt. return @@ Ok ()
60
-
61
- let update_access_token_of_context ~ctx :_ ~code :_ = Lwt. return @@ Error " undefined for local setup"
62
66
end
0 commit comments