Metadata-Version: 2.1
Name: trefleapi
Version: 0.1.0
Summary: A simple wrapper for the trefle botanical RESTAPI
Home-page: https://github.com/overlrd/trefle
Author: Overlrd
Author-email: sudooverloord@gmail.com
License: MIT
Project-URL: Bug Reports, https://github.com/oberlrd/trefle/issues
Project-URL: Source, https://github.com/oberlrd/trefle/
Keywords: trefle,botanical,plants,api
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests (>=2.3)
Requires-Dist: appdirs (>=1.4.4)
Provides-Extra: dev
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: validators ; extra == 'dev'
Requires-Dist: twine (>=4.0.2) ; extra == 'dev'

# Trefle-Api

*Trefle-API* is a simple python API wrapper for the [trefle](https://trefle.io./) botanic data API

```python
>>> from trefle_api import TrefleAPI
>>> Client = TrefleAPI(token="trefle_api_token")
>>> Query = Client.search("rose").in_("plants").filter(family="Rosaceae").sort_by(slug="asc")
>>> Query.get_json()
"{'data': [{'id': 265580, 'common_name': 'Field rose', 'slug': 'rosa-arvensis', 'scientific_name': 'Rosa arvensis'..."
>>> New_Query = Query.range(year=[2000, 2010]).exclude(common_name="null")
>>> New_Query.get_models()
"[[Plant(id=345576, name='', slug='physaria-purpurea', common_name='Rose bladderpod', scientific_name='Physaria purpurea', year=2002,..."
```

This package allows you to build simple to more complex queries to fetch data from the the [trefle](https://trefle.io./) RESTAPI <br>
Query tags :
 - `search()`
    <br> description : search a query  
    args : __q__ # **the string to use as query**
    returns : a copy of the `Query` class to allow chaining
 - `retrieve()`
    <br> description : retrieve an item based on it's slug or id  
    args : __slug__ or __id__ # a string representing the slug of a vegetable or it's id in the trefle api records  
    returns : a copy of the `Query` class to allow chaining

- `in_()`
 <br> description : select a category in which to search or retrieve  
 args __category__ # available categories are : 
  - kingdoms
  - subkingdoms
  - divisions
  - divisionclasses
  - division_orders
  - families
  - genus
  - plants
  - species

