active-activity-search
Active.com Activity Search v2 HTTP API client.
npm install active-activity-search --save
npm stats
Example
Initialize
var client = require('active-activity-search')({
key: '******',
url: 'https://api.amp.active.com/v2/search'
})
Callback
client
.query('basketball')
.category('event')
.city('Denver')
.state('CO')
.zip('80202')
.radius(50)
.search(function (error, data) {
if (error) throw error
console.log(data)
})
Promise
client
.query('basketball')
.category('event')
.city('Denver')
.state('CO')
.zip('80202')
.radius(50)
.search()
.then(function (data) {
console.log(data)
})
.catch(function (error) {
console.error(error.message)
})
Features
- Supports all documented API query parameters.
- Supports 12-factor configuration.
- Accepts a traditional node-style callback otherwise, returns a promise.
- Exposes a
User-Agent
request header including the name and version of the client. - Exposes a fluent interface.
- Emits debug logs via
DEBUG=active-activity-search*
.
12-factor configuration example
ACTIVE_ACTIVITY_API_KEY="*****"
ACTIVE_ACTIVITY_API_URL="https://api.amp.active.com/v2/search"
API
active([options])
Arguments
The following arguments can also be specified via environment variables.
[options]: (Object)
options object.
[key]: (String)
API key.
- or
process.env.ACTIVE_API_KEY
[url]: (String)
API base URL.
- or
process.env.ACTIVE_API_URL
Returns
client: (Object)
API client object.
.options()
(read only)
Arguments
Returns
options: (Object)
options object.
.set
Invoke corresponding accessor for each snake_cased parameter in given source object.
set({ show_suggest: true, query: 'running' })
NOTE: see http://developer.active.com/docs/read/v2_Activity_API_Search
Accessors
For each parameter a corresponding camelCased accessor (getter/setter) function is exposed.
- All accessors are chainable.
- Call accessor function w/o arguments and it will act as a getter.
- Call accessor function w/ an argument and it will act as a setter.
functions
- near
- latLon
- bbox
- geoPoints
- radius
- showDistance
- city
- state
- zip
- country
- query
- currentPage
- perPage
- sort
- facets
- facetValues
- category
- categoryName
- topic
- topicName
- metaInterest
- metaInterestName
- attributes
- tags
- startDate
- endDate
- cb
- excludeChildren
- includeEvergreenChildren
- registerableOnly
- exists
- notExists
- assetName
- orgId
- placeId
- sourceSystemId
- sourceSystemName
- showSuggest
- searchAgain
- fields
- assetGuid
- substitutionUrl
- authorName
- reqMinAge
- cityName
- topicName
Resources
Licenses