drupal-org-api
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -28,8 +28,7 @@ const axios = require('axios'); | ||
return this.axios({ method, url }) | ||
.then(({ data }) => Promise.resolve(data)) | ||
.catch(Promise.reject); | ||
.then(({ data }) => data); | ||
} | ||
/** | ||
* Node | ||
* @param {Object} filterOptions | ||
* @param {Object} [filterOptions={}] | ||
* Query string filter options | ||
@@ -39,3 +38,3 @@ * @return {Promise} | ||
*/ | ||
node(filterOptions) { | ||
node(filterOptions = {}) { | ||
return this.issueRequest( | ||
@@ -47,3 +46,3 @@ this.methods.GET, | ||
* User | ||
* @param {Object} filterOptions | ||
* @param {Object} [filterOptions={}] | ||
* Query string filter options | ||
@@ -53,3 +52,3 @@ * @return {Promise} | ||
*/ | ||
user(filterOptions) { | ||
user(filterOptions = {}) { | ||
return this.issueRequest( | ||
@@ -61,3 +60,3 @@ this.methods.GET, | ||
* Comments | ||
* @param {Object} filterOptions | ||
* @param {Object} [filterOptions={}] | ||
* Query string filter options | ||
@@ -67,3 +66,3 @@ * @return {Promise} | ||
*/ | ||
comment(filterOptions) { | ||
comment(filterOptions = {}) { | ||
return this.issueRequest( | ||
@@ -99,3 +98,3 @@ this.methods.GET, | ||
* DrupalCI Jobs | ||
* @param {Object} filterOptions | ||
* @param {Object} [filterOptions={}] | ||
* Query string filter options | ||
@@ -105,3 +104,3 @@ * @return {Promise} | ||
*/ | ||
ci(filterOptions) { | ||
ci(filterOptions = {}) { | ||
return this.issueRequest( | ||
@@ -114,12 +113,12 @@ this.methods.GET, | ||
* Taxonomy Term | ||
* @param {String} [tid] | ||
* Taxonomy Term ID | ||
* @param {Object} [filterOptions={}] | ||
* Query string filter options | ||
* @return {Promise} | ||
* Pending issueRequest promise. | ||
*/ | ||
taxonomyTerm(tid) { | ||
taxonomyTerm(filterOptions = {}) { | ||
return this.issueRequest( | ||
this.methods.GET, | ||
`${this.base}taxonomy_term.${this.format}${tid ? `?tid=${tid}` : ''}`); | ||
`${this.base}taxonomy_term.${this.format}?${qs.stringify(filterOptions, { indices: false })}`); | ||
} | ||
}; |
{ | ||
"name": "drupal-org-api", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "JavaScript client for Drupal.org", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -64,7 +64,7 @@ # Drupal.org HTTP API | ||
### `exports.taxonomyTerm(tid)` | ||
### `exports.taxonomyTerm(filterOptions)` | ||
**Parameters** | ||
**tid**: `String`, Taxonomy Term ID | ||
**filterOptions**: `Object`, Query string filter options | ||
@@ -71,0 +71,0 @@ **Returns**: `Promise`, Pending `issueRequest` promise. |
const DrupalAPI = require('./lib'); | ||
const drupalapi = new DrupalAPI(); | ||
drupalapi.taxonomyTerm(38080).then(console.log) | ||
drupalapi.node({nid: 2885090}) | ||
//.then(res => drupalapi.getRelatedTaxonomyTerms(res)) | ||
//.then(d => console.log(d.list[0].comments)) | ||
//.then(res => drupalapi.getRelatedComments(res)) | ||
.then(console.log) | ||
.catch(console.log); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44630
132