summaryrefslogtreecommitdiff
path: root/lib/polyjuice/client/room.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/polyjuice/client/room.ex')
-rw-r--r--lib/polyjuice/client/room.ex38
1 files changed, 37 insertions, 1 deletions
diff --git a/lib/polyjuice/client/room.ex b/lib/polyjuice/client/room.ex
index af43bb6..62009f9 100644
--- a/lib/polyjuice/client/room.ex
+++ b/lib/polyjuice/client/room.ex
@@ -1,4 +1,4 @@
-# Copyright 2019 Hubert Chathi <hubert@uhoreg.ca>
+# Copyright 2020 Hubert Chathi <hubert@uhoreg.ca>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -187,6 +187,42 @@ defmodule Polyjuice.Client.Room do
end
@doc """
+ Leave a room.
+ """
+ @spec leave(
+ client_api :: Polyjuice.Client.API.t(),
+ room :: String.t()
+ ) :: {:ok, String.t()} | any
+ def leave(client_api, room) when is_binary(room) do
+ Polyjuice.Client.API.room_queue(client_api, room, fn ->
+ Polyjuice.Client.API.call(
+ client_api,
+ %Polyjuice.Client.Endpoint.PostRoomsLeave{
+ room: room
+ }
+ )
+ end)
+ end
+
+ @doc """
+ Forget a room.
+ """
+ @spec forget(
+ client_api :: Polyjuice.Client.API.t(),
+ room :: String.t()
+ ) :: {:ok, String.t()} | any
+ def forget(client_api, room) when is_binary(room) do
+ Polyjuice.Client.API.room_queue(client_api, room, fn ->
+ Polyjuice.Client.API.call(
+ client_api,
+ %Polyjuice.Client.Endpoint.PostRoomsForget{
+ room: room
+ }
+ )
+ end)
+ end
+
+ @doc """
Get messages from a room starting from a certain point.
"""
@spec get_messages(