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.
Files changed (167) hide show
  1. nadeshiko/__init__.py +10 -0
  2. nadeshiko/_version.py +1 -0
  3. nadeshiko/api/__init__.py +1 -0
  4. nadeshiko/api/auth/__init__.py +3 -0
  5. nadeshiko/api/auth/internal/__init__.py +11 -0
  6. nadeshiko/api/auth/internal/get_discord_auth_url.py +176 -0
  7. nadeshiko/api/auth/internal/login.py +213 -0
  8. nadeshiko/api/auth/internal/login_discord.py +204 -0
  9. nadeshiko/api/auth/internal/login_google.py +204 -0
  10. nadeshiko/api/auth/internal/register.py +212 -0
  11. nadeshiko/api/auth_jwt/__init__.py +3 -0
  12. nadeshiko/api/auth_jwt/internal/__init__.py +7 -0
  13. nadeshiko/api/auth_jwt/internal/logout.py +151 -0
  14. nadeshiko/api/lists/__init__.py +8 -0
  15. nadeshiko/api/lists/internal/__init__.py +12 -0
  16. nadeshiko/api/lists/internal/list_add_item.py +215 -0
  17. nadeshiko/api/lists/internal/list_create.py +194 -0
  18. nadeshiko/api/lists/internal/list_destroy.py +193 -0
  19. nadeshiko/api/lists/internal/list_remove_item.py +207 -0
  20. nadeshiko/api/lists/internal/list_update.py +215 -0
  21. nadeshiko/api/lists/internal/list_update_item.py +229 -0
  22. nadeshiko/api/lists/list_index.py +257 -0
  23. nadeshiko/api/lists/list_show.py +193 -0
  24. nadeshiko/api/media/__init__.py +14 -0
  25. nadeshiko/api/media/character_show.py +193 -0
  26. nadeshiko/api/media/episode_index.py +229 -0
  27. nadeshiko/api/media/episode_show.py +207 -0
  28. nadeshiko/api/media/internal/__init__.py +16 -0
  29. nadeshiko/api/media/internal/episode_create.py +215 -0
  30. nadeshiko/api/media/internal/episode_destroy.py +205 -0
  31. nadeshiko/api/media/internal/episode_update.py +229 -0
  32. nadeshiko/api/media/internal/media_create.py +194 -0
  33. nadeshiko/api/media/internal/media_destroy.py +197 -0
  34. nadeshiko/api/media/internal/media_update.py +219 -0
  35. nadeshiko/api/media/internal/segment_create.py +229 -0
  36. nadeshiko/api/media/internal/segment_destroy.py +219 -0
  37. nadeshiko/api/media/internal/segment_index.py +243 -0
  38. nadeshiko/api/media/internal/segment_update.py +243 -0
  39. nadeshiko/api/media/media_index.py +232 -0
  40. nadeshiko/api/media/media_show.py +193 -0
  41. nadeshiko/api/media/segment_show.py +221 -0
  42. nadeshiko/api/media/segment_show_by_uuid.py +193 -0
  43. nadeshiko/api/media/seiyuu_show.py +193 -0
  44. nadeshiko/api/search/__init__.py +11 -0
  45. nadeshiko/api/search/fetch_media_info.py +278 -0
  46. nadeshiko/api/search/fetch_sentence_context.py +219 -0
  47. nadeshiko/api/search/internal/__init__.py +6 -0
  48. nadeshiko/api/search/search.py +295 -0
  49. nadeshiko/api/search/search_health_check.py +168 -0
  50. nadeshiko/api/search/search_multiple.py +238 -0
  51. nadeshiko/api/user/__init__.py +3 -0
  52. nadeshiko/api/user/internal/__init__.py +11 -0
  53. nadeshiko/api/user/internal/create_api_key.py +199 -0
  54. nadeshiko/api/user/internal/deactivate_api_key.py +194 -0
  55. nadeshiko/api/user/internal/get_api_keys.py +151 -0
  56. nadeshiko/api/user/internal/get_identity_me.py +156 -0
  57. nadeshiko/api/user/internal/get_user_info.py +156 -0
  58. nadeshiko/client.py +138 -0
  59. nadeshiko/errors.py +16 -0
  60. nadeshiko/models/__init__.py +215 -0
  61. nadeshiko/models/api_key.py +118 -0
  62. nadeshiko/models/api_key_permission.py +70 -0
  63. nadeshiko/models/auth_user.py +107 -0
  64. nadeshiko/models/basic_info.py +132 -0
  65. nadeshiko/models/category_statistic.py +71 -0
  66. nadeshiko/models/character.py +100 -0
  67. nadeshiko/models/character_input.py +130 -0
  68. nadeshiko/models/character_input_character_role.py +10 -0
  69. nadeshiko/models/character_with_media.py +124 -0
  70. nadeshiko/models/character_with_media_media_appearances_item.py +93 -0
  71. nadeshiko/models/character_with_media_media_appearances_item_role.py +10 -0
  72. nadeshiko/models/create_api_key_request.py +75 -0
  73. nadeshiko/models/create_api_key_response.py +70 -0
  74. nadeshiko/models/deactivate_api_key_request.py +62 -0
  75. nadeshiko/models/deactivate_api_key_response.py +62 -0
  76. nadeshiko/models/discord_auth_url_response.py +62 -0
  77. nadeshiko/models/discord_login_request.py +62 -0
  78. nadeshiko/models/episode.py +253 -0
  79. nadeshiko/models/episode_create_request.py +145 -0
  80. nadeshiko/models/episode_list_response.py +94 -0
  81. nadeshiko/models/episode_update_request.py +135 -0
  82. nadeshiko/models/error.py +128 -0
  83. nadeshiko/models/error_errors.py +46 -0
  84. nadeshiko/models/fetch_media_info_response.py +115 -0
  85. nadeshiko/models/fetch_media_info_type.py +10 -0
  86. nadeshiko/models/fetch_sentence_context_request.py +96 -0
  87. nadeshiko/models/fetch_sentence_context_response.py +75 -0
  88. nadeshiko/models/get_api_keys_response.py +86 -0
  89. nadeshiko/models/google_login_request.py +62 -0
  90. nadeshiko/models/list_.py +97 -0
  91. nadeshiko/models/list_add_item_body.py +69 -0
  92. nadeshiko/models/list_add_item_response_201.py +61 -0
  93. nadeshiko/models/list_create_request.py +107 -0
  94. nadeshiko/models/list_create_request_type.py +9 -0
  95. nadeshiko/models/list_create_request_visibility.py +9 -0
  96. nadeshiko/models/list_destroy_response_200.py +70 -0
  97. nadeshiko/models/list_index_type.py +9 -0
  98. nadeshiko/models/list_index_visibility.py +9 -0
  99. nadeshiko/models/list_input.py +138 -0
  100. nadeshiko/models/list_input_list_type.py +9 -0
  101. nadeshiko/models/list_input_list_visibility.py +9 -0
  102. nadeshiko/models/list_remove_item_response_200.py +61 -0
  103. nadeshiko/models/list_type.py +9 -0
  104. nadeshiko/models/list_update_body.py +78 -0
  105. nadeshiko/models/list_update_body_visibility.py +9 -0
  106. nadeshiko/models/list_update_item_body.py +61 -0
  107. nadeshiko/models/list_update_item_response_200.py +61 -0
  108. nadeshiko/models/list_visibility.py +9 -0
  109. nadeshiko/models/list_with_media.py +119 -0
  110. nadeshiko/models/list_with_media_media_item.py +83 -0
  111. nadeshiko/models/list_with_media_type.py +9 -0
  112. nadeshiko/models/list_with_media_visibility.py +9 -0
  113. nadeshiko/models/login_request.py +70 -0
  114. nadeshiko/models/login_response.py +84 -0
  115. nadeshiko/models/logout_response.py +73 -0
  116. nadeshiko/models/media.py +288 -0
  117. nadeshiko/models/media_category.py +11 -0
  118. nadeshiko/models/media_character.py +78 -0
  119. nadeshiko/models/media_character_role.py +10 -0
  120. nadeshiko/models/media_create_request.py +270 -0
  121. nadeshiko/models/media_create_request_category.py +11 -0
  122. nadeshiko/models/media_destroy_response_200.py +70 -0
  123. nadeshiko/models/media_index_category.py +9 -0
  124. nadeshiko/models/media_info_data.py +307 -0
  125. nadeshiko/models/media_info_path.py +83 -0
  126. nadeshiko/models/media_info_stats.py +89 -0
  127. nadeshiko/models/media_list_response.py +94 -0
  128. nadeshiko/models/media_update_request.py +297 -0
  129. nadeshiko/models/media_update_request_category.py +9 -0
  130. nadeshiko/models/quota_info.py +87 -0
  131. nadeshiko/models/quota_info_quota_limit_type_1.py +8 -0
  132. nadeshiko/models/register_request.py +78 -0
  133. nadeshiko/models/register_response.py +76 -0
  134. nadeshiko/models/register_response_user.py +46 -0
  135. nadeshiko/models/search_health_check_response.py +138 -0
  136. nadeshiko/models/search_multiple_request.py +72 -0
  137. nadeshiko/models/search_multiple_response.py +79 -0
  138. nadeshiko/models/search_request.py +253 -0
  139. nadeshiko/models/search_request_content_sort.py +13 -0
  140. nadeshiko/models/search_request_media_item.py +85 -0
  141. nadeshiko/models/search_request_media_item_seasons_item.py +69 -0
  142. nadeshiko/models/search_response.py +158 -0
  143. nadeshiko/models/segment.py +303 -0
  144. nadeshiko/models/segment_create_request.py +203 -0
  145. nadeshiko/models/segment_create_request_status.py +13 -0
  146. nadeshiko/models/segment_info.py +207 -0
  147. nadeshiko/models/segment_list_response.py +94 -0
  148. nadeshiko/models/segment_status.py +13 -0
  149. nadeshiko/models/segment_update_request.py +198 -0
  150. nadeshiko/models/segment_update_request_status.py +13 -0
  151. nadeshiko/models/seiyuu.py +86 -0
  152. nadeshiko/models/seiyuu_with_roles.py +108 -0
  153. nadeshiko/models/seiyuu_with_roles_roles_item.py +109 -0
  154. nadeshiko/models/seiyuu_with_roles_roles_item_role.py +10 -0
  155. nadeshiko/models/sentence.py +88 -0
  156. nadeshiko/models/statistic.py +132 -0
  157. nadeshiko/models/statistic_season_with_episode_hits.py +74 -0
  158. nadeshiko/models/statistic_season_with_episode_hits_additional_property.py +46 -0
  159. nadeshiko/models/user_info_response.py +79 -0
  160. nadeshiko/models/user_info_response_user.py +91 -0
  161. nadeshiko/models/user_role.py +71 -0
  162. nadeshiko/models/word_match.py +107 -0
  163. nadeshiko/models/word_match_media.py +98 -0
  164. nadeshiko/types.py +54 -0
  165. nadeshiko_sdk-0.1.0.dist-info/METADATA +147 -0
  166. nadeshiko_sdk-0.1.0.dist-info/RECORD +167 -0
  167. nadeshiko_sdk-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,257 @@
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.list_ import List
10
+ from ...models.list_index_type import ListIndexType
11
+ from ...models.list_index_visibility import ListIndexVisibility
12
+ from ...types import UNSET, Response, Unset
13
+
14
+
15
+ def _get_kwargs(
16
+ *,
17
+ visibility: ListIndexVisibility | Unset = UNSET,
18
+ type_: ListIndexType | Unset = UNSET,
19
+ user_id: int | Unset = UNSET,
20
+ media_id: int | Unset = UNSET,
21
+ ) -> dict[str, Any]:
22
+ params: dict[str, Any] = {}
23
+
24
+ json_visibility: str | Unset = UNSET
25
+ if not isinstance(visibility, Unset):
26
+ json_visibility = visibility.value
27
+
28
+ params["visibility"] = json_visibility
29
+
30
+ json_type_: str | Unset = UNSET
31
+ if not isinstance(type_, Unset):
32
+ json_type_ = type_.value
33
+
34
+ params["type"] = json_type_
35
+
36
+ params["userId"] = user_id
37
+
38
+ params["mediaId"] = media_id
39
+
40
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
41
+
42
+ _kwargs: dict[str, Any] = {
43
+ "method": "get",
44
+ "url": "/v1/lists",
45
+ "params": params,
46
+ }
47
+
48
+ return _kwargs
49
+
50
+
51
+ def _parse_response(
52
+ *, client: AuthenticatedClient | Client, response: httpx.Response
53
+ ) -> Error | list[List] | None:
54
+ if response.status_code == 200:
55
+ response_200 = []
56
+ _response_200 = response.json()
57
+ for response_200_item_data in _response_200:
58
+ response_200_item = List.from_dict(response_200_item_data)
59
+
60
+ response_200.append(response_200_item)
61
+
62
+ return response_200
63
+
64
+ if response.status_code == 400:
65
+ response_400 = Error.from_dict(response.json())
66
+
67
+ return response_400
68
+
69
+ if response.status_code == 401:
70
+ response_401 = Error.from_dict(response.json())
71
+
72
+ return response_401
73
+
74
+ if response.status_code == 403:
75
+ response_403 = Error.from_dict(response.json())
76
+
77
+ return response_403
78
+
79
+ if response.status_code == 429:
80
+ response_429 = Error.from_dict(response.json())
81
+
82
+ return response_429
83
+
84
+ if response.status_code == 500:
85
+ response_500 = Error.from_dict(response.json())
86
+
87
+ return response_500
88
+
89
+ if client.raise_on_unexpected_status:
90
+ raise errors.UnexpectedStatus(response.status_code, response.content)
91
+ else:
92
+ return None
93
+
94
+
95
+ def _build_response(
96
+ *, client: AuthenticatedClient | Client, response: httpx.Response
97
+ ) -> Response[Error | list[List]]:
98
+ return Response(
99
+ status_code=HTTPStatus(response.status_code),
100
+ content=response.content,
101
+ headers=response.headers,
102
+ parsed=_parse_response(client=client, response=response),
103
+ )
104
+
105
+
106
+ def sync_detailed(
107
+ *,
108
+ client: AuthenticatedClient,
109
+ visibility: ListIndexVisibility | Unset = UNSET,
110
+ type_: ListIndexType | Unset = UNSET,
111
+ user_id: int | Unset = UNSET,
112
+ media_id: int | Unset = UNSET,
113
+ ) -> Response[Error | list[List]]:
114
+ """List all lists
115
+
116
+ Returns all lists matching the query filters. Can filter by media ID to find lists containing a
117
+ specific media. Public lists are visible to all users.
118
+
119
+ Args:
120
+ visibility (ListIndexVisibility | Unset): Example: public.
121
+ type_ (ListIndexType | Unset): Example: SERIES.
122
+ user_id (int | Unset): Example: 1.
123
+ media_id (int | Unset): Example: 12345.
124
+
125
+ Raises:
126
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
128
+
129
+ Returns:
130
+ Response[Error | list[List]]
131
+ """
132
+
133
+ kwargs = _get_kwargs(
134
+ visibility=visibility,
135
+ type_=type_,
136
+ user_id=user_id,
137
+ media_id=media_id,
138
+ )
139
+
140
+ response = client.get_httpx_client().request(
141
+ **kwargs,
142
+ )
143
+
144
+ return _build_response(client=client, response=response)
145
+
146
+
147
+ def sync(
148
+ *,
149
+ client: AuthenticatedClient,
150
+ visibility: ListIndexVisibility | Unset = UNSET,
151
+ type_: ListIndexType | Unset = UNSET,
152
+ user_id: int | Unset = UNSET,
153
+ media_id: int | Unset = UNSET,
154
+ ) -> Error | list[List] | None:
155
+ """List all lists
156
+
157
+ Returns all lists matching the query filters. Can filter by media ID to find lists containing a
158
+ specific media. Public lists are visible to all users.
159
+
160
+ Args:
161
+ visibility (ListIndexVisibility | Unset): Example: public.
162
+ type_ (ListIndexType | Unset): Example: SERIES.
163
+ user_id (int | Unset): Example: 1.
164
+ media_id (int | Unset): Example: 12345.
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
+ Error | list[List]
172
+ """
173
+
174
+ return sync_detailed(
175
+ client=client,
176
+ visibility=visibility,
177
+ type_=type_,
178
+ user_id=user_id,
179
+ media_id=media_id,
180
+ ).parsed
181
+
182
+
183
+ async def asyncio_detailed(
184
+ *,
185
+ client: AuthenticatedClient,
186
+ visibility: ListIndexVisibility | Unset = UNSET,
187
+ type_: ListIndexType | Unset = UNSET,
188
+ user_id: int | Unset = UNSET,
189
+ media_id: int | Unset = UNSET,
190
+ ) -> Response[Error | list[List]]:
191
+ """List all lists
192
+
193
+ Returns all lists matching the query filters. Can filter by media ID to find lists containing a
194
+ specific media. Public lists are visible to all users.
195
+
196
+ Args:
197
+ visibility (ListIndexVisibility | Unset): Example: public.
198
+ type_ (ListIndexType | Unset): Example: SERIES.
199
+ user_id (int | Unset): Example: 1.
200
+ media_id (int | Unset): Example: 12345.
201
+
202
+ Raises:
203
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
204
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
205
+
206
+ Returns:
207
+ Response[Error | list[List]]
208
+ """
209
+
210
+ kwargs = _get_kwargs(
211
+ visibility=visibility,
212
+ type_=type_,
213
+ user_id=user_id,
214
+ media_id=media_id,
215
+ )
216
+
217
+ response = await client.get_async_httpx_client().request(**kwargs)
218
+
219
+ return _build_response(client=client, response=response)
220
+
221
+
222
+ async def asyncio(
223
+ *,
224
+ client: AuthenticatedClient,
225
+ visibility: ListIndexVisibility | Unset = UNSET,
226
+ type_: ListIndexType | Unset = UNSET,
227
+ user_id: int | Unset = UNSET,
228
+ media_id: int | Unset = UNSET,
229
+ ) -> Error | list[List] | None:
230
+ """List all lists
231
+
232
+ Returns all lists matching the query filters. Can filter by media ID to find lists containing a
233
+ specific media. Public lists are visible to all users.
234
+
235
+ Args:
236
+ visibility (ListIndexVisibility | Unset): Example: public.
237
+ type_ (ListIndexType | Unset): Example: SERIES.
238
+ user_id (int | Unset): Example: 1.
239
+ media_id (int | Unset): Example: 12345.
240
+
241
+ Raises:
242
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
243
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
244
+
245
+ Returns:
246
+ Error | list[List]
247
+ """
248
+
249
+ return (
250
+ await asyncio_detailed(
251
+ client=client,
252
+ visibility=visibility,
253
+ type_=type_,
254
+ user_id=user_id,
255
+ media_id=media_id,
256
+ )
257
+ ).parsed
@@ -0,0 +1,193 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.error import Error
10
+ from ...models.list_with_media import ListWithMedia
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ id: int,
16
+ ) -> dict[str, Any]:
17
+ _kwargs: dict[str, Any] = {
18
+ "method": "get",
19
+ "url": "/v1/lists/{id}".format(
20
+ id=quote(str(id), safe=""),
21
+ ),
22
+ }
23
+
24
+ return _kwargs
25
+
26
+
27
+ def _parse_response(
28
+ *, client: AuthenticatedClient | Client, response: httpx.Response
29
+ ) -> Error | ListWithMedia | None:
30
+ if response.status_code == 200:
31
+ response_200 = ListWithMedia.from_dict(response.json())
32
+
33
+ return response_200
34
+
35
+ if response.status_code == 400:
36
+ response_400 = Error.from_dict(response.json())
37
+
38
+ return response_400
39
+
40
+ if response.status_code == 401:
41
+ response_401 = Error.from_dict(response.json())
42
+
43
+ return response_401
44
+
45
+ if response.status_code == 403:
46
+ response_403 = Error.from_dict(response.json())
47
+
48
+ return response_403
49
+
50
+ if response.status_code == 404:
51
+ response_404 = Error.from_dict(response.json())
52
+
53
+ return response_404
54
+
55
+ if response.status_code == 429:
56
+ response_429 = Error.from_dict(response.json())
57
+
58
+ return response_429
59
+
60
+ if response.status_code == 500:
61
+ response_500 = Error.from_dict(response.json())
62
+
63
+ return response_500
64
+
65
+ if client.raise_on_unexpected_status:
66
+ raise errors.UnexpectedStatus(response.status_code, response.content)
67
+ else:
68
+ return None
69
+
70
+
71
+ def _build_response(
72
+ *, client: AuthenticatedClient | Client, response: httpx.Response
73
+ ) -> Response[Error | ListWithMedia]:
74
+ return Response(
75
+ status_code=HTTPStatus(response.status_code),
76
+ content=response.content,
77
+ headers=response.headers,
78
+ parsed=_parse_response(client=client, response=response),
79
+ )
80
+
81
+
82
+ def sync_detailed(
83
+ id: int,
84
+ *,
85
+ client: AuthenticatedClient,
86
+ ) -> Response[Error | ListWithMedia]:
87
+ """Get list details
88
+
89
+ Returns a list with all media in order (sorted by position).
90
+
91
+ Args:
92
+ id (int): Example: 123.
93
+
94
+ Raises:
95
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
96
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
97
+
98
+ Returns:
99
+ Response[Error | ListWithMedia]
100
+ """
101
+
102
+ kwargs = _get_kwargs(
103
+ id=id,
104
+ )
105
+
106
+ response = client.get_httpx_client().request(
107
+ **kwargs,
108
+ )
109
+
110
+ return _build_response(client=client, response=response)
111
+
112
+
113
+ def sync(
114
+ id: int,
115
+ *,
116
+ client: AuthenticatedClient,
117
+ ) -> Error | ListWithMedia | None:
118
+ """Get list details
119
+
120
+ Returns a list with all media in order (sorted by position).
121
+
122
+ Args:
123
+ id (int): Example: 123.
124
+
125
+ Raises:
126
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
128
+
129
+ Returns:
130
+ Error | ListWithMedia
131
+ """
132
+
133
+ return sync_detailed(
134
+ id=id,
135
+ client=client,
136
+ ).parsed
137
+
138
+
139
+ async def asyncio_detailed(
140
+ id: int,
141
+ *,
142
+ client: AuthenticatedClient,
143
+ ) -> Response[Error | ListWithMedia]:
144
+ """Get list details
145
+
146
+ Returns a list with all media in order (sorted by position).
147
+
148
+ Args:
149
+ id (int): Example: 123.
150
+
151
+ Raises:
152
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
153
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
154
+
155
+ Returns:
156
+ Response[Error | ListWithMedia]
157
+ """
158
+
159
+ kwargs = _get_kwargs(
160
+ id=id,
161
+ )
162
+
163
+ response = await client.get_async_httpx_client().request(**kwargs)
164
+
165
+ return _build_response(client=client, response=response)
166
+
167
+
168
+ async def asyncio(
169
+ id: int,
170
+ *,
171
+ client: AuthenticatedClient,
172
+ ) -> Error | ListWithMedia | None:
173
+ """Get list details
174
+
175
+ Returns a list with all media in order (sorted by position).
176
+
177
+ Args:
178
+ id (int): Example: 123.
179
+
180
+ Raises:
181
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
182
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
183
+
184
+ Returns:
185
+ Error | ListWithMedia
186
+ """
187
+
188
+ return (
189
+ await asyncio_detailed(
190
+ id=id,
191
+ client=client,
192
+ )
193
+ ).parsed
@@ -0,0 +1,14 @@
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 character_show
8
+ from . import episode_index
9
+ from . import episode_show
10
+ from . import media_index
11
+ from . import media_show
12
+ from . import segment_show_by_uuid
13
+ from . import segment_show
14
+ from . import seiyuu_show
@@ -0,0 +1,193 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.character_with_media import CharacterWithMedia
10
+ from ...models.error import Error
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ id: int,
16
+ ) -> dict[str, Any]:
17
+ _kwargs: dict[str, Any] = {
18
+ "method": "get",
19
+ "url": "/v1/media/characters/{id}".format(
20
+ id=quote(str(id), safe=""),
21
+ ),
22
+ }
23
+
24
+ return _kwargs
25
+
26
+
27
+ def _parse_response(
28
+ *, client: AuthenticatedClient | Client, response: httpx.Response
29
+ ) -> CharacterWithMedia | Error | None:
30
+ if response.status_code == 200:
31
+ response_200 = CharacterWithMedia.from_dict(response.json())
32
+
33
+ return response_200
34
+
35
+ if response.status_code == 400:
36
+ response_400 = Error.from_dict(response.json())
37
+
38
+ return response_400
39
+
40
+ if response.status_code == 401:
41
+ response_401 = Error.from_dict(response.json())
42
+
43
+ return response_401
44
+
45
+ if response.status_code == 403:
46
+ response_403 = Error.from_dict(response.json())
47
+
48
+ return response_403
49
+
50
+ if response.status_code == 404:
51
+ response_404 = Error.from_dict(response.json())
52
+
53
+ return response_404
54
+
55
+ if response.status_code == 429:
56
+ response_429 = Error.from_dict(response.json())
57
+
58
+ return response_429
59
+
60
+ if response.status_code == 500:
61
+ response_500 = Error.from_dict(response.json())
62
+
63
+ return response_500
64
+
65
+ if client.raise_on_unexpected_status:
66
+ raise errors.UnexpectedStatus(response.status_code, response.content)
67
+ else:
68
+ return None
69
+
70
+
71
+ def _build_response(
72
+ *, client: AuthenticatedClient | Client, response: httpx.Response
73
+ ) -> Response[CharacterWithMedia | Error]:
74
+ return Response(
75
+ status_code=HTTPStatus(response.status_code),
76
+ content=response.content,
77
+ headers=response.headers,
78
+ parsed=_parse_response(client=client, response=response),
79
+ )
80
+
81
+
82
+ def sync_detailed(
83
+ id: int,
84
+ *,
85
+ client: AuthenticatedClient,
86
+ ) -> Response[CharacterWithMedia | Error]:
87
+ """Get character details
88
+
89
+ Returns a character with their seiyuu and all media appearances.
90
+
91
+ Args:
92
+ id (int): Example: 14545.
93
+
94
+ Raises:
95
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
96
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
97
+
98
+ Returns:
99
+ Response[CharacterWithMedia | Error]
100
+ """
101
+
102
+ kwargs = _get_kwargs(
103
+ id=id,
104
+ )
105
+
106
+ response = client.get_httpx_client().request(
107
+ **kwargs,
108
+ )
109
+
110
+ return _build_response(client=client, response=response)
111
+
112
+
113
+ def sync(
114
+ id: int,
115
+ *,
116
+ client: AuthenticatedClient,
117
+ ) -> CharacterWithMedia | Error | None:
118
+ """Get character details
119
+
120
+ Returns a character with their seiyuu and all media appearances.
121
+
122
+ Args:
123
+ id (int): Example: 14545.
124
+
125
+ Raises:
126
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
128
+
129
+ Returns:
130
+ CharacterWithMedia | Error
131
+ """
132
+
133
+ return sync_detailed(
134
+ id=id,
135
+ client=client,
136
+ ).parsed
137
+
138
+
139
+ async def asyncio_detailed(
140
+ id: int,
141
+ *,
142
+ client: AuthenticatedClient,
143
+ ) -> Response[CharacterWithMedia | Error]:
144
+ """Get character details
145
+
146
+ Returns a character with their seiyuu and all media appearances.
147
+
148
+ Args:
149
+ id (int): Example: 14545.
150
+
151
+ Raises:
152
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
153
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
154
+
155
+ Returns:
156
+ Response[CharacterWithMedia | Error]
157
+ """
158
+
159
+ kwargs = _get_kwargs(
160
+ id=id,
161
+ )
162
+
163
+ response = await client.get_async_httpx_client().request(**kwargs)
164
+
165
+ return _build_response(client=client, response=response)
166
+
167
+
168
+ async def asyncio(
169
+ id: int,
170
+ *,
171
+ client: AuthenticatedClient,
172
+ ) -> CharacterWithMedia | Error | None:
173
+ """Get character details
174
+
175
+ Returns a character with their seiyuu and all media appearances.
176
+
177
+ Args:
178
+ id (int): Example: 14545.
179
+
180
+ Raises:
181
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
182
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
183
+
184
+ Returns:
185
+ CharacterWithMedia | Error
186
+ """
187
+
188
+ return (
189
+ await asyncio_detailed(
190
+ id=id,
191
+ client=client,
192
+ )
193
+ ).parsed