Skip to content

Commit 4afbe45

Browse files
committed
fix: Fix return type on index counts method
1 parent 6379e35 commit 4afbe45

File tree

1 file changed

+74
-4
lines changed

1 file changed

+74
-4
lines changed

asknews_sdk/api/news.py

Lines changed: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,43 @@ def get_index_counts(
278278
sentiment: Optional[Literal["negative", "neutral", "positive"]] = None,
279279
*,
280280
http_headers: Optional[Dict] = None,
281-
) -> SearchResponse:
282-
""" """
281+
) -> IndexCountsResponse:
282+
"""
283+
Get index counts over time.
284+
285+
https://docs.asknews.app/en/reference#get-/v1/index_counts
286+
287+
:param start_datetime: The start datetime.
288+
:type start_datetime: datetime
289+
:param end_datetime: The end datetime.
290+
:type end_datetime: datetime
291+
:param time_filter: The time filter.
292+
:type time_filter: Literal["crawl_date", "pub_date"]
293+
:param categories: The categories.
294+
:type categories: Optional[List[
295+
Literal[
296+
"All", "Business", "Crime", "Politics", "Science", "Sports",
297+
"Technology", "Military", "Health", "Entertainment", "Finance",
298+
"Culture", "Climate", "Environment", "World"
299+
]
300+
]]
301+
:param sampling: The sampling.
302+
:type sampling: Literal["5m", "1h", "12h", "1d", "1w", "1m"]
303+
:param provocative: The provocative filter.
304+
:type provocative: Optional[str]
305+
:param reporting_voice: The reporting voice filter.
306+
:type reporting_voice: Optional[Union[List[str], str]]
307+
:param domains: The domains filter.
308+
:type domains: Optional[Union[List[str], str]]
309+
:param bad_domain_url: The bad domain URL filter.
310+
:type bad_domain_url: Optional[Union[List[str], str]]
311+
:param page_rank: The page rank filter.
312+
:type page_rank: Optional[int]
313+
:param http_headers: Additional HTTP headers.
314+
:type http_headers: Optional[Dict]
315+
:return: The index counts response.
316+
:rtype: IndexCountsResponse
317+
"""
283318
print(f" Datetimes {start_datetime.isoformat()}, {end_datetime.isoformat()}")
284319
response = self.client.request(
285320
method="GET",
@@ -688,8 +723,43 @@ async def get_index_counts(
688723
sentiment: Optional[Literal["negative", "neutral", "positive"]] = None,
689724
*,
690725
http_headers: Optional[Dict] = None,
691-
) -> SearchResponse:
692-
""" """
726+
) -> IndexCountsResponse:
727+
"""
728+
Get index counts over time.
729+
730+
https://docs.asknews.app/en/reference#get-/v1/index_counts
731+
732+
:param start_datetime: The start datetime.
733+
:type start_datetime: datetime
734+
:param end_datetime: The end datetime.
735+
:type end_datetime: datetime
736+
:param time_filter: The time filter.
737+
:type time_filter: Literal["crawl_date", "pub_date"]
738+
:param categories: The categories.
739+
:type categories: Optional[List[
740+
Literal[
741+
"All", "Business", "Crime", "Politics", "Science", "Sports",
742+
"Technology", "Military", "Health", "Entertainment", "Finance",
743+
"Culture", "Climate", "Environment", "World"
744+
]
745+
]]
746+
:param sampling: The sampling.
747+
:type sampling: Literal["5m", "1h", "12h", "1d", "1w", "1m"]
748+
:param provocative: The provocative filter.
749+
:type provocative: Optional[str]
750+
:param reporting_voice: The reporting voice filter.
751+
:type reporting_voice: Optional[Union[List[str], str]]
752+
:param domains: The domains filter.
753+
:type domains: Optional[Union[List[str], str]]
754+
:param bad_domain_url: The bad domain URL filter.
755+
:type bad_domain_url: Optional[Union[List[str], str]]
756+
:param page_rank: The page rank filter.
757+
:type page_rank: Optional[int]
758+
:param http_headers: Additional HTTP headers.
759+
:type http_headers: Optional[Dict]
760+
:return: The index counts response.
761+
:rtype: IndexCountsResponse
762+
"""
693763
response = await self.client.request(
694764
method="GET",
695765
endpoint="/v1/index_counts",

0 commit comments

Comments
 (0)