@lokalise/node-api
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -18,3 +18,2 @@ module.exports = { | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
@@ -40,4 +39,4 @@ "plugin:node/recommended", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/camelcase": "off", | ||
"@typescript-eslint/no-inferrable-types": "off", | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"node/no-unsupported-features/es-syntax": "off", | ||
@@ -44,0 +43,0 @@ "node/no-unpublished-import": "off", |
# Lokalise API Node Client Changelog | ||
## 4.0.1 (16-Jun-20) | ||
* Update all dependencies to recent versions | ||
* Update linters | ||
## 4.0.0 (18-May-20) | ||
@@ -4,0 +9,0 @@ |
@@ -5,109 +5,106 @@ "use strict"; | ||
const base_1 = require("../http_client/base"); | ||
let BaseCollection = /** @class */ (() => { | ||
class BaseCollection { | ||
constructor() { | ||
// Workaround for handling HTTP header pagination params | ||
this.totalResults = null; | ||
this.totalPages = null; | ||
this.resultsPerPage = null; | ||
this.currentPage = null; | ||
class BaseCollection { | ||
constructor() { | ||
// Workaround for handling HTTP header pagination params | ||
this.totalResults = null; | ||
this.totalPages = null; | ||
this.resultsPerPage = null; | ||
this.currentPage = null; | ||
} | ||
get(id, params = {}, body = null) { | ||
params["id"] = id; | ||
return this.createPromise("GET", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
list(params = {}) { | ||
return this.createPromise("GET", params, this.populateArrayFromJson, this.handleReject, null); | ||
} | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateObjectFromJson, this.handleReject, body); | ||
} | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJson, this.handleReject, body); | ||
} | ||
delete(id, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("DELETE", params, this.returnBareJSON, this.handleReject, null); | ||
} | ||
populatePaginationDataFor(headers) { | ||
this.totalResults = parseInt(headers["x-pagination-total-count"]); | ||
this.totalPages = parseInt(headers["x-pagination-page-count"]); | ||
this.resultsPerPage = parseInt(headers["x-pagination-limit"]); | ||
this.currentPage = parseInt(headers["x-pagination-page"]); | ||
return; | ||
} | ||
populateObjectFromJsonRoot(json) { | ||
const childClass = this.constructor; | ||
if (childClass.rootElementNameSingular != null) { | ||
json = json[childClass.rootElementNameSingular]; | ||
} | ||
get(id, params = {}, body = null) { | ||
params["id"] = id; | ||
return this.createPromise("GET", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
return this.populateObjectFromJson(json); | ||
} | ||
populateSecondaryObjectFromJsonRoot(json) { | ||
const childClass = this.constructor; | ||
if (childClass.secondaryElementNameSingular != null) { | ||
json = json[childClass.secondaryElementNameSingular]; | ||
} | ||
list(params = {}) { | ||
return this.createPromise("GET", params, this.populateArrayFromJson, this.handleReject, null); | ||
return this.populateObjectFromJson(json, true); | ||
} | ||
populateObjectFromJson(json, secondary = false) { | ||
const childClass = this.constructor; | ||
if (secondary) { | ||
return new childClass.secondaryElementClass(json); | ||
} | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateObjectFromJson, this.handleReject, body); | ||
else { | ||
return new childClass.elementClass(json); | ||
} | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJson, this.handleReject, body); | ||
} | ||
populateArrayFromJson(json) { | ||
const childClass = this.constructor; | ||
const arr = []; | ||
const jsonArray = json[childClass.rootElementName]; | ||
for (const obj of jsonArray) { | ||
arr.push(this.populateObjectFromJson(obj)); | ||
} | ||
delete(id, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("DELETE", params, this.returnBareJSON, this.handleReject, null); | ||
return arr; | ||
} | ||
populateApiErrorFromJson(json) { | ||
return json; | ||
} | ||
returnBareJSON(json) { | ||
return json; | ||
} | ||
handleReject(data) { | ||
return this.populateApiErrorFromJson(data); | ||
} | ||
createPromise(method, params, resolveFn, rejectFn = this.handleReject, body = null, uri = null) { | ||
const childClass = this.constructor; | ||
if (uri == null) { | ||
uri = childClass.prefixURI; | ||
} | ||
populatePaginationDataFor(headers) { | ||
this.totalResults = parseInt(headers["x-pagination-total-count"]); | ||
this.totalPages = parseInt(headers["x-pagination-page-count"]); | ||
this.resultsPerPage = parseInt(headers["x-pagination-limit"]); | ||
this.currentPage = parseInt(headers["x-pagination-page"]); | ||
return; | ||
} | ||
populateObjectFromJsonRoot(json) { | ||
const childClass = this.constructor; | ||
if (childClass.rootElementNameSingular != null) { | ||
json = json[childClass.rootElementNameSingular]; | ||
} | ||
return this.populateObjectFromJson(json); | ||
} | ||
populateSecondaryObjectFromJsonRoot(json) { | ||
const childClass = this.constructor; | ||
if (childClass.secondaryElementNameSingular != null) { | ||
json = json[childClass.secondaryElementNameSingular]; | ||
} | ||
return this.populateObjectFromJson(json, true); | ||
} | ||
populateObjectFromJson(json, secondary = false) { | ||
const childClass = this.constructor; | ||
if (secondary) { | ||
return new childClass.secondaryElementClass(json); | ||
} | ||
else { | ||
return new childClass.elementClass(json); | ||
} | ||
} | ||
populateArrayFromJson(json) { | ||
const childClass = this.constructor; | ||
const arr = []; | ||
const jsonArray = json[childClass.rootElementName]; | ||
for (const obj of jsonArray) { | ||
arr.push(this.populateObjectFromJson(obj)); | ||
} | ||
return arr; | ||
} | ||
populateApiErrorFromJson(json) { | ||
return json; | ||
} | ||
returnBareJSON(json) { | ||
return json; | ||
} | ||
handleReject(data) { | ||
return this.populateApiErrorFromJson(data); | ||
} | ||
createPromise(method, params, resolveFn, rejectFn = this.handleReject, body = null, uri = null) { | ||
const childClass = this.constructor; | ||
if (uri == null) { | ||
uri = childClass.prefixURI; | ||
} | ||
return new Promise((resolve, reject) => { | ||
const response = new base_1.ApiRequest(uri, method, body, params); | ||
response.promise | ||
.then((result) => { | ||
const headers = result["headers"]; | ||
this.populatePaginationDataFor(headers); | ||
const json = result["body"]; | ||
resolve(resolveFn.call(this, json)); | ||
}) | ||
.catch((data) => { | ||
reject(rejectFn.call(this, data)); | ||
}); | ||
return new Promise((resolve, reject) => { | ||
const response = new base_1.ApiRequest(uri, method, body, params); | ||
response.promise | ||
.then((result) => { | ||
const headers = result["headers"]; | ||
this.populatePaginationDataFor(headers); | ||
const json = result["body"]; | ||
resolve(resolveFn.call(this, json)); | ||
}) | ||
.catch((data) => { | ||
reject(rejectFn.call(this, data)); | ||
}); | ||
} | ||
}); | ||
} | ||
BaseCollection.rootElementName = ""; | ||
BaseCollection.rootElementNameSingular = null; | ||
BaseCollection.endpoint = null; | ||
BaseCollection.prefixURI = null; | ||
BaseCollection.elementClass = null; | ||
// Secondaries are used when an instance of a different class has to be created | ||
// For example, uploading a File may return a QueuedProcess | ||
BaseCollection.secondaryElementNameSingular = null; | ||
BaseCollection.secondaryElementClass = null; | ||
return BaseCollection; | ||
})(); | ||
} | ||
exports.BaseCollection = BaseCollection; | ||
BaseCollection.rootElementName = ""; | ||
BaseCollection.rootElementNameSingular = null; | ||
BaseCollection.endpoint = null; | ||
BaseCollection.prefixURI = null; | ||
BaseCollection.elementClass = null; | ||
// Secondaries are used when an instance of a different class has to be created | ||
// For example, uploading a File may return a QueuedProcess | ||
BaseCollection.secondaryElementNameSingular = null; | ||
BaseCollection.secondaryElementClass = null; | ||
//# sourceMappingURL=base_collection.js.map |
@@ -6,23 +6,20 @@ "use strict"; | ||
const branch_1 = require("../models/branch"); | ||
let Branches = /** @class */ (() => { | ||
class Branches extends base_collection_1.BaseCollection { | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
merge(id, body = {}, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("POST", params, this.returnBareJSON, this.handleReject, body, "projects/{!:project_id}/branches/{:id}/merge"); | ||
} | ||
class Branches extends base_collection_1.BaseCollection { | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
Branches.rootElementName = "branches"; | ||
Branches.rootElementNameSingular = "branch"; | ||
Branches.prefixURI = "projects/{!:project_id}/branches/{:id}"; | ||
Branches.elementClass = branch_1.Branch; | ||
return Branches; | ||
})(); | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
merge(id, body = {}, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("POST", params, this.returnBareJSON, this.handleReject, body, "projects/{!:project_id}/branches/{:id}/merge"); | ||
} | ||
} | ||
exports.Branches = Branches; | ||
Branches.rootElementName = "branches"; | ||
Branches.rootElementNameSingular = "branch"; | ||
Branches.prefixURI = "projects/{!:project_id}/branches/{:id}"; | ||
Branches.elementClass = branch_1.Branch; | ||
//# sourceMappingURL=branches.js.map |
@@ -6,18 +6,15 @@ "use strict"; | ||
const comment_1 = require("../models/comment"); | ||
let Comments = /** @class */ (() => { | ||
class Comments extends base_collection_1.BaseCollection { | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateArrayFromJson, this.handleReject, body); | ||
} | ||
list_project_comments(params = {}) { | ||
return this.createPromise("GET", { project_id: params["project_id"] }, this.populateArrayFromJson, this.handleReject, null, "projects/{!:project_id}/comments"); | ||
} | ||
class Comments extends base_collection_1.BaseCollection { | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateArrayFromJson, this.handleReject, body); | ||
} | ||
Comments.rootElementName = "comments"; | ||
Comments.rootElementNameSingular = "comment"; | ||
Comments.prefixURI = "projects/{!:project_id}/keys/{!:key_id}/comments/{:id}"; | ||
Comments.elementClass = comment_1.Comment; | ||
return Comments; | ||
})(); | ||
list_project_comments(params = {}) { | ||
return this.createPromise("GET", { project_id: params["project_id"] }, this.populateArrayFromJson, this.handleReject, null, "projects/{!:project_id}/comments"); | ||
} | ||
} | ||
exports.Comments = Comments; | ||
Comments.rootElementName = "comments"; | ||
Comments.rootElementNameSingular = "comment"; | ||
Comments.prefixURI = "projects/{!:project_id}/keys/{!:key_id}/comments/{:id}"; | ||
Comments.elementClass = comment_1.Comment; | ||
//# sourceMappingURL=comments.js.map |
@@ -6,20 +6,17 @@ "use strict"; | ||
const contributor_1 = require("../models/contributor"); | ||
let Contributors = /** @class */ (() => { | ||
class Contributors extends base_collection_1.BaseCollection { | ||
create(raw_body, params = {}) { | ||
const body = { contributors: raw_body }; | ||
return this.createPromise("POST", params, this.populateArrayFromJson, this.handleReject, body, "projects/{!:project_id}/contributors"); | ||
} | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
class Contributors extends base_collection_1.BaseCollection { | ||
create(raw_body, params = {}) { | ||
const body = { contributors: raw_body }; | ||
return this.createPromise("POST", params, this.populateArrayFromJson, this.handleReject, body, "projects/{!:project_id}/contributors"); | ||
} | ||
Contributors.rootElementName = "contributors"; | ||
Contributors.rootElementNameSingular = "contributor"; | ||
Contributors.prefixURI = "projects/{!:project_id}/contributors/{:id}"; | ||
Contributors.elementClass = contributor_1.Contributor; | ||
return Contributors; | ||
})(); | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
} | ||
exports.Contributors = Contributors; | ||
Contributors.rootElementName = "contributors"; | ||
Contributors.rootElementNameSingular = "contributor"; | ||
Contributors.prefixURI = "projects/{!:project_id}/contributors/{:id}"; | ||
Contributors.elementClass = contributor_1.Contributor; | ||
//# sourceMappingURL=contributors.js.map |
@@ -7,21 +7,18 @@ "use strict"; | ||
const queued_process_1 = require("../models/queued_process"); | ||
let Files = /** @class */ (() => { | ||
class Files extends base_collection_1.BaseCollection { | ||
upload(project_id, upload) { | ||
// Always upload in the background | ||
upload.queue = true; | ||
return this.createPromise("POST", { project_id: project_id }, this.populateSecondaryObjectFromJsonRoot, this.handleReject, upload, "projects/{!:project_id}/files/upload"); | ||
} | ||
download(project_id, download) { | ||
return this.createPromise("POST", { project_id: project_id }, this.returnBareJSON, this.handleReject, download, "projects/{!:project_id}/files/download"); | ||
} | ||
class Files extends base_collection_1.BaseCollection { | ||
upload(project_id, upload) { | ||
// Always upload in the background | ||
upload.queue = true; | ||
return this.createPromise("POST", { project_id: project_id }, this.populateSecondaryObjectFromJsonRoot, this.handleReject, upload, "projects/{!:project_id}/files/upload"); | ||
} | ||
Files.rootElementName = "files"; | ||
Files.prefixURI = "projects/{!:project_id}/files/{:id}"; | ||
Files.elementClass = file_1.File; | ||
Files.secondaryElementNameSingular = "process"; | ||
Files.secondaryElementClass = queued_process_1.QueuedProcess; | ||
return Files; | ||
})(); | ||
download(project_id, download) { | ||
return this.createPromise("POST", { project_id: project_id }, this.returnBareJSON, this.handleReject, download, "projects/{!:project_id}/files/download"); | ||
} | ||
} | ||
exports.Files = Files; | ||
Files.rootElementName = "files"; | ||
Files.prefixURI = "projects/{!:project_id}/files/{:id}"; | ||
Files.elementClass = file_1.File; | ||
Files.secondaryElementNameSingular = "process"; | ||
Files.secondaryElementClass = queued_process_1.QueuedProcess; | ||
//# sourceMappingURL=files.js.map |
@@ -6,28 +6,25 @@ "use strict"; | ||
const key_1 = require("../models/key"); | ||
let Keys = /** @class */ (() => { | ||
class Keys extends base_collection_1.BaseCollection { | ||
create(raw_body, params = {}) { | ||
const body = { keys: raw_body }; | ||
return this.createPromise("POST", params, this.populateArrayFromJson, this.handleReject, body); | ||
} | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
bulk_update(raw_keys, params) { | ||
const keys = { keys: raw_keys }; | ||
return this.createPromise("PUT", params, this.populateArrayFromJson, this.handleReject, keys, "projects/{!:project_id}/keys"); | ||
} | ||
bulk_delete(raw_keys, params) { | ||
const keys = { keys: raw_keys }; | ||
return this.createPromise("DELETE", params, this.returnBareJSON, this.handleReject, keys, "projects/{!:project_id}/keys"); | ||
} | ||
class Keys extends base_collection_1.BaseCollection { | ||
create(raw_body, params = {}) { | ||
const body = { keys: raw_body }; | ||
return this.createPromise("POST", params, this.populateArrayFromJson, this.handleReject, body); | ||
} | ||
Keys.rootElementName = "keys"; | ||
Keys.rootElementNameSingular = "key"; | ||
Keys.prefixURI = "projects/{!:project_id}/keys/{:id}"; | ||
Keys.elementClass = key_1.Key; | ||
return Keys; | ||
})(); | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
bulk_update(raw_keys, params) { | ||
const keys = { keys: raw_keys }; | ||
return this.createPromise("PUT", params, this.populateArrayFromJson, this.handleReject, keys, "projects/{!:project_id}/keys"); | ||
} | ||
bulk_delete(raw_keys, params) { | ||
const keys = { keys: raw_keys }; | ||
return this.createPromise("DELETE", params, this.returnBareJSON, this.handleReject, keys, "projects/{!:project_id}/keys"); | ||
} | ||
} | ||
exports.Keys = Keys; | ||
Keys.rootElementName = "keys"; | ||
Keys.rootElementNameSingular = "key"; | ||
Keys.prefixURI = "projects/{!:project_id}/keys/{:id}"; | ||
Keys.elementClass = key_1.Key; | ||
//# sourceMappingURL=keys.js.map |
@@ -6,23 +6,20 @@ "use strict"; | ||
const base_collection_1 = require("./base_collection"); | ||
let Languages = /** @class */ (() => { | ||
class Languages extends base_collection_1.BaseCollection { | ||
system_languages(params) { | ||
return this.createPromise("GET", params, this.populateArrayFromJson, this.handleReject, null, "system/languages"); | ||
} | ||
create(raw_body, params = {}) { | ||
const body = { languages: raw_body }; | ||
return this.createPromise("POST", params, this.populateArrayFromJson, this.handleReject, body); | ||
} | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
class Languages extends base_collection_1.BaseCollection { | ||
system_languages(params) { | ||
return this.createPromise("GET", params, this.populateArrayFromJson, this.handleReject, null, "system/languages"); | ||
} | ||
Languages.rootElementName = "languages"; | ||
Languages.rootElementNameSingular = "language"; | ||
Languages.prefixURI = "projects/{!:project_id}/languages/{:id}"; | ||
Languages.elementClass = language_1.Language; | ||
return Languages; | ||
})(); | ||
create(raw_body, params = {}) { | ||
const body = { languages: raw_body }; | ||
return this.createPromise("POST", params, this.populateArrayFromJson, this.handleReject, body); | ||
} | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
} | ||
exports.Languages = Languages; | ||
Languages.rootElementName = "languages"; | ||
Languages.rootElementNameSingular = "language"; | ||
Languages.prefixURI = "projects/{!:project_id}/languages/{:id}"; | ||
Languages.elementClass = language_1.Language; | ||
//# sourceMappingURL=languages.js.map |
@@ -6,11 +6,8 @@ "use strict"; | ||
const base_collection_1 = require("./base_collection"); | ||
let Orders = /** @class */ (() => { | ||
class Orders extends base_collection_1.BaseCollection { | ||
} | ||
Orders.rootElementName = "orders"; | ||
Orders.prefixURI = "teams/{!:team_id}/orders/{:id}"; | ||
Orders.elementClass = order_1.Order; | ||
return Orders; | ||
})(); | ||
class Orders extends base_collection_1.BaseCollection { | ||
} | ||
exports.Orders = Orders; | ||
Orders.rootElementName = "orders"; | ||
Orders.prefixURI = "teams/{!:team_id}/orders/{:id}"; | ||
Orders.elementClass = order_1.Order; | ||
//# sourceMappingURL=orders.js.map |
@@ -6,12 +6,9 @@ "use strict"; | ||
const base_collection_1 = require("./base_collection"); | ||
let PaymentCards = /** @class */ (() => { | ||
class PaymentCards extends base_collection_1.BaseCollection { | ||
} | ||
PaymentCards.rootElementName = "payment_cards"; | ||
PaymentCards.rootElementNameSingular = "payment_card"; | ||
PaymentCards.prefixURI = "payment_cards/{:id}"; | ||
PaymentCards.elementClass = payment_card_1.PaymentCard; | ||
return PaymentCards; | ||
})(); | ||
class PaymentCards extends base_collection_1.BaseCollection { | ||
} | ||
exports.PaymentCards = PaymentCards; | ||
PaymentCards.rootElementName = "payment_cards"; | ||
PaymentCards.rootElementNameSingular = "payment_card"; | ||
PaymentCards.prefixURI = "payment_cards/{:id}"; | ||
PaymentCards.elementClass = payment_card_1.PaymentCard; | ||
//# sourceMappingURL=payment_cards.js.map |
@@ -6,14 +6,11 @@ "use strict"; | ||
const base_collection_1 = require("./base_collection"); | ||
let Projects = /** @class */ (() => { | ||
class Projects extends base_collection_1.BaseCollection { | ||
empty(project_id) { | ||
return this.createPromise("PUT", { project_id: project_id }, this.populateObjectFromJson, this.handleReject, null, "projects/{!:project_id}/empty"); | ||
} | ||
class Projects extends base_collection_1.BaseCollection { | ||
empty(project_id) { | ||
return this.createPromise("PUT", { project_id: project_id }, this.populateObjectFromJson, this.handleReject, null, "projects/{!:project_id}/empty"); | ||
} | ||
Projects.rootElementName = "projects"; | ||
Projects.prefixURI = "projects/{:id}"; | ||
Projects.elementClass = project_1.Project; | ||
return Projects; | ||
})(); | ||
} | ||
exports.Projects = Projects; | ||
Projects.rootElementName = "projects"; | ||
Projects.prefixURI = "projects/{:id}"; | ||
Projects.elementClass = project_1.Project; | ||
//# sourceMappingURL=projects.js.map |
@@ -6,12 +6,9 @@ "use strict"; | ||
const base_collection_1 = require("./base_collection"); | ||
let QueuedProcesses = /** @class */ (() => { | ||
class QueuedProcesses extends base_collection_1.BaseCollection { | ||
} | ||
QueuedProcesses.rootElementName = "processes"; | ||
QueuedProcesses.rootElementNameSingular = "process"; | ||
QueuedProcesses.prefixURI = "projects/{!:project_id}/processes/{:id}"; | ||
QueuedProcesses.elementClass = queued_process_1.QueuedProcess; | ||
return QueuedProcesses; | ||
})(); | ||
class QueuedProcesses extends base_collection_1.BaseCollection { | ||
} | ||
exports.QueuedProcesses = QueuedProcesses; | ||
QueuedProcesses.rootElementName = "processes"; | ||
QueuedProcesses.rootElementNameSingular = "process"; | ||
QueuedProcesses.prefixURI = "projects/{!:project_id}/processes/{:id}"; | ||
QueuedProcesses.elementClass = queued_process_1.QueuedProcess; | ||
//# sourceMappingURL=queued_processes.js.map |
@@ -6,20 +6,17 @@ "use strict"; | ||
const screenshot_1 = require("../models/screenshot"); | ||
let Screenshots = /** @class */ (() => { | ||
class Screenshots extends base_collection_1.BaseCollection { | ||
create(raw_body, params = {}) { | ||
const body = { screenshots: raw_body }; | ||
return this.createPromise("POST", params, this.populateArrayFromJson, this.handleReject, body); | ||
} | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
class Screenshots extends base_collection_1.BaseCollection { | ||
create(raw_body, params = {}) { | ||
const body = { screenshots: raw_body }; | ||
return this.createPromise("POST", params, this.populateArrayFromJson, this.handleReject, body); | ||
} | ||
Screenshots.rootElementName = "screenshots"; | ||
Screenshots.rootElementNameSingular = "screenshot"; | ||
Screenshots.prefixURI = "projects/{!:project_id}/screenshots/{:id}"; | ||
Screenshots.elementClass = screenshot_1.Screenshot; | ||
return Screenshots; | ||
})(); | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
} | ||
exports.Screenshots = Screenshots; | ||
Screenshots.rootElementName = "screenshots"; | ||
Screenshots.rootElementNameSingular = "screenshot"; | ||
Screenshots.prefixURI = "projects/{!:project_id}/screenshots/{:id}"; | ||
Screenshots.elementClass = screenshot_1.Screenshot; | ||
//# sourceMappingURL=screenshots.js.map |
@@ -6,19 +6,16 @@ "use strict"; | ||
const snapshot_1 = require("../models/snapshot"); | ||
let Snapshots = /** @class */ (() => { | ||
class Snapshots extends base_collection_1.BaseCollection { | ||
restore(id, params) { | ||
params["id"] = id; | ||
return this.createPromise("POST", params, this.returnBareJSON, this.handleReject, {}); | ||
} | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
class Snapshots extends base_collection_1.BaseCollection { | ||
restore(id, params) { | ||
params["id"] = id; | ||
return this.createPromise("POST", params, this.returnBareJSON, this.handleReject, {}); | ||
} | ||
Snapshots.rootElementName = "snapshots"; | ||
Snapshots.rootElementNameSingular = "snapshot"; | ||
Snapshots.prefixURI = "projects/{!:project_id}/snapshots/{:id}"; | ||
Snapshots.elementClass = snapshot_1.Snapshot; | ||
return Snapshots; | ||
})(); | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
} | ||
exports.Snapshots = Snapshots; | ||
Snapshots.rootElementName = "snapshots"; | ||
Snapshots.rootElementNameSingular = "snapshot"; | ||
Snapshots.prefixURI = "projects/{!:project_id}/snapshots/{:id}"; | ||
Snapshots.elementClass = snapshot_1.Snapshot; | ||
//# sourceMappingURL=snapshots.js.map |
@@ -6,19 +6,16 @@ "use strict"; | ||
const task_1 = require("../models/task"); | ||
let Tasks = /** @class */ (() => { | ||
class Tasks extends base_collection_1.BaseCollection { | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
class Tasks extends base_collection_1.BaseCollection { | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
Tasks.rootElementName = "tasks"; | ||
Tasks.rootElementNameSingular = "task"; | ||
Tasks.prefixURI = "projects/{!:project_id}/tasks/{:id}"; | ||
Tasks.elementClass = task_1.Task; | ||
return Tasks; | ||
})(); | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
} | ||
exports.Tasks = Tasks; | ||
Tasks.rootElementName = "tasks"; | ||
Tasks.rootElementNameSingular = "task"; | ||
Tasks.prefixURI = "projects/{!:project_id}/tasks/{:id}"; | ||
Tasks.elementClass = task_1.Task; | ||
//# sourceMappingURL=tasks.js.map |
@@ -6,16 +6,13 @@ "use strict"; | ||
const team_user_1 = require("../models/team_user"); | ||
let TeamUsers = /** @class */ (() => { | ||
class TeamUsers extends base_collection_1.BaseCollection { | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
class TeamUsers extends base_collection_1.BaseCollection { | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
TeamUsers.rootElementName = "team_users"; | ||
TeamUsers.rootElementNameSingular = "team_user"; | ||
TeamUsers.prefixURI = "teams/{!:team_id}/users/{:id}"; | ||
TeamUsers.elementClass = team_user_1.TeamUser; | ||
return TeamUsers; | ||
})(); | ||
} | ||
exports.TeamUsers = TeamUsers; | ||
TeamUsers.rootElementName = "team_users"; | ||
TeamUsers.rootElementNameSingular = "team_user"; | ||
TeamUsers.prefixURI = "teams/{!:team_id}/users/{:id}"; | ||
TeamUsers.elementClass = team_user_1.TeamUser; | ||
//# sourceMappingURL=team_users.js.map |
@@ -6,11 +6,8 @@ "use strict"; | ||
const team_1 = require("../models/team"); | ||
let Teams = /** @class */ (() => { | ||
class Teams extends base_collection_1.BaseCollection { | ||
} | ||
Teams.rootElementName = "teams"; | ||
Teams.prefixURI = "teams"; | ||
Teams.elementClass = team_1.Team; | ||
return Teams; | ||
})(); | ||
class Teams extends base_collection_1.BaseCollection { | ||
} | ||
exports.Teams = Teams; | ||
Teams.rootElementName = "teams"; | ||
Teams.prefixURI = "teams"; | ||
Teams.elementClass = team_1.Team; | ||
//# sourceMappingURL=teams.js.map |
@@ -6,11 +6,8 @@ "use strict"; | ||
const translation_provider_1 = require("../models/translation_provider"); | ||
let TranslationProviders = /** @class */ (() => { | ||
class TranslationProviders extends base_collection_1.BaseCollection { | ||
} | ||
TranslationProviders.rootElementName = "translation_providers"; | ||
TranslationProviders.prefixURI = "teams/{!:team_id}/translation_providers/{:id}"; | ||
TranslationProviders.elementClass = translation_provider_1.TranslationProvider; | ||
return TranslationProviders; | ||
})(); | ||
class TranslationProviders extends base_collection_1.BaseCollection { | ||
} | ||
exports.TranslationProviders = TranslationProviders; | ||
TranslationProviders.rootElementName = "translation_providers"; | ||
TranslationProviders.prefixURI = "teams/{!:team_id}/translation_providers/{:id}"; | ||
TranslationProviders.elementClass = translation_provider_1.TranslationProvider; | ||
//# sourceMappingURL=translation_providers.js.map |
@@ -6,22 +6,19 @@ "use strict"; | ||
const translation_status_1 = require("../models/translation_status"); | ||
let TranslationStatuses = /** @class */ (() => { | ||
class TranslationStatuses extends base_collection_1.BaseCollection { | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
available_colors(params = {}) { | ||
return this.createPromise("GET", params, this.returnBareJSON, this.handleReject, {}, "projects/{!:project_id}/custom_translation_statuses/colors"); | ||
} | ||
class TranslationStatuses extends base_collection_1.BaseCollection { | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
TranslationStatuses.rootElementName = "custom_translation_statuses"; | ||
TranslationStatuses.prefixURI = "projects/{!:project_id}/custom_translation_statuses/{:id}"; | ||
TranslationStatuses.elementClass = translation_status_1.TranslationStatus; | ||
TranslationStatuses.rootElementNameSingular = "custom_translation_status"; | ||
return TranslationStatuses; | ||
})(); | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
available_colors(params = {}) { | ||
return this.createPromise("GET", params, this.returnBareJSON, this.handleReject, {}, "projects/{!:project_id}/custom_translation_statuses/colors"); | ||
} | ||
} | ||
exports.TranslationStatuses = TranslationStatuses; | ||
TranslationStatuses.rootElementName = "custom_translation_statuses"; | ||
TranslationStatuses.prefixURI = "projects/{!:project_id}/custom_translation_statuses/{:id}"; | ||
TranslationStatuses.elementClass = translation_status_1.TranslationStatus; | ||
TranslationStatuses.rootElementNameSingular = "custom_translation_status"; | ||
//# sourceMappingURL=translation_statuses.js.map |
@@ -6,16 +6,13 @@ "use strict"; | ||
const translation_1 = require("../models/translation"); | ||
let Translations = /** @class */ (() => { | ||
class Translations extends base_collection_1.BaseCollection { | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
class Translations extends base_collection_1.BaseCollection { | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
Translations.rootElementName = "translations"; | ||
Translations.rootElementNameSingular = "translation"; | ||
Translations.prefixURI = "projects/{!:project_id}/translations/{:id}"; | ||
Translations.elementClass = translation_1.Translation; | ||
return Translations; | ||
})(); | ||
} | ||
exports.Translations = Translations; | ||
Translations.rootElementName = "translations"; | ||
Translations.rootElementNameSingular = "translation"; | ||
Translations.prefixURI = "projects/{!:project_id}/translations/{:id}"; | ||
Translations.elementClass = translation_1.Translation; | ||
//# sourceMappingURL=translations.js.map |
@@ -6,46 +6,43 @@ "use strict"; | ||
const user_group_1 = require("../models/user_group"); | ||
let UserGroups = /** @class */ (() => { | ||
class UserGroups extends base_collection_1.BaseCollection { | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateGroupFromJsonRoot, this.handleReject, body); | ||
} | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateGroupFromJsonRoot, this.handleReject, body); | ||
} | ||
add_members_to_group(team_id, group_id, raw_body, params = {}) { | ||
params["team_id"] = team_id; | ||
params["group_id"] = group_id; | ||
const body = { users: raw_body }; | ||
return this.createPromise("PUT", params, this.populateGroupFromJsonRoot, this.handleReject, body, "teams/{!:team_id}/groups/{!:group_id}/members/add"); | ||
} | ||
remove_members_from_group(team_id, group_id, raw_body, params = {}) { | ||
params["team_id"] = team_id; | ||
params["group_id"] = group_id; | ||
const body = { users: raw_body }; | ||
return this.createPromise("PUT", params, this.populateGroupFromJsonRoot, this.handleReject, body, "teams/{!:team_id}/groups/{!:group_id}/members/remove"); | ||
} | ||
add_projects_to_group(team_id, group_id, raw_body, params = {}) { | ||
params["team_id"] = team_id; | ||
params["group_id"] = group_id; | ||
const body = { projects: raw_body }; | ||
return this.createPromise("PUT", params, this.populateGroupFromJsonRoot, this.handleReject, body, "teams/{!:team_id}/groups/{!:group_id}/projects/add"); | ||
} | ||
remove_projects_from_group(team_id, group_id, raw_body, params = {}) { | ||
params["team_id"] = team_id; | ||
params["group_id"] = group_id; | ||
const body = { projects: raw_body }; | ||
return this.createPromise("PUT", params, this.populateGroupFromJsonRoot, this.handleReject, body, "teams/{!:team_id}/groups/{!:group_id}/projects/remove"); | ||
} | ||
populateGroupFromJsonRoot(json) { | ||
const formatted_json = json["group"]; | ||
return this.populateObjectFromJson(formatted_json); | ||
} | ||
class UserGroups extends base_collection_1.BaseCollection { | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateGroupFromJsonRoot, this.handleReject, body); | ||
} | ||
UserGroups.rootElementName = "user_groups"; | ||
UserGroups.prefixURI = "teams/{!:team_id}/groups/{:id}"; | ||
UserGroups.elementClass = user_group_1.UserGroup; | ||
return UserGroups; | ||
})(); | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateGroupFromJsonRoot, this.handleReject, body); | ||
} | ||
add_members_to_group(team_id, group_id, raw_body, params = {}) { | ||
params["team_id"] = team_id; | ||
params["group_id"] = group_id; | ||
const body = { users: raw_body }; | ||
return this.createPromise("PUT", params, this.populateGroupFromJsonRoot, this.handleReject, body, "teams/{!:team_id}/groups/{!:group_id}/members/add"); | ||
} | ||
remove_members_from_group(team_id, group_id, raw_body, params = {}) { | ||
params["team_id"] = team_id; | ||
params["group_id"] = group_id; | ||
const body = { users: raw_body }; | ||
return this.createPromise("PUT", params, this.populateGroupFromJsonRoot, this.handleReject, body, "teams/{!:team_id}/groups/{!:group_id}/members/remove"); | ||
} | ||
add_projects_to_group(team_id, group_id, raw_body, params = {}) { | ||
params["team_id"] = team_id; | ||
params["group_id"] = group_id; | ||
const body = { projects: raw_body }; | ||
return this.createPromise("PUT", params, this.populateGroupFromJsonRoot, this.handleReject, body, "teams/{!:team_id}/groups/{!:group_id}/projects/add"); | ||
} | ||
remove_projects_from_group(team_id, group_id, raw_body, params = {}) { | ||
params["team_id"] = team_id; | ||
params["group_id"] = group_id; | ||
const body = { projects: raw_body }; | ||
return this.createPromise("PUT", params, this.populateGroupFromJsonRoot, this.handleReject, body, "teams/{!:team_id}/groups/{!:group_id}/projects/remove"); | ||
} | ||
populateGroupFromJsonRoot(json) { | ||
const formatted_json = json["group"]; | ||
return this.populateObjectFromJson(formatted_json); | ||
} | ||
} | ||
exports.UserGroups = UserGroups; | ||
UserGroups.rootElementName = "user_groups"; | ||
UserGroups.prefixURI = "teams/{!:team_id}/groups/{:id}"; | ||
UserGroups.elementClass = user_group_1.UserGroup; | ||
//# sourceMappingURL=user_groups.js.map |
@@ -6,23 +6,20 @@ "use strict"; | ||
const webhook_1 = require("../models/webhook"); | ||
let Webhooks = /** @class */ (() => { | ||
class Webhooks extends base_collection_1.BaseCollection { | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
regenerate_secret(id, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PATCH", params, this.returnBareJSON, this.handleReject, null, "projects/{!:project_id}/webhooks/{:id}/secret/regenerate"); | ||
} | ||
class Webhooks extends base_collection_1.BaseCollection { | ||
create(body, params = {}) { | ||
return this.createPromise("POST", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
Webhooks.rootElementName = "webhooks"; | ||
Webhooks.rootElementNameSingular = "webhook"; | ||
Webhooks.prefixURI = "projects/{!:project_id}/webhooks/{:id}"; | ||
Webhooks.elementClass = webhook_1.Webhook; | ||
return Webhooks; | ||
})(); | ||
update(id, body, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PUT", params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
regenerate_secret(id, params = {}) { | ||
params["id"] = id; | ||
return this.createPromise("PATCH", params, this.returnBareJSON, this.handleReject, null, "projects/{!:project_id}/webhooks/{:id}/secret/regenerate"); | ||
} | ||
} | ||
exports.Webhooks = Webhooks; | ||
Webhooks.rootElementName = "webhooks"; | ||
Webhooks.rootElementNameSingular = "webhook"; | ||
Webhooks.prefixURI = "projects/{!:project_id}/webhooks/{:id}"; | ||
Webhooks.elementClass = webhook_1.Webhook; | ||
//# sourceMappingURL=webhooks.js.map |
@@ -5,22 +5,19 @@ "use strict"; | ||
const api_methods_1 = require("./api_methods"); | ||
let LokaliseApi = /** @class */ (() => { | ||
class LokaliseApi extends api_methods_1.LocaliseApiMethods { | ||
/** | ||
* Instantiate LokaliseApi to have access to methods | ||
* @param params object, mandaratory | ||
* @returns LokaliseApi object to work with. | ||
*/ | ||
constructor(params = {}) { | ||
super(); | ||
LokaliseApi.apiKey = params["apiKey"]; | ||
if (LokaliseApi.apiKey == null || LokaliseApi.apiKey.length == 0) { | ||
throw new Error("Error: Instantiation failed: Please pass an API key"); | ||
} | ||
return this; | ||
class LokaliseApi extends api_methods_1.LocaliseApiMethods { | ||
/** | ||
* Instantiate LokaliseApi to have access to methods | ||
* @param params object, mandaratory | ||
* @returns LokaliseApi object to work with. | ||
*/ | ||
constructor(params = {}) { | ||
super(); | ||
LokaliseApi.apiKey = params["apiKey"]; | ||
if (LokaliseApi.apiKey == null || LokaliseApi.apiKey.length == 0) { | ||
throw new Error("Error: Instantiation failed: Please pass an API key"); | ||
} | ||
return this; | ||
} | ||
LokaliseApi.apiKey = null; | ||
return LokaliseApi; | ||
})(); | ||
} | ||
exports.LokaliseApi = LokaliseApi; | ||
LokaliseApi.apiKey = null; | ||
//# sourceMappingURL=lokalise.js.map |
{ | ||
"name": "@lokalise/node-api", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Official Lokalise API 2.0 Node.js client", | ||
@@ -25,21 +25,21 @@ "license": "MIT", | ||
"@types/mocha": "^7.0.2", | ||
"@types/node": "^14.0.1", | ||
"@typescript-eslint/eslint-plugin": "^2.33.0", | ||
"@typescript-eslint/parser": "^2.33.0", | ||
"acorn": "^7.2.0", | ||
"@types/node": "^14.0.13", | ||
"@typescript-eslint/eslint-plugin": "^3.3.0", | ||
"@typescript-eslint/parser": "^3.3.0", | ||
"acorn": "^7.3.1", | ||
"chai": "^4.2.0", | ||
"dotenv": "^8.2.0", | ||
"eslint": "^6.8.0", | ||
"eslint": "^7.2.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"mocha": "^7.1.2", | ||
"mocha-cassettes": "0.1.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"mocha": "^8.0.0", | ||
"mocha-cassettes": "1.0.0", | ||
"prettier": "2.0.5", | ||
"source-map-support": "^0.5.19", | ||
"ts-node": "^8.10.1" | ||
"ts-node": "^8.10.2" | ||
}, | ||
"dependencies": { | ||
"got": "^11.1.4", | ||
"typescript": "^3.9.2" | ||
"got": "^11.3.0", | ||
"typescript": "^3.9.5" | ||
}, | ||
@@ -46,0 +46,0 @@ "bugs": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
842241
5675
+ Added@types/node@22.10.1(transitive)
- Removed@types/node@22.10.0(transitive)
Updatedgot@^11.3.0
Updatedtypescript@^3.9.5