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
|
@@ -0,0 +1,238 @@
|
|
|
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.search_multiple_request import SearchMultipleRequest
|
|
10
|
+
from ...models.search_multiple_response import SearchMultipleResponse
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: SearchMultipleRequest,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/v1/search/media/match/words",
|
|
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(
|
|
34
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
35
|
+
) -> Error | SearchMultipleResponse | None:
|
|
36
|
+
if response.status_code == 200:
|
|
37
|
+
response_200 = SearchMultipleResponse.from_dict(response.json())
|
|
38
|
+
|
|
39
|
+
return response_200
|
|
40
|
+
|
|
41
|
+
if response.status_code == 400:
|
|
42
|
+
response_400 = Error.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_400
|
|
45
|
+
|
|
46
|
+
if response.status_code == 401:
|
|
47
|
+
response_401 = Error.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
return response_401
|
|
50
|
+
|
|
51
|
+
if response.status_code == 403:
|
|
52
|
+
response_403 = Error.from_dict(response.json())
|
|
53
|
+
|
|
54
|
+
return response_403
|
|
55
|
+
|
|
56
|
+
if response.status_code == 429:
|
|
57
|
+
response_429 = Error.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
return response_429
|
|
60
|
+
|
|
61
|
+
if response.status_code == 500:
|
|
62
|
+
response_500 = Error.from_dict(response.json())
|
|
63
|
+
|
|
64
|
+
return response_500
|
|
65
|
+
|
|
66
|
+
if client.raise_on_unexpected_status:
|
|
67
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
68
|
+
else:
|
|
69
|
+
return None
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _build_response(
|
|
73
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
74
|
+
) -> Response[Error | SearchMultipleResponse]:
|
|
75
|
+
return Response(
|
|
76
|
+
status_code=HTTPStatus(response.status_code),
|
|
77
|
+
content=response.content,
|
|
78
|
+
headers=response.headers,
|
|
79
|
+
parsed=_parse_response(client=client, response=response),
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def sync_detailed(
|
|
84
|
+
*,
|
|
85
|
+
client: AuthenticatedClient | Client,
|
|
86
|
+
body: SearchMultipleRequest,
|
|
87
|
+
) -> Response[Error | SearchMultipleResponse]:
|
|
88
|
+
"""Search by multiple queries
|
|
89
|
+
|
|
90
|
+
Searches for multiple words simultaneously and aggregates results by media.
|
|
91
|
+
|
|
92
|
+
Unlike the main search endpoint, this returns a summary of matches per media rather than individual
|
|
93
|
+
sentence segments.
|
|
94
|
+
|
|
95
|
+
**Use Cases**
|
|
96
|
+
- Vocabulary discovery across media library
|
|
97
|
+
- Finding anime/dramas that use specific words
|
|
98
|
+
- Comparing word usage across different titles
|
|
99
|
+
|
|
100
|
+
**Requirements:**
|
|
101
|
+
- Required Scopes: `READ_MEDIA`
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
body (SearchMultipleRequest):
|
|
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[Error | SearchMultipleResponse]
|
|
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 | Client,
|
|
128
|
+
body: SearchMultipleRequest,
|
|
129
|
+
) -> Error | SearchMultipleResponse | None:
|
|
130
|
+
"""Search by multiple queries
|
|
131
|
+
|
|
132
|
+
Searches for multiple words simultaneously and aggregates results by media.
|
|
133
|
+
|
|
134
|
+
Unlike the main search endpoint, this returns a summary of matches per media rather than individual
|
|
135
|
+
sentence segments.
|
|
136
|
+
|
|
137
|
+
**Use Cases**
|
|
138
|
+
- Vocabulary discovery across media library
|
|
139
|
+
- Finding anime/dramas that use specific words
|
|
140
|
+
- Comparing word usage across different titles
|
|
141
|
+
|
|
142
|
+
**Requirements:**
|
|
143
|
+
- Required Scopes: `READ_MEDIA`
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
body (SearchMultipleRequest):
|
|
147
|
+
|
|
148
|
+
Raises:
|
|
149
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
150
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
151
|
+
|
|
152
|
+
Returns:
|
|
153
|
+
Error | SearchMultipleResponse
|
|
154
|
+
"""
|
|
155
|
+
|
|
156
|
+
return sync_detailed(
|
|
157
|
+
client=client,
|
|
158
|
+
body=body,
|
|
159
|
+
).parsed
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
async def asyncio_detailed(
|
|
163
|
+
*,
|
|
164
|
+
client: AuthenticatedClient | Client,
|
|
165
|
+
body: SearchMultipleRequest,
|
|
166
|
+
) -> Response[Error | SearchMultipleResponse]:
|
|
167
|
+
"""Search by multiple queries
|
|
168
|
+
|
|
169
|
+
Searches for multiple words simultaneously and aggregates results by media.
|
|
170
|
+
|
|
171
|
+
Unlike the main search endpoint, this returns a summary of matches per media rather than individual
|
|
172
|
+
sentence segments.
|
|
173
|
+
|
|
174
|
+
**Use Cases**
|
|
175
|
+
- Vocabulary discovery across media library
|
|
176
|
+
- Finding anime/dramas that use specific words
|
|
177
|
+
- Comparing word usage across different titles
|
|
178
|
+
|
|
179
|
+
**Requirements:**
|
|
180
|
+
- Required Scopes: `READ_MEDIA`
|
|
181
|
+
|
|
182
|
+
Args:
|
|
183
|
+
body (SearchMultipleRequest):
|
|
184
|
+
|
|
185
|
+
Raises:
|
|
186
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
187
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
188
|
+
|
|
189
|
+
Returns:
|
|
190
|
+
Response[Error | SearchMultipleResponse]
|
|
191
|
+
"""
|
|
192
|
+
|
|
193
|
+
kwargs = _get_kwargs(
|
|
194
|
+
body=body,
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
198
|
+
|
|
199
|
+
return _build_response(client=client, response=response)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
async def asyncio(
|
|
203
|
+
*,
|
|
204
|
+
client: AuthenticatedClient | Client,
|
|
205
|
+
body: SearchMultipleRequest,
|
|
206
|
+
) -> Error | SearchMultipleResponse | None:
|
|
207
|
+
"""Search by multiple queries
|
|
208
|
+
|
|
209
|
+
Searches for multiple words simultaneously and aggregates results by media.
|
|
210
|
+
|
|
211
|
+
Unlike the main search endpoint, this returns a summary of matches per media rather than individual
|
|
212
|
+
sentence segments.
|
|
213
|
+
|
|
214
|
+
**Use Cases**
|
|
215
|
+
- Vocabulary discovery across media library
|
|
216
|
+
- Finding anime/dramas that use specific words
|
|
217
|
+
- Comparing word usage across different titles
|
|
218
|
+
|
|
219
|
+
**Requirements:**
|
|
220
|
+
- Required Scopes: `READ_MEDIA`
|
|
221
|
+
|
|
222
|
+
Args:
|
|
223
|
+
body (SearchMultipleRequest):
|
|
224
|
+
|
|
225
|
+
Raises:
|
|
226
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
227
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
228
|
+
|
|
229
|
+
Returns:
|
|
230
|
+
Error | SearchMultipleResponse
|
|
231
|
+
"""
|
|
232
|
+
|
|
233
|
+
return (
|
|
234
|
+
await asyncio_detailed(
|
|
235
|
+
client=client,
|
|
236
|
+
body=body,
|
|
237
|
+
)
|
|
238
|
+
).parsed
|
|
@@ -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 create_api_key
|
|
8
|
+
from . import deactivate_api_key
|
|
9
|
+
from . import get_api_keys
|
|
10
|
+
from . import get_identity_me
|
|
11
|
+
from . import get_user_info
|
|
@@ -0,0 +1,199 @@
|
|
|
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_api_key_request import CreateApiKeyRequest
|
|
9
|
+
from ....models.create_api_key_response import CreateApiKeyResponse
|
|
10
|
+
from ....models.error import Error
|
|
11
|
+
from ....types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: CreateApiKeyRequest,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/v1/user/createApiKey",
|
|
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(
|
|
34
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
35
|
+
) -> CreateApiKeyResponse | Error | None:
|
|
36
|
+
if response.status_code == 201:
|
|
37
|
+
response_201 = CreateApiKeyResponse.from_dict(response.json())
|
|
38
|
+
|
|
39
|
+
return response_201
|
|
40
|
+
|
|
41
|
+
if response.status_code == 400:
|
|
42
|
+
response_400 = Error.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_400
|
|
45
|
+
|
|
46
|
+
if response.status_code == 401:
|
|
47
|
+
response_401 = Error.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
return response_401
|
|
50
|
+
|
|
51
|
+
if response.status_code == 403:
|
|
52
|
+
response_403 = Error.from_dict(response.json())
|
|
53
|
+
|
|
54
|
+
return response_403
|
|
55
|
+
|
|
56
|
+
if response.status_code == 404:
|
|
57
|
+
response_404 = Error.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
return response_404
|
|
60
|
+
|
|
61
|
+
if response.status_code == 429:
|
|
62
|
+
response_429 = Error.from_dict(response.json())
|
|
63
|
+
|
|
64
|
+
return response_429
|
|
65
|
+
|
|
66
|
+
if response.status_code == 500:
|
|
67
|
+
response_500 = Error.from_dict(response.json())
|
|
68
|
+
|
|
69
|
+
return response_500
|
|
70
|
+
|
|
71
|
+
if client.raise_on_unexpected_status:
|
|
72
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
73
|
+
else:
|
|
74
|
+
return None
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _build_response(
|
|
78
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
79
|
+
) -> Response[CreateApiKeyResponse | Error]:
|
|
80
|
+
return Response(
|
|
81
|
+
status_code=HTTPStatus(response.status_code),
|
|
82
|
+
content=response.content,
|
|
83
|
+
headers=response.headers,
|
|
84
|
+
parsed=_parse_response(client=client, response=response),
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def sync_detailed(
|
|
89
|
+
*,
|
|
90
|
+
client: AuthenticatedClient,
|
|
91
|
+
body: CreateApiKeyRequest,
|
|
92
|
+
) -> Response[CreateApiKeyResponse | Error]:
|
|
93
|
+
"""Create API key
|
|
94
|
+
|
|
95
|
+
Create a new API key for the authenticated user
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
body (CreateApiKeyRequest): Create API key request
|
|
99
|
+
|
|
100
|
+
Raises:
|
|
101
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
102
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
Response[CreateApiKeyResponse | Error]
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
kwargs = _get_kwargs(
|
|
109
|
+
body=body,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
response = client.get_httpx_client().request(
|
|
113
|
+
**kwargs,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
return _build_response(client=client, response=response)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def sync(
|
|
120
|
+
*,
|
|
121
|
+
client: AuthenticatedClient,
|
|
122
|
+
body: CreateApiKeyRequest,
|
|
123
|
+
) -> CreateApiKeyResponse | Error | None:
|
|
124
|
+
"""Create API key
|
|
125
|
+
|
|
126
|
+
Create a new API key for the authenticated user
|
|
127
|
+
|
|
128
|
+
Args:
|
|
129
|
+
body (CreateApiKeyRequest): Create API key request
|
|
130
|
+
|
|
131
|
+
Raises:
|
|
132
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
133
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
CreateApiKeyResponse | Error
|
|
137
|
+
"""
|
|
138
|
+
|
|
139
|
+
return sync_detailed(
|
|
140
|
+
client=client,
|
|
141
|
+
body=body,
|
|
142
|
+
).parsed
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
async def asyncio_detailed(
|
|
146
|
+
*,
|
|
147
|
+
client: AuthenticatedClient,
|
|
148
|
+
body: CreateApiKeyRequest,
|
|
149
|
+
) -> Response[CreateApiKeyResponse | Error]:
|
|
150
|
+
"""Create API key
|
|
151
|
+
|
|
152
|
+
Create a new API key for the authenticated user
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
body (CreateApiKeyRequest): Create API key request
|
|
156
|
+
|
|
157
|
+
Raises:
|
|
158
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
159
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
Response[CreateApiKeyResponse | Error]
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
kwargs = _get_kwargs(
|
|
166
|
+
body=body,
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
170
|
+
|
|
171
|
+
return _build_response(client=client, response=response)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
async def asyncio(
|
|
175
|
+
*,
|
|
176
|
+
client: AuthenticatedClient,
|
|
177
|
+
body: CreateApiKeyRequest,
|
|
178
|
+
) -> CreateApiKeyResponse | Error | None:
|
|
179
|
+
"""Create API key
|
|
180
|
+
|
|
181
|
+
Create a new API key for the authenticated user
|
|
182
|
+
|
|
183
|
+
Args:
|
|
184
|
+
body (CreateApiKeyRequest): Create API key request
|
|
185
|
+
|
|
186
|
+
Raises:
|
|
187
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
188
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
189
|
+
|
|
190
|
+
Returns:
|
|
191
|
+
CreateApiKeyResponse | Error
|
|
192
|
+
"""
|
|
193
|
+
|
|
194
|
+
return (
|
|
195
|
+
await asyncio_detailed(
|
|
196
|
+
client=client,
|
|
197
|
+
body=body,
|
|
198
|
+
)
|
|
199
|
+
).parsed
|
|
@@ -0,0 +1,194 @@
|
|
|
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.deactivate_api_key_request import DeactivateApiKeyRequest
|
|
9
|
+
from ....models.deactivate_api_key_response import DeactivateApiKeyResponse
|
|
10
|
+
from ....models.error import Error
|
|
11
|
+
from ....types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: DeactivateApiKeyRequest,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/v1/user/deactivateApiKey",
|
|
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(
|
|
34
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
35
|
+
) -> DeactivateApiKeyResponse | Error | None:
|
|
36
|
+
if response.status_code == 200:
|
|
37
|
+
response_200 = DeactivateApiKeyResponse.from_dict(response.json())
|
|
38
|
+
|
|
39
|
+
return response_200
|
|
40
|
+
|
|
41
|
+
if response.status_code == 400:
|
|
42
|
+
response_400 = Error.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_400
|
|
45
|
+
|
|
46
|
+
if response.status_code == 401:
|
|
47
|
+
response_401 = Error.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
return response_401
|
|
50
|
+
|
|
51
|
+
if response.status_code == 404:
|
|
52
|
+
response_404 = Error.from_dict(response.json())
|
|
53
|
+
|
|
54
|
+
return response_404
|
|
55
|
+
|
|
56
|
+
if response.status_code == 429:
|
|
57
|
+
response_429 = Error.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
return response_429
|
|
60
|
+
|
|
61
|
+
if response.status_code == 500:
|
|
62
|
+
response_500 = Error.from_dict(response.json())
|
|
63
|
+
|
|
64
|
+
return response_500
|
|
65
|
+
|
|
66
|
+
if client.raise_on_unexpected_status:
|
|
67
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
68
|
+
else:
|
|
69
|
+
return None
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _build_response(
|
|
73
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
74
|
+
) -> Response[DeactivateApiKeyResponse | Error]:
|
|
75
|
+
return Response(
|
|
76
|
+
status_code=HTTPStatus(response.status_code),
|
|
77
|
+
content=response.content,
|
|
78
|
+
headers=response.headers,
|
|
79
|
+
parsed=_parse_response(client=client, response=response),
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def sync_detailed(
|
|
84
|
+
*,
|
|
85
|
+
client: AuthenticatedClient,
|
|
86
|
+
body: DeactivateApiKeyRequest,
|
|
87
|
+
) -> Response[DeactivateApiKeyResponse | Error]:
|
|
88
|
+
"""Deactivate API key
|
|
89
|
+
|
|
90
|
+
Deactivate an API key for the authenticated user
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
body (DeactivateApiKeyRequest): Deactivate API key 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[DeactivateApiKeyResponse | Error]
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
kwargs = _get_kwargs(
|
|
104
|
+
body=body,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
response = client.get_httpx_client().request(
|
|
108
|
+
**kwargs,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
return _build_response(client=client, response=response)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def sync(
|
|
115
|
+
*,
|
|
116
|
+
client: AuthenticatedClient,
|
|
117
|
+
body: DeactivateApiKeyRequest,
|
|
118
|
+
) -> DeactivateApiKeyResponse | Error | None:
|
|
119
|
+
"""Deactivate API key
|
|
120
|
+
|
|
121
|
+
Deactivate an API key for the authenticated user
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
body (DeactivateApiKeyRequest): Deactivate API key request
|
|
125
|
+
|
|
126
|
+
Raises:
|
|
127
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
128
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
DeactivateApiKeyResponse | Error
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
return sync_detailed(
|
|
135
|
+
client=client,
|
|
136
|
+
body=body,
|
|
137
|
+
).parsed
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
async def asyncio_detailed(
|
|
141
|
+
*,
|
|
142
|
+
client: AuthenticatedClient,
|
|
143
|
+
body: DeactivateApiKeyRequest,
|
|
144
|
+
) -> Response[DeactivateApiKeyResponse | Error]:
|
|
145
|
+
"""Deactivate API key
|
|
146
|
+
|
|
147
|
+
Deactivate an API key for the authenticated user
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
body (DeactivateApiKeyRequest): Deactivate API key request
|
|
151
|
+
|
|
152
|
+
Raises:
|
|
153
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
154
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
155
|
+
|
|
156
|
+
Returns:
|
|
157
|
+
Response[DeactivateApiKeyResponse | Error]
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
kwargs = _get_kwargs(
|
|
161
|
+
body=body,
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
165
|
+
|
|
166
|
+
return _build_response(client=client, response=response)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
async def asyncio(
|
|
170
|
+
*,
|
|
171
|
+
client: AuthenticatedClient,
|
|
172
|
+
body: DeactivateApiKeyRequest,
|
|
173
|
+
) -> DeactivateApiKeyResponse | Error | None:
|
|
174
|
+
"""Deactivate API key
|
|
175
|
+
|
|
176
|
+
Deactivate an API key for the authenticated user
|
|
177
|
+
|
|
178
|
+
Args:
|
|
179
|
+
body (DeactivateApiKeyRequest): Deactivate API key request
|
|
180
|
+
|
|
181
|
+
Raises:
|
|
182
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
183
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
184
|
+
|
|
185
|
+
Returns:
|
|
186
|
+
DeactivateApiKeyResponse | Error
|
|
187
|
+
"""
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
await asyncio_detailed(
|
|
191
|
+
client=client,
|
|
192
|
+
body=body,
|
|
193
|
+
)
|
|
194
|
+
).parsed
|