Commit c8d505d2 authored by Evgeniy Zaitsev's avatar Evgeniy Zaitsev
Browse files

v0.0.1

parent f81c228f
......@@ -25,6 +25,7 @@ class SDK {
constructor(config) {
this.server = koa();
this.config = config;
this.logger = logger;
validate(this.server);
......@@ -40,7 +41,7 @@ class SDK {
this.server.context.tablesNames = tablesNames;
this.server.context.db = mysql.createConnection(this.config.mySql);
this.server.context.logger = logger;
this.server.context.logger = this.logger;
this.server.context.config = this.config;
this.server.context.throwResponseErrorIfNeed = throwResponseErrorIfNeed.bind(this.server.context);
......@@ -52,32 +53,46 @@ class SDK {
}
fetchPrivateListings(feedEndpoint, projectFeedUUID) {
this.logger.log('fetch private listings', feedEndpoint, projectFeedUUID);
return this._fetchPrivateFeed('privateListings', feedEndpoint, projectFeedUUID);
}
fetchPrivateLatestResultsByEventFeedUUID(feedEndpoint, eventFeedUUID) {
this.logger.log('fetch private latest result by event feed uuid', feedEndpoint, eventFeedUUID);
return this._fetchPrivateFeed('privateLatestResults', feedEndpoint, eventFeedUUID);
}
fetchPrivateAllPublishedElementsByEventFeedUUID(feedEndpoint, eventFeedUUID) {
this.logger.log('fetch private all publish elements by event feed uuid', feedEndpoint, eventFeedUUID);
return this._fetchPrivateFeed('privateAllPublishedElements', feedEndpoint, eventFeedUUID);
}
fetchPrivateAllElementsByEventFeedUUID(feedEndpoint, eventFeedUUID) {
this.logger.log('fetch private all elements by event feed uuid', feedEndpoint, eventFeedUUID);
return this._fetchPrivateFeed('privateAllElements', feedEndpoint, eventFeedUUID);
}
fetchPrivateLatestResultsByEventId(feedEndpoint, projectFeedUUID, eventId) {
this.logger.log('fetch private latest result by event uuid', feedEndpoint, eventId);
return this._fetchPrivateListingsAndGetEventFeedUUID(feedEndpoint, projectFeedUUID, eventId)
.then(eventFeedUUID => this.fetchPrivateLatestResultsByEventFeedUUID(feedEndpoint, eventFeedUUID));
}
fetchPrivateAllPublishedElementsByEventId(feedEndpoint, projectFeedUUID, eventId) {
this.logger.log('fetch private all publish elements by event uuid', feedEndpoint, eventId);
return this._fetchPrivateListingsAndGetEventFeedUUID(feedEndpoint, projectFeedUUID, eventId)
.then(eventFeedUUID => this.fetchPrivateAllPublishedElementsByEventFeedUUID(feedEndpoint, eventFeedUUID));
}
fetchPrivateAllElementsByEventId(feedEndpoint, projectFeedUUID, eventId) {
this.logger.log('fetch private all elements by event uuid', feedEndpoint, eventId);
return this._fetchPrivateListingsAndGetEventFeedUUID(feedEndpoint, projectFeedUUID, eventId)
.then(eventFeedUUID => this.fetchPrivateAllElementsByEventFeedUUID(feedEndpoint, eventFeedUUID));
}
......@@ -112,8 +127,11 @@ class SDK {
}
_fetchPrivateFeed(feedName, feedEndpoint, feedUUID) {
return fetch(lvisEndpoints[feedName](feedEndpoint, this.config.feedVersion, feedUUID))
.then(res => res.json());
const url = lvisEndpoints[feedName](feedEndpoint, this.config.feedVersion, feedUUID);
this.logger.log('fetch private feed', url);
return fetch(url).then(res => res.json());
}
_fetchPrivateListingsAndGetEventFeedUUID(feedEndpoint, projectFeedUUID, eventId) {
......
{
"name": "service-sdk",
"version": "0.0.12",
"version": "0.0.13",
"private": true,
"description": "Service SDK for LViS",
"keywords": [],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment