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,207 @@
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_remove_item_response_200 import ListRemoveItemResponse200
11
+ from ....types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ id: int,
16
+ media_id: int,
17
+ ) -> dict[str, Any]:
18
+ _kwargs: dict[str, Any] = {
19
+ "method": "delete",
20
+ "url": "/v1/lists/{id}/items/{media_id}".format(
21
+ id=quote(str(id), safe=""),
22
+ media_id=quote(str(media_id), safe=""),
23
+ ),
24
+ }
25
+
26
+ return _kwargs
27
+
28
+
29
+ def _parse_response(
30
+ *, client: AuthenticatedClient | Client, response: httpx.Response
31
+ ) -> Error | ListRemoveItemResponse200 | None:
32
+ if response.status_code == 200:
33
+ response_200 = ListRemoveItemResponse200.from_dict(response.json())
34
+
35
+ return response_200
36
+
37
+ if response.status_code == 400:
38
+ response_400 = Error.from_dict(response.json())
39
+
40
+ return response_400
41
+
42
+ if response.status_code == 401:
43
+ response_401 = Error.from_dict(response.json())
44
+
45
+ return response_401
46
+
47
+ if response.status_code == 403:
48
+ response_403 = Error.from_dict(response.json())
49
+
50
+ return response_403
51
+
52
+ if response.status_code == 404:
53
+ response_404 = Error.from_dict(response.json())
54
+
55
+ return response_404
56
+
57
+ if response.status_code == 429:
58
+ response_429 = Error.from_dict(response.json())
59
+
60
+ return response_429
61
+
62
+ if response.status_code == 500:
63
+ response_500 = Error.from_dict(response.json())
64
+
65
+ return response_500
66
+
67
+ if client.raise_on_unexpected_status:
68
+ raise errors.UnexpectedStatus(response.status_code, response.content)
69
+ else:
70
+ return None
71
+
72
+
73
+ def _build_response(
74
+ *, client: AuthenticatedClient | Client, response: httpx.Response
75
+ ) -> Response[Error | ListRemoveItemResponse200]:
76
+ return Response(
77
+ status_code=HTTPStatus(response.status_code),
78
+ content=response.content,
79
+ headers=response.headers,
80
+ parsed=_parse_response(client=client, response=response),
81
+ )
82
+
83
+
84
+ def sync_detailed(
85
+ id: int,
86
+ media_id: int,
87
+ *,
88
+ client: AuthenticatedClient,
89
+ ) -> Response[Error | ListRemoveItemResponse200]:
90
+ """Remove media from list
91
+
92
+ Removes a media entry from the list. Requires admin permissions.
93
+
94
+ Args:
95
+ id (int): Example: 123.
96
+ media_id (int): Example: 7674.
97
+
98
+ Raises:
99
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
100
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
101
+
102
+ Returns:
103
+ Response[Error | ListRemoveItemResponse200]
104
+ """
105
+
106
+ kwargs = _get_kwargs(
107
+ id=id,
108
+ media_id=media_id,
109
+ )
110
+
111
+ response = client.get_httpx_client().request(
112
+ **kwargs,
113
+ )
114
+
115
+ return _build_response(client=client, response=response)
116
+
117
+
118
+ def sync(
119
+ id: int,
120
+ media_id: int,
121
+ *,
122
+ client: AuthenticatedClient,
123
+ ) -> Error | ListRemoveItemResponse200 | None:
124
+ """Remove media from list
125
+
126
+ Removes a media entry from the list. Requires admin permissions.
127
+
128
+ Args:
129
+ id (int): Example: 123.
130
+ media_id (int): Example: 7674.
131
+
132
+ Raises:
133
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
134
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
135
+
136
+ Returns:
137
+ Error | ListRemoveItemResponse200
138
+ """
139
+
140
+ return sync_detailed(
141
+ id=id,
142
+ media_id=media_id,
143
+ client=client,
144
+ ).parsed
145
+
146
+
147
+ async def asyncio_detailed(
148
+ id: int,
149
+ media_id: int,
150
+ *,
151
+ client: AuthenticatedClient,
152
+ ) -> Response[Error | ListRemoveItemResponse200]:
153
+ """Remove media from list
154
+
155
+ Removes a media entry from the list. Requires admin permissions.
156
+
157
+ Args:
158
+ id (int): Example: 123.
159
+ media_id (int): Example: 7674.
160
+
161
+ Raises:
162
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
163
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
164
+
165
+ Returns:
166
+ Response[Error | ListRemoveItemResponse200]
167
+ """
168
+
169
+ kwargs = _get_kwargs(
170
+ id=id,
171
+ media_id=media_id,
172
+ )
173
+
174
+ response = await client.get_async_httpx_client().request(**kwargs)
175
+
176
+ return _build_response(client=client, response=response)
177
+
178
+
179
+ async def asyncio(
180
+ id: int,
181
+ media_id: int,
182
+ *,
183
+ client: AuthenticatedClient,
184
+ ) -> Error | ListRemoveItemResponse200 | None:
185
+ """Remove media from list
186
+
187
+ Removes a media entry from the list. Requires admin permissions.
188
+
189
+ Args:
190
+ id (int): Example: 123.
191
+ media_id (int): Example: 7674.
192
+
193
+ Raises:
194
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
195
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
196
+
197
+ Returns:
198
+ Error | ListRemoveItemResponse200
199
+ """
200
+
201
+ return (
202
+ await asyncio_detailed(
203
+ id=id,
204
+ media_id=media_id,
205
+ client=client,
206
+ )
207
+ ).parsed
@@ -0,0 +1,215 @@
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_ import List
11
+ from ....models.list_update_body import ListUpdateBody
12
+ from ....types import Response
13
+
14
+
15
+ def _get_kwargs(
16
+ id: int,
17
+ *,
18
+ body: ListUpdateBody,
19
+ ) -> dict[str, Any]:
20
+ headers: dict[str, Any] = {}
21
+
22
+ _kwargs: dict[str, Any] = {
23
+ "method": "patch",
24
+ "url": "/v1/lists/{id}".format(
25
+ id=quote(str(id), safe=""),
26
+ ),
27
+ }
28
+
29
+ _kwargs["json"] = body.to_dict()
30
+
31
+ headers["Content-Type"] = "application/json"
32
+
33
+ _kwargs["headers"] = headers
34
+ return _kwargs
35
+
36
+
37
+ def _parse_response(
38
+ *, client: AuthenticatedClient | Client, response: httpx.Response
39
+ ) -> Error | List | None:
40
+ if response.status_code == 200:
41
+ response_200 = List.from_dict(response.json())
42
+
43
+ return response_200
44
+
45
+ if response.status_code == 400:
46
+ response_400 = Error.from_dict(response.json())
47
+
48
+ return response_400
49
+
50
+ if response.status_code == 401:
51
+ response_401 = Error.from_dict(response.json())
52
+
53
+ return response_401
54
+
55
+ if response.status_code == 403:
56
+ response_403 = Error.from_dict(response.json())
57
+
58
+ return response_403
59
+
60
+ if response.status_code == 404:
61
+ response_404 = Error.from_dict(response.json())
62
+
63
+ return response_404
64
+
65
+ if response.status_code == 429:
66
+ response_429 = Error.from_dict(response.json())
67
+
68
+ return response_429
69
+
70
+ if response.status_code == 500:
71
+ response_500 = Error.from_dict(response.json())
72
+
73
+ return response_500
74
+
75
+ if client.raise_on_unexpected_status:
76
+ raise errors.UnexpectedStatus(response.status_code, response.content)
77
+ else:
78
+ return None
79
+
80
+
81
+ def _build_response(
82
+ *, client: AuthenticatedClient | Client, response: httpx.Response
83
+ ) -> Response[Error | List]:
84
+ return Response(
85
+ status_code=HTTPStatus(response.status_code),
86
+ content=response.content,
87
+ headers=response.headers,
88
+ parsed=_parse_response(client=client, response=response),
89
+ )
90
+
91
+
92
+ def sync_detailed(
93
+ id: int,
94
+ *,
95
+ client: AuthenticatedClient,
96
+ body: ListUpdateBody,
97
+ ) -> Response[Error | List]:
98
+ """Update list metadata
99
+
100
+ Updates list name or visibility. Requires admin permissions.
101
+
102
+ Args:
103
+ id (int): Example: 123.
104
+ body (ListUpdateBody):
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 | List]
112
+ """
113
+
114
+ kwargs = _get_kwargs(
115
+ id=id,
116
+ body=body,
117
+ )
118
+
119
+ response = client.get_httpx_client().request(
120
+ **kwargs,
121
+ )
122
+
123
+ return _build_response(client=client, response=response)
124
+
125
+
126
+ def sync(
127
+ id: int,
128
+ *,
129
+ client: AuthenticatedClient,
130
+ body: ListUpdateBody,
131
+ ) -> Error | List | None:
132
+ """Update list metadata
133
+
134
+ Updates list name or visibility. Requires admin permissions.
135
+
136
+ Args:
137
+ id (int): Example: 123.
138
+ body (ListUpdateBody):
139
+
140
+ Raises:
141
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
142
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
143
+
144
+ Returns:
145
+ Error | List
146
+ """
147
+
148
+ return sync_detailed(
149
+ id=id,
150
+ client=client,
151
+ body=body,
152
+ ).parsed
153
+
154
+
155
+ async def asyncio_detailed(
156
+ id: int,
157
+ *,
158
+ client: AuthenticatedClient,
159
+ body: ListUpdateBody,
160
+ ) -> Response[Error | List]:
161
+ """Update list metadata
162
+
163
+ Updates list name or visibility. Requires admin permissions.
164
+
165
+ Args:
166
+ id (int): Example: 123.
167
+ body (ListUpdateBody):
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
+ Response[Error | List]
175
+ """
176
+
177
+ kwargs = _get_kwargs(
178
+ id=id,
179
+ body=body,
180
+ )
181
+
182
+ response = await client.get_async_httpx_client().request(**kwargs)
183
+
184
+ return _build_response(client=client, response=response)
185
+
186
+
187
+ async def asyncio(
188
+ id: int,
189
+ *,
190
+ client: AuthenticatedClient,
191
+ body: ListUpdateBody,
192
+ ) -> Error | List | None:
193
+ """Update list metadata
194
+
195
+ Updates list name or visibility. Requires admin permissions.
196
+
197
+ Args:
198
+ id (int): Example: 123.
199
+ body (ListUpdateBody):
200
+
201
+ Raises:
202
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
203
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
204
+
205
+ Returns:
206
+ Error | List
207
+ """
208
+
209
+ return (
210
+ await asyncio_detailed(
211
+ id=id,
212
+ client=client,
213
+ body=body,
214
+ )
215
+ ).parsed
@@ -0,0 +1,229 @@
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_update_item_body import ListUpdateItemBody
11
+ from ....models.list_update_item_response_200 import ListUpdateItemResponse200
12
+ from ....types import Response
13
+
14
+
15
+ def _get_kwargs(
16
+ id: int,
17
+ media_id: int,
18
+ *,
19
+ body: ListUpdateItemBody,
20
+ ) -> dict[str, Any]:
21
+ headers: dict[str, Any] = {}
22
+
23
+ _kwargs: dict[str, Any] = {
24
+ "method": "patch",
25
+ "url": "/v1/lists/{id}/items/{media_id}".format(
26
+ id=quote(str(id), safe=""),
27
+ media_id=quote(str(media_id), safe=""),
28
+ ),
29
+ }
30
+
31
+ _kwargs["json"] = body.to_dict()
32
+
33
+ headers["Content-Type"] = "application/json"
34
+
35
+ _kwargs["headers"] = headers
36
+ return _kwargs
37
+
38
+
39
+ def _parse_response(
40
+ *, client: AuthenticatedClient | Client, response: httpx.Response
41
+ ) -> Error | ListUpdateItemResponse200 | None:
42
+ if response.status_code == 200:
43
+ response_200 = ListUpdateItemResponse200.from_dict(response.json())
44
+
45
+ return response_200
46
+
47
+ if response.status_code == 400:
48
+ response_400 = Error.from_dict(response.json())
49
+
50
+ return response_400
51
+
52
+ if response.status_code == 401:
53
+ response_401 = Error.from_dict(response.json())
54
+
55
+ return response_401
56
+
57
+ if response.status_code == 403:
58
+ response_403 = Error.from_dict(response.json())
59
+
60
+ return response_403
61
+
62
+ if response.status_code == 404:
63
+ response_404 = Error.from_dict(response.json())
64
+
65
+ return response_404
66
+
67
+ if response.status_code == 429:
68
+ response_429 = Error.from_dict(response.json())
69
+
70
+ return response_429
71
+
72
+ if response.status_code == 500:
73
+ response_500 = Error.from_dict(response.json())
74
+
75
+ return response_500
76
+
77
+ if client.raise_on_unexpected_status:
78
+ raise errors.UnexpectedStatus(response.status_code, response.content)
79
+ else:
80
+ return None
81
+
82
+
83
+ def _build_response(
84
+ *, client: AuthenticatedClient | Client, response: httpx.Response
85
+ ) -> Response[Error | ListUpdateItemResponse200]:
86
+ return Response(
87
+ status_code=HTTPStatus(response.status_code),
88
+ content=response.content,
89
+ headers=response.headers,
90
+ parsed=_parse_response(client=client, response=response),
91
+ )
92
+
93
+
94
+ def sync_detailed(
95
+ id: int,
96
+ media_id: int,
97
+ *,
98
+ client: AuthenticatedClient,
99
+ body: ListUpdateItemBody,
100
+ ) -> Response[Error | ListUpdateItemResponse200]:
101
+ """Update media position in list
102
+
103
+ Updates the position of a media entry within the list. Requires admin permissions.
104
+
105
+ Args:
106
+ id (int): Example: 123.
107
+ media_id (int): Example: 7674.
108
+ body (ListUpdateItemBody):
109
+
110
+ Raises:
111
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
112
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
113
+
114
+ Returns:
115
+ Response[Error | ListUpdateItemResponse200]
116
+ """
117
+
118
+ kwargs = _get_kwargs(
119
+ id=id,
120
+ media_id=media_id,
121
+ body=body,
122
+ )
123
+
124
+ response = client.get_httpx_client().request(
125
+ **kwargs,
126
+ )
127
+
128
+ return _build_response(client=client, response=response)
129
+
130
+
131
+ def sync(
132
+ id: int,
133
+ media_id: int,
134
+ *,
135
+ client: AuthenticatedClient,
136
+ body: ListUpdateItemBody,
137
+ ) -> Error | ListUpdateItemResponse200 | None:
138
+ """Update media position in list
139
+
140
+ Updates the position of a media entry within the list. Requires admin permissions.
141
+
142
+ Args:
143
+ id (int): Example: 123.
144
+ media_id (int): Example: 7674.
145
+ body (ListUpdateItemBody):
146
+
147
+ Raises:
148
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
149
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
150
+
151
+ Returns:
152
+ Error | ListUpdateItemResponse200
153
+ """
154
+
155
+ return sync_detailed(
156
+ id=id,
157
+ media_id=media_id,
158
+ client=client,
159
+ body=body,
160
+ ).parsed
161
+
162
+
163
+ async def asyncio_detailed(
164
+ id: int,
165
+ media_id: int,
166
+ *,
167
+ client: AuthenticatedClient,
168
+ body: ListUpdateItemBody,
169
+ ) -> Response[Error | ListUpdateItemResponse200]:
170
+ """Update media position in list
171
+
172
+ Updates the position of a media entry within the list. Requires admin permissions.
173
+
174
+ Args:
175
+ id (int): Example: 123.
176
+ media_id (int): Example: 7674.
177
+ body (ListUpdateItemBody):
178
+
179
+ Raises:
180
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
181
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
182
+
183
+ Returns:
184
+ Response[Error | ListUpdateItemResponse200]
185
+ """
186
+
187
+ kwargs = _get_kwargs(
188
+ id=id,
189
+ media_id=media_id,
190
+ body=body,
191
+ )
192
+
193
+ response = await client.get_async_httpx_client().request(**kwargs)
194
+
195
+ return _build_response(client=client, response=response)
196
+
197
+
198
+ async def asyncio(
199
+ id: int,
200
+ media_id: int,
201
+ *,
202
+ client: AuthenticatedClient,
203
+ body: ListUpdateItemBody,
204
+ ) -> Error | ListUpdateItemResponse200 | None:
205
+ """Update media position in list
206
+
207
+ Updates the position of a media entry within the list. Requires admin permissions.
208
+
209
+ Args:
210
+ id (int): Example: 123.
211
+ media_id (int): Example: 7674.
212
+ body (ListUpdateItemBody):
213
+
214
+ Raises:
215
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
216
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
217
+
218
+ Returns:
219
+ Error | ListUpdateItemResponse200
220
+ """
221
+
222
+ return (
223
+ await asyncio_detailed(
224
+ id=id,
225
+ media_id=media_id,
226
+ client=client,
227
+ body=body,
228
+ )
229
+ ).parsed