Skip to content

Commit ab63c6a

Browse files
authored
Merge pull request gooddata#1335 from jeskepetr/PJE/LX-2081
feat: Introduce AllTimeDateFilter and date filter emptyValueHandling
2 parents 0aece7f + e138f10 commit ab63c6a

22 files changed

+1040
-35
lines changed

gooddata-api-client/gooddata_api_client/model/absolute_date_filter_absolute_date_filter.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ class AbsoluteDateFilterAbsoluteDateFilter(ModelNormal):
6060
"""
6161

6262
allowed_values = {
63+
('empty_value_handling',): {
64+
'INCLUDE': "INCLUDE",
65+
'EXCLUDE': "EXCLUDE",
66+
'ONLY': "ONLY",
67+
},
6368
}
6469

6570
validations = {
@@ -99,6 +104,7 @@ def openapi_types():
99104
lazy_import()
100105
return {
101106
'dataset': (AfmObjectIdentifierDataset,), # noqa: E501
107+
'empty_value_handling': (str,), # noqa: E501
102108
'_from': (str,), # noqa: E501
103109
'to': (str,), # noqa: E501
104110
'apply_on_result': (bool,), # noqa: E501
@@ -112,6 +118,7 @@ def discriminator():
112118

113119
attribute_map = {
114120
'dataset': 'dataset', # noqa: E501
121+
'empty_value_handling': 'emptyValueHandling', # noqa: E501
115122
'_from': 'from', # noqa: E501
116123
'to': 'to', # noqa: E501
117124
'apply_on_result': 'applyOnResult', # noqa: E501

gooddata-api-client/gooddata_api_client/model/afm_filters_inner.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
def lazy_import():
3434
from gooddata_api_client.model.absolute_date_filter_absolute_date_filter import AbsoluteDateFilterAbsoluteDateFilter
35+
from gooddata_api_client.model.all_time_date_filter_all_time_date_filter import AllTimeDateFilterAllTimeDateFilter
3536
from gooddata_api_client.model.abstract_measure_value_filter import AbstractMeasureValueFilter
3637
from gooddata_api_client.model.comparison_measure_value_filter_comparison_measure_value_filter import ComparisonMeasureValueFilterComparisonMeasureValueFilter
3738
from gooddata_api_client.model.compound_measure_value_filter_compound_measure_value_filter import CompoundMeasureValueFilterCompoundMeasureValueFilter
@@ -45,6 +46,7 @@ def lazy_import():
4546
from gooddata_api_client.model.ranking_filter_ranking_filter import RankingFilterRankingFilter
4647
from gooddata_api_client.model.relative_date_filter_relative_date_filter import RelativeDateFilterRelativeDateFilter
4748
globals()['AbsoluteDateFilterAbsoluteDateFilter'] = AbsoluteDateFilterAbsoluteDateFilter
49+
globals()['AllTimeDateFilterAllTimeDateFilter'] = AllTimeDateFilterAllTimeDateFilter
4850
globals()['AbstractMeasureValueFilter'] = AbstractMeasureValueFilter
4951
globals()['ComparisonMeasureValueFilterComparisonMeasureValueFilter'] = ComparisonMeasureValueFilterComparisonMeasureValueFilter
5052
globals()['CompoundMeasureValueFilterCompoundMeasureValueFilter'] = CompoundMeasureValueFilterCompoundMeasureValueFilter
@@ -110,6 +112,7 @@ def openapi_types():
110112
'compound_measure_value_filter': (CompoundMeasureValueFilterCompoundMeasureValueFilter,), # noqa: E501
111113
'ranking_filter': (RankingFilterRankingFilter,), # noqa: E501
112114
'absolute_date_filter': (AbsoluteDateFilterAbsoluteDateFilter,), # noqa: E501
115+
'all_time_date_filter': (AllTimeDateFilterAllTimeDateFilter,), # noqa: E501
113116
'relative_date_filter': (RelativeDateFilterRelativeDateFilter,), # noqa: E501
114117
'negative_attribute_filter': (NegativeAttributeFilterNegativeAttributeFilter,), # noqa: E501
115118
'positive_attribute_filter': (PositiveAttributeFilterPositiveAttributeFilter,), # noqa: E501
@@ -128,6 +131,7 @@ def discriminator():
128131
'compound_measure_value_filter': 'compoundMeasureValueFilter', # noqa: E501
129132
'ranking_filter': 'rankingFilter', # noqa: E501
130133
'absolute_date_filter': 'absoluteDateFilter', # noqa: E501
134+
'all_time_date_filter': 'allTimeDateFilter', # noqa: E501
131135
'relative_date_filter': 'relativeDateFilter', # noqa: E501
132136
'negative_attribute_filter': 'negativeAttributeFilter', # noqa: E501
133137
'positive_attribute_filter': 'positiveAttributeFilter', # noqa: E501
Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
"""
2+
OpenAPI definition
3+
4+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
5+
6+
The version of the OpenAPI document: v0
7+
Contact: support@gooddata.com
8+
Generated by: https://openapi-generator.tech
9+
"""
10+
11+
12+
import re # noqa: F401
13+
import sys # noqa: F401
14+
15+
from gooddata_api_client.model_utils import ( # noqa: F401
16+
ApiTypeError,
17+
ModelComposed,
18+
ModelNormal,
19+
ModelSimple,
20+
cached_property,
21+
change_keys_js_to_python,
22+
convert_js_args_to_python_args,
23+
date,
24+
datetime,
25+
file_type,
26+
none_type,
27+
validate_get_composed_info,
28+
OpenApiModel,
29+
)
30+
from gooddata_api_client.exceptions import ApiAttributeError
31+
32+
33+
def lazy_import():
34+
from gooddata_api_client.model.all_time_date_filter_all_time_date_filter import AllTimeDateFilterAllTimeDateFilter
35+
36+
globals()["AllTimeDateFilterAllTimeDateFilter"] = AllTimeDateFilterAllTimeDateFilter
37+
38+
39+
class AllTimeDateFilter(ModelNormal):
40+
"""NOTE: This class is auto generated by OpenAPI Generator.
41+
Ref: https://openapi-generator.tech
42+
43+
Do not edit the class manually.
44+
45+
Attributes:
46+
allowed_values (dict): The key is the tuple path to the attribute
47+
and the for var_name this is (var_name,). The value is a dict
48+
with a capitalized key describing the allowed value and an allowed
49+
value. These dicts store the allowed enum values.
50+
attribute_map (dict): The key is attribute name
51+
and the value is json key in definition.
52+
discriminator_value_class_map (dict): A dict to go from the discriminator
53+
variable value to the discriminator class name.
54+
validations (dict): The key is the tuple path to the attribute
55+
and the for var_name this is (var_name,). The value is a dict
56+
that stores validations for max_length, min_length, max_items,
57+
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
58+
inclusive_minimum, and regex.
59+
additional_properties_type (tuple): A tuple of classes accepted
60+
as additional properties values.
61+
"""
62+
63+
allowed_values = {}
64+
validations = {}
65+
66+
@cached_property
67+
def additional_properties_type():
68+
"""
69+
This must be a method because a model may have properties that are
70+
of type self, this must run after the class is loaded
71+
"""
72+
lazy_import()
73+
return (bool, date, datetime, dict, float, int, list, str, none_type) # noqa: E501
74+
75+
_nullable = False
76+
77+
@cached_property
78+
def openapi_types():
79+
"""
80+
This must be a method because a model may have properties that are
81+
of type self, this must run after the class is loaded
82+
83+
Returns
84+
openapi_types (dict): The key is attribute name
85+
and the value is attribute type.
86+
"""
87+
lazy_import()
88+
return {
89+
"all_time_date_filter": (AllTimeDateFilterAllTimeDateFilter,), # noqa: E501
90+
}
91+
92+
@cached_property
93+
def discriminator():
94+
return None
95+
96+
attribute_map = {
97+
"all_time_date_filter": "allTimeDateFilter", # noqa: E501
98+
}
99+
100+
read_only_vars = {}
101+
102+
_composed_schemas = {}
103+
104+
@classmethod
105+
@convert_js_args_to_python_args
106+
def _from_openapi_data(cls, all_time_date_filter, *args, **kwargs): # noqa: E501
107+
"""AllTimeDateFilter - a model defined in OpenAPI
108+
109+
Args:
110+
all_time_date_filter (AllTimeDateFilterAllTimeDateFilter):
111+
112+
Keyword Args:
113+
_check_type (bool): if True, values for parameters in openapi_types
114+
will be type checked and a TypeError will be
115+
raised if the wrong type is input.
116+
Defaults to True
117+
_path_to_item (tuple/list): This is a list of keys or values to
118+
drill down to the model in received_data
119+
when deserializing a response
120+
_spec_property_naming (bool): True if the variable names in the input data
121+
are serialized names, as specified in the OpenAPI document.
122+
False if the variable names in the input data
123+
are pythonic names, e.g. snake case (default)
124+
_configuration (Configuration): the instance to use when
125+
deserializing a file_type parameter.
126+
If passed, type conversion is attempted
127+
If omitted no type conversion is done.
128+
_visited_composed_classes (tuple): This stores a tuple of
129+
classes that we have traveled through so that
130+
if we see that class again we will not use its
131+
discriminator again.
132+
When traveling through a discriminator, the
133+
composed schema that is
134+
is traveled through is added to this set.
135+
For example if Animal has a discriminator
136+
petType and we pass in "Dog", and the class Dog
137+
allOf includes Animal, we move through Animal
138+
once using the discriminator, and pick Dog.
139+
Then in Dog, we will make an instance of the
140+
Animal class but this time we won't travel
141+
through its discriminator because we passed in
142+
_visited_composed_classes = (Animal,)
143+
"""
144+
145+
_check_type = kwargs.pop("_check_type", True)
146+
_spec_property_naming = kwargs.pop("_spec_property_naming", True)
147+
_path_to_item = kwargs.pop("_path_to_item", ())
148+
_configuration = kwargs.pop("_configuration", None)
149+
_visited_composed_classes = kwargs.pop("_visited_composed_classes", ())
150+
151+
self = super(OpenApiModel, cls).__new__(cls)
152+
153+
if args:
154+
for arg in args:
155+
if isinstance(arg, dict):
156+
kwargs.update(arg)
157+
else:
158+
raise ApiTypeError(
159+
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments."
160+
% (
161+
args,
162+
self.__class__.__name__,
163+
),
164+
path_to_item=_path_to_item,
165+
valid_classes=(self.__class__,),
166+
)
167+
168+
self._data_store = {}
169+
self._check_type = _check_type
170+
self._spec_property_naming = _spec_property_naming
171+
self._path_to_item = _path_to_item
172+
self._configuration = _configuration
173+
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
174+
175+
self.all_time_date_filter = all_time_date_filter
176+
for var_name, var_value in kwargs.items():
177+
if (
178+
var_name not in self.attribute_map
179+
and self._configuration is not None
180+
and self._configuration.discard_unknown_keys
181+
and self.additional_properties_type is None
182+
):
183+
# discard variable.
184+
continue
185+
setattr(self, var_name, var_value)
186+
return self
187+
188+
required_properties = {
189+
"_data_store",
190+
"_check_type",
191+
"_spec_property_naming",
192+
"_path_to_item",
193+
"_configuration",
194+
"_visited_composed_classes",
195+
}
196+
197+
@convert_js_args_to_python_args
198+
def __init__(self, all_time_date_filter, *args, **kwargs): # noqa: E501
199+
"""AllTimeDateFilter - a model defined in OpenAPI
200+
201+
Args:
202+
all_time_date_filter (AllTimeDateFilterAllTimeDateFilter):
203+
204+
Keyword Args:
205+
_check_type (bool): if True, values for parameters in openapi_types
206+
will be type checked and a TypeError will be
207+
raised if the wrong type is input.
208+
Defaults to True
209+
_path_to_item (tuple/list): This is a list of keys or values to
210+
drill down to the model in received_data
211+
when deserializing a response
212+
_spec_property_naming (bool): True if the variable names in the input data
213+
are serialized names, as specified in the OpenAPI document.
214+
False if the variable names in the input data
215+
are pythonic names, e.g. snake case (default)
216+
_configuration (Configuration): the instance to use when
217+
deserializing a file_type parameter.
218+
If passed, type conversion is attempted
219+
If omitted no type conversion is done.
220+
_visited_composed_classes (tuple): This stores a tuple of
221+
classes that we have traveled through so that
222+
if we see that class again we will not use its
223+
discriminator again.
224+
When traveling through a discriminator, the
225+
composed schema that is
226+
is traveled through is added to this set.
227+
For example if Animal has a discriminator
228+
petType and we pass in "Dog", and the class Dog
229+
allOf includes Animal, we move through Animal
230+
once using the discriminator, and pick Dog.
231+
Then in Dog, we will make an instance of the
232+
Animal class but this time we won't travel
233+
through its discriminator because we passed in
234+
_visited_composed_classes = (Animal,)
235+
"""
236+
237+
_check_type = kwargs.pop("_check_type", True)
238+
_spec_property_naming = kwargs.pop("_spec_property_naming", False)
239+
_path_to_item = kwargs.pop("_path_to_item", ())
240+
_configuration = kwargs.pop("_configuration", None)
241+
_visited_composed_classes = kwargs.pop("_visited_composed_classes", ())
242+
243+
if args:
244+
for arg in args:
245+
if isinstance(arg, dict):
246+
kwargs.update(arg)
247+
else:
248+
raise ApiTypeError(
249+
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments."
250+
% (
251+
args,
252+
self.__class__.__name__,
253+
),
254+
path_to_item=_path_to_item,
255+
valid_classes=(self.__class__,),
256+
)
257+
258+
self._data_store = {}
259+
self._check_type = _check_type
260+
self._spec_property_naming = _spec_property_naming
261+
self._path_to_item = _path_to_item
262+
self._configuration = _configuration
263+
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
264+
265+
self.all_time_date_filter = all_time_date_filter
266+
for var_name, var_value in kwargs.items():
267+
if (
268+
var_name not in self.attribute_map
269+
and self._configuration is not None
270+
and self._configuration.discard_unknown_keys
271+
and self.additional_properties_type is None
272+
):
273+
# discard variable.
274+
continue
275+
setattr(self, var_name, var_value)
276+
if var_name in self.read_only_vars:
277+
raise ApiAttributeError(
278+
f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
279+
f"class with read only attributes."
280+
)
281+

0 commit comments

Comments
 (0)