mpl-lobby-client 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mpl_lobby_client-0.1.0/PKG-INFO +8 -0
- mpl_lobby_client-0.1.0/lobby_api_client/__init__.py +8 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/__init__.py +1 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/__init__.py +1 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/add_lobby_seat.py +271 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/create_lobby.py +220 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/create_lobby_connection_token.py +204 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/create_lobby_session.py +202 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/get_lobby.py +209 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/heartbeat_lobby.py +235 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/join_lobby.py +200 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/kick_lobby_watcher.py +237 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/leave_lobby.py +207 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/list_lobby_watchers.py +211 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/release_lobby_lease.py +242 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/remove_lobby_seat.py +231 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/select_lobby_team.py +231 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/set_lobby_ready.py +243 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/start_lobby.py +251 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/unwatch_lobby.py +211 -0
- mpl_lobby_client-0.1.0/lobby_api_client/api/lobby/watch_lobby.py +234 -0
- mpl_lobby_client-0.1.0/lobby_api_client/client.py +268 -0
- mpl_lobby_client-0.1.0/lobby_api_client/errors.py +16 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/__init__.py +75 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/add_seat_body.py +87 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/add_seat_body_seat_settings.py +50 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/connection_token.py +70 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/connection_token_input_body.py +42 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/create_lobby_body.py +146 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/create_lobby_body_game_settings.py +50 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/create_session_body.py +53 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/error_detail.py +60 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/error_model.py +133 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/guest_session.py +71 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/heartbeat_body.py +62 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/heartbeat_result.py +96 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/join_lobby_body.py +70 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/lobby.py +129 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/lobby_game_settings.py +50 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/lobby_invalidation.py +85 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/lobby_invalidation_schema_version.py +8 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/lobby_invalidation_type.py +8 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/member.py +184 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/member_kind.py +9 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/member_seat_settings_type_0.py +49 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/problem.py +111 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/problem_code.py +25 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/ready_body.py +53 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/select_team_body.py +72 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/snapshot.py +202 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/start_input_body.py +42 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/start_roster_entry.py +66 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/start_rules.py +42 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/team.py +66 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/team_definition.py +50 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/watch_access.py +80 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/watch_lobby_body.py +61 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/watcher.py +60 -0
- mpl_lobby_client-0.1.0/lobby_api_client/models/watcher_list.py +67 -0
- mpl_lobby_client-0.1.0/lobby_api_client/py.typed +1 -0
- mpl_lobby_client-0.1.0/lobby_api_client/types.py +54 -0
- mpl_lobby_client-0.1.0/lobby_client/__init__.py +10 -0
- mpl_lobby_client-0.1.0/lobby_client/client.py +596 -0
- mpl_lobby_client-0.1.0/lobby_client/errors.py +51 -0
- mpl_lobby_client-0.1.0/lobby_client/reconcile.py +73 -0
- mpl_lobby_client-0.1.0/pyproject.toml +30 -0
- mpl_lobby_client-0.1.0/pyproject.toml.orig +28 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
from uuid import UUID
|
|
5
|
+
|
|
6
|
+
import httpx
|
|
7
|
+
|
|
8
|
+
from ... import errors
|
|
9
|
+
from ...client import AuthenticatedClient, Client
|
|
10
|
+
from ...models.add_seat_body import AddSeatBody
|
|
11
|
+
from ...models.problem import Problem
|
|
12
|
+
from ...models.snapshot import Snapshot
|
|
13
|
+
from ...types import Response
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_kwargs(
|
|
17
|
+
game_key: str,
|
|
18
|
+
lobby_id: UUID,
|
|
19
|
+
*,
|
|
20
|
+
body: AddSeatBody,
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
headers: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
_kwargs: dict[str, Any] = {
|
|
25
|
+
"method": "post",
|
|
26
|
+
"url": "/lobby/v1/games/{game_key}/lobbies/{lobby_id}/seats".format(
|
|
27
|
+
game_key=quote(str(game_key), safe=""),
|
|
28
|
+
lobby_id=quote(str(lobby_id), safe=""),
|
|
29
|
+
),
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
_kwargs["json"] = body.to_dict()
|
|
33
|
+
|
|
34
|
+
headers["Content-Type"] = "application/json"
|
|
35
|
+
|
|
36
|
+
_kwargs["headers"] = headers
|
|
37
|
+
return _kwargs
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Problem | Snapshot | None:
|
|
41
|
+
if response.status_code == 200:
|
|
42
|
+
response_200 = Snapshot.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_200
|
|
45
|
+
|
|
46
|
+
if response.status_code == 401:
|
|
47
|
+
response_401 = Problem.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
return response_401
|
|
50
|
+
|
|
51
|
+
if response.status_code == 403:
|
|
52
|
+
response_403 = Problem.from_dict(response.json())
|
|
53
|
+
|
|
54
|
+
return response_403
|
|
55
|
+
|
|
56
|
+
if response.status_code == 404:
|
|
57
|
+
response_404 = Problem.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
return response_404
|
|
60
|
+
|
|
61
|
+
if response.status_code == 409:
|
|
62
|
+
response_409 = Problem.from_dict(response.json())
|
|
63
|
+
|
|
64
|
+
return response_409
|
|
65
|
+
|
|
66
|
+
if response.status_code == 422:
|
|
67
|
+
response_422 = Problem.from_dict(response.json())
|
|
68
|
+
|
|
69
|
+
return response_422
|
|
70
|
+
|
|
71
|
+
if response.status_code == 500:
|
|
72
|
+
response_500 = Problem.from_dict(response.json())
|
|
73
|
+
|
|
74
|
+
return response_500
|
|
75
|
+
|
|
76
|
+
if response.status_code == 503:
|
|
77
|
+
response_503 = Problem.from_dict(response.json())
|
|
78
|
+
|
|
79
|
+
return response_503
|
|
80
|
+
|
|
81
|
+
if client.raise_on_unexpected_status:
|
|
82
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
83
|
+
else:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Problem | Snapshot]:
|
|
88
|
+
return Response(
|
|
89
|
+
status_code=HTTPStatus(response.status_code),
|
|
90
|
+
content=response.content,
|
|
91
|
+
headers=response.headers,
|
|
92
|
+
parsed=_parse_response(client=client, response=response),
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def sync_detailed(
|
|
97
|
+
game_key: str,
|
|
98
|
+
lobby_id: UUID,
|
|
99
|
+
*,
|
|
100
|
+
client: AuthenticatedClient,
|
|
101
|
+
body: AddSeatBody,
|
|
102
|
+
) -> Response[Problem | Snapshot]:
|
|
103
|
+
"""Add a seat
|
|
104
|
+
|
|
105
|
+
Adds a seat that no person plays, such as the game's bot, to a team, and returns the snapshot, where
|
|
106
|
+
the seat is a member of kind seat. Only the host can add one (otherwise not_host), and only while
|
|
107
|
+
the lobby waits (otherwise phase_conflict). The game checks seat_settings and names the seat;
|
|
108
|
+
settings it doesn't understand fail with invalid_seat_settings, and a game without seats refuses
|
|
109
|
+
every one. The seat counts toward the lobby's and the team's capacity (lobby_full, team_full) and
|
|
110
|
+
toward the members a start needs, is always ready, never disconnects, and joins the start roster
|
|
111
|
+
with its own player_id. A start still needs the host, a person. A team_id that isn't one of the
|
|
112
|
+
lobby's teams is invalid_input. The optional request_id makes a retry after a lost response safe:
|
|
113
|
+
repeating it with the same team_id and seat_settings returns the current snapshot without a second
|
|
114
|
+
seat, and with another team or settings fails with idempotency_conflict. Without one, each call adds
|
|
115
|
+
a seat.
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
game_key (str):
|
|
119
|
+
lobby_id (UUID):
|
|
120
|
+
body (AddSeatBody):
|
|
121
|
+
|
|
122
|
+
Raises:
|
|
123
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
124
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
Response[Problem | Snapshot]
|
|
128
|
+
"""
|
|
129
|
+
|
|
130
|
+
kwargs = _get_kwargs(
|
|
131
|
+
game_key=game_key,
|
|
132
|
+
lobby_id=lobby_id,
|
|
133
|
+
body=body,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
response = client.get_httpx_client().request(
|
|
137
|
+
**kwargs,
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
return _build_response(client=client, response=response)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def sync(
|
|
144
|
+
game_key: str,
|
|
145
|
+
lobby_id: UUID,
|
|
146
|
+
*,
|
|
147
|
+
client: AuthenticatedClient,
|
|
148
|
+
body: AddSeatBody,
|
|
149
|
+
) -> Problem | Snapshot | None:
|
|
150
|
+
"""Add a seat
|
|
151
|
+
|
|
152
|
+
Adds a seat that no person plays, such as the game's bot, to a team, and returns the snapshot, where
|
|
153
|
+
the seat is a member of kind seat. Only the host can add one (otherwise not_host), and only while
|
|
154
|
+
the lobby waits (otherwise phase_conflict). The game checks seat_settings and names the seat;
|
|
155
|
+
settings it doesn't understand fail with invalid_seat_settings, and a game without seats refuses
|
|
156
|
+
every one. The seat counts toward the lobby's and the team's capacity (lobby_full, team_full) and
|
|
157
|
+
toward the members a start needs, is always ready, never disconnects, and joins the start roster
|
|
158
|
+
with its own player_id. A start still needs the host, a person. A team_id that isn't one of the
|
|
159
|
+
lobby's teams is invalid_input. The optional request_id makes a retry after a lost response safe:
|
|
160
|
+
repeating it with the same team_id and seat_settings returns the current snapshot without a second
|
|
161
|
+
seat, and with another team or settings fails with idempotency_conflict. Without one, each call adds
|
|
162
|
+
a seat.
|
|
163
|
+
|
|
164
|
+
Args:
|
|
165
|
+
game_key (str):
|
|
166
|
+
lobby_id (UUID):
|
|
167
|
+
body (AddSeatBody):
|
|
168
|
+
|
|
169
|
+
Raises:
|
|
170
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
171
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
172
|
+
|
|
173
|
+
Returns:
|
|
174
|
+
Problem | Snapshot
|
|
175
|
+
"""
|
|
176
|
+
|
|
177
|
+
return sync_detailed(
|
|
178
|
+
game_key=game_key,
|
|
179
|
+
lobby_id=lobby_id,
|
|
180
|
+
client=client,
|
|
181
|
+
body=body,
|
|
182
|
+
).parsed
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
async def asyncio_detailed(
|
|
186
|
+
game_key: str,
|
|
187
|
+
lobby_id: UUID,
|
|
188
|
+
*,
|
|
189
|
+
client: AuthenticatedClient,
|
|
190
|
+
body: AddSeatBody,
|
|
191
|
+
) -> Response[Problem | Snapshot]:
|
|
192
|
+
"""Add a seat
|
|
193
|
+
|
|
194
|
+
Adds a seat that no person plays, such as the game's bot, to a team, and returns the snapshot, where
|
|
195
|
+
the seat is a member of kind seat. Only the host can add one (otherwise not_host), and only while
|
|
196
|
+
the lobby waits (otherwise phase_conflict). The game checks seat_settings and names the seat;
|
|
197
|
+
settings it doesn't understand fail with invalid_seat_settings, and a game without seats refuses
|
|
198
|
+
every one. The seat counts toward the lobby's and the team's capacity (lobby_full, team_full) and
|
|
199
|
+
toward the members a start needs, is always ready, never disconnects, and joins the start roster
|
|
200
|
+
with its own player_id. A start still needs the host, a person. A team_id that isn't one of the
|
|
201
|
+
lobby's teams is invalid_input. The optional request_id makes a retry after a lost response safe:
|
|
202
|
+
repeating it with the same team_id and seat_settings returns the current snapshot without a second
|
|
203
|
+
seat, and with another team or settings fails with idempotency_conflict. Without one, each call adds
|
|
204
|
+
a seat.
|
|
205
|
+
|
|
206
|
+
Args:
|
|
207
|
+
game_key (str):
|
|
208
|
+
lobby_id (UUID):
|
|
209
|
+
body (AddSeatBody):
|
|
210
|
+
|
|
211
|
+
Raises:
|
|
212
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
213
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
214
|
+
|
|
215
|
+
Returns:
|
|
216
|
+
Response[Problem | Snapshot]
|
|
217
|
+
"""
|
|
218
|
+
|
|
219
|
+
kwargs = _get_kwargs(
|
|
220
|
+
game_key=game_key,
|
|
221
|
+
lobby_id=lobby_id,
|
|
222
|
+
body=body,
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
226
|
+
|
|
227
|
+
return _build_response(client=client, response=response)
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
async def asyncio(
|
|
231
|
+
game_key: str,
|
|
232
|
+
lobby_id: UUID,
|
|
233
|
+
*,
|
|
234
|
+
client: AuthenticatedClient,
|
|
235
|
+
body: AddSeatBody,
|
|
236
|
+
) -> Problem | Snapshot | None:
|
|
237
|
+
"""Add a seat
|
|
238
|
+
|
|
239
|
+
Adds a seat that no person plays, such as the game's bot, to a team, and returns the snapshot, where
|
|
240
|
+
the seat is a member of kind seat. Only the host can add one (otherwise not_host), and only while
|
|
241
|
+
the lobby waits (otherwise phase_conflict). The game checks seat_settings and names the seat;
|
|
242
|
+
settings it doesn't understand fail with invalid_seat_settings, and a game without seats refuses
|
|
243
|
+
every one. The seat counts toward the lobby's and the team's capacity (lobby_full, team_full) and
|
|
244
|
+
toward the members a start needs, is always ready, never disconnects, and joins the start roster
|
|
245
|
+
with its own player_id. A start still needs the host, a person. A team_id that isn't one of the
|
|
246
|
+
lobby's teams is invalid_input. The optional request_id makes a retry after a lost response safe:
|
|
247
|
+
repeating it with the same team_id and seat_settings returns the current snapshot without a second
|
|
248
|
+
seat, and with another team or settings fails with idempotency_conflict. Without one, each call adds
|
|
249
|
+
a seat.
|
|
250
|
+
|
|
251
|
+
Args:
|
|
252
|
+
game_key (str):
|
|
253
|
+
lobby_id (UUID):
|
|
254
|
+
body (AddSeatBody):
|
|
255
|
+
|
|
256
|
+
Raises:
|
|
257
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
258
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
259
|
+
|
|
260
|
+
Returns:
|
|
261
|
+
Problem | Snapshot
|
|
262
|
+
"""
|
|
263
|
+
|
|
264
|
+
return (
|
|
265
|
+
await asyncio_detailed(
|
|
266
|
+
game_key=game_key,
|
|
267
|
+
lobby_id=lobby_id,
|
|
268
|
+
client=client,
|
|
269
|
+
body=body,
|
|
270
|
+
)
|
|
271
|
+
).parsed
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.create_lobby_body import CreateLobbyBody
|
|
9
|
+
from ...models.problem import Problem
|
|
10
|
+
from ...models.snapshot import Snapshot
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: CreateLobbyBody,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/lobby/v1/lobbies",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_kwargs["json"] = body.to_dict()
|
|
26
|
+
|
|
27
|
+
headers["Content-Type"] = "application/json"
|
|
28
|
+
|
|
29
|
+
_kwargs["headers"] = headers
|
|
30
|
+
return _kwargs
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Problem | Snapshot | None:
|
|
34
|
+
if response.status_code == 201:
|
|
35
|
+
response_201 = Snapshot.from_dict(response.json())
|
|
36
|
+
|
|
37
|
+
return response_201
|
|
38
|
+
|
|
39
|
+
if response.status_code == 401:
|
|
40
|
+
response_401 = Problem.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
return response_401
|
|
43
|
+
|
|
44
|
+
if response.status_code == 403:
|
|
45
|
+
response_403 = Problem.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_403
|
|
48
|
+
|
|
49
|
+
if response.status_code == 404:
|
|
50
|
+
response_404 = Problem.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_404
|
|
53
|
+
|
|
54
|
+
if response.status_code == 409:
|
|
55
|
+
response_409 = Problem.from_dict(response.json())
|
|
56
|
+
|
|
57
|
+
return response_409
|
|
58
|
+
|
|
59
|
+
if response.status_code == 422:
|
|
60
|
+
response_422 = Problem.from_dict(response.json())
|
|
61
|
+
|
|
62
|
+
return response_422
|
|
63
|
+
|
|
64
|
+
if response.status_code == 500:
|
|
65
|
+
response_500 = Problem.from_dict(response.json())
|
|
66
|
+
|
|
67
|
+
return response_500
|
|
68
|
+
|
|
69
|
+
if response.status_code == 503:
|
|
70
|
+
response_503 = Problem.from_dict(response.json())
|
|
71
|
+
|
|
72
|
+
return response_503
|
|
73
|
+
|
|
74
|
+
if client.raise_on_unexpected_status:
|
|
75
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
76
|
+
else:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Problem | Snapshot]:
|
|
81
|
+
return Response(
|
|
82
|
+
status_code=HTTPStatus(response.status_code),
|
|
83
|
+
content=response.content,
|
|
84
|
+
headers=response.headers,
|
|
85
|
+
parsed=_parse_response(client=client, response=response),
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def sync_detailed(
|
|
90
|
+
*,
|
|
91
|
+
client: AuthenticatedClient,
|
|
92
|
+
body: CreateLobbyBody,
|
|
93
|
+
) -> Response[Problem | Snapshot]:
|
|
94
|
+
"""Create a lobby
|
|
95
|
+
|
|
96
|
+
Creates a lobby. The optional game_settings object is checked by the game now; invalid settings fail
|
|
97
|
+
with invalid_game_settings. The lobby stores the settings without reading them and returns them in
|
|
98
|
+
every snapshot, including the started one. They can't change after creation. Repeating the same
|
|
99
|
+
request_id and payload within the idempotency window, 24 hours by default, returns the committed
|
|
100
|
+
snapshot. The lobby is deleted, in any phase, once nobody has been connected to it for an hour, and
|
|
101
|
+
in any case a day after creation, unless its game sets other times.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
body (CreateLobbyBody):
|
|
105
|
+
|
|
106
|
+
Raises:
|
|
107
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
108
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
Response[Problem | Snapshot]
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
kwargs = _get_kwargs(
|
|
115
|
+
body=body,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
response = client.get_httpx_client().request(
|
|
119
|
+
**kwargs,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
return _build_response(client=client, response=response)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def sync(
|
|
126
|
+
*,
|
|
127
|
+
client: AuthenticatedClient,
|
|
128
|
+
body: CreateLobbyBody,
|
|
129
|
+
) -> Problem | Snapshot | None:
|
|
130
|
+
"""Create a lobby
|
|
131
|
+
|
|
132
|
+
Creates a lobby. The optional game_settings object is checked by the game now; invalid settings fail
|
|
133
|
+
with invalid_game_settings. The lobby stores the settings without reading them and returns them in
|
|
134
|
+
every snapshot, including the started one. They can't change after creation. Repeating the same
|
|
135
|
+
request_id and payload within the idempotency window, 24 hours by default, returns the committed
|
|
136
|
+
snapshot. The lobby is deleted, in any phase, once nobody has been connected to it for an hour, and
|
|
137
|
+
in any case a day after creation, unless its game sets other times.
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
body (CreateLobbyBody):
|
|
141
|
+
|
|
142
|
+
Raises:
|
|
143
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
144
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
Problem | Snapshot
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
return sync_detailed(
|
|
151
|
+
client=client,
|
|
152
|
+
body=body,
|
|
153
|
+
).parsed
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
async def asyncio_detailed(
|
|
157
|
+
*,
|
|
158
|
+
client: AuthenticatedClient,
|
|
159
|
+
body: CreateLobbyBody,
|
|
160
|
+
) -> Response[Problem | Snapshot]:
|
|
161
|
+
"""Create a lobby
|
|
162
|
+
|
|
163
|
+
Creates a lobby. The optional game_settings object is checked by the game now; invalid settings fail
|
|
164
|
+
with invalid_game_settings. The lobby stores the settings without reading them and returns them in
|
|
165
|
+
every snapshot, including the started one. They can't change after creation. Repeating the same
|
|
166
|
+
request_id and payload within the idempotency window, 24 hours by default, returns the committed
|
|
167
|
+
snapshot. The lobby is deleted, in any phase, once nobody has been connected to it for an hour, and
|
|
168
|
+
in any case a day after creation, unless its game sets other times.
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
body (CreateLobbyBody):
|
|
172
|
+
|
|
173
|
+
Raises:
|
|
174
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
175
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
176
|
+
|
|
177
|
+
Returns:
|
|
178
|
+
Response[Problem | Snapshot]
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
kwargs = _get_kwargs(
|
|
182
|
+
body=body,
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
186
|
+
|
|
187
|
+
return _build_response(client=client, response=response)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
async def asyncio(
|
|
191
|
+
*,
|
|
192
|
+
client: AuthenticatedClient,
|
|
193
|
+
body: CreateLobbyBody,
|
|
194
|
+
) -> Problem | Snapshot | None:
|
|
195
|
+
"""Create a lobby
|
|
196
|
+
|
|
197
|
+
Creates a lobby. The optional game_settings object is checked by the game now; invalid settings fail
|
|
198
|
+
with invalid_game_settings. The lobby stores the settings without reading them and returns them in
|
|
199
|
+
every snapshot, including the started one. They can't change after creation. Repeating the same
|
|
200
|
+
request_id and payload within the idempotency window, 24 hours by default, returns the committed
|
|
201
|
+
snapshot. The lobby is deleted, in any phase, once nobody has been connected to it for an hour, and
|
|
202
|
+
in any case a day after creation, unless its game sets other times.
|
|
203
|
+
|
|
204
|
+
Args:
|
|
205
|
+
body (CreateLobbyBody):
|
|
206
|
+
|
|
207
|
+
Raises:
|
|
208
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
209
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
210
|
+
|
|
211
|
+
Returns:
|
|
212
|
+
Problem | Snapshot
|
|
213
|
+
"""
|
|
214
|
+
|
|
215
|
+
return (
|
|
216
|
+
await asyncio_detailed(
|
|
217
|
+
client=client,
|
|
218
|
+
body=body,
|
|
219
|
+
)
|
|
220
|
+
).parsed
|