nadeshiko-sdk 0.1.0__py3-none-any.whl
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.
- nadeshiko/__init__.py +10 -0
- nadeshiko/_version.py +1 -0
- nadeshiko/api/__init__.py +1 -0
- nadeshiko/api/auth/__init__.py +3 -0
- nadeshiko/api/auth/internal/__init__.py +11 -0
- nadeshiko/api/auth/internal/get_discord_auth_url.py +176 -0
- nadeshiko/api/auth/internal/login.py +213 -0
- nadeshiko/api/auth/internal/login_discord.py +204 -0
- nadeshiko/api/auth/internal/login_google.py +204 -0
- nadeshiko/api/auth/internal/register.py +212 -0
- nadeshiko/api/auth_jwt/__init__.py +3 -0
- nadeshiko/api/auth_jwt/internal/__init__.py +7 -0
- nadeshiko/api/auth_jwt/internal/logout.py +151 -0
- nadeshiko/api/lists/__init__.py +8 -0
- nadeshiko/api/lists/internal/__init__.py +12 -0
- nadeshiko/api/lists/internal/list_add_item.py +215 -0
- nadeshiko/api/lists/internal/list_create.py +194 -0
- nadeshiko/api/lists/internal/list_destroy.py +193 -0
- nadeshiko/api/lists/internal/list_remove_item.py +207 -0
- nadeshiko/api/lists/internal/list_update.py +215 -0
- nadeshiko/api/lists/internal/list_update_item.py +229 -0
- nadeshiko/api/lists/list_index.py +257 -0
- nadeshiko/api/lists/list_show.py +193 -0
- nadeshiko/api/media/__init__.py +14 -0
- nadeshiko/api/media/character_show.py +193 -0
- nadeshiko/api/media/episode_index.py +229 -0
- nadeshiko/api/media/episode_show.py +207 -0
- nadeshiko/api/media/internal/__init__.py +16 -0
- nadeshiko/api/media/internal/episode_create.py +215 -0
- nadeshiko/api/media/internal/episode_destroy.py +205 -0
- nadeshiko/api/media/internal/episode_update.py +229 -0
- nadeshiko/api/media/internal/media_create.py +194 -0
- nadeshiko/api/media/internal/media_destroy.py +197 -0
- nadeshiko/api/media/internal/media_update.py +219 -0
- nadeshiko/api/media/internal/segment_create.py +229 -0
- nadeshiko/api/media/internal/segment_destroy.py +219 -0
- nadeshiko/api/media/internal/segment_index.py +243 -0
- nadeshiko/api/media/internal/segment_update.py +243 -0
- nadeshiko/api/media/media_index.py +232 -0
- nadeshiko/api/media/media_show.py +193 -0
- nadeshiko/api/media/segment_show.py +221 -0
- nadeshiko/api/media/segment_show_by_uuid.py +193 -0
- nadeshiko/api/media/seiyuu_show.py +193 -0
- nadeshiko/api/search/__init__.py +11 -0
- nadeshiko/api/search/fetch_media_info.py +278 -0
- nadeshiko/api/search/fetch_sentence_context.py +219 -0
- nadeshiko/api/search/internal/__init__.py +6 -0
- nadeshiko/api/search/search.py +295 -0
- nadeshiko/api/search/search_health_check.py +168 -0
- nadeshiko/api/search/search_multiple.py +238 -0
- nadeshiko/api/user/__init__.py +3 -0
- nadeshiko/api/user/internal/__init__.py +11 -0
- nadeshiko/api/user/internal/create_api_key.py +199 -0
- nadeshiko/api/user/internal/deactivate_api_key.py +194 -0
- nadeshiko/api/user/internal/get_api_keys.py +151 -0
- nadeshiko/api/user/internal/get_identity_me.py +156 -0
- nadeshiko/api/user/internal/get_user_info.py +156 -0
- nadeshiko/client.py +138 -0
- nadeshiko/errors.py +16 -0
- nadeshiko/models/__init__.py +215 -0
- nadeshiko/models/api_key.py +118 -0
- nadeshiko/models/api_key_permission.py +70 -0
- nadeshiko/models/auth_user.py +107 -0
- nadeshiko/models/basic_info.py +132 -0
- nadeshiko/models/category_statistic.py +71 -0
- nadeshiko/models/character.py +100 -0
- nadeshiko/models/character_input.py +130 -0
- nadeshiko/models/character_input_character_role.py +10 -0
- nadeshiko/models/character_with_media.py +124 -0
- nadeshiko/models/character_with_media_media_appearances_item.py +93 -0
- nadeshiko/models/character_with_media_media_appearances_item_role.py +10 -0
- nadeshiko/models/create_api_key_request.py +75 -0
- nadeshiko/models/create_api_key_response.py +70 -0
- nadeshiko/models/deactivate_api_key_request.py +62 -0
- nadeshiko/models/deactivate_api_key_response.py +62 -0
- nadeshiko/models/discord_auth_url_response.py +62 -0
- nadeshiko/models/discord_login_request.py +62 -0
- nadeshiko/models/episode.py +253 -0
- nadeshiko/models/episode_create_request.py +145 -0
- nadeshiko/models/episode_list_response.py +94 -0
- nadeshiko/models/episode_update_request.py +135 -0
- nadeshiko/models/error.py +128 -0
- nadeshiko/models/error_errors.py +46 -0
- nadeshiko/models/fetch_media_info_response.py +115 -0
- nadeshiko/models/fetch_media_info_type.py +10 -0
- nadeshiko/models/fetch_sentence_context_request.py +96 -0
- nadeshiko/models/fetch_sentence_context_response.py +75 -0
- nadeshiko/models/get_api_keys_response.py +86 -0
- nadeshiko/models/google_login_request.py +62 -0
- nadeshiko/models/list_.py +97 -0
- nadeshiko/models/list_add_item_body.py +69 -0
- nadeshiko/models/list_add_item_response_201.py +61 -0
- nadeshiko/models/list_create_request.py +107 -0
- nadeshiko/models/list_create_request_type.py +9 -0
- nadeshiko/models/list_create_request_visibility.py +9 -0
- nadeshiko/models/list_destroy_response_200.py +70 -0
- nadeshiko/models/list_index_type.py +9 -0
- nadeshiko/models/list_index_visibility.py +9 -0
- nadeshiko/models/list_input.py +138 -0
- nadeshiko/models/list_input_list_type.py +9 -0
- nadeshiko/models/list_input_list_visibility.py +9 -0
- nadeshiko/models/list_remove_item_response_200.py +61 -0
- nadeshiko/models/list_type.py +9 -0
- nadeshiko/models/list_update_body.py +78 -0
- nadeshiko/models/list_update_body_visibility.py +9 -0
- nadeshiko/models/list_update_item_body.py +61 -0
- nadeshiko/models/list_update_item_response_200.py +61 -0
- nadeshiko/models/list_visibility.py +9 -0
- nadeshiko/models/list_with_media.py +119 -0
- nadeshiko/models/list_with_media_media_item.py +83 -0
- nadeshiko/models/list_with_media_type.py +9 -0
- nadeshiko/models/list_with_media_visibility.py +9 -0
- nadeshiko/models/login_request.py +70 -0
- nadeshiko/models/login_response.py +84 -0
- nadeshiko/models/logout_response.py +73 -0
- nadeshiko/models/media.py +288 -0
- nadeshiko/models/media_category.py +11 -0
- nadeshiko/models/media_character.py +78 -0
- nadeshiko/models/media_character_role.py +10 -0
- nadeshiko/models/media_create_request.py +270 -0
- nadeshiko/models/media_create_request_category.py +11 -0
- nadeshiko/models/media_destroy_response_200.py +70 -0
- nadeshiko/models/media_index_category.py +9 -0
- nadeshiko/models/media_info_data.py +307 -0
- nadeshiko/models/media_info_path.py +83 -0
- nadeshiko/models/media_info_stats.py +89 -0
- nadeshiko/models/media_list_response.py +94 -0
- nadeshiko/models/media_update_request.py +297 -0
- nadeshiko/models/media_update_request_category.py +9 -0
- nadeshiko/models/quota_info.py +87 -0
- nadeshiko/models/quota_info_quota_limit_type_1.py +8 -0
- nadeshiko/models/register_request.py +78 -0
- nadeshiko/models/register_response.py +76 -0
- nadeshiko/models/register_response_user.py +46 -0
- nadeshiko/models/search_health_check_response.py +138 -0
- nadeshiko/models/search_multiple_request.py +72 -0
- nadeshiko/models/search_multiple_response.py +79 -0
- nadeshiko/models/search_request.py +253 -0
- nadeshiko/models/search_request_content_sort.py +13 -0
- nadeshiko/models/search_request_media_item.py +85 -0
- nadeshiko/models/search_request_media_item_seasons_item.py +69 -0
- nadeshiko/models/search_response.py +158 -0
- nadeshiko/models/segment.py +303 -0
- nadeshiko/models/segment_create_request.py +203 -0
- nadeshiko/models/segment_create_request_status.py +13 -0
- nadeshiko/models/segment_info.py +207 -0
- nadeshiko/models/segment_list_response.py +94 -0
- nadeshiko/models/segment_status.py +13 -0
- nadeshiko/models/segment_update_request.py +198 -0
- nadeshiko/models/segment_update_request_status.py +13 -0
- nadeshiko/models/seiyuu.py +86 -0
- nadeshiko/models/seiyuu_with_roles.py +108 -0
- nadeshiko/models/seiyuu_with_roles_roles_item.py +109 -0
- nadeshiko/models/seiyuu_with_roles_roles_item_role.py +10 -0
- nadeshiko/models/sentence.py +88 -0
- nadeshiko/models/statistic.py +132 -0
- nadeshiko/models/statistic_season_with_episode_hits.py +74 -0
- nadeshiko/models/statistic_season_with_episode_hits_additional_property.py +46 -0
- nadeshiko/models/user_info_response.py +79 -0
- nadeshiko/models/user_info_response_user.py +91 -0
- nadeshiko/models/user_role.py +71 -0
- nadeshiko/models/word_match.py +107 -0
- nadeshiko/models/word_match_media.py +98 -0
- nadeshiko/types.py +54 -0
- nadeshiko_sdk-0.1.0.dist-info/METADATA +147 -0
- nadeshiko_sdk-0.1.0.dist-info/RECORD +167 -0
- nadeshiko_sdk-0.1.0.dist-info/WHEEL +4 -0
nadeshiko/__init__.py
ADDED
nadeshiko/_version.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
import httpx
|
|
3
|
+
from .... import errors
|
|
4
|
+
from ....client import AuthenticatedClient, Client
|
|
5
|
+
from ....types import Response
|
|
6
|
+
|
|
7
|
+
from . import get_discord_auth_url
|
|
8
|
+
from . import login_discord
|
|
9
|
+
from . import login_google
|
|
10
|
+
from . import login
|
|
11
|
+
from . import register
|
|
@@ -0,0 +1,176 @@
|
|
|
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.discord_auth_url_response import DiscordAuthUrlResponse
|
|
9
|
+
from ....models.error import Error
|
|
10
|
+
from ....types import UNSET, Response, Unset
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
*,
|
|
15
|
+
referer: str | Unset = UNSET,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
headers: dict[str, Any] = {}
|
|
18
|
+
if not isinstance(referer, Unset):
|
|
19
|
+
headers["Referer"] = referer
|
|
20
|
+
|
|
21
|
+
_kwargs: dict[str, Any] = {
|
|
22
|
+
"method": "get",
|
|
23
|
+
"url": "/v1/auth/discord/url",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
_kwargs["headers"] = headers
|
|
27
|
+
return _kwargs
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _parse_response(
|
|
31
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
32
|
+
) -> DiscordAuthUrlResponse | Error | None:
|
|
33
|
+
if response.status_code == 200:
|
|
34
|
+
response_200 = DiscordAuthUrlResponse.from_dict(response.json())
|
|
35
|
+
|
|
36
|
+
return response_200
|
|
37
|
+
|
|
38
|
+
if response.status_code == 429:
|
|
39
|
+
response_429 = Error.from_dict(response.json())
|
|
40
|
+
|
|
41
|
+
return response_429
|
|
42
|
+
|
|
43
|
+
if response.status_code == 500:
|
|
44
|
+
response_500 = Error.from_dict(response.json())
|
|
45
|
+
|
|
46
|
+
return response_500
|
|
47
|
+
|
|
48
|
+
if client.raise_on_unexpected_status:
|
|
49
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
50
|
+
else:
|
|
51
|
+
return None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _build_response(
|
|
55
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
56
|
+
) -> Response[DiscordAuthUrlResponse | Error]:
|
|
57
|
+
return Response(
|
|
58
|
+
status_code=HTTPStatus(response.status_code),
|
|
59
|
+
content=response.content,
|
|
60
|
+
headers=response.headers,
|
|
61
|
+
parsed=_parse_response(client=client, response=response),
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def sync_detailed(
|
|
66
|
+
*,
|
|
67
|
+
client: AuthenticatedClient | Client,
|
|
68
|
+
referer: str | Unset = UNSET,
|
|
69
|
+
) -> Response[DiscordAuthUrlResponse | Error]:
|
|
70
|
+
"""(OAuth) Get Discord Login URL
|
|
71
|
+
|
|
72
|
+
Get the Discord OAuth authorization URL for login
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
referer (str | Unset): Example: http://localhost:3000.
|
|
76
|
+
|
|
77
|
+
Raises:
|
|
78
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
79
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
Response[DiscordAuthUrlResponse | Error]
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
kwargs = _get_kwargs(
|
|
86
|
+
referer=referer,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
response = client.get_httpx_client().request(
|
|
90
|
+
**kwargs,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
return _build_response(client=client, response=response)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def sync(
|
|
97
|
+
*,
|
|
98
|
+
client: AuthenticatedClient | Client,
|
|
99
|
+
referer: str | Unset = UNSET,
|
|
100
|
+
) -> DiscordAuthUrlResponse | Error | None:
|
|
101
|
+
"""(OAuth) Get Discord Login URL
|
|
102
|
+
|
|
103
|
+
Get the Discord OAuth authorization URL for login
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
referer (str | Unset): Example: http://localhost:3000.
|
|
107
|
+
|
|
108
|
+
Raises:
|
|
109
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
110
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
DiscordAuthUrlResponse | Error
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
return sync_detailed(
|
|
117
|
+
client=client,
|
|
118
|
+
referer=referer,
|
|
119
|
+
).parsed
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
async def asyncio_detailed(
|
|
123
|
+
*,
|
|
124
|
+
client: AuthenticatedClient | Client,
|
|
125
|
+
referer: str | Unset = UNSET,
|
|
126
|
+
) -> Response[DiscordAuthUrlResponse | Error]:
|
|
127
|
+
"""(OAuth) Get Discord Login URL
|
|
128
|
+
|
|
129
|
+
Get the Discord OAuth authorization URL for login
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
referer (str | Unset): Example: http://localhost:3000.
|
|
133
|
+
|
|
134
|
+
Raises:
|
|
135
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
136
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
137
|
+
|
|
138
|
+
Returns:
|
|
139
|
+
Response[DiscordAuthUrlResponse | Error]
|
|
140
|
+
"""
|
|
141
|
+
|
|
142
|
+
kwargs = _get_kwargs(
|
|
143
|
+
referer=referer,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
147
|
+
|
|
148
|
+
return _build_response(client=client, response=response)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
async def asyncio(
|
|
152
|
+
*,
|
|
153
|
+
client: AuthenticatedClient | Client,
|
|
154
|
+
referer: str | Unset = UNSET,
|
|
155
|
+
) -> DiscordAuthUrlResponse | Error | None:
|
|
156
|
+
"""(OAuth) Get Discord Login URL
|
|
157
|
+
|
|
158
|
+
Get the Discord OAuth authorization URL for login
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
referer (str | Unset): Example: http://localhost:3000.
|
|
162
|
+
|
|
163
|
+
Raises:
|
|
164
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
165
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
DiscordAuthUrlResponse | Error
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
await asyncio_detailed(
|
|
173
|
+
client=client,
|
|
174
|
+
referer=referer,
|
|
175
|
+
)
|
|
176
|
+
).parsed
|
|
@@ -0,0 +1,213 @@
|
|
|
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.error import Error
|
|
9
|
+
from ....models.login_request import LoginRequest
|
|
10
|
+
from ....models.login_response import LoginResponse
|
|
11
|
+
from ....types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: LoginRequest,
|
|
17
|
+
referer: str | Unset = UNSET,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
headers: dict[str, Any] = {}
|
|
20
|
+
if not isinstance(referer, Unset):
|
|
21
|
+
headers["Referer"] = referer
|
|
22
|
+
|
|
23
|
+
_kwargs: dict[str, Any] = {
|
|
24
|
+
"method": "post",
|
|
25
|
+
"url": "/v1/auth/login",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_kwargs["json"] = body.to_dict()
|
|
29
|
+
|
|
30
|
+
headers["Content-Type"] = "application/json"
|
|
31
|
+
|
|
32
|
+
_kwargs["headers"] = headers
|
|
33
|
+
return _kwargs
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _parse_response(
|
|
37
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
38
|
+
) -> Error | LoginResponse | None:
|
|
39
|
+
if response.status_code == 200:
|
|
40
|
+
response_200 = LoginResponse.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
return response_200
|
|
43
|
+
|
|
44
|
+
if response.status_code == 400:
|
|
45
|
+
response_400 = Error.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_400
|
|
48
|
+
|
|
49
|
+
if response.status_code == 401:
|
|
50
|
+
response_401 = Error.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_401
|
|
53
|
+
|
|
54
|
+
if response.status_code == 404:
|
|
55
|
+
response_404 = Error.from_dict(response.json())
|
|
56
|
+
|
|
57
|
+
return response_404
|
|
58
|
+
|
|
59
|
+
if response.status_code == 429:
|
|
60
|
+
response_429 = Error.from_dict(response.json())
|
|
61
|
+
|
|
62
|
+
return response_429
|
|
63
|
+
|
|
64
|
+
if response.status_code == 500:
|
|
65
|
+
response_500 = Error.from_dict(response.json())
|
|
66
|
+
|
|
67
|
+
return response_500
|
|
68
|
+
|
|
69
|
+
if client.raise_on_unexpected_status:
|
|
70
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
71
|
+
else:
|
|
72
|
+
return None
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _build_response(
|
|
76
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
77
|
+
) -> Response[Error | LoginResponse]:
|
|
78
|
+
return Response(
|
|
79
|
+
status_code=HTTPStatus(response.status_code),
|
|
80
|
+
content=response.content,
|
|
81
|
+
headers=response.headers,
|
|
82
|
+
parsed=_parse_response(client=client, response=response),
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def sync_detailed(
|
|
87
|
+
*,
|
|
88
|
+
client: AuthenticatedClient | Client,
|
|
89
|
+
body: LoginRequest,
|
|
90
|
+
referer: str | Unset = UNSET,
|
|
91
|
+
) -> Response[Error | LoginResponse]:
|
|
92
|
+
"""Login with email and password
|
|
93
|
+
|
|
94
|
+
Authenticate user with email and password. This is not offered to public users, just for internal
|
|
95
|
+
testing purposes.
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
referer (str | Unset): Example: http://localhost:3000.
|
|
99
|
+
body (LoginRequest): Login request body
|
|
100
|
+
|
|
101
|
+
Raises:
|
|
102
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
103
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
Response[Error | LoginResponse]
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
kwargs = _get_kwargs(
|
|
110
|
+
body=body,
|
|
111
|
+
referer=referer,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
response = client.get_httpx_client().request(
|
|
115
|
+
**kwargs,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
return _build_response(client=client, response=response)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def sync(
|
|
122
|
+
*,
|
|
123
|
+
client: AuthenticatedClient | Client,
|
|
124
|
+
body: LoginRequest,
|
|
125
|
+
referer: str | Unset = UNSET,
|
|
126
|
+
) -> Error | LoginResponse | None:
|
|
127
|
+
"""Login with email and password
|
|
128
|
+
|
|
129
|
+
Authenticate user with email and password. This is not offered to public users, just for internal
|
|
130
|
+
testing purposes.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
referer (str | Unset): Example: http://localhost:3000.
|
|
134
|
+
body (LoginRequest): Login request body
|
|
135
|
+
|
|
136
|
+
Raises:
|
|
137
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
138
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
Error | LoginResponse
|
|
142
|
+
"""
|
|
143
|
+
|
|
144
|
+
return sync_detailed(
|
|
145
|
+
client=client,
|
|
146
|
+
body=body,
|
|
147
|
+
referer=referer,
|
|
148
|
+
).parsed
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
async def asyncio_detailed(
|
|
152
|
+
*,
|
|
153
|
+
client: AuthenticatedClient | Client,
|
|
154
|
+
body: LoginRequest,
|
|
155
|
+
referer: str | Unset = UNSET,
|
|
156
|
+
) -> Response[Error | LoginResponse]:
|
|
157
|
+
"""Login with email and password
|
|
158
|
+
|
|
159
|
+
Authenticate user with email and password. This is not offered to public users, just for internal
|
|
160
|
+
testing purposes.
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
referer (str | Unset): Example: http://localhost:3000.
|
|
164
|
+
body (LoginRequest): Login request body
|
|
165
|
+
|
|
166
|
+
Raises:
|
|
167
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
168
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
Response[Error | LoginResponse]
|
|
172
|
+
"""
|
|
173
|
+
|
|
174
|
+
kwargs = _get_kwargs(
|
|
175
|
+
body=body,
|
|
176
|
+
referer=referer,
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
180
|
+
|
|
181
|
+
return _build_response(client=client, response=response)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
async def asyncio(
|
|
185
|
+
*,
|
|
186
|
+
client: AuthenticatedClient | Client,
|
|
187
|
+
body: LoginRequest,
|
|
188
|
+
referer: str | Unset = UNSET,
|
|
189
|
+
) -> Error | LoginResponse | None:
|
|
190
|
+
"""Login with email and password
|
|
191
|
+
|
|
192
|
+
Authenticate user with email and password. This is not offered to public users, just for internal
|
|
193
|
+
testing purposes.
|
|
194
|
+
|
|
195
|
+
Args:
|
|
196
|
+
referer (str | Unset): Example: http://localhost:3000.
|
|
197
|
+
body (LoginRequest): Login request body
|
|
198
|
+
|
|
199
|
+
Raises:
|
|
200
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
201
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
202
|
+
|
|
203
|
+
Returns:
|
|
204
|
+
Error | LoginResponse
|
|
205
|
+
"""
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
await asyncio_detailed(
|
|
209
|
+
client=client,
|
|
210
|
+
body=body,
|
|
211
|
+
referer=referer,
|
|
212
|
+
)
|
|
213
|
+
).parsed
|
|
@@ -0,0 +1,204 @@
|
|
|
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.discord_login_request import DiscordLoginRequest
|
|
9
|
+
from ....models.error import Error
|
|
10
|
+
from ....models.login_response import LoginResponse
|
|
11
|
+
from ....types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: DiscordLoginRequest,
|
|
17
|
+
referer: str | Unset = UNSET,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
headers: dict[str, Any] = {}
|
|
20
|
+
if not isinstance(referer, Unset):
|
|
21
|
+
headers["Referer"] = referer
|
|
22
|
+
|
|
23
|
+
_kwargs: dict[str, Any] = {
|
|
24
|
+
"method": "post",
|
|
25
|
+
"url": "/v1/auth/discord",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_kwargs["json"] = body.to_dict()
|
|
29
|
+
|
|
30
|
+
headers["Content-Type"] = "application/json"
|
|
31
|
+
|
|
32
|
+
_kwargs["headers"] = headers
|
|
33
|
+
return _kwargs
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _parse_response(
|
|
37
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
38
|
+
) -> Error | LoginResponse | None:
|
|
39
|
+
if response.status_code == 200:
|
|
40
|
+
response_200 = LoginResponse.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
return response_200
|
|
43
|
+
|
|
44
|
+
if response.status_code == 400:
|
|
45
|
+
response_400 = Error.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_400
|
|
48
|
+
|
|
49
|
+
if response.status_code == 409:
|
|
50
|
+
response_409 = Error.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_409
|
|
53
|
+
|
|
54
|
+
if response.status_code == 429:
|
|
55
|
+
response_429 = Error.from_dict(response.json())
|
|
56
|
+
|
|
57
|
+
return response_429
|
|
58
|
+
|
|
59
|
+
if response.status_code == 500:
|
|
60
|
+
response_500 = Error.from_dict(response.json())
|
|
61
|
+
|
|
62
|
+
return response_500
|
|
63
|
+
|
|
64
|
+
if client.raise_on_unexpected_status:
|
|
65
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
66
|
+
else:
|
|
67
|
+
return None
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _build_response(
|
|
71
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
72
|
+
) -> Response[Error | LoginResponse]:
|
|
73
|
+
return Response(
|
|
74
|
+
status_code=HTTPStatus(response.status_code),
|
|
75
|
+
content=response.content,
|
|
76
|
+
headers=response.headers,
|
|
77
|
+
parsed=_parse_response(client=client, response=response),
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def sync_detailed(
|
|
82
|
+
*,
|
|
83
|
+
client: AuthenticatedClient | Client,
|
|
84
|
+
body: DiscordLoginRequest,
|
|
85
|
+
referer: str | Unset = UNSET,
|
|
86
|
+
) -> Response[Error | LoginResponse]:
|
|
87
|
+
"""(OAuth) Login with Discord
|
|
88
|
+
|
|
89
|
+
Receive the callback from Discord OAuth2 and authenticate or register the user properly.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
referer (str | Unset): Example: http://localhost:3000.
|
|
93
|
+
body (DiscordLoginRequest): Discord OAuth Login Request
|
|
94
|
+
|
|
95
|
+
Raises:
|
|
96
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
97
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
Response[Error | LoginResponse]
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
kwargs = _get_kwargs(
|
|
104
|
+
body=body,
|
|
105
|
+
referer=referer,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
response = client.get_httpx_client().request(
|
|
109
|
+
**kwargs,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
return _build_response(client=client, response=response)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def sync(
|
|
116
|
+
*,
|
|
117
|
+
client: AuthenticatedClient | Client,
|
|
118
|
+
body: DiscordLoginRequest,
|
|
119
|
+
referer: str | Unset = UNSET,
|
|
120
|
+
) -> Error | LoginResponse | None:
|
|
121
|
+
"""(OAuth) Login with Discord
|
|
122
|
+
|
|
123
|
+
Receive the callback from Discord OAuth2 and authenticate or register the user properly.
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
referer (str | Unset): Example: http://localhost:3000.
|
|
127
|
+
body (DiscordLoginRequest): Discord OAuth Login Request
|
|
128
|
+
|
|
129
|
+
Raises:
|
|
130
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
131
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
132
|
+
|
|
133
|
+
Returns:
|
|
134
|
+
Error | LoginResponse
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
return sync_detailed(
|
|
138
|
+
client=client,
|
|
139
|
+
body=body,
|
|
140
|
+
referer=referer,
|
|
141
|
+
).parsed
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
async def asyncio_detailed(
|
|
145
|
+
*,
|
|
146
|
+
client: AuthenticatedClient | Client,
|
|
147
|
+
body: DiscordLoginRequest,
|
|
148
|
+
referer: str | Unset = UNSET,
|
|
149
|
+
) -> Response[Error | LoginResponse]:
|
|
150
|
+
"""(OAuth) Login with Discord
|
|
151
|
+
|
|
152
|
+
Receive the callback from Discord OAuth2 and authenticate or register the user properly.
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
referer (str | Unset): Example: http://localhost:3000.
|
|
156
|
+
body (DiscordLoginRequest): Discord OAuth Login Request
|
|
157
|
+
|
|
158
|
+
Raises:
|
|
159
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
160
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
161
|
+
|
|
162
|
+
Returns:
|
|
163
|
+
Response[Error | LoginResponse]
|
|
164
|
+
"""
|
|
165
|
+
|
|
166
|
+
kwargs = _get_kwargs(
|
|
167
|
+
body=body,
|
|
168
|
+
referer=referer,
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
172
|
+
|
|
173
|
+
return _build_response(client=client, response=response)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
async def asyncio(
|
|
177
|
+
*,
|
|
178
|
+
client: AuthenticatedClient | Client,
|
|
179
|
+
body: DiscordLoginRequest,
|
|
180
|
+
referer: str | Unset = UNSET,
|
|
181
|
+
) -> Error | LoginResponse | None:
|
|
182
|
+
"""(OAuth) Login with Discord
|
|
183
|
+
|
|
184
|
+
Receive the callback from Discord OAuth2 and authenticate or register the user properly.
|
|
185
|
+
|
|
186
|
+
Args:
|
|
187
|
+
referer (str | Unset): Example: http://localhost:3000.
|
|
188
|
+
body (DiscordLoginRequest): Discord OAuth Login Request
|
|
189
|
+
|
|
190
|
+
Raises:
|
|
191
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
192
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
193
|
+
|
|
194
|
+
Returns:
|
|
195
|
+
Error | LoginResponse
|
|
196
|
+
"""
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
await asyncio_detailed(
|
|
200
|
+
client=client,
|
|
201
|
+
body=body,
|
|
202
|
+
referer=referer,
|
|
203
|
+
)
|
|
204
|
+
).parsed
|