{title}
60 |{description}
61 |├── .dockerignore
├── .github
└── workflows
│ ├── deploy.yml
│ └── test-deploy.yml
├── .gitignore
├── CNAME
├── README.md
├── babel.config.js
├── blog
└── 2020-07-15-1-6-0.md
├── docs
├── advanced
│ ├── client-side-apps.md
│ ├── complete-data.md
│ ├── distributions.md
│ └── plants-fields.md
├── examples
│ └── snippets.md
└── guides
│ ├── filtering.md
│ ├── getting-started.md
│ ├── pagination.md
│ ├── reporting-errors.md
│ ├── searching.md
│ └── sorting.md
├── docusaurus.config.js
├── jargon.js
├── package.json
├── plugins
└── plugin-token-fetcher
│ ├── package.json
│ └── src
│ ├── fetcher.js
│ └── index.js
├── sidebars.js
├── src
├── css
│ ├── custom.css
│ └── fonts.css
├── pages
│ ├── index.js
│ ├── reference.js
│ └── styles.module.css
└── theme
│ ├── Footer
│ ├── index.js
│ └── styles.module.css
│ └── MultiLanguageSnippet
│ └── index.js
├── static
├── .nojekyll
├── CNAME
├── img
│ ├── client-scheme.png
│ ├── distributions-world.png
│ ├── favicon.ico
│ ├── logo.png
│ └── logo.svg
└── swagger.yaml
└── yarn.lock
/.dockerignore:
--------------------------------------------------------------------------------
1 | */node_modules
2 | *.log
3 |
--------------------------------------------------------------------------------
/.github/workflows/deploy.yml:
--------------------------------------------------------------------------------
1 | name: Deploy to GitHub Pages
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | - master
8 | # Review gh actions docs if you want to further define triggers, paths, etc
9 | # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
10 |
11 | jobs:
12 | deploy:
13 | name: Deploy to GitHub Pages
14 | runs-on: ubuntu-latest
15 | steps:
16 | - uses: actions/checkout@v3
17 | - uses: actions/setup-node@v3
18 | with:
19 | node-version: 18
20 | cache: yarn
21 |
22 | - name: Install dependencies
23 | run: yarn install --frozen-lockfile
24 | - name: Build website
25 | run: yarn build
26 |
27 | # Popular action to deploy to GitHub Pages:
28 | # Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
29 | - name: Deploy to GitHub Pages
30 | uses: peaceiris/actions-gh-pages@v3
31 | with:
32 | github_token: ${{ secrets.GITHUB_TOKEN }}
33 | # Build output to publish to the `gh-pages` branch:
34 | publish_dir: ./build
35 | # The following lines assign commit authorship to the official
36 | # GH-Actions bot for deploys to `gh-pages` branch:
37 | # https://github.com/actions/checkout/issues/13#issuecomment-724415212
38 | # The GH actions bot is used by default if you didn't specify the two fields.
39 | # You can swap them out with your own user credentials.
40 | user_name: github-actions[bot]
41 | user_email: 41898282+github-actions[bot]@users.noreply.github.com
42 |
43 |
--------------------------------------------------------------------------------
/.github/workflows/test-deploy.yml:
--------------------------------------------------------------------------------
1 | name: Test deployment
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - main
7 | - master
8 | # Review gh actions docs if you want to further define triggers, paths, etc
9 | # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
10 |
11 | jobs:
12 | test-deploy:
13 | name: Test deployment
14 | runs-on: ubuntu-latest
15 | steps:
16 | - uses: actions/checkout@v3
17 | - uses: actions/setup-node@v3
18 | with:
19 | node-version: 18
20 | cache: yarn
21 |
22 | - name: Install dependencies
23 | run: yarn install --frozen-lockfile
24 | - name: Test build website
25 | run: yarn build
26 |
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Dependencies
2 | /node_modules
3 |
4 | # Production
5 | /build
6 |
7 | # Generated files
8 | .docusaurus
9 | .cache-loader
10 |
11 | # Misc
12 | .DS_Store
13 | .env.local
14 | .env.development.local
15 | .env.test.local
16 | .env.production.local
17 |
18 | npm-debug.log*
19 | yarn-debug.log*
20 | yarn-error.log*
21 |
--------------------------------------------------------------------------------
/CNAME:
--------------------------------------------------------------------------------
1 | docs.trefle.io
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # The Trefle Documentation
2 |
3 | [🌎 Website](https://trefle.io) • [🚀 Getting started](https://docs.trefle.io) • [📖 API Documentation](https://docs.trefle.io/reference) • [💡 Ideas and features](https://github.com/orgs/treflehq/projects/3) • [🐛 Issues](https://github.com/orgs/treflehq/projects/2)
4 |
5 | [](https://oss.skylight.io/app/applications/nz7MAOv6K6ra) [](https://oss.skylight.io/app/applications/nz7MAOv6K6ra) [](https://oss.skylight.io/app/applications/nz7MAOv6K6ra) [](https://oss.skylight.io/app/applications/nz7MAOv6K6ra)
6 |
7 | This is the repository for the [Trefle documentation](https://docs.trefle.io). It's built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
8 |
9 | ### Installation
10 |
11 | ```
12 | $ yarn
13 | ```
14 |
15 | ### Local Development
16 |
17 | ```
18 | $ yarn start
19 | ```
20 |
21 | This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
22 |
23 | ### Build
24 |
25 | ```
26 | $ yarn build
27 | ```
28 |
29 | This command generates static content into the `build` directory and can be served using any static contents hosting service.
30 |
31 | ### Deployment
32 |
33 | Deployment is automated by pushing on `master` branch.
34 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3 | };
4 |
--------------------------------------------------------------------------------
/blog/2020-07-15-1-6-0.md:
--------------------------------------------------------------------------------
1 | ---
2 | slug: 1-6-0-released
3 | title: "1.6.0"
4 | author: André Aubin
5 | author_title: Trefle Core Team
6 | author_url: https://twitter.com/lambda_2
7 | author_image_url: https://pbs.twimg.com/profile_images/1247213607353540608/i9oN_Gbg_400x400.jpg
8 | tags: [releases]
9 | ---
10 |
11 | This major release of Trefle brings a lot of new exciting features, such as distributions, farming fields and blazing fast search.
12 |
13 |
14 |
15 | ## What changed ?
16 |
17 | ### 📦 Endpoints versioning
18 |
19 | In order to avoid making breaking changes like this one in the future, API routes are now versionned. So the endpoint `/api/species` is now `/api/v1/species`. This let you the possibility to update when you're ready for the next releases.
20 |
21 | ### 📄 The data scructure changes
22 |
23 | One of the biggest struggles we noticed was the pagination. Parsing the pagination links in the response headers was really painful, even if it's a stardard.
24 |
25 | To solve this, **we decided to include pagination links directly in the JSON response**.
26 |
27 | Now, all API calls wraps a `data` field, along with a `links` field, for pagination links, and optionally a `meta` fields, for high level informations such as counts.
28 |
29 | ### 🔧 Plant and species fields names changes
30 |
31 | **We removed and added a lot of fields**. Most of USDA fields, such as `propagation` or products uses were removed, as they were too inaccurates.
32 |
33 | You can get:
34 |
35 | - [A simplified list of the current fields in the documentation](/docs/advanced/plants-fields).
36 | - [The full list in the reference](/reference/#operation/getSpecies).
37 |
38 |
39 | ### ✂️ The filters and sort parameter changes
40 |
41 | In order to avoid any name collision in parameters, **filters are now scoped in the `filter` parameter**. This means that `common_name=mint` is now `filter[common_name]=mint`.
42 |
43 | You now also can exclude null values from results with the `filter_not[ATTRIBUTE]` parameter.
44 |
45 | You can [read more about filters in the documentation](/docs/guides/filtering) or see the [The full list of filters in the reference](/reference/#operation/listSpecies).
46 |
47 | ### 📐 Ranges and orders
48 |
49 | You can now query the range of values between two values with the `range[FIELD]=min,max` parameter.
50 |
51 | For example, to query only species with a minimum height **between** 5 **and** 20 centimeters: `api/v1/species?token=YOUR_TREFLE_TOKEN&range[maximum_height_cm]=5,20`.
52 |
53 | Filtering on ranges also allow to set only minimum or maximum values. For example:
54 |
55 | - `/api/v1/species?range[maximum_height_cm]=5` only return species higher than 5 cm
56 | - `/api/v1/species?range[maximum_height_cm]=,5` only return species lower than 5 cm
57 |
58 | You can [read more about ranges in the documentation](/docs/guides/filtering#filter-on-ranges) or see the [The full list of ranges in the reference](/reference/#operation/listSpecies).
59 |
60 |
61 | ### 🖼 Better plants/species images
62 |
63 | Images were fully reviewed, and are now **splitted into categories**: flower, leaf, habit, fruit, bark and other.
64 |
65 | ### 🌍 Species distributions
66 |
67 | **We began to collect plant locations (ex: France) and establishments (ex: Native) per zone**, and they're now included in the `/species/{species_slug}` and `/plants/{species_slug}` endpoints.
68 |
69 | You can also filter species by distribution zones or by establishment.
70 |
71 | For example, to get plants native from Tibet: `/api/v1/distributions/tibet/plants?filter[establishment]=native`.
72 |
73 | ### 🔍 Blazing fast search engine
74 |
75 | A new search endpoint for plants and species is available: `/api/v1/species/search?q=term`.
76 |
77 | **This search was designed to respond in milliseconds**, and is ready for input autocomplete or "as you type" queries. [You can see it in action on the landing page](https://trefle.io).
78 |
79 | ### 🧰 Error reporting and data collection
80 |
81 | **You can now [report errors on species](/docs/guides/reporting-errors), or even [submit corrections / changes](/docs/advanced/complete-data) to us, directly from an API call.**
82 |
83 | This means a lot to us, as we want our data to be everyone's, and believe strongly in the power of the community.
84 |
85 | ### 📕 Adoption of better standards
86 |
87 | All units are following the [International System of Units (SI)](https://en.wikipedia.org/wiki/Metric_system), so **we replaced feets by centimeters, inches by millimeters and so on**.
88 | Temperatures are in celcuis and kelvin degrees for now, as the conversion is more complex than for standard units.
89 |
90 | Scientific names now follows the [Binomial nomenclature](https://en.wikipedia.org/wiki/Binomial_nomenclature). For the species, it represents its genus and its species within the genus, resulting in a single worldwide name for each organism. The scientific name of an infraspecific taxons (ranks below species, such as subspecies, forms, varieties...) is a combination of the name of a species and an infraspecific epithet. A connecting term is used to denote the rank. [See IAPT recommendation](https://www.iapt-taxon.org/nomen/pages/main/art_24.html).
91 |
92 | Distribution zones for plants/species are following the [World Geographical Scheme for Recording Plant Distributions (WGSRPD)](https://www.tdwg.org/standards/wgsrpd/).
93 |
94 | ### 📦 JSON responses when listing plants and species are more complete
95 |
96 | We added some fields in the response, such as an image url or the genus and family names, and embedded synonyms.
97 |
98 | For example, when listing plants:
99 |
100 | ```javascript
101 | [
102 | {
103 | "id": 123486,
104 | "slug": "corylus-avellana"
105 | "scientific_name": "Corylus avellana",
106 | "common_name": "common filbert",
107 | "complete_data": false,
108 | "link": "http://trefle.io/api/plants/123486",
109 | }
110 | ]
111 | ```
112 |
113 | Is now
114 |
115 | ```javascript
116 | {
117 | "data": [
118 | {
119 | "id": 123486,
120 | "slug": "corylus-avellana",
121 | "scientific_name": "Corylus avellana",
122 | "common_name": "common filbert",
123 | "author": "L.",
124 | "bibliography": "Sp. Pl.: 998 (1753)",
125 | "family": "Betulaceae",
126 | "family_common_name": "Birch family",
127 | "genus": "Corylus",
128 | "genus_id": 2057,
129 | "image_url": "https://bs.floristic.org/image/o/0d92cadb0d66dce1b0a8b26913125d6501e31d68",
130 | "rank": "species",
131 | "status": "accepted",
132 | "synonyms": [
133 | "Corylus sylvestris"
134 | ],
135 | "year": 1753,
136 | "links": {
137 | "genus": "/api/v1/genus/corylus",
138 | "plant": "/api/v1/plants/corylus-avellana",
139 | "self": "/api/v1/species/corylus-avellana"
140 | }
141 | }
142 | ],
143 | "links": {
144 | "first": "/api/v1/plants?filter%5Bscientific_name%5D=Corylus+avellana&page=1",
145 | "last": "/api/v1/plants?filter%5Bscientific_name%5D=Corylus+avellana&page=1",
146 | "self": "/api/v1/plants?filter%5Bscientific_name%5D=Corylus+avellana"
147 | },
148 | "meta": {
149 | "total": 1
150 | }
151 | }
152 | ```
153 |
154 | ### 📋 Synonyms separation
155 |
156 | Synonyms are no longer returned in the species or plants response, and are now included as an array in the response.
157 |
158 | ### 📐 Species fields scales changes
159 |
160 | "Scale-like" fields, such as "light" or "soil adaptation" are no longer with values like 'Low', 'Medium' and 'High', but are now on a scale from 0 to 10.
161 |
162 | ### 📋 Common names split
163 |
164 | Common names have been reviewed, and are now grouped by language.
165 |
--------------------------------------------------------------------------------
/docs/advanced/client-side-apps.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: client-side-apps
3 | title: Client-side applications
4 | image: /img/client-scheme.png
5 | ---
6 | import Tabs from '@theme/Tabs';
7 | import TabItem from '@theme/TabItem';
8 |
9 |
10 | The access token you get from [your account page](https://trefle.io/profile) allow you to makes queries on the Trefle API, but your token needs to be kept secret, so **you can't make queries from the browser as the user on your website will see the access token**, and could use it for their personal needs. Additionally this is not a good practice in developing software.
11 |
12 | 
13 |
14 | If you need to perform client-side requests you will have to request a client-side token from your own backend and get a JWT token in return. This token will be usable on the client side. This call needs your secret access token and the url of the website that the client side requests will come from.
15 |
16 | :::info
17 | Because this is a **POST** request it can't be done directly from the browser.
18 | :::
19 |
20 |
21 | {description} {siteConfig.tagline}
Can be: `annual`, `biennial`, and `perennial`. |
169 | | **flower_color** (string) | The species flower color(s). Several values can be separated with "\|"
Can be: `white`, `red`, `brown`, `orange`, `yellow`, `lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `grey`, and `black`. |
170 | | **flower_conspicuous** (boolean) | |
171 | | **foliage_color** (string) | The species foliage color(s). Several values can be separated with "\|"
Can be: `white`, `red`, `brown`, `orange`, `yellow`, `lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `grey`, and `black`. |
172 | | **foliage_texture** (string) | Can be: `fine`, `medium`, and `coarse`. |
173 | | **leaf_retention** (boolean) | |
174 | | **fruit_color** (string) | The species fruit color(s). Several values can be separated with "\|"
Can be: `white`, `red`, `brown`, `orange`, `yellow`, `lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `grey`, and `black`. |
175 | | **fruit_conspicuous** (boolean) | |
176 | | **fruit_seed_persistence** (boolean) | |
177 | | **fruit_months** (string) | The months when his species have fruits. Several values can be separated by "\|"
Can be: `jan`, `feb`, `mar`, `apr`, `may`, `jun`, `jul`, `aug`, `sep`, `oct`, `nov`, and `dec`. |
178 | | **bloom_months** (string) | The months when this species blooms. Several values can be separated by "\|"
Can be: `jan`, `feb`, `mar`, `apr`, `may`, `jun`, `jul`, `aug`, `sep`, `oct`, `nov`, and `dec`. |
179 | | **ground_humidity** (integer) | Required humidity of the soil, on a scale from 0 (xerophile) to 10 (subaquatic) |
180 | | **growth_form** (string) | |
181 | | **growth_habit** (string) | |
182 | | **growth_months** (string) | The months when this species grows. Several values can be separated by "\|"
Can be: `jan`, `feb`, `mar`, `apr`, `may`, `jun`, `jul`, `aug`, `sep`, `oct`, `nov`, and `dec`. |
183 | | **growth_rate** (string) | |
184 | | **edible_part** (string) | The edible part of the species (if any). Several values can be separated by "\|"
Can be: `roots`, `stem`, `leaves`, `flowers`, `fruits`, and `seeds`. |
185 | | **vegetable** (boolean) | |
186 | | **light** (integer) | Required amount of light, on a scale from 0 (no light, <= 10 lux) to 10 (very intensive insolation, >= 100 000 lux) |
187 | | **atmospheric_humidity** (integer) | Required relative humidity in the air, on a scale from 0 (<=10%) to 10 (>= 90%) |
188 | | **adapted_to_coarse_textured_soils** (string) | |
189 | | **adapted_to_fine_textured_soils** (string) | |
190 | | **adapted_to_medium_textured_soils** (string) | |
191 | | **anaerobic_tolerance** (string) | |
192 | | **average_height_unit** (string) | Can be: `in`, `ft`, `cm`, and `m`. |
193 | | **average_height_value** (number) | |
194 | | **maximum_height_unit** (string) | Can be: `in`, `ft`, `cm`, and `m`. |
195 | | **maximum_height_value** (number) | |
196 | | **planting_row_spacing_unit** (string) | Can be: `in`, `ft`, `cm`, and `m`. |
197 | | **planting_row_spacing_value** (number) | The minimum spacing between each rows of plants |
198 | | **planting_spread_unit** (string) | Can be: `in`, `ft`, `cm`, and `m`. |
199 | | **planting_spread_value** (number) | The average spreading of the plant |
200 | | **planting_days_to_harvest** (integer) | |
201 | | **maximum_precipitation_unit** (string) | Can be: `in`, `ft`, `mm`, `cm`, and `m`. |
202 | | **maximum_precipitation_value** (number) | |
203 | | **minimum_precipitation_unit** (string) | Can be: `in`, `ft`, `mm`, `cm`, and `m`. |
204 | | **minimum_precipitation_value** (number) | |
205 | | **minimum_root_depth_unit** (string) | Can be: `in`, `ft`, `cm`, and `m`. |
206 | | **minimum_root_depth_value** (number) | |
207 | | **ph_maximum** (number) | |
208 | | **ph_minimum** (number) | |
209 | | **soil_nutriments** (integer) | Required quantity of nutriments in the soil, on a scale from 0 (oligotrophic) to 10 (hypereutrophic) |
210 | | **soil_salinity** (integer) | Tolerance to salinity, on a scale from 0 (untolerant) to 10 (hyperhaline) |
211 | | **minimum_temperature_deg_c** (number) | The minimum required temperature in celcius degrees |
212 | | **maximum_temperature_deg_c** (number) | The maximum required temperature in celcius degrees |
213 | | **soil_texture** (string) | Required texture of the soil, on a scale from 0 (clay) to 10 (rock)
Can be: `argile`, `intermediaire`, `limon`, `sable_fin`, `sable_grossier`, `graviers`, `galets`, `blocs_fentes_des_parois`, and `dalle`. |
214 | | **ligneous_type** (string) | Can be: `liana`, `subshrub`, `shrub`, `tree`, and `parasite`. |
215 | | **toxicity** (string) | Can be: `none`, `low`, `medium`, and `high`. |
216 |
--------------------------------------------------------------------------------
/docs/advanced/distributions.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: distributions
3 | title: Distributions
4 | image: /img/distributions-world.png
5 | ---
6 |
7 | ### Specification
8 |
9 | In Trefle, the distribution zones for _plants_ are following the [World Geographical Scheme for Recording Plant Distributions (WGSRPD)](https://www.tdwg.org/standards/wgsrpd/).
10 |
11 | WGSRPD provides an agreed system of geographical units at approximately "country" level and upwards for use in recording plant distributions.
12 |
13 | **The system offered covers the whole world and identifies units at four levels**, firstly continental, secondly regional (or subcontinental), thirdly at what may be called "Botanical Country" level (which may often ignore purely political considerations), and fourthly at a slightly lower level called "Basic Recording Units" where political integrity is fully recognised.
14 |
15 | In many cases, where Botanical Countries have no complicating political factors, the units at Level-3 and Level-4 are identical. Very large countries, however, have been subdivided into more conveniently sized units according to constituent states or provinces. It is a fundamental principle that units at all levels are bounded either by political boundaries which appear on modern maps or by coast lines.
16 |
17 | ### List of zones
18 |
19 | 
20 |
21 | A complete list of zones is [available on Wikipedia](https://en.wikipedia.org/wiki/List_of_codes_used_in_the_World_Geographical_Scheme_for_Recording_Plant_Distributions)
22 |
23 | ### Mapping zones to a map
24 |
25 | Trefle does not provides coordinates for the species distribution zones yet. In the meantime, you can find GeoJSON files for each zones [on the TDWG Github repository](https://github.com/tdwg/wgsrpd/tree/master/geojson).
26 |
--------------------------------------------------------------------------------
/docs/advanced/plants-fields.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: plants-fields
3 | title: Plants fields
4 | ---
5 |
6 | When you query a species (or a plant), you will have a lot of fields to dig into. This is a simplified version of the [reference](/reference) that tries to explain a bit what each fields represents.
7 |
8 | :::tip In doubt, refer to the reference
9 | This documentation is way lighter than the reference, and do not show all the fields. If you have any doubt, please check the [reference](/reference).
10 | :::
11 |
12 |
13 | ## Species
14 |
15 | | field | description |
16 | |------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
17 | | **id** (integer) | An unique identifier |
18 | | **common_name** (string) | The usual common name, in english, of the species (if any). |
19 | | **slug** (string) | An unique human-readable identifier (if you can, prefer to use this over id) |
20 | | **scientific_name** (string) | The scientific name follows the [Binomial nomenclature](https://en.wikipedia.org/wiki/Binomial_nomenclature), and represents its genus and its species within the genus, resulting in a single worldwide name for each organism. The scientific name of an infraspecific taxons (ranks below species, such as subspecies, forms, varieties...) is a combination of the name of a species and an infraspecific epithet. A connecting term is used to denote the rank. [See IAPT recommendation](https://www.iapt-taxon.org/nomen/pages/main/art_24.html) |
21 | | **year** (integer) | The first publication year of a valid name of this species. [See author citation](https://en.wikipedia.org/wiki/Author_citation_(botany)) |
22 | | **bibliography** (string) | The first publication of a valid name of this species. [See author citation](https://en.wikipedia.org/wiki/Author_citation_(botany)) |
23 | | **author** (string) | The author(s) of the first publication of a valid name of this species. [See author citation](https://en.wikipedia.org/wiki/Author_citation_(botany)) |
24 | | **status** (string) | The acceptance status of this species by IPNI
Can be: `accepted` and `unknown`. |
25 | | **rank** (string) | The [taxonomic rank](https://en.wikipedia.org/wiki/Taxonomic_rank) of the species
Can be: `species`, `ssp`, `var`, `form`, `hybrid`, and `subvar`. |
26 | | **family_common_name** (string) | The common name (in english) of the species family |
27 | | **family** (string) | The scientific name of the species family |
28 | | **genus_id** (integer) | The id of the species genus |
29 | | **genus** (string) | The scientific name of the species genus |
30 | | **image_url** (string) | A main image url of the species |
31 | | **duration** (array of strings) | The plant duration(s), which can be:
- Annual: plants that live, reproduce, and die in one growing season.
- Biennial: plants that need two growing seasons to complete their life cycle, normally completing vegetative growth the first year and flowering the second year.
- Perennial: plants that live for more than two years, with the shoot system dying back to soil level each year.
|
32 | | **edible_part** (array of strings) | The plant edible part(s), if any. |
33 | | **edible** (boolean) | Is the species edible? |
34 | | **vegetable** (boolean) | Is the species a vegetable? |
35 | | **observations** (string) | Some habit observations on the species |
36 | | **common_names** (object) | Common names of the species per language |
37 | | **distribution** (object) | (Deprecated) Distribution of the species per establishment |
38 | | **synonyms** (array of objects) | The symonyms scientific names and authors |
39 | | **sources** (array of objects) | The symonyms scientific names and authors |
40 | | **extras** () | |
41 |
42 | ### links
43 |
44 |
45 | API endpoints to related resources
46 |
47 | | field | description |
48 | |--------------------|------------------------------------|
49 | | **self** (string) | API endpoint to the species itself |
50 | | **genus** (string) | API endpoint to the species genus |
51 | | **plant** (string) | API endpoint to the species plant |
52 |
53 | ### images
54 |
55 | | field | description |
56 | |-------------------------------|--------------------------------|
57 | | **flower** (array of objects) | Image(s) of the species flower |
58 | | **leaf** (array of objects) | Image(s) of the species leaf |
59 | | **habit** (array of objects) | Image(s) of the species habit |
60 | | **fruit** (array of objects) | Image(s) of the species fruit |
61 | | **bark** (array of objects) | Image(s) of the species bark |
62 | | **other** (array of objects) | Image(s) of the species other |
63 |
64 | ### distributions
65 |
66 |
67 | Distribution of the species per establishment
68 |
69 | | field | description |
70 | |-----------------------------------|-----------------------------------------------------------|
71 | | **native** (array of objects) | Zones the species is native from |
72 | | **introduced** (array of objects) | Zones the species has been introduced |
73 | | **doubtful** (array of objects) | Zones the species presence is doubtful |
74 | | **absent** (array of objects) | Zones the species is absent and has been wrongly recorded |
75 | | **extinct** (array of objects) | Zones the species is extinct |
76 |
77 | ### flower
78 |
79 |
80 | Flower related fields (the reproductive structure found in flowering plants)
81 |
82 | | field | description |
83 | |------------------------------|------------------------|
84 | | **color** (array of strings) | The flower color(s) |
85 | | **conspicuous** (boolean) | Is the flower visible? |
86 |
87 | ### foliage
88 |
89 |
90 | Foliage (or leaves) related fields
91 |
92 | | field | description |
93 | |------------------------------|-----------------------------------------------------------------------------------------|
94 | | **texture** (string) | The general texture of the plant’s foliage
Can be: `fine`, `medium`, and `coarse`. |
95 | | **color** (array of strings) | The leaves color(s) |
96 | | **leaf_retention** (boolean) | Does the leaves stay all year long? |
97 |
98 | ### fruit_or_seed
99 |
100 |
101 | Fruit or seed related fields
102 |
103 | | field | description |
104 | |--------------------------------|------------------------------------------------------------------------------|
105 | | **conspicuous** (boolean) | Is the fruit visible? |
106 | | **color** (array of strings) | The fruit color(s) |
107 | | **shape** (string) | Fruit shape |
108 | | **seed_persistence** (boolean) | Are the fruit or seed generally recognized as being persistent on the plant? |
109 |
110 | ### specifications
111 |
112 |
113 | Species's main characteristics
114 |
115 | | field | description |
116 | |------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
117 | | **ligneous_type** (string) | The ligneous type of the woody plant
Can be: `liana`, `subshrub`, `shrub`, `tree`, and `parasite`. |
118 | | **growth_form** (string) | The primary growth form on the landscape in relation to soil stabilization on slopes and streamsides? Each plant species is assigned the single growth form that most enhances its ability to stabilize soil |
119 | | **growth_habit** (string) | The general appearance, growth form, or architecture of the plant |
120 | | **growth_rate** (string) | The relative growth speed of the plant |
121 | | **average_height** (object) | The average height of the species, in centimeters |
122 | | **maximum_height** (object) | The maximum height of the species, in centimeters |
123 | | **nitrogen_fixation** (string) | Capability to fix nitrogen in monoculture |
124 | | **shape_and_orientation** (string) | The predominant shape of the species |
125 | | **toxicity** (string) | Relative toxicity of the species for humans or animals
Can be: `none`, `low`, `medium`, and `high`. |
126 |
127 | ### growth
128 |
129 |
130 | Growing of farming related fields
131 |
132 | | field | description |
133 | |--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
134 | | **days_to_harvest** (number) | The average numbers of days required to from planting to harvest |
135 | | **description** (string) | A description on how the plant usually grows |
136 | | **sowing** (string) | A description on how to sow the plant |
137 | | **ph_maximum** (number) | The maximum acceptable soil pH (of the top 30 centimeters of soil) for the plant |
138 | | **ph_minimum** (number) | The minimum acceptable soil pH (of the top 30 centimeters of soil) for the plant |
139 | | **light** (integer) | Required amount of light, on a scale from 0 (no light, <= 10 lux) to 10 (very intensive insolation, >= 100 000 lux) |
140 | | **atmospheric_humidity** (integer) | Required relative humidity in the air, on a scale from 0 (<=10%) to 10 (>= 90%) |
141 | | **growth_months** (array of strings) | The most active growth months of the species (usually all year round for perennial plants) |
142 | | **bloom_months** (array of strings) | The months the species usually blooms |
143 | | **fruit_months** (array of strings) | The months the species usually produces fruits |
144 | | **row_spacing** (object) | The minimum spacing between each rows of plants, in centimeters |
145 | | **spread** (object) | The average spreading of the plant, in centimeters |
146 | | **minimum_precipitation** (object) | Minimum precipitation per year, in milimeters per year |
147 | | **maximum_precipitation** (object) | Maximum precipitation per year, in milimeters per year |
148 | | **minimum_root_depth** (object) | Minimum depth of soil required for the species, in centimeters. Plants that do not have roots such as rootless aquatic plants have 0 |
149 | | **minimum_temperature** (object) | The minimum tolerable temperature for the species. In celsius or fahrenheit degrees |
150 | | **maximum_temperature** (object) | The maximum tolerable temperature for the species. In celsius or fahrenheit degrees |
151 | | **soil_nutriments** (integer) | Required quantity of nutriments in the soil, on a scale from 0 (oligotrophic) to 10 (hypereutrophic) |
152 | | **soil_salinity** (integer) | Tolerance to salinity, on a scale from 0 (untolerant) to 10 (hyperhaline) |
153 | | **soil_texture** (integer) | Required texture of the soil, on a scale from 0 (clay) to 10 (rock) |
154 | | **soil_humidity** (integer) | Required humidity of the soil, on a scale from 0 (xerophile) to 10 (subaquatic) |
155 |
156 | ### synonyms[]
157 |
158 | | field | description |
159 | |---------------------|------------------------------------|
160 | | **id** (integer) | An unique identifier |
161 | | **name** (string) | The scientific name of the symonym |
162 | | **author** (string) | The author of the symonym |
163 |
164 | ### sources[]
165 |
166 | | field | description |
167 | |--------------------------|--------------------------------------------------------------|
168 | | **id** (string) | An unique identifier from the source |
169 | | **name** (string) | The name of the source |
170 | | **citation** (string) | How to cite the source |
171 | | **url** (string) | The link on the source website, or the publication reference |
172 | | **last_update** (string) | The last time the source was checked |
--------------------------------------------------------------------------------
/docs/examples/snippets.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: snippets
3 | title: Snippets
4 | ---
5 |
6 | import MultiLanguageSnippet from '@theme/MultiLanguageSnippet';
7 |
8 | Here is some request samples
9 |
10 | :::tip Third party libraries
11 | The `node`, `ruby` and `python` snippets require third-party libraries:
12 |
13 | - **node**: [node-fetch](https://github.com/node-fetch/node-fetch) library.
14 | - **python**: [request](https://requests.readthedocs.io/en/master/) library.
15 | - **ruby**: [HTTParty](https://github.com/jnunemaker/httparty) library.
16 |
17 | :::
18 |
19 |
20 |
21 |
22 |
23 | ## Genus
24 |
25 |
26 | ### Get all genus
27 |
28 |
31 |
32 |
33 |
34 | ---------
35 |
36 |
37 |
38 | ## Plants & Species
39 |
40 | :::tip Reminder
41 | **In all the following samples, `/plants` can be switched to `/species` and `/species` can be switched to `/plants`.**
42 | The only difference is that `/species` API calls will return matching species, subspecies, varieties etc..., and `/plants` API calls will only return main species (without all the children species).
43 | :::
44 |
45 |
46 | ### Get all plants
47 |
48 |
52 |
53 | ### Get all species
54 |
55 |
58 |
59 | ### Get only edible plants
60 |
61 |
64 |
65 |
66 | ### Get tallest trees
67 |
68 | :::tip Explanation
69 | - Get all plants
70 | - With **tree** ligneous type `filter[ligneous_type]=tree`
71 | - Without plants with no maximum height `filter_not[maximum_height_cm]=null`
72 | - Ordered by maximum height descending (highest first) `order[maximum_height_cm]=desc`
73 | :::
74 |
75 |
85 |
86 | ### Get plants in Antartica
87 |
88 | > See [Distributions](/docs/advanced/distributions) to learn more about distributions zones.
89 |
90 |
91 |
97 |
98 | ### Get plants introduced in Marion-Prince Edward
99 |
100 |
108 |
109 | ### Get plants native from Tibet
110 |
111 |
119 |
120 | ### Get species with height between 5cm and 20cm
121 |
122 |
126 |
127 | ### Get species with red flowers
128 |
129 |
133 |
134 | ### Get search for coconut species
135 |
136 |
140 |
141 | ### Get species with oldest discoveries first
142 |
143 |
147 |
148 | ---------
149 |
150 |
151 |
152 |
153 | ## Zones & Distributions
154 |
155 | > See [Distributions](/docs/advanced/distributions) to learn more about distributions zones.
156 |
157 | ### Get all countries / zones
158 |
159 |
162 |
163 | ### Get countries / zones with less than 10 species
164 |
165 | Or with the native https node library
78 |
79 | ```js
80 | const https = require('https');
81 |
82 | https.get('https://trefle.io/api/v1/plants?token=YOUR_TREFLE_TOKEN', (resp)
83 | => {
84 | let data = '';
85 |
86 | // A chunk of data has been recieved.
87 | resp.on('data', (chunk) => {
88 | data += chunk;
89 | });
90 |
91 | // The whole response has been received. Print out the result.
92 | resp.on('end', () => {
93 | console.log(JSON.parse(data));
94 | });
95 |
96 | }).on("error", (err) => {
97 | console.log("Error: " + err.message);
98 | });
99 | ```
100 |
101 | {title}
60 | {siteConfig.title}
77 |
40 | );
41 |
42 | function Footer() {
43 | const context = useDocusaurusContext();
44 | const {siteConfig = {}} = context;
45 | const {themeConfig = {}} = siteConfig;
46 | const {footer} = themeConfig;
47 |
48 | const {copyright, links = [], logo = {}} = footer || {};
49 | const logoUrl = useBaseUrl(logo.src);
50 |
51 | if (!footer) {
52 | return null;
53 | }
54 |
55 | return (
56 |
120 | );
121 | }
122 |
123 | export default Footer;
124 |
--------------------------------------------------------------------------------
/src/theme/Footer/styles.module.css:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | .footerLogoLink {
9 | opacity: 0.5;
10 | transition: opacity 0.15s ease-in-out;
11 | }
12 |
13 | .footerLogoLink:hover {
14 | opacity: 1;
15 | }
16 |
--------------------------------------------------------------------------------
/src/theme/MultiLanguageSnippet/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Tabs from '@theme/Tabs';
3 | import TabItem from '@theme/TabItem';
4 | import CodeBlock from '@theme/CodeBlock';
5 | import qs from 'jquery-param';
6 |
7 |
8 | const MultiLanguageSnippet = ({
9 | endpoint,
10 | method = 'GET',
11 | query = {},
12 | body = {},
13 | ...props
14 | }) => {
15 |
16 | console.log({ endpoint, method, query, props });
17 | const qparams = {
18 | ...query,
19 | token: 'YOUR_TREFLE_TOKEN'
20 | };
21 |
22 | const searchParams = qs(qparams);
23 |
24 | const values = [
25 | { label: 'CURL', value: 'curl' },
26 | { label: 'Browser', value: 'browser' },
27 | { label: 'NodeJS', value: 'node' },
28 | { label: 'Python', value: 'python' },
29 | { label: 'Ruby', value: 'ruby' },
30 | ]
31 |
32 | const renderCodeBlock = ({ value }) => {
33 |
34 | switch (value) {
35 | case "browser":
36 | return (