33Fred API for Releases Namespace.
44"""
55from .fred_client import FredClient
6+ from ..util .decorators import validate_api_args
67
78
89class FredAPIReleases (FredClient ):
@@ -21,58 +22,112 @@ class FredAPIReleases(FredClient):
2122 fred/release/tables - Get the release tables for a given release.
2223 """
2324
25+ @validate_api_args (
26+ "api_key" , "file_type" , "realtime_start" , "realtime_end" , "limit" , "offset" , "order_by" , "sort_order"
27+ )
2428 def get_releases (self , ** kwargs ) -> dict :
2529 """Get releases."""
26- return self ._get (f"releases" , {
27- ** kwargs ,
28- })
30+ return self ._get (f"releases" , {** kwargs ,})
2931
32+ @validate_api_args (
33+ "api_key" ,
34+ "file_type" ,
35+ "realtime_start" ,
36+ "realtime_end" ,
37+ "limit" ,
38+ "offset" ,
39+ "order_by" ,
40+ "sort_order" ,
41+ "include_release_dates_with_no_data" ,
42+ )
3043 def get_releases_dates (self , ** kwargs ) -> dict :
3144 """Get releases dates."""
32- return self ._get (f"releases/dates" , {
33- ** kwargs ,
34- })
45+ return self ._get (f"releases/dates" , {** kwargs ,})
3546
36- def get_release (self , release_id : int = None , ** kwargs ) -> dict :
47+ @validate_api_args ("api_key" , "release_id" , "file_type" , "realtime_start" , "realtime_end" )
48+ def get_release (self , release_id : int , ** kwargs ) -> dict :
3749 """Get release by ID."""
38- return self ._get (f"release" , {
39- "release_id" : release_id ,
40- ** kwargs ,
41- })
50+ return self ._get (f"release" , {"release_id" : release_id , ** kwargs ,})
4251
43- def get_release_dates (self , release_id : int = None , ** kwargs ) -> dict :
52+ @validate_api_args (
53+ "api_key" ,
54+ "release_id" ,
55+ "file_type" ,
56+ "realtime_start" ,
57+ "realtime_end" ,
58+ "limit" ,
59+ "offset" ,
60+ "sort_order" ,
61+ "include_release_dates_with_no_data" ,
62+ )
63+ def get_release_dates (self , release_id : int , ** kwargs ) -> dict :
4464 """Get release dates by ID."""
45- return self ._get (f"release/dates" , {
46- "release_id" : release_id ,
47- ** kwargs ,
48- })
65+ return self ._get (f"release/dates" , {"release_id" : release_id , ** kwargs ,})
4966
50- def get_release_series (self , release_id : int = None , ** kwargs ) -> dict :
67+ @validate_api_args (
68+ "api_key" ,
69+ "file_type" ,
70+ "release_id" ,
71+ "realtime_start" ,
72+ "realtime_end" ,
73+ "limit" ,
74+ "offset" ,
75+ "order_by" ,
76+ "sort_order" ,
77+ "filter_variable" ,
78+ "filter_value" ,
79+ "tag_names" ,
80+ "exclude_tag_names" ,
81+ )
82+ def get_release_series (self , release_id : int , ** kwargs ) -> dict :
5183 """Get release series by ID."""
52- return self ._get (f"release/series" , {
53- "release_id" : release_id ,
54- ** kwargs ,
55- })
84+ return self ._get (f"release/series" , {"release_id" : release_id , ** kwargs ,})
5685
57- def get_release_sources (self , release_id : int = None , ** kwargs ) -> dict :
86+ @validate_api_args ("api_key" , "file_type" , "release_id" , "realtime_start" , "realtime_end" )
87+ def get_release_sources (self , release_id : int , ** kwargs ) -> dict :
5888 """Get release sources by ID."""
59- return self ._get (f"release/sources" , {
60- "release_id" : release_id ,
61- ** kwargs ,
62- })
89+ return self ._get (f"release/sources" , {"release_id" : release_id , ** kwargs ,})
6390
64- def get_release_tags (self , release_id : int = None , ** kwargs ) -> dict :
91+ @validate_api_args (
92+ "api_key" ,
93+ "file_type" ,
94+ "release_id" ,
95+ "realtime_start" ,
96+ "realtime_end" ,
97+ "tag_names" ,
98+ "tag_group_id" ,
99+ "search_text" ,
100+ "limit" ,
101+ "offset" ,
102+ "order_by" ,
103+ "sort_order" ,
104+ )
105+ def get_release_tags (self , release_id : int , ** kwargs ) -> dict :
65106 """Get release tags by ID."""
66- raise NotImplementedError ( "get_release_tags endpoint is not yet implemented." )
107+ return self . _get ( f"release/tags" , { "release_id" : release_id , ** kwargs ,} )
67108
68- def get_release_related_tags (self , release_id : int = None , ** kwargs ) -> dict :
109+ @validate_api_args (
110+ "api_key" ,
111+ "file_type" ,
112+ "release_id" ,
113+ "realtime_start" ,
114+ "realtime_end" ,
115+ "tag_names" ,
116+ "exclude_tag_names" ,
117+ "tag_group_id" ,
118+ "search_text" ,
119+ "limit" ,
120+ "offset" ,
121+ "order_by" ,
122+ "sort_order" ,
123+ )
124+ def get_release_related_tags (self , release_id : int , tag_names : str , ** kwargs ) -> dict :
69125 """Get release related tags by ID."""
70- raise NotImplementedError ( "get_release_related_tags endpoint is not yet implemented." )
126+ return self . _get ( f"release/related_tags" , { "release_id" : release_id , "tag_names" : tag_names , ** kwargs ,} )
71127
72- def get_release_tables (self , release_id : int = None , element_id : int = None , ** kwargs ) -> dict :
128+ @validate_api_args (
129+ "api_key" , "file_type" , "release_id" , "element_id" , "include_observation_values" , "observation_date"
130+ )
131+ def get_release_tables (self , release_id : int , element_id : int = None , ** kwargs ) -> dict :
73132 """Get release tables by ID."""
74- return self ._get (f"release/tables" , {
75- "release_id" : release_id ,
76- "element_id" : element_id ,
77- ** kwargs ,
78- })
133+ return self ._get (f"release/tables" , {"release_id" : release_id , "element_id" : element_id , ** kwargs ,})
0 commit comments