quintype-backend
Advanced tools
Comparing version 1.9.0 to 1.10.0
143
index.js
@@ -243,8 +243,15 @@ 'use strict'; | ||
request(path, opts) { | ||
const params = Object.assign({ | ||
method: 'GET', | ||
uri: this.baseUrl + path, | ||
json: true, | ||
gzip: true | ||
}, opts); | ||
return rp(params); | ||
} | ||
getFromBulkApiManager(slug, params) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/bulk/" + slug, | ||
qs: params, | ||
json: true | ||
return this.request("/api/v1/bulk/" + slug,{ | ||
qs: params | ||
}) | ||
@@ -254,23 +261,12 @@ } | ||
getTags(slug) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/tags/" + slug, | ||
json: true | ||
}) | ||
return this.request("/api/v1/tags/" + slug) | ||
} | ||
getPublicPreviewStory(publicPreviewKey) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/preview/story/" + publicPreviewKey, | ||
json: true | ||
}).catch(e => catch404(e, {})) | ||
return this.request("/api/v1/preview/story/" + publicPreviewKey).catch(e => catch404(e, {})) | ||
} | ||
getCollectionBySlug(slug, params) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/collections/" + slug, | ||
qs: params, | ||
json: true | ||
return this.request("/api/v1/collections/" + slug, { | ||
qs: params | ||
}).catch(e => catch404(e, null)) | ||
@@ -280,25 +276,15 @@ } | ||
getStories(params) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/stories", | ||
qs: params, | ||
json: true | ||
}); | ||
return this.request("/api/v1/stories", { | ||
qs: params | ||
}) | ||
} | ||
getStoryBySlug(slug, params) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/stories-by-slug", | ||
qs: _.merge({slug: slug}, params), | ||
json: true | ||
}).catch(e => catch404(e, {})); | ||
return this.request("/api/v1/stories-by-slug", { | ||
qs: _.merge({slug: slug}, params) | ||
}).catch(e => catch404(e, {})) | ||
} | ||
getStoryById(id) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/stories/" + id, | ||
json: true | ||
}).catch(e => catch404(e, {})); | ||
return this.request("/api/v1/stories/" + id).catch(e => catch404(e, {})) | ||
} | ||
@@ -316,35 +302,22 @@ | ||
getCurrentMember(authToken) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/members/me", | ||
return this.request("/api/v1/members/me", { | ||
headers: { | ||
"X-QT-AUTH": authToken | ||
}, | ||
json: true | ||
}); | ||
} | ||
}) | ||
} | ||
getAuthor(authorId) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/authors/" + authorId, | ||
json: true | ||
}).catch(e => catch404(e, {})); | ||
return this.request("/api/v1/authors/" + authorId).catch(e => catch404(e, {})) | ||
} | ||
getAuthors(params) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/authors", | ||
qs: params, | ||
json: true | ||
}); | ||
return this.request("/api/authors", { | ||
qs: params | ||
}) | ||
} | ||
getSearch(params) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/search", | ||
qs: params, | ||
json: true | ||
return this.request("/api/v1/search", { | ||
qs: params | ||
}) | ||
@@ -354,28 +327,18 @@ } | ||
getRelatedStories(storyId = null, sectionId = null) { | ||
return rp({ | ||
method: 'GET', | ||
uri: `${this.baseUrl}/api/v1/stories/${storyId}/related-stories?section-id=${sectionId}`, | ||
json: true | ||
}) | ||
return this.request("/api/v1/stories/" + storyId + "/related-stories?section-id=" + sectionId) | ||
} | ||
updateConfig() { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/config", | ||
json: true | ||
}) | ||
.then(config => this.config = Config.build(config)); | ||
return this.request("/api/v1/config") | ||
.then(config => this.config = Config.build(config)) | ||
} | ||
postComments(params, authToken){ | ||
return rp ({ | ||
return this.request("/api/v1/comments", { | ||
method: 'POST', | ||
uri: this.baseUrl + "/api/v1/comments", | ||
body: params, | ||
headers: { | ||
"X-QT-AUTH": authToken, | ||
'content-type': 'application/json' | ||
}, | ||
json: true | ||
"X-QT-AUTH": authToken, | ||
'content-type': 'application/json' | ||
} | ||
}) | ||
@@ -385,7 +348,5 @@ } | ||
getInBulk(requests){ | ||
return rp({ | ||
return this.request("/api/v1/bulk-request", { | ||
method: 'POST', | ||
uri: this.baseUrl + "/api/v1/bulk-request", | ||
body: requests, | ||
json: true, | ||
headers: { | ||
@@ -399,25 +360,15 @@ 'content-type': 'application/json' | ||
getAmpStoryBySlug(slug) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/amp/story", | ||
qs : {slug}, | ||
json: true | ||
}); | ||
return this.request("/api/v1/amp/story", { | ||
qs: {slug} | ||
}) | ||
} | ||
getEntities(params) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/entities", | ||
qs: params, | ||
json: true | ||
}); | ||
return this.request("/api/v1/entities", { | ||
qs: params | ||
}) | ||
} | ||
getCustomURL(slug) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/custom-urls/" + encodeURIComponent(slug), | ||
json: true | ||
}) | ||
return this.request("/api/v1/custom-urls/" + encodeURIComponent(slug)) | ||
} | ||
@@ -424,0 +375,0 @@ } |
{ | ||
"name": "quintype-backend", | ||
"version": "1.9.0", | ||
"version": "1.10.0", | ||
"description": "client for accessing quintype API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
12261
356