helpscout.domain package¶
Module contents¶
-
class
helpscout.domain.Domain(queries=None, join_with='AND')[source]¶ Bases:
properties.base.base.HasPropertiesThis represents a full search query.
-
AND= 'AND'¶
-
OR= 'OR'¶
-
add_query(query, join_with='AND')[source]¶ Join a new query to existing queries on the stack.
Parameters: - query (tuple or list or DomainCondition) – The condition for the
query. If a
DomainConditionobject is not provided, the input should conform to the interface defined infrom_tuple(). - join_with (str) – The join string to apply, if other queries are already on the stack.
- query (tuple or list or DomainCondition) – The condition for the
query. If a
-
classmethod
from_tuple(queries)[source]¶ Create a
Domaingiven a set of complex query tuples.Parameters: queries (iter) – An iterator of complex queries. Each iteration should contain either:
- A data-set compatible with
add_query() - A string to switch the join type
Example:
[('subject', 'Test1'), 'OR', ('subject', 'Test2')', ('subject', 'Test3')', ] # The above is equivalent to: # subject:'Test1' OR subject:'Test2' OR subject:'Test3' [('modified_at', datetime(2017, 01, 01)), ('status', 'active'), ] # The above is equivalent to: # modified_at:[2017-01-01T00:00:00Z TO *] # AND status:"active"
Returns: A domain representing the input queries. Return type: Domain - A data-set compatible with
-
-
class
helpscout.domain.DomainCondition(field, value, **kwargs)[source]¶ Bases:
properties.base.base.HasPropertiesThis represents one condition of a domain query.
Required Properties:
-
field¶ Field to search on
-
field_name¶ Return the name of the API field.
-
classmethod
from_tuple(query)[source]¶ Create a condition from a query tuple.
Parameters: query (tuple or list) – Tuple or list that contains a query domain in the format of (field_name, field_value, field_value_to).field_value_tois only applicable in the case of a date search.Returns: - An instance of a domain condition. The specific
- type will depend on the data type of the first value provided
in
query.
Return type: DomainCondition
-
value¶ String Value
-
-
class
helpscout.domain.DomainConditionBoolean(field, value, **kwargs)[source]¶ Bases:
helpscout.domain.DomainConditionThis represents an integer query.
Required Properties:
-
value¶ Boolean Value
-
-
class
helpscout.domain.DomainConditionDateTime(field, value_from, value_to=None)[source]¶ Bases:
helpscout.domain.DomainConditionThis represents a date time query.
Required Properties:
- field (
String): Field to search on, a unicode string - value (
DateTime): Date From, a datetime object - value_to (
DateTime): Date To, a datetime object
-
value¶ Date From
-
value_to¶ Date To
- field (