in api-reference-examples/python/pytx/pytx/request.py [0:0]
def build_get_parameters(cls,
text=None,
strict_text=None,
type_=None,
sample_type=None,
fields=None,
limit=None,
since=None,
until=None,
include_expired=None,
max_confidence=None,
min_confidence=None,
owner=None,
status=None,
review_status=None,
share_level=None,
sort_by=None,
sort_order=None):
"""
Validate arguments and convert them into GET parameters.
:param text: The text used for limiting the search.
:type text: str
:param strict_text: Whether we should use strict searching.
:type strict_text: bool, str, int
:param type_: The Indicator type to limit to.
:type type_: str
:param sample_type: The Sample type to limit to.
:type sample_type: str
:param fields: Select specific fields to pull
:type fields: str, list
:param limit: The maximum number of objects to return.
:type limit: int, str
:param since: The timestamp to limit the beginning of the search.
:type since: str
:param until: The timestamp to limit the end of the search.
:type until: str
:param include_expired: Include expired content in your results.
:type until: bool, str, int
:param max_confidence: The max confidence level to search for.
:type max_confidence: int
:param min_confidence: The min confidence level to search for.
:type min_confidence: int
:param owner: The owner to limit to. This can be comma-delimited to
include multiple owners.
:type owner: str
:param status: The status to limit to.
:type status: str
:param review_status: The review status to limit to.
:type review_status: str
:param share_level: The share level to limit to.
:type share_level: str
:param sort_by: Sort by relevance or create time.
:type sort_by: str
:param sort_order: The sort order for results.
:type sort_order: str
:returns: dict
"""
cls.validate_get(limit, since, until)
strict = cls.sanitize_bool(strict_text)
include_expired = cls.sanitize_bool(include_expired)
params = {}
if text:
params[t.TEXT] = text
if strict is not None:
params[t.STRICT_TEXT] = strict
if type_:
params[t.TYPE] = type_
if fields:
params[t.FIELDS] = ','.join(fields) if isinstance(fields, list) else fields
if limit:
params[t.LIMIT] = limit
if since:
params[t.SINCE] = since
if until:
params[t.UNTIL] = until
if include_expired is not None:
params[t.INCLUDE_EXPIRED] = include_expired
if max_confidence:
params[t.MAX_CONFIDENCE] = max_confidence
if min_confidence:
params[t.MIN_CONFIDENCE] = min_confidence
if owner:
params[t.OWNER] = owner
if sample_type:
params[t.SAMPLE_TYPE] = sample_type
if status:
params[t.STATUS] = status
if review_status:
params[t.REVIEW_STATUS] = review_status
if share_level:
params[t.SHARE_LEVEL] = share_level
if sort_by in (t.RELEVANCE, t.CREATE_TIME):
params[t.SORT_BY] = sort_by
if sort_order in (t.ASCENDING, t.DESCENDING):
params[t.SORT_ORDER] = sort_order
return params