Cannabis Reports
A Cannabis Reports API wrapper for Node.js
This project uses modern ES2016+ syntax, which means you can use promises (as shown in the documentation) or async/await.
Installation
npm install --save cannabis-reports
Usage
;
Only import the modules you need. For example, if you only need the Strain
and Extract
modules:
;
To set your API Key, set the environment variable CANNABIS_REPORTS_API_KEY
. Alternatively, you can set the configuration manually
;
Strains
- Strain.all()
- Strain.search()
- Strain.strain()
- Strain.user()
- Strain.reviews()
- Strain.effectsFlavors()
- Strain.seedCompany()
- Strain.genetics()
- Strain.children()
- Strain.availability()
Flowers
- Flower.all()
- Flower.type()
- Flower.flower()
- Flower.user()
- Flower.reviews()
- Flower.effectsFlavors()
- Flower.producer()
- Flower.strain()
- Flower.availability()
Extracts
- Extract.all()
- Extract.type()
- Extract.extract()
- Extract.user()
- Extract.reviews()
- Extract.effectsFlavors()
- Extract.producer()
- Extract.strain()
- Extract.availability()
Edibles
- Edible.all()
- Edible.type()
- Edible.edible()
- Edible.user()
- Edible.reviews()
- Edible.effectsFlavors()
- Edible.producer()
- Edible.strain()
- Edible.availability()
Products
- Product.all()
- Product.type()
- Product.product()
- Product.user()
- Product.reviews()
- Product.effectsFlavors()
- Product.producer()
- Product.strain()
- Product.availability()
Producers
- Producer.all()
- Producer.producer()
- Producer.user()
- Producer.extracts()
- Producer.edibles()
- Producer.products()
- Producer.availability()
Dispensaries
- Dispensary.all()
- Dispensary.dispensary()
- Dispensary.strains()
- Dispensary.extracts()
- Dispensary.edibles()
- Dispensary.products()
Seed Companies
Strain.all(options)
returns an Array of strain objects.options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated recordsname
- Alphabetically stating with numeric strains. 0-9, A-Z.-name
- Alphabetically starting with Z and working back through numeric strains. Z-A, 9-0.
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Strain alloptions
Strain.search(query, options)
returns an Array of strain objects matching the search query.query
(required) - [String]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Strain
Strain.strain(ucpc)
returns a single strain object with the specified UCPCucpc
(required) - [String]
Strain
Strain.user(ucpc)
returns a single user object of the user who added the strain to the database.ucpc
(required) - [String]
Strain
Strain.reviews(ucpc, options)
returns an array of reviews for a cannabis strain.ucpc
(required) - [String]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Strain
Strain.effectsFlavors(ucpc)
returns a object containing the average effects and flavors from reviews for this strain.ucpc
(required) - [String]
Strain
Strain.seedCompany(ucpc)
returns a object for the seed company that was responsible for a cannabis strain.ucpc
(required) - [String]
Strain
Strain.genetics(ucpc)
returns an array of strains that were the parent material for the strain with the given UCPC.ucpc
(required) - [String]
Strain
Strain.children(ucpc, options)
returns an array of the child strains that this strain has been bred into.ucpc
(required) - [String]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Strain
Strain.availability(ucpc, lat, lng, options)
returns an Array of information about the availability of a strain using latitude and longitude.ucpc
(required) - [String]
lat
(required) - [String] or [Number]
lng
(required) - [String] or [Number]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.radius
- [Number] Radius to search for in miles, max 25.
Strain
Flower.all(options)
returns an Array of flower objects.options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Flower alloptions
Flower.type(flowerType, options)
returns an Array of products for a given type.flowerType
(required) - String Possible values:
flowers
seeds
clones
shake
options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Flower typeflowerType options
Flower.flower(ucpc)
returns a single flower object with the specified UCPC.ucpc
(required) - [String]
Flower
Flower.user(ucpc)
returns a single user object of the user who added the flower to the database.ucpc
(required) - [String]
Flower
Flower.reviews(ucpc, options)
returns an array of reviews for a cannabis flower.ucpc
(required) - [String]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Flower
Flower.effectsFlavors(ucpc)
returns a object containing the average effects and flavors from reviews for this flower.ucpc
(required) - [String]
Flower
Flower.producer(ucpc)
returns a object for the producer of a flower.ucpc
(required) - [String]
Flower
Flower.strain(ucpc)
returns a object for the strain of a flower.ucpc
(required) - [String]
Flower
Flower.availability(ucpc, lat, lng, options)
returns an Array of information about the availability of a flower using latitude and longitude.ucpc
(required) - [String]
lat
(required) - [String] or [Number]
lng
(required) - [String] or [Number]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.radius
- [Number] Radius to search for in miles, max 25.
Flower
Extract.all(options)
returns an Array of extract objects.options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Extract alloptions
Extract.type(extractType, options)
returns an Array of products for a given type.extractType
(required) - String Possible values:
kief
hash
water-hash
oil
wax
crumble
honeycomb
shatter
vaporizer-disposable
vaporizer-cartridge
options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Extract typeextractType options
Extract.extract(ucpc)
returns a single extract object with the specified UCPC.ucpc
(required) - [String]
Extract
Extract.user(ucpc)
returns a single user object of the user who added the extract to the database.ucpc
(required) - [String]
Extract
Extract.reviews(ucpc, options)
returns an array of reviews for a cannabis extract.ucpc
(required) - [String]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Extract
Extract.effectsFlavors(ucpc)
returns a object containing the average effects and flavors from reviews for this extract.ucpc
(required) - [String]
Extract
Extract.producer(ucpc)
returns a object for the producer of a extract.ucpc
(required) - [String]
Extract
Extract.strain(ucpc)
returns a object for the strain of a extract.ucpc
(required) - [String]
Extract
Extract.availability(ucpc, lat, lng, options)
returns an Array of information about the availability of a extract using latitude and longitude.ucpc
(required) - [String]
lat
(required) - [String] or [Number]
lng
(required) - [String] or [Number]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.radius
- [Number] Radius to search for in miles, max 25.
Extract
Edible.all(options)
returns an Array of edible objects.options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Edible alloptions
Edible.type(edibleType, options)
returns an Array of products for a given type.edibleType
(required) - String Possible values:
baked goods
candy
treat
chocolate
snack
beverage
pill
tincture
butter
honey
breath strips
tea
ice cream
options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Edible typeedibleType options
Edible.edible(ucpc)
returns a single edible object with the specified UCPC.ucpc
(required) - [String]
Edible
Edible.user(ucpc)
returns a single user object of the user who added the edible to the database.ucpc
(required) - [String]
Edible
Edible.reviews(ucpc, options)
returns an array of reviews for a cannabis edible.ucpc
(required) - [String]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Edible
Edible.effectsFlavors(ucpc)
returns a object containing the average effects and flavors from reviews for this edible.ucpc
(required) - [String]
Edible
Edible.producer(ucpc)
returns a object for the producer of a edible.ucpc
(required) - [String]
Edible
Edible.strain(ucpc)
returns a object for the strain of a edible.ucpc
(required) - [String]
Edible
Edible.availability(ucpc, lat, lng, options)
returns an Array of information about the availability of a edible using latitude and longitude.ucpc
(required) - [String]
lat
(required) - [String] or [Number]
lng
(required) - [String] or [Number]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.radius
- [Number] Radius to search for in miles, max 25.
Edible
Product.all(options)
returns an Array of product objects.options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Product alloptions
Product.type(productType, options)
returns an Array of products for a given type.productType
(required) - String Possible values:
bath
topical
skin care
pre-roll
lip balm
massage oil
personal lubricant
options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Product typeproductType options
Product.product(ucpc)
returns a single product object with the specified UCPC.ucpc
(required) - [String]
Product product'3CV7E33XLHTJT2XZ4GMD00000'
Product.user(ucpc)
returns a single user object of the user who added the product to the database.ucpc
(required) - [String]
Product
Product.reviews(ucpc, options)
returns an array of reviews for a cannabis product.ucpc
(required) - [String]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Product
Product.effectsFlavors(ucpc)
returns a object containing the average effects and flavors from reviews for this product.ucpc
(required) - [String]
Product
Product.producer(ucpc)
returns a object for the producer of a product.ucpc
(required) - [String]
Product
Product.strain(ucpc)
returns a object for the strain of a product.ucpc
(required) - [String]
Product
Product.availability(ucpc, lat, lng, options)
returns an Array of information about the availability of a product using latitude and longitude.ucpc
(required) - [String]
lat
(required) - [String] or [Number]
lng
(required) - [String] or [Number]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.radius
- [Number] Radius to search for in miles, max 25.
Product
Producer.all(options)
returns an Array of producer objects.options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated recordsname
- Alphabetically stating with numeric producers. 0-9, A-Z.-name
- Alphabetically starting with Z and working back through numeric producers. Z-A, 9-0.
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Producer alloptions
Producer.producer(ucpc)
returns a single producer object with the specified UCPC.ucpc
(required) - [String]
Producer
Producer.extracts(ucpc, options)
returns an array of extracts for a cannabis producer.ucpc
(required) - [String]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
Producer
Producer.edibles(ucpc, options)
returns an array of edibles for a cannabis producer.ucpc
(required) - [String]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
Producer
Producer.products(ucpc, options)
returns an array of products for a cannabis producer.ucpc
(required) - [String]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
Producer
Producer.availability(ucpc, lat, lng, options)
returns an Array of information about the availability of a producer using latitude and longitude.ucpc
(required) - [String]
lat
(required) - [String] or [Number]
lng
(required) - [String] or [Number]
options
(optional) - [Object]
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.radius
- [Number] Radius to search for in miles, max 25.
Producer
SeedCompany.seedCompany(ucpc)
returns an individual seed company object with the specified UCPC.ucpc
(required) - [String]
Product
SeedCompany.strains(ucpc, options)
returns an Array of strains offered by the specified seed company.options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
SeedCompany
SeedCompany.reviews(ucpc, options)
returns an Array of reviews for the strains available from the seed company.options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
SeedCompany
Dispensary.all(options)
returns an Array of dispensary objects.options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated recordsname
- Alphabetically stating with numeric strains. 0-9, A-Z.-name
- Alphabetically starting with Z and working back through numeric strains. Z-A, 9-0.
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Dispensary alloptions
Dispensary.dispensary(state, city, slug)
returns a individual dispensary object based on the state, city, and slug.state
(required) - [String] Two character state for the dispensary.
city
(required) - [String] City the dispensary is in (kebab-case).
slug
(required) - [String] Slug for the name of the dispensary.
Dispensary
Dispensary.strains(state, city, slug)
returns an Array of strains for a given dispensarystate
(required) - [String] Two character state for the dispensary.
city
(required) - [String] City the dispensary is in (kebab-case).
slug
(required) - [String] Slug for the name of the dispensary.
options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Dispensary
Dispensary.extracts(state, city, slug)
returns an Array of extracts for a given dispensarystate
(required) - [String] Two character state for the dispensary.
city
(required) - [String] City the dispensary is in (kebab-case).
slug
(required) - [String] Slug for the name of the dispensary.
options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Dispensary
Dispensary.edibles(state, city, slug)
returns an Array of edibles for a given dispensarystate
(required) - [String] Two character state for the dispensary.
city
(required) - [String] City the dispensary is in (kebab-case).
slug
(required) - [String] Slug for the name of the dispensary.
options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Dispensary
Dispensary.products(state, city, slug)
returns an Array of products for a given dispensarystate
(required) - [String] Two character state for the dispensary.
city
(required) - [String] City the dispensary is in (kebab-case).
slug
(required) - [String] Slug for the name of the dispensary.
options
(optional) - [Object]
sort
- [String] Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated records
page
- [Number] By default, Cannabis Reports will return 10 records at a time for this API call. You can use thepage
argument to fetch the page of results you want. Check out the pagination section of the documentation for further information.
Dispensary