tonita.listings
#
- tonita.listings.add(data=None, json_path=None, corpus_id=None, api_key=None, session=None)#
Add (or overwrite if already exists) data for a batch of listings.
- Parameters:
data (Optional[Dict[str, Any]]) – A dict containing listings data. Exactly one of
data
orjson_path
should be provided.json_path (Optional[str]) – A path to a JSON file containing listings data. Exactly one of
data
orjson_path
should be provided.corpus_id (Optional[str]) – The ID of the corpus this listing belongs to. If this argument is
None
, then the value oftonita.corpus_id
will be used.api_key (Optional[str]) – An API key. If this argument is
None
, then the value oftonita.api_key
will be used.session (Optional[requests.Session]) – A requests.Session object to use for the request. If the user does not provide a session, a new one will be created.
- Returns:
See docstring for AddListingsResponse.
- Return type:
- Raises:
TonitaBadRequestError – The request is malformed; see error message for specifics.
TonitaInternalServerError – A server-side error occurred.
TonitaUnauthorizedError – The API key is missing or invalid.
ValueError –
If neither data nor json_path are provided. * If both data and json_path are provided.
- tonita.listings.list(start_listing_id=None, limit=1000, corpus_id=None, api_key=None)#
List IDs of all listings in corpus given by
corpus_id
.- Parameters:
start_listing_id (Optional[str]) – If provided, then only listings whose IDs appear at or after this listing ID according to lexicographical order are returned. If
None
, then listing IDs are returned beginning with the first listing ID according to lexicographical order.limit (int) – If provided, then at most this many listing IDs are returned (in lexicographical order). The default returns at most 1000 listing IDs. To return all listing IDs in the corpus, pass -1. If there are more listing IDs to return than a positive
limit
, then thenext_listing_id
field in the return object will be populated with the next listing ID according to lexicographical order. The caller can pass this listing ID asstart_listing_id
in a subsequent call to list() to “page” through the remaining results. If there are no more listing IDs to return, thenext_listing_id
field in the response will beNone
.corpus_id (Optional[str]) – The ID of the corpus this listing belongs to. If this argument is
None
, then the value oftonita.corpus_id
will be used.api_key (Optional[str]) – An API key. If this argument is
None
, then the value oftonita.api_key
will be used.
- Returns:
See docstring for ListListingsResponse.
- Return type:
- Raises:
TonitaBadRequestError – The request is malformed; see error message for specifics.
TonitaInternalServerError – A server-side error occurred.
TonitaUnauthorizedError – The API key is missing or invalid.
- tonita.listings.get(listing_ids, corpus_id=None, api_key=None)#
Retrieve data for specified listings.
- Parameters:
listing_ids (List[str]) – The IDs of the listings to retrieve. The elements of this list must be distinct (i.e., no duplicates); a TonitaBadRequestError will be raised otherwise.
corpus_id (Optional[str]) – The ID of the corpus this listing belongs to. If this argument is
None
, then the value oftonita.corpus_id
will be used.api_key (Optional[str]) – An API key. If this argument is
None
, then the value oftonita.api_key
will be used.
- Returns:
See docstring for GetListingsResponse.
- Return type:
- Raises:
TonitaBadRequestError – The request is malformed; see error message for specifics.
TonitaInternalServerError – A server-side error occurred.
TonitaUnauthorizedError – The API key is missing or invalid.
- tonita.listings.delete(listing_ids, corpus_id=None, api_key=None)#
Delete data for listings.
- Parameters:
listing_ids (List[str]) – The IDs of the listings to delete. The elements of this list must be distinct (i.e., no duplicates); a TonitaBadRequestError will be raised otherwise.
corpus_id (Optional[str]) – The ID of the corpus this listing belongs to. If this argument is
None
, then the value oftonita.corpus_id
will be used.api_key (Optional[str]) – An API key. If this argument is
None
, then the value oftonita.api_key
will be used.
- Returns:
See docstring for DeleteListingsResponse.
- Return type:
- Raises:
TonitaBadRequestError – The request is malformed; see error message for specifics.
TonitaInternalServerError – A server-side error occurred.
TonitaUnauthorizedError – The API key is missing or invalid.
- tonita.listings.recover(listing_ids, corpus_id=None, api_key=None)#
Recover a batch of listings that were previously marked to be deleted.
- Parameters:
listing_ids (List[str]) – The IDs of the listings to recover. The elements of this list must be distinct (i.e., no duplicates); a TonitaBadRequestError will be raised otherwise.
corpus_id (Optional[str]) – The ID of the corpus this listing belongs to. If this argument is
None
, then the value oftonita.corpus_id
will be used.api_key (Optional[str]) – An API key. If this argument is
None
, then the value oftonita.api_key
will be used.
- Returns:
See docstring for RecoverListingsResponse.
- Return type:
- Raises:
TonitaBadRequestError – The request is malformed; see error message for specifics.
TonitaInternalServerError – A server-side error occurred.
TonitaUnauthorizedError – The API key is missing or invalid.