quintype-backend
Advanced tools
Comparing version 1.9.0 to 1.10.0-testing2
156
index.js
@@ -173,2 +173,10 @@ 'use strict'; | ||
class Static { | ||
static getStaticData(client, params) { | ||
return client | ||
.getStaticData(params) | ||
.then(response => response); | ||
} | ||
} | ||
class Config { | ||
@@ -244,8 +252,15 @@ constructor(config) { | ||
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 | ||
}) | ||
@@ -255,23 +270,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)) | ||
@@ -281,25 +285,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, {})) | ||
} | ||
@@ -317,35 +311,26 @@ | ||
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 | ||
}) | ||
} | ||
getStaticData(params) { | ||
return this.request("/api/v1/static-pages/" + params.customSlug) | ||
} | ||
getSearch(params) { | ||
return rp({ | ||
method: 'GET', | ||
uri: this.baseUrl + "/api/v1/search", | ||
qs: params, | ||
json: true | ||
return this.request("/api/v1/search", { | ||
qs: params | ||
}) | ||
@@ -355,28 +340,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' | ||
} | ||
}) | ||
@@ -386,7 +361,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: { | ||
@@ -400,25 +373,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)) | ||
} | ||
@@ -437,2 +400,3 @@ } | ||
Author: Author, | ||
Static: Static, | ||
Collection: Collection, | ||
@@ -439,0 +403,0 @@ Entity: Entity, |
{ | ||
"name": "quintype-backend", | ||
"version": "1.9.0", | ||
"version": "1.10.0-testing2", | ||
"description": "client for accessing quintype API", | ||
"main": "index.js", | ||
"scripts": { | ||
"prepublishOnly": "npm install && git diff --quiet && git tag v$(cat package.json | grep version | head -n1 | cut -d \\\" -f 4) && git push --tags origin master" | ||
"prepublishOnly": "" | ||
}, | ||
@@ -9,0 +9,0 @@ "repository": { |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
12391
367
2