Coverage for youversion/models/__init__.py: 100%
15 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
1from typing import Any, Optional, Protocol
3try:
4 from typing import TypeAlias
5except ImportError:
6 # Python < 3.10 compatibility
7 from typing import TypeAlias
9from youversion.models.base import Moment, MomentProtocol, Reference, ReferenceProtocol
11# Import new model classes
12from .bible import (
13 Book,
14 Chapter,
15 ChapterContent,
16 Configuration,
17 Language,
18 Publisher,
19 RecommendedLanguages,
20 Version,
21)
22from .common import (
23 ApiError,
24 ApiErrors,
25 ApiResponse,
26 Avatar,
27 Images,
28 Link,
29 Localize,
30 PaginationInfo,
31 UserBase,
32)
33from .events import (
34 Event,
35 EventConfiguration,
36 EventContent,
37 EventLocation,
38 EventTime,
39 SavedEvent,
40 SavedEvents,
41 SearchEvent,
42 SearchEvents,
43)
44from .friends import (
45 Contact,
46 Contacts,
47 Friend,
48 Friendable,
49 Friendables,
50 FriendOffer,
51 Friends,
52 Offers,
53)
54from .moments import CreateMoment, ReferenceCreate
57class VotdProtocol(Protocol):
58 """Protocol for verse of the day objects."""
60 day: int
61 image_id: str | None
62 usfm: list[str] | None
64 def __getattr__(self, name: str) -> Any:
65 """Allow access to dynamically added fields."""
66 class_name = self.__class__.__name__
67 raise AttributeError(f"'{class_name}' has no attribute '{name}'")
70# Type alias for convenience
71Votd: TypeAlias = VotdProtocol
74# Export all models
75__all__ = [
76 # Verse of the day
77 "Votd",
78 "VotdProtocol",
79 # Reference (used for Bible references)
80 "Reference",
81 "ReferenceProtocol",
82 # Moment Protocol (for dynamically created moments)
83 "Moment",
84 "MomentProtocol",
85 # Bible models
86 "Book",
87 "Chapter",
88 "ChapterContent",
89 "Configuration",
90 "Language",
91 "Publisher",
92 "RecommendedLanguages",
93 "Version",
94 # Friends models
95 "Contact",
96 "Contacts",
97 "Friend",
98 "FriendOffer",
99 "Friendable",
100 "Friendables",
101 "Friends",
102 "Offers",
103 # Events models
104 "Event",
105 "EventConfiguration",
106 "EventContent",
107 "EventLocation",
108 "EventTime",
109 "SavedEvent",
110 "SavedEvents",
111 "SearchEvent",
112 "SearchEvents",
113 # Common models
114 "ApiError",
115 "ApiErrors",
116 "ApiResponse",
117 "Avatar",
118 "Images",
119 "Link",
120 "Localize",
121 "PaginationInfo",
122 "UserBase",
123 # Moment creation models
124 "CreateMoment",
125 "ReferenceCreate",
126]