I am using the Python API library and running into a small bug. The `IN` operator for the CRM objects search API (and all CRM search APIs, I think) is not supported because the parameters for the `Filter` constructor does not include `values`, only `value`. In order for the search API to process the `IN` operator, it must be passed with the key `values` and have a list of strings assigned to it. I imagine this is because the Open API spec does not include that part of the spec (I had to figure it out by guessing in my Postman collection).
I’ll work around this issue, but wanted to get some one aware as I do not know how to report this bug to Hubspot so figured I’d start here.
Upon further work, this also affects the “BETWEEN” operator because the Filter object does not have an attribute called “high_value” which is needed by the API to process that kind of search (again found by trial and error via Postman requests).
If anyone happens to stumble upon this post with the same problem, I was able to successfully extend the `Filter` object like so:
class ExtendedFilter(Filter):
openapi_types = {
"value": "str",
"values": "list",
"high_value": "str",
"property_name": "str",
"operator": "str",
}
attribute_map = {
"value": "value",
"values": "values",
"high_value": "highValue",
"property_name": "propertyName",
"operator": "operator",
}
def __init__(
self,
value=None,
values=None,
high_value=None,
property_name=None,
operator=None,
local_vars_configuration=None,
):
if value and values:
raise ValueError(
"You cannot construct a Filter with both `value` and `values`."
)
super().__init__(value, property_name, operator, local_vars_configuration)
self._values = None
self._high_value = None
if values is not None:
self.values = values
if high_value is not None:
self.high_value = high_value
@property
def values(self):
return self._values
@values.setter
def values(self, values):
self._values = values
if values is not None:
self.value = None
@property
def value(self):
return self._value
@value.setter
def value(self, value):
self._value = value
if value is not None:
self.values = None
@property
def high_value(self):
return self._high_value
@high_value.setter
def high_value(self, high_value):
self._high_value = high_value
if high_value is not None:
self.values = None
if self._value is None:
self._value = 0
def __eq__(self, other):
if not isinstance(other, ExtendedFilter):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
if not isinstance(other, ExtendedFilter):
return True
return self.to_dict() != other.to_dict()