1.1.9 • Published 7 years ago
cannabis-reports v1.1.9
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
import { Strain, Flower, Extract, Edible, Product, Producer, SeedCompany, Dispensary } from 'cannabis-reports';
Only import the modules you need. For example, if you only need the Strain
and Extract
modules:
import { Strain, Extract } from 'cannabis-reports';
To set your API Key, set the environment variable CANNABIS_REPORTS_API_KEY
. Alternatively, you can set the configuration manually
import { setCannabisReportsKey } from 'cannabis-reports';
setCannabisReportsKey('<your-api-key>')
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
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
.all(options)
.then(data => console.log(data))
.catch(err => console.log(err))
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
.search('orange')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Strain
.strain('VUJCJ4TYMG000000000000000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Strain
.strain('VUJCJ4TYMG000000000000000')
.then(data => console.log(data))
.catch(err => console.log(err))
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
.reviews('VUJCJ4TYMG000000000000000', options)
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Strain
.effectsFlavors('VUJCJ4TYMG000000000000000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Strain
.seedCompany('VUJCJ4TYMG000000000000000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Strain
.genetics('VUJCJ4TYMG000000000000000')
.then(data => console.log(data))
.catch(err => console.log(err))
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
.children('VUJCJ4TYMG000000000000000', options)
.then(data => console.log(data))
.catch(err => console.log(err))
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
.availability('VUJCJ4TYMG000000000000000', 37.7749295, -122.4194155, options)
.then(data => console.log(data))
.catch(err => console.log(err))
options
(optional) - Object
sort
- String Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated recordspage
- 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
.all(options)
.then(data => console.log(data))
.catch(err => console.log(err))
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 recordspage
- 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
.type(flowerType, options)
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Flower
.flower('AHZ7H4N6467FVUDY3DAY00000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Flower
.user('AHZ7H4N6467FVUDY3DAY00000')
.then(data => console.log(data))
.catch(err => console.log(err))
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
.reviews('AHZ7H4N6467FVUDY3DAY00000', options)
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Flower
.effectsFlavors('AHZ7H4N6467FVUDY3DAY00000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Flower
.producer('AHZ7H4N6467FVUDY3DAY00000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Flower
.strain('AHZ7H4N6467FVUDY3DAY00000')
.then(data => console.log(data))
.catch(err => console.log(err))
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
.availability('AHZ7H4N6467FVUDY3DAY00000', 37.7749295, -122.4194155, options)
.then(data => console.log(data))
.catch(err => console.log(err))
options
(optional) - Object
sort
- String Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated recordspage
- 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
.all(options)
.then(data => console.log(data))
.catch(err => console.log(err))
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 recordspage
- 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
.type(extractType, options)
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Extract
.extract('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Extract
.user('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
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
.reviews('3CV7E33XLHTJT2XZ4GMD00000', options)
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Extract
.effectsFlavors('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Extract
.producer('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Extract
.strain('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
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
.availability('3CV7E33XLHTJT2XZ4GMD00000', 37.7749295, -122.4194155, options)
.then(data => console.log(data))
.catch(err => console.log(err))
options
(optional) - Object
sort
- String Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated recordspage
- 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
.all(options)
.then(data => console.log(data))
.catch(err => console.log(err))
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 recordspage
- 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
.type(edibleType, options)
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Edible
.edible('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Edible
.user('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
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
.reviews('3CV7E33XLHTJT2XZ4GMD00000', options)
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Edible
.effectsFlavors('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Edible
.producer('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Edible
.strain('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
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
.availability('3CV7E33XLHTJT2XZ4GMD00000', 37.7749295, -122.4194155, options)
.then(data => console.log(data))
.catch(err => console.log(err))
options
(optional) - Object
sort
- String Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated recordspage
- 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
.all(options)
.then(data => console.log(data))
.catch(err => console.log(err))
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 recordspage
- 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
.type(productType, options)
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Product
.product('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Product
.user('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
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
.reviews('3CV7E33XLHTJT2XZ4GMD00000', options)
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Product
.effectsFlavors('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Product
.producer('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Product
.strain('3CV7E33XLHTJT2XZ4GMD00000')
.then(data => console.log(data))
.catch(err => console.log(err))
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
.availability('3CV7E33XLHTJT2XZ4GMD00000', 37.7749295, -122.4194155, options)
.then(data => console.log(data))
.catch(err => console.log(err))
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
.all(options)
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Producer
.producer('0000000000L6M7E0000000000')
.then(data => console.log(data))
.catch(err => console.log(err))
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
.extracts('0000000000L6M7E0000000000', options)
.then(data => console.log(data))
.catch(err => console.log(err))
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
.edibles('0000000000L6M7E0000000000', options)
.then(data => console.log(data))
.catch(err => console.log(err))
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
.products('0000000000L6M7E0000000000', options)
.then(data => console.log(data))
.catch(err => console.log(err))
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
.availability('0000000000L6M7E0000000000', 37.7749295, -122.4194155, options)
.then(data => console.log(data))
.catch(err => console.log(err))
ucpc
(required) - String
Product
.seedCompany('VUJCJ00000000000000000000')
.then(data => console.log(data))
.catch(err => console.log(err))
options
(optional) - Object
sort
- String Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated recordspage
- 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('VUJCJ00000000000000000000', options)
.then(data => console.log(data))
.catch(err => console.log(err))
options
(optional) - Object
sort
- String Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated recordspage
- 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
.reviews('VUJCJ00000000000000000000', options)
.then(data => console.log(data))
.catch(err => console.log(err))
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
.all(options)
.then(data => console.log(data))
.catch(err => console.log(err))
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('ca', 'san-francisco', 'grass-roots')
.then(data => console.log(data))
.catch(err => console.log(err))
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.
options
(optional) - Object
sort
- String Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated recordspage
- 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
.strains('ca', 'san-francisco', 'grass-roots', options)
.then(data => console.log(data))
.catch(err => console.log(err))
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.
options
(optional) - Object
sort
- String Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated recordspage
- 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
.extracts('ca', 'san-francisco', 'grass-roots', options)
.then(data => console.log(data))
.catch(err => console.log(err))
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.
options
(optional) - Object
sort
- String Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated recordspage
- 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
.edibles('ca', 'san-francisco', 'grass-roots', options)
.then(data => console.log(data))
.catch(err => console.log(err))
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.
options
(optional) - Object
sort
- String Possible values:createdAt
- Oldest records-createdAt
- Newest recordsupdatedAt
- Oldest updated records-updatedAt
- Newest updated recordspage
- 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
.products('ca', 'san-francisco', 'grass-roots', options)
.then(data => console.log(data))
.catch(err => console.log(err))