Skip to content

Commit

Permalink
slack: update users.lookupByEmail call
Browse files Browse the repository at this point in the history
  • Loading branch information
Khady committed Feb 15, 2024
1 parent 310357d commit 8393284
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/api_remote.ml
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ module Slack : Api.Slack = struct
let lookup_user ~(ctx : Context.t) ~(cfg : Config_t.config) ~email =
(* Check if config holds the Github to Slack email mapping *)
let email = List.Assoc.find cfg.user_mappings ~equal:String.equal email |> Option.value ~default:email in
let data = Slack_j.string_of_lookup_user_req { Slack_t.email } in
request_token_auth ~name:"lookup user by email"
~body:(`Raw ("application/json", data))
~ctx `GET "users.lookupByEmail" Slack_j.read_lookup_user_res
let url_args = Web.make_url_args [ "email", email ] in
request_token_auth ~name:"lookup user by email" ~ctx `GET
(sprintf "users.lookupByEmail?%s" url_args)
Slack_j.read_lookup_user_res

(** [send_notification ctx msg] notifies [msg.channel] with the payload [msg];
uses web API with access token if available, or with webhook otherwise *)
Expand Down
4 changes: 0 additions & 4 deletions lib/slack.atd
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ type post_message_res = {
channel: string;
}

type lookup_user_req = {
email: string;
}

type lookup_user_res = {
user: user;
}
Expand Down

0 comments on commit 8393284

Please sign in to comment.