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,219 @@
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.fetch_sentence_context_request import FetchSentenceContextRequest
10
+ from ...models.fetch_sentence_context_response import FetchSentenceContextResponse
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ *,
16
+ body: FetchSentenceContextRequest,
17
+ ) -> dict[str, Any]:
18
+ headers: dict[str, Any] = {}
19
+
20
+ _kwargs: dict[str, Any] = {
21
+ "method": "post",
22
+ "url": "/v1/search/media/context",
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 | FetchSentenceContextResponse | None:
36
+ if response.status_code == 200:
37
+ response_200 = FetchSentenceContextResponse.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 == 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[Error | FetchSentenceContextResponse]:
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 | Client,
91
+ body: FetchSentenceContextRequest,
92
+ ) -> Response[Error | FetchSentenceContextResponse]:
93
+ """Fetch context for a sentence
94
+
95
+ Retrieves sentences surrounding a specific segment position within an episode.
96
+ Returns segments both before and after the target position, providing context for understanding how
97
+ a sentence is used in dialogue.
98
+
99
+ **Requirements:**
100
+ - Required scopes: `READ_MEDIA`
101
+
102
+ Args:
103
+ body (FetchSentenceContextRequest):
104
+
105
+ Raises:
106
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
107
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
108
+
109
+ Returns:
110
+ Response[Error | FetchSentenceContextResponse]
111
+ """
112
+
113
+ kwargs = _get_kwargs(
114
+ body=body,
115
+ )
116
+
117
+ response = client.get_httpx_client().request(
118
+ **kwargs,
119
+ )
120
+
121
+ return _build_response(client=client, response=response)
122
+
123
+
124
+ def sync(
125
+ *,
126
+ client: AuthenticatedClient | Client,
127
+ body: FetchSentenceContextRequest,
128
+ ) -> Error | FetchSentenceContextResponse | None:
129
+ """Fetch context for a sentence
130
+
131
+ Retrieves sentences surrounding a specific segment position within an episode.
132
+ Returns segments both before and after the target position, providing context for understanding how
133
+ a sentence is used in dialogue.
134
+
135
+ **Requirements:**
136
+ - Required scopes: `READ_MEDIA`
137
+
138
+ Args:
139
+ body (FetchSentenceContextRequest):
140
+
141
+ Raises:
142
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
143
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
144
+
145
+ Returns:
146
+ Error | FetchSentenceContextResponse
147
+ """
148
+
149
+ return sync_detailed(
150
+ client=client,
151
+ body=body,
152
+ ).parsed
153
+
154
+
155
+ async def asyncio_detailed(
156
+ *,
157
+ client: AuthenticatedClient | Client,
158
+ body: FetchSentenceContextRequest,
159
+ ) -> Response[Error | FetchSentenceContextResponse]:
160
+ """Fetch context for a sentence
161
+
162
+ Retrieves sentences surrounding a specific segment position within an episode.
163
+ Returns segments both before and after the target position, providing context for understanding how
164
+ a sentence is used in dialogue.
165
+
166
+ **Requirements:**
167
+ - Required scopes: `READ_MEDIA`
168
+
169
+ Args:
170
+ body (FetchSentenceContextRequest):
171
+
172
+ Raises:
173
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
174
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
175
+
176
+ Returns:
177
+ Response[Error | FetchSentenceContextResponse]
178
+ """
179
+
180
+ kwargs = _get_kwargs(
181
+ body=body,
182
+ )
183
+
184
+ response = await client.get_async_httpx_client().request(**kwargs)
185
+
186
+ return _build_response(client=client, response=response)
187
+
188
+
189
+ async def asyncio(
190
+ *,
191
+ client: AuthenticatedClient | Client,
192
+ body: FetchSentenceContextRequest,
193
+ ) -> Error | FetchSentenceContextResponse | None:
194
+ """Fetch context for a sentence
195
+
196
+ Retrieves sentences surrounding a specific segment position within an episode.
197
+ Returns segments both before and after the target position, providing context for understanding how
198
+ a sentence is used in dialogue.
199
+
200
+ **Requirements:**
201
+ - Required scopes: `READ_MEDIA`
202
+
203
+ Args:
204
+ body (FetchSentenceContextRequest):
205
+
206
+ Raises:
207
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
208
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
209
+
210
+ Returns:
211
+ Error | FetchSentenceContextResponse
212
+ """
213
+
214
+ return (
215
+ await asyncio_detailed(
216
+ client=client,
217
+ body=body,
218
+ )
219
+ ).parsed
@@ -0,0 +1,6 @@
1
+ from typing import Any
2
+ import httpx
3
+ from .... import errors
4
+ from ....client import AuthenticatedClient, Client
5
+ from ....types import Response
6
+
@@ -0,0 +1,295 @@
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_request import SearchRequest
10
+ from ...models.search_response import SearchResponse
11
+ from ...types import UNSET, Response, Unset
12
+
13
+
14
+ def _get_kwargs(
15
+ *,
16
+ body: SearchRequest | Unset = UNSET,
17
+ ) -> dict[str, Any]:
18
+ headers: dict[str, Any] = {}
19
+
20
+ _kwargs: dict[str, Any] = {
21
+ "method": "post",
22
+ "url": "/v1/search/media/sentence",
23
+ }
24
+
25
+ if not isinstance(body, Unset):
26
+ _kwargs["json"] = body.to_dict()
27
+
28
+ headers["Content-Type"] = "application/json"
29
+
30
+ _kwargs["headers"] = headers
31
+ return _kwargs
32
+
33
+
34
+ def _parse_response(
35
+ *, client: AuthenticatedClient | Client, response: httpx.Response
36
+ ) -> Error | SearchResponse | None:
37
+ if response.status_code == 200:
38
+ response_200 = SearchResponse.from_dict(response.json())
39
+
40
+ return response_200
41
+
42
+ if response.status_code == 400:
43
+ response_400 = Error.from_dict(response.json())
44
+
45
+ return response_400
46
+
47
+ if response.status_code == 401:
48
+ response_401 = Error.from_dict(response.json())
49
+
50
+ return response_401
51
+
52
+ if response.status_code == 403:
53
+ response_403 = Error.from_dict(response.json())
54
+
55
+ return response_403
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 | SearchResponse]:
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
+ *,
86
+ client: AuthenticatedClient | Client,
87
+ body: SearchRequest | Unset = UNSET,
88
+ ) -> Response[Error | SearchResponse]:
89
+ r"""Search by query
90
+
91
+ The primary search endpoint for finding Japanese sentences and their translations across indexed
92
+ media (anime, J-Drama, audiobooks).
93
+
94
+ This endpoint uses Elasticsearch with advanced Japanese text analysis supporting multiple input
95
+ types (romaji, kanji, kana) and providing intelligent field-based boosting.
96
+
97
+ **Query Features**
98
+ - **Multi-language Support:** Search using Japanese (kanji/kana), Romaji, or English/Spanish
99
+ - **Boolean Operators:** `AND`, `OR`, `NOT` supported (e.g., `(cat OR dog) AND bird`)
100
+ - **Phrase Matching:** Use quotes for exact phrases (e.g., `\"good morning\"`), or pass
101
+ `exact_match: true` to the request body
102
+ - **Wildcards:** `te*t` format (leading wildcards not supported)
103
+ - **Smart Field Selection:** Automatically chooses optimal search fields based on input type
104
+
105
+ **Input Type Handling**
106
+ | Input Type | Search Strategy |
107
+ |------------|-----------------|
108
+ | **Romaji** (`go`, `taberu`) | Boosts EN/ES translations, reading form (pronunciation), and base
109
+ form |
110
+ | **Kanji** (`食べる`, `彼女`) | Searches content and base form (dictionary form). Ignores matches by
111
+ reading (homophones). |
112
+ | **Kana** (`たべる`, `かのじょ`) | Standard search across content, base form, and reading form |
113
+ | **English/Spanish** | Direct translation search |
114
+
115
+ **Requirements**
116
+ - API Key with `READ_MEDIA` permission
117
+
118
+ Args:
119
+ body (SearchRequest | Unset):
120
+
121
+ Raises:
122
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
123
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
124
+
125
+ Returns:
126
+ Response[Error | SearchResponse]
127
+ """
128
+
129
+ kwargs = _get_kwargs(
130
+ body=body,
131
+ )
132
+
133
+ response = client.get_httpx_client().request(
134
+ **kwargs,
135
+ )
136
+
137
+ return _build_response(client=client, response=response)
138
+
139
+
140
+ def sync(
141
+ *,
142
+ client: AuthenticatedClient | Client,
143
+ body: SearchRequest | Unset = UNSET,
144
+ ) -> Error | SearchResponse | None:
145
+ r"""Search by query
146
+
147
+ The primary search endpoint for finding Japanese sentences and their translations across indexed
148
+ media (anime, J-Drama, audiobooks).
149
+
150
+ This endpoint uses Elasticsearch with advanced Japanese text analysis supporting multiple input
151
+ types (romaji, kanji, kana) and providing intelligent field-based boosting.
152
+
153
+ **Query Features**
154
+ - **Multi-language Support:** Search using Japanese (kanji/kana), Romaji, or English/Spanish
155
+ - **Boolean Operators:** `AND`, `OR`, `NOT` supported (e.g., `(cat OR dog) AND bird`)
156
+ - **Phrase Matching:** Use quotes for exact phrases (e.g., `\"good morning\"`), or pass
157
+ `exact_match: true` to the request body
158
+ - **Wildcards:** `te*t` format (leading wildcards not supported)
159
+ - **Smart Field Selection:** Automatically chooses optimal search fields based on input type
160
+
161
+ **Input Type Handling**
162
+ | Input Type | Search Strategy |
163
+ |------------|-----------------|
164
+ | **Romaji** (`go`, `taberu`) | Boosts EN/ES translations, reading form (pronunciation), and base
165
+ form |
166
+ | **Kanji** (`食べる`, `彼女`) | Searches content and base form (dictionary form). Ignores matches by
167
+ reading (homophones). |
168
+ | **Kana** (`たべる`, `かのじょ`) | Standard search across content, base form, and reading form |
169
+ | **English/Spanish** | Direct translation search |
170
+
171
+ **Requirements**
172
+ - API Key with `READ_MEDIA` permission
173
+
174
+ Args:
175
+ body (SearchRequest | Unset):
176
+
177
+ Raises:
178
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
179
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
180
+
181
+ Returns:
182
+ Error | SearchResponse
183
+ """
184
+
185
+ return sync_detailed(
186
+ client=client,
187
+ body=body,
188
+ ).parsed
189
+
190
+
191
+ async def asyncio_detailed(
192
+ *,
193
+ client: AuthenticatedClient | Client,
194
+ body: SearchRequest | Unset = UNSET,
195
+ ) -> Response[Error | SearchResponse]:
196
+ r"""Search by query
197
+
198
+ The primary search endpoint for finding Japanese sentences and their translations across indexed
199
+ media (anime, J-Drama, audiobooks).
200
+
201
+ This endpoint uses Elasticsearch with advanced Japanese text analysis supporting multiple input
202
+ types (romaji, kanji, kana) and providing intelligent field-based boosting.
203
+
204
+ **Query Features**
205
+ - **Multi-language Support:** Search using Japanese (kanji/kana), Romaji, or English/Spanish
206
+ - **Boolean Operators:** `AND`, `OR`, `NOT` supported (e.g., `(cat OR dog) AND bird`)
207
+ - **Phrase Matching:** Use quotes for exact phrases (e.g., `\"good morning\"`), or pass
208
+ `exact_match: true` to the request body
209
+ - **Wildcards:** `te*t` format (leading wildcards not supported)
210
+ - **Smart Field Selection:** Automatically chooses optimal search fields based on input type
211
+
212
+ **Input Type Handling**
213
+ | Input Type | Search Strategy |
214
+ |------------|-----------------|
215
+ | **Romaji** (`go`, `taberu`) | Boosts EN/ES translations, reading form (pronunciation), and base
216
+ form |
217
+ | **Kanji** (`食べる`, `彼女`) | Searches content and base form (dictionary form). Ignores matches by
218
+ reading (homophones). |
219
+ | **Kana** (`たべる`, `かのじょ`) | Standard search across content, base form, and reading form |
220
+ | **English/Spanish** | Direct translation search |
221
+
222
+ **Requirements**
223
+ - API Key with `READ_MEDIA` permission
224
+
225
+ Args:
226
+ body (SearchRequest | Unset):
227
+
228
+ Raises:
229
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
230
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
231
+
232
+ Returns:
233
+ Response[Error | SearchResponse]
234
+ """
235
+
236
+ kwargs = _get_kwargs(
237
+ body=body,
238
+ )
239
+
240
+ response = await client.get_async_httpx_client().request(**kwargs)
241
+
242
+ return _build_response(client=client, response=response)
243
+
244
+
245
+ async def asyncio(
246
+ *,
247
+ client: AuthenticatedClient | Client,
248
+ body: SearchRequest | Unset = UNSET,
249
+ ) -> Error | SearchResponse | None:
250
+ r"""Search by query
251
+
252
+ The primary search endpoint for finding Japanese sentences and their translations across indexed
253
+ media (anime, J-Drama, audiobooks).
254
+
255
+ This endpoint uses Elasticsearch with advanced Japanese text analysis supporting multiple input
256
+ types (romaji, kanji, kana) and providing intelligent field-based boosting.
257
+
258
+ **Query Features**
259
+ - **Multi-language Support:** Search using Japanese (kanji/kana), Romaji, or English/Spanish
260
+ - **Boolean Operators:** `AND`, `OR`, `NOT` supported (e.g., `(cat OR dog) AND bird`)
261
+ - **Phrase Matching:** Use quotes for exact phrases (e.g., `\"good morning\"`), or pass
262
+ `exact_match: true` to the request body
263
+ - **Wildcards:** `te*t` format (leading wildcards not supported)
264
+ - **Smart Field Selection:** Automatically chooses optimal search fields based on input type
265
+
266
+ **Input Type Handling**
267
+ | Input Type | Search Strategy |
268
+ |------------|-----------------|
269
+ | **Romaji** (`go`, `taberu`) | Boosts EN/ES translations, reading form (pronunciation), and base
270
+ form |
271
+ | **Kanji** (`食べる`, `彼女`) | Searches content and base form (dictionary form). Ignores matches by
272
+ reading (homophones). |
273
+ | **Kana** (`たべる`, `かのじょ`) | Standard search across content, base form, and reading form |
274
+ | **English/Spanish** | Direct translation search |
275
+
276
+ **Requirements**
277
+ - API Key with `READ_MEDIA` permission
278
+
279
+ Args:
280
+ body (SearchRequest | Unset):
281
+
282
+ Raises:
283
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
284
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
285
+
286
+ Returns:
287
+ Error | SearchResponse
288
+ """
289
+
290
+ return (
291
+ await asyncio_detailed(
292
+ client=client,
293
+ body=body,
294
+ )
295
+ ).parsed
@@ -0,0 +1,168 @@
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_health_check_response import SearchHealthCheckResponse
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs() -> dict[str, Any]:
14
+ _kwargs: dict[str, Any] = {
15
+ "method": "get",
16
+ "url": "/v1/search/health",
17
+ }
18
+
19
+ return _kwargs
20
+
21
+
22
+ def _parse_response(
23
+ *, client: AuthenticatedClient | Client, response: httpx.Response
24
+ ) -> Error | SearchHealthCheckResponse | None:
25
+ if response.status_code == 200:
26
+ response_200 = SearchHealthCheckResponse.from_dict(response.json())
27
+
28
+ return response_200
29
+
30
+ if response.status_code == 401:
31
+ response_401 = Error.from_dict(response.json())
32
+
33
+ return response_401
34
+
35
+ if response.status_code == 403:
36
+ response_403 = Error.from_dict(response.json())
37
+
38
+ return response_403
39
+
40
+ if response.status_code == 429:
41
+ response_429 = Error.from_dict(response.json())
42
+
43
+ return response_429
44
+
45
+ if response.status_code == 500:
46
+ response_500 = Error.from_dict(response.json())
47
+
48
+ return response_500
49
+
50
+ if client.raise_on_unexpected_status:
51
+ raise errors.UnexpectedStatus(response.status_code, response.content)
52
+ else:
53
+ return None
54
+
55
+
56
+ def _build_response(
57
+ *, client: AuthenticatedClient | Client, response: httpx.Response
58
+ ) -> Response[Error | SearchHealthCheckResponse]:
59
+ return Response(
60
+ status_code=HTTPStatus(response.status_code),
61
+ content=response.content,
62
+ headers=response.headers,
63
+ parsed=_parse_response(client=client, response=response),
64
+ )
65
+
66
+
67
+ def sync_detailed(
68
+ *,
69
+ client: AuthenticatedClient,
70
+ ) -> Response[Error | SearchHealthCheckResponse]:
71
+ """Health check for search
72
+
73
+ Tests the search service connectivity and functionality by performing a simple search query.
74
+
75
+ **Requirements:**
76
+ - Required Scopes: `READ_MEDIA`
77
+
78
+ Raises:
79
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
80
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
81
+
82
+ Returns:
83
+ Response[Error | SearchHealthCheckResponse]
84
+ """
85
+
86
+ kwargs = _get_kwargs()
87
+
88
+ response = client.get_httpx_client().request(
89
+ **kwargs,
90
+ )
91
+
92
+ return _build_response(client=client, response=response)
93
+
94
+
95
+ def sync(
96
+ *,
97
+ client: AuthenticatedClient,
98
+ ) -> Error | SearchHealthCheckResponse | None:
99
+ """Health check for search
100
+
101
+ Tests the search service connectivity and functionality by performing a simple search query.
102
+
103
+ **Requirements:**
104
+ - Required Scopes: `READ_MEDIA`
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
+ Error | SearchHealthCheckResponse
112
+ """
113
+
114
+ return sync_detailed(
115
+ client=client,
116
+ ).parsed
117
+
118
+
119
+ async def asyncio_detailed(
120
+ *,
121
+ client: AuthenticatedClient,
122
+ ) -> Response[Error | SearchHealthCheckResponse]:
123
+ """Health check for search
124
+
125
+ Tests the search service connectivity and functionality by performing a simple search query.
126
+
127
+ **Requirements:**
128
+ - Required Scopes: `READ_MEDIA`
129
+
130
+ Raises:
131
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
132
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
133
+
134
+ Returns:
135
+ Response[Error | SearchHealthCheckResponse]
136
+ """
137
+
138
+ kwargs = _get_kwargs()
139
+
140
+ response = await client.get_async_httpx_client().request(**kwargs)
141
+
142
+ return _build_response(client=client, response=response)
143
+
144
+
145
+ async def asyncio(
146
+ *,
147
+ client: AuthenticatedClient,
148
+ ) -> Error | SearchHealthCheckResponse | None:
149
+ """Health check for search
150
+
151
+ Tests the search service connectivity and functionality by performing a simple search query.
152
+
153
+ **Requirements:**
154
+ - Required Scopes: `READ_MEDIA`
155
+
156
+ Raises:
157
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
158
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
159
+
160
+ Returns:
161
+ Error | SearchHealthCheckResponse
162
+ """
163
+
164
+ return (
165
+ await asyncio_detailed(
166
+ client=client,
167
+ )
168
+ ).parsed