diff options
| author | Matias Goldfeld <[email protected]> | 2021-01-29 13:40:47 -0500 |
|---|---|---|
| committer | Matias Goldfeld <[email protected]> | 2021-01-29 13:40:47 -0500 |
| commit | a44882d0e2c7b3397fc6c6c616e554eeb2248fdb (patch) | |
| tree | f0fc6ff32bbf586b94d573ecb4c99b17324ea0ee /lib/models/channel/channel.ml | |
| parent | Revert "Started conversion to ppx_yojson_conv" (diff) | |
| download | disml-a44882d0e2c7b3397fc6c6c616e554eeb2248fdb.tar.xz disml-a44882d0e2c7b3397fc6c6c616e554eeb2248fdb.zip | |
Revert "More Int64 refactors"
This reverts commit b499169e93e9f7bdd0f877a3cdf0247ec495abe1.
Diffstat (limited to 'lib/models/channel/channel.ml')
| -rw-r--r-- | lib/models/channel/channel.ml | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/models/channel/channel.ml b/lib/models/channel/channel.ml index 4d7b29d..47cf500 100644 --- a/lib/models/channel/channel.ml +++ b/lib/models/channel/channel.ml @@ -33,13 +33,16 @@ let delete ch = let get_message ~id ch =
Http.get_message (get_id ch) id
-let get_messages ?(mode=`Around) ~id ?(limit=50) ch =
+let get_messages ?(mode=`Around) ?id ?(limit=50) ch =
let kind = match mode with
- | `Around -> "around", id
- | `Before -> "before", id
- | `After -> "after", id
+ | `Around -> "around", limit
+ | `Before -> "before", limit
+ | `After -> "after", limit
in
- Http.get_messages (get_id ch) limit kind
+ let id = match id with
+ | Some id -> id
+ | None -> raise No_message_found in
+ Http.get_messages (get_id ch) id kind
let broadcast_typing ch =
Http.broadcast_typing (get_id ch)
@@ -48,5 +51,5 @@ let get_pins ch = Http.get_pinned_messages (get_id ch)
let bulk_delete msgs ch =
- let msgs = `List (List.map ~f:(fun id -> `Intlit (Int64.to_string id)) msgs) in
+ let msgs = `List (List.map ~f:(fun id -> `Int id) msgs) in
Http.bulk_delete (get_id ch) msgs
\ No newline at end of file |