|
1 | | -from typing import Dict, TypeVar, Optional |
| 1 | +from typing import Dict, TypeVar, Optional, List, Tuple |
2 | 2 | from datetime import datetime |
3 | 3 | from os import path, getcwd |
4 | 4 | from shutil import copyfileobj |
@@ -407,3 +407,24 @@ def get_verse_of_the_day(self, day: int = current_day_of_year()) -> VerseOfTheDa |
407 | 407 | } |
408 | 408 | ) |
409 | 409 | ) |
| 410 | + |
| 411 | + def get_all_verse_of_the_days(self, limit: int = 366, page: int = 1) -> Tuple[bool, int, Optional[List[VerseOfTheDay]]]: |
| 412 | + """ |
| 413 | + Gets multiple verse of the day objects |
| 414 | +
|
| 415 | + :param limit: Currently not used (see issue: https://github.com/lifechurch/youversion-public-api-docs/issues/7) |
| 416 | + :param page: Currently not used (see issue: https://github.com/lifechurch/youversion-public-api-docs/issues/7) |
| 417 | + :return: tuple[bool, int, list of VerseOfTheDay]. |
| 418 | + bool indicates if another page is available, if results are paginated |
| 419 | + int the number of VerseOfTheDay objects contained in the response |
| 420 | + list of VerseOfTheDay objects |
| 421 | + """ |
| 422 | + json = self._get('verse_of_the_day', params={'version_id': self.bible_version.id}) |
| 423 | + if not json or 'data' not in json: |
| 424 | + return False, 0, None |
| 425 | + |
| 426 | + votds = [VerseOfTheDay(bible_version=self.bible_version, json=data) for data in json.get('data', [])] |
| 427 | + next_page = json.get('next_page', False) |
| 428 | + page_size = json.get('page_size', len(votds)) |
| 429 | + |
| 430 | + return next_page, page_size, votds |
0 commit comments