Skip to content

Commit 4ec3d79

Browse files
authored
Add docs for Jellyfish.Client.update_address/2 (#35)
1 parent c997733 commit 4ec3d79

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

lib/jellyfish/client.ex

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ defmodule Jellyfish.Client do
7373
%__MODULE__{http_client: http_client}
7474
end
7575

76+
@doc """
77+
Updates Jellyfish address.
78+
79+
When running Jellyfish in a cluster, user has to
80+
manually update Jellyfish address after creating a room.
81+
See also `Jellyfish.Room.create/2`.
82+
"""
7683
@spec update_address(t(), String.t()) :: t()
7784
def update_address(client, new_address) do
7885
Utils.check_prefixes(new_address)

lib/jellyfish/room.ex

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ defmodule Jellyfish.Room do
7474
}
7575

7676
@doc """
77-
List metadata of all of the rooms.
77+
Lists metadata of all of the rooms.
7878
"""
7979
@spec get_all(Client.t()) :: {:ok, [t()]} | {:error, atom() | String.t()}
8080
def get_all(client) do
@@ -89,7 +89,7 @@ defmodule Jellyfish.Room do
8989
end
9090

9191
@doc """
92-
Get metadata of the room with `room_id`.
92+
Gets metadata of the room with `room_id`.
9393
"""
9494
@spec get(Client.t(), id()) :: {:ok, t()} | {:error, atom() | String.t()}
9595
def get(client, room_id) do
@@ -105,7 +105,13 @@ defmodule Jellyfish.Room do
105105
end
106106

107107
@doc """
108-
Create a room.
108+
Creates a new room.
109+
110+
Returns an address of Jellyfish where the room was created.
111+
When running Jellyfish in a cluster, this address might be different
112+
than the one used in the initial call.
113+
Therefore, it is important to call `Jellyfish.Client.update_address/2`
114+
before subsequent operations like adding peers or components.
109115
"""
110116
@spec create(Client.t(), options()) :: {:ok, t(), String.t()} | {:error, atom() | String.t()}
111117
def create(client, opts \\ []) do
@@ -130,7 +136,7 @@ defmodule Jellyfish.Room do
130136
end
131137

132138
@doc """
133-
Delete the room with `room_id`.
139+
Deletes the room with `room_id`.
134140
"""
135141
@spec delete(Client.t(), id()) :: :ok | {:error, atom() | String.t()}
136142
def delete(client, room_id) do
@@ -141,7 +147,7 @@ defmodule Jellyfish.Room do
141147
end
142148

143149
@doc """
144-
Add a peer to the room with `room_id`.
150+
Adds a peer to the room with `room_id`.
145151
"""
146152
@spec add_peer(Client.t(), id(), Peer.options() | Peer.type()) ::
147153
{:ok, Peer.t(), peer_token()} | {:error, atom() | String.t()}
@@ -169,7 +175,7 @@ defmodule Jellyfish.Room do
169175
end
170176

171177
@doc """
172-
Delete the peer with `peer_id` from the room with `room_id`.
178+
Deletes the peer with `peer_id` from the room with `room_id`.
173179
"""
174180
@spec delete_peer(Client.t(), id(), Peer.id()) :: :ok | {:error, atom() | String.t()}
175181
def delete_peer(client, room_id, peer_id) do
@@ -183,7 +189,7 @@ defmodule Jellyfish.Room do
183189
end
184190

185191
@doc """
186-
Add component to the room with `room_id`.
192+
Adds a component to the room with `room_id`.
187193
"""
188194
@spec add_component(Client.t(), id(), Component.options() | Component.type()) ::
189195
{:ok, Component.t()} | {:error, atom() | String.t()}
@@ -211,7 +217,7 @@ defmodule Jellyfish.Room do
211217
end
212218

213219
@doc """
214-
Delete the component with `component_id` from the room with `room_id`.
220+
Deletes the component with `component_id` from the room with `room_id`.
215221
"""
216222
@spec delete_component(Client.t(), id(), Component.id()) :: :ok | {:error, atom() | String.t()}
217223
def delete_component(client, room_id, component_id) do

0 commit comments

Comments
 (0)