Coverage for youversion/core/interfaces.py: 100%
8 statements
« prev ^ index » next coverage.py v7.14.3, created at 2026-06-26 11:31 +0100
« prev ^ index » next coverage.py v7.14.3, created at 2026-06-26 11:31 +0100
1"""Interfaces for YouVersion Bible API client components."""
3from abc import ABC, abstractmethod
4from typing import Any
6import httpx
8from ..models.base import Moment
11class IAuthenticator(ABC):
12 """Interface for authentication handling."""
14 @abstractmethod
15 async def authenticate(self, username: str, password: str) -> httpx.AsyncClient:
16 """Authenticate and return an HTTP client."""
17 pass
20class IHttpClient(ABC):
21 """Interface for HTTP operations."""
23 @abstractmethod
24 async def get(self, url: str, **kwargs) -> dict[str, Any]:
25 """Perform GET request.
27 Args:
28 url: URL to request
29 **kwargs: Additional arguments for the request
30 """
31 pass
33 @abstractmethod
34 async def post(self, url: str, **kwargs) -> dict[str, Any]:
35 """Perform POST request.
37 Args:
38 url: URL to request
39 **kwargs: Additional arguments for the request
40 """
41 pass
43 @abstractmethod
44 async def close(self) -> None:
45 """Close the HTTP client."""
46 pass
49class IDataProcessor(ABC):
50 """Interface for data processing operations."""
52 @abstractmethod
53 def process_moments(self, raw_data: list[dict[str, Any]]) -> list[Moment]:
54 """Process raw moments data."""
55 pass
57 @abstractmethod
58 def process_highlights(self, raw_data: list[dict[str, Any]]) -> list[Any]:
59 """Process raw highlights data."""
60 pass
62 @abstractmethod
63 def process_verse_of_the_day(
64 self, raw_data: dict[str, Any], day: int | None = None
65 ) -> Any:
66 """Process verse of the day data."""
67 pass
69 @abstractmethod
70 def process_bible_version(self, raw_data: dict[str, Any]) -> Any:
71 """Process raw Bible version data."""
72 pass
74 @abstractmethod
75 def process_bible_versions(self, raw_data: dict[str, Any]) -> dict[str, Any]:
76 """Process raw Bible versions data."""
77 pass
79 @abstractmethod
80 def process_bible_chapter(self, raw_data: dict[str, Any]) -> Any:
81 """Process raw Bible chapter data."""
82 pass
84 @abstractmethod
85 def process_audio_chapter(
86 self, raw_data: dict[str, Any] | list[dict[str, Any]]
87 ) -> Any:
88 """Process raw audio chapter data."""
89 pass
91 @abstractmethod
92 def process_audio_version(self, raw_data: dict[str, Any]) -> Any:
93 """Process raw audio version data."""
94 pass
96 @abstractmethod
97 def process_bible_configuration(self, raw_data: dict[str, Any]) -> dict[str, Any]:
98 """Process raw Bible configuration data."""
99 pass
101 @abstractmethod
102 def process_recommended_languages(self, raw_data: dict[str, Any]) -> dict[str, Any]:
103 """Process raw recommended languages data."""
104 pass
106 @abstractmethod
107 def process_search_plans(self, raw_data: dict[str, Any]) -> dict[str, Any]:
108 """Process raw plan search results data."""
109 pass
111 @abstractmethod
112 def process_search_users(self, raw_data: dict[str, Any]) -> dict[str, Any]:
113 """Process raw user search results data."""
114 pass
116 @abstractmethod
117 def process_videos(self, raw_data: dict[str, Any]) -> dict[str, Any]:
118 """Process raw videos data."""
119 pass
121 @abstractmethod
122 def process_video_details(self, raw_data: dict[str, Any]) -> dict[str, Any]:
123 """Process raw video details data."""
124 pass
126 @abstractmethod
127 def process_image_upload_url(self, raw_data: dict[str, Any]) -> dict[str, Any]:
128 """Process raw image upload URL data."""
129 pass
131 @abstractmethod
132 def process_search_events(self, raw_data: dict[str, Any]) -> dict[str, Any]:
133 """Process raw event search results data."""
134 pass
136 @abstractmethod
137 def process_event_details(self, raw_data: dict[str, Any]) -> dict[str, Any]:
138 """Process raw event details data."""
139 pass
141 @abstractmethod
142 def process_saved_events(self, raw_data: dict[str, Any]) -> dict[str, Any]:
143 """Process raw saved events data."""
144 pass
146 @abstractmethod
147 def process_moments_list(self, raw_data: dict[str, Any]) -> dict[str, Any]:
148 """Process raw moments list data."""
149 pass
151 @abstractmethod
152 def process_moment_details(self, raw_data: dict[str, Any]) -> dict[str, Any]:
153 """Process raw moment details data."""
154 pass
156 @abstractmethod
157 def process_moment_colors(self, raw_data: dict[str, Any]) -> dict[str, Any]:
158 """Process raw moment colors data."""
159 pass
161 @abstractmethod
162 def process_moment_labels(self, raw_data: dict[str, Any]) -> dict[str, Any]:
163 """Process raw moment labels data."""
164 pass
166 @abstractmethod
167 def process_verse_colors(self, raw_data: dict[str, Any]) -> dict[str, Any]:
168 """Process raw verse colors data."""
169 pass
171 @abstractmethod
172 def process_moments_configuration(self, raw_data: dict[str, Any]) -> dict[str, Any]:
173 """Process raw moments configuration data."""
174 pass
176 @abstractmethod
177 def process_themes(self, raw_data: dict[str, Any]) -> dict[str, Any]:
178 """Process raw themes data."""
179 pass
181 @abstractmethod
182 def process_theme_description(self, raw_data: dict[str, Any]) -> dict[str, Any]:
183 """Process raw theme description data."""
184 pass
186 @abstractmethod
187 def process_event_configuration(self, raw_data: dict[str, Any]) -> dict[str, Any]:
188 """Process raw event configuration data."""
189 pass
191 @abstractmethod
192 def process_all_saved_event_ids(self, raw_data: dict[str, Any]) -> dict[str, Any]:
193 """Process raw all saved event IDs data."""
194 pass
197class IClient(ABC):
198 """Interface for YouVersion API client."""
200 @property
201 @abstractmethod
202 def user_id(self) -> int | None:
203 """Get the authenticated user ID."""
204 pass
206 @abstractmethod
207 async def moments(self, page: int = 1) -> list[Moment]:
208 """Get moments."""
209 pass
211 @abstractmethod
212 async def highlights(self, page: int = 1) -> list[Any]:
213 """Get highlights."""
214 pass
216 @abstractmethod
217 async def verse_of_the_day(self, day: int | None = None) -> Any:
218 """Get verse of the day."""
219 pass
221 @abstractmethod
222 async def notes(self, page: int = 1) -> list[Any]:
223 """Get notes."""
224 pass
226 @abstractmethod
227 async def bookmarks(self, page: int = 1) -> list[Any]:
228 """Get bookmarks."""
229 pass
231 @abstractmethod
232 async def my_images(self, page: int = 1) -> list[Any]:
233 """Get images."""
234 pass
236 @abstractmethod
237 async def plan_progress(self, page: int = 1) -> list[Any]:
238 """Get plan progress."""
239 pass
241 @abstractmethod
242 async def plan_subscriptions(self, page: int = 1) -> list[Any]:
243 """Get plan subscriptions."""
244 pass
246 @abstractmethod
247 async def plan_completions(self, page: int = 1) -> list[Any]:
248 """Get plan completions."""
249 pass
251 @abstractmethod
252 async def convert_note_to_md(self) -> list[Any]:
253 """Convert notes to markdown."""
254 pass
256 @abstractmethod
257 async def send_friend_request(self, user_id: int) -> dict[str, Any]:
258 """Send a friend request to a user."""
259 pass