@lokalise/node-api
Advanced tools
Comparing version 1.2.0 to 1.3.0
# Lokalise API Node Client Changelog | ||
## 1.3.0 (30-Oct-19) | ||
* Added support for [`Branch` endpoint](https://lokalise.com/api2docs/curl/#resource-branches) | ||
* Test against Node 13 | ||
* Update dependencies | ||
## 1.2.0 (20-Aug-19) | ||
@@ -4,0 +10,0 @@ |
@@ -65,2 +65,3 @@ "use strict"; | ||
} | ||
exports.BaseCollection = BaseCollection; | ||
BaseCollection.rootElementName = null; | ||
@@ -71,3 +72,2 @@ BaseCollection.rootElementNameSingular = null; | ||
BaseCollection.elementClass = null; | ||
exports.BaseCollection = BaseCollection; | ||
//# sourceMappingURL=base_collection.js.map |
@@ -13,2 +13,3 @@ "use strict"; | ||
} | ||
exports.Comments = Comments; | ||
Comments.rootElementName = 'comments'; | ||
@@ -18,3 +19,2 @@ Comments.rootElementNameSingular = 'comment'; | ||
Comments.elementClass = comment_1.Comment; | ||
exports.Comments = Comments; | ||
//# sourceMappingURL=comments.js.map |
@@ -15,2 +15,3 @@ "use strict"; | ||
} | ||
exports.Contributors = Contributors; | ||
Contributors.rootElementName = 'contributors'; | ||
@@ -20,3 +21,2 @@ Contributors.rootElementNameSingular = 'contributor'; | ||
Contributors.elementClass = contributor_1.Contributor; | ||
exports.Contributors = Contributors; | ||
//# sourceMappingURL=contributors.js.map |
@@ -13,6 +13,6 @@ "use strict"; | ||
} | ||
exports.Files = Files; | ||
Files.rootElementName = 'files'; | ||
Files.prefixURI = 'projects/{!:project_id}/files/{:id}'; | ||
Files.elementClass = file_1.File; | ||
exports.Files = Files; | ||
//# sourceMappingURL=files.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const branches_1 = require("./branches"); | ||
exports.Branches = branches_1.Branches; | ||
const comments_1 = require("./comments"); | ||
@@ -4,0 +6,0 @@ exports.Comments = comments_1.Comments; |
@@ -23,2 +23,3 @@ "use strict"; | ||
} | ||
exports.Keys = Keys; | ||
Keys.rootElementName = 'keys'; | ||
@@ -28,3 +29,2 @@ Keys.rootElementNameSingular = 'key'; | ||
Keys.elementClass = key_1.Key; | ||
exports.Keys = Keys; | ||
//# sourceMappingURL=keys.js.map |
@@ -18,2 +18,3 @@ "use strict"; | ||
} | ||
exports.Languages = Languages; | ||
Languages.rootElementName = 'languages'; | ||
@@ -23,3 +24,2 @@ Languages.rootElementNameSingular = 'language'; | ||
Languages.elementClass = language_1.Language; | ||
exports.Languages = Languages; | ||
//# sourceMappingURL=languages.js.map |
@@ -7,6 +7,6 @@ "use strict"; | ||
} | ||
exports.Orders = Orders; | ||
Orders.rootElementName = 'orders'; | ||
Orders.prefixURI = 'teams/{!:team_id}/orders/{:id}'; | ||
Orders.elementClass = order_1.Order; | ||
exports.Orders = Orders; | ||
//# sourceMappingURL=orders.js.map |
@@ -7,2 +7,3 @@ "use strict"; | ||
} | ||
exports.PaymentCards = PaymentCards; | ||
PaymentCards.rootElementName = 'payment_cards'; | ||
@@ -12,3 +13,2 @@ PaymentCards.rootElementNameSingular = 'payment_card'; | ||
PaymentCards.elementClass = payment_card_1.PaymentCard; | ||
exports.PaymentCards = PaymentCards; | ||
//# sourceMappingURL=payment_cards.js.map |
@@ -10,6 +10,6 @@ "use strict"; | ||
} | ||
exports.Projects = Projects; | ||
Projects.rootElementName = 'projects'; | ||
Projects.prefixURI = 'projects/{:id}'; | ||
Projects.elementClass = project_1.Project; | ||
exports.Projects = Projects; | ||
//# sourceMappingURL=projects.js.map |
@@ -15,2 +15,3 @@ "use strict"; | ||
} | ||
exports.Screenshots = Screenshots; | ||
Screenshots.rootElementName = 'screenshots'; | ||
@@ -20,3 +21,2 @@ Screenshots.rootElementNameSingular = 'screenshot'; | ||
Screenshots.elementClass = screenshot_1.Screenshot; | ||
exports.Screenshots = Screenshots; | ||
//# sourceMappingURL=screenshots.js.map |
@@ -14,2 +14,3 @@ "use strict"; | ||
} | ||
exports.Snapshots = Snapshots; | ||
Snapshots.rootElementName = 'snapshots'; | ||
@@ -19,3 +20,2 @@ Snapshots.rootElementNameSingular = 'snapshot'; | ||
Snapshots.elementClass = snapshot_1.Snapshot; | ||
exports.Snapshots = Snapshots; | ||
//# sourceMappingURL=snapshots.js.map |
@@ -14,2 +14,3 @@ "use strict"; | ||
} | ||
exports.Tasks = Tasks; | ||
Tasks.rootElementName = 'tasks'; | ||
@@ -19,3 +20,2 @@ Tasks.rootElementNameSingular = 'task'; | ||
Tasks.elementClass = task_1.Task; | ||
exports.Tasks = Tasks; | ||
//# sourceMappingURL=tasks.js.map |
@@ -11,2 +11,3 @@ "use strict"; | ||
} | ||
exports.TeamUsers = TeamUsers; | ||
TeamUsers.rootElementName = 'team_users'; | ||
@@ -16,3 +17,2 @@ TeamUsers.rootElementNameSingular = 'team_user'; | ||
TeamUsers.elementClass = team_user_1.TeamUser; | ||
exports.TeamUsers = TeamUsers; | ||
//# sourceMappingURL=team_users.js.map |
@@ -7,6 +7,6 @@ "use strict"; | ||
} | ||
exports.Teams = Teams; | ||
Teams.rootElementName = 'teams'; | ||
Teams.prefixURI = 'teams'; | ||
Teams.elementClass = team_1.Team; | ||
exports.Teams = Teams; | ||
//# sourceMappingURL=teams.js.map |
@@ -7,6 +7,6 @@ "use strict"; | ||
} | ||
exports.TranslationProviders = TranslationProviders; | ||
TranslationProviders.rootElementName = 'translation_providers'; | ||
TranslationProviders.prefixURI = 'teams/{!:team_id}/translation_providers/{:id}'; | ||
TranslationProviders.elementClass = translation_provider_1.TranslationProvider; | ||
exports.TranslationProviders = TranslationProviders; | ||
//# sourceMappingURL=translation_providers.js.map |
@@ -17,2 +17,3 @@ "use strict"; | ||
} | ||
exports.TranslationStatuses = TranslationStatuses; | ||
TranslationStatuses.rootElementName = 'custom_translation_statuses'; | ||
@@ -22,3 +23,2 @@ TranslationStatuses.prefixURI = 'projects/{!:project_id}/custom_translation_statuses/{:id}'; | ||
TranslationStatuses.rootElementNameSingular = 'custom_translation_status'; | ||
exports.TranslationStatuses = TranslationStatuses; | ||
//# sourceMappingURL=translation_statuses.js.map |
@@ -11,2 +11,3 @@ "use strict"; | ||
} | ||
exports.Translations = Translations; | ||
Translations.rootElementName = 'translations'; | ||
@@ -16,3 +17,2 @@ Translations.rootElementNameSingular = 'translation'; | ||
Translations.elementClass = translation_1.Translation; | ||
exports.Translations = Translations; | ||
//# sourceMappingURL=translations.js.map |
@@ -42,6 +42,6 @@ "use strict"; | ||
} | ||
exports.UserGroups = UserGroups; | ||
UserGroups.rootElementName = 'user_groups'; | ||
UserGroups.prefixURI = 'teams/{!:team_id}/groups/{:id}'; | ||
UserGroups.elementClass = user_group_1.UserGroup; | ||
exports.UserGroups = UserGroups; | ||
//# sourceMappingURL=user_groups.js.map |
@@ -14,2 +14,3 @@ "use strict"; | ||
} | ||
exports.Webhooks = Webhooks; | ||
Webhooks.rootElementName = 'webhooks'; | ||
@@ -19,3 +20,2 @@ Webhooks.rootElementNameSingular = 'webhook'; | ||
Webhooks.elementClass = webhook_1.Webhook; | ||
exports.Webhooks = Webhooks; | ||
//# sourceMappingURL=webhooks.js.map |
@@ -7,2 +7,3 @@ "use strict"; | ||
// TODO: Lazy loading | ||
this.branches = new Collections.Branches(); | ||
this.comments = new Collections.Comments(); | ||
@@ -9,0 +10,0 @@ this.contributors = new Collections.Contributors(); |
@@ -19,4 +19,4 @@ "use strict"; | ||
} | ||
exports.LokaliseApi = LokaliseApi; | ||
LokaliseApi.apiKey = null; | ||
exports.LokaliseApi = LokaliseApi; | ||
//# sourceMappingURL=lokalise.js.map |
declare module '@lokalise/node-api' { | ||
export interface Branch { | ||
branch_id: number; | ||
name: string; | ||
created_at: string; | ||
created_at_timestamp: number; | ||
created_by: number; | ||
created_by_email: string; | ||
} | ||
export interface Comment { | ||
@@ -330,2 +339,11 @@ comment_id: number; | ||
export class Branches extends BaseCollection { | ||
protected static rootElementName: string; | ||
protected static rootElementNameSingular: string; | ||
protected static prefixURI: string; | ||
protected static elementClass: Object; | ||
create(body, params: StandartParams): Promise<any>; | ||
update(id, body, params : StandartParams) : Promise<any>; | ||
} | ||
export class Comments extends BaseCollection { | ||
@@ -491,2 +509,3 @@ protected static rootElementName: string; | ||
export class LocaliseApiMethods { | ||
branches: Branches; | ||
comments: Comments; | ||
@@ -503,6 +522,9 @@ contributors: Contributors; | ||
tasks: Tasks; | ||
teams: Teams; | ||
teamUsers: TeamUsers; | ||
translationProviders: TranslationProviders; | ||
translations: Translations; | ||
translationStatuses: TranslationStatuses; | ||
userGroups: UserGroups; | ||
webhooks: Webhooks; | ||
} | ||
@@ -509,0 +531,0 @@ |
{ | ||
"name": "@lokalise/node-api", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Official Lokalise API 2.0 Node.js client", | ||
@@ -20,25 +20,23 @@ "license": "MIT", | ||
"build": "tsc", | ||
"test": "tsc && nyc mocha -r ts-node/register test/**/*.spec.ts --timeout 5000" | ||
"test": "tsc && mocha -r ts-node/register test/**/*.spec.ts --timeout 5000" | ||
}, | ||
"devDependencies": { | ||
"@istanbuljs/nyc-config-typescript": "^0.1.3", | ||
"@types/chai": "^4.2.0", | ||
"@types/chai": "^4.2.4", | ||
"@types/express": "^4.17.1", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^12.7.2", | ||
"acorn": "^7.0.0", | ||
"dotenv": "^8.1.0", | ||
"@types/node": "^12.12.0", | ||
"acorn": "^7.1.0", | ||
"dotenv": "^8.2.0", | ||
"lodash": "^4.17.15", | ||
"mocha": "^6.2.0", | ||
"mocha": "^6.2.2", | ||
"mocha-tape-deck": "0.0.9", | ||
"nyc": "^14.1.1", | ||
"request-promise": "^4.2.4", | ||
"source-map-support": "^0.5.13", | ||
"ts-node": "^8.3.0" | ||
"source-map-support": "^0.5.16", | ||
"ts-node": "^8.4.1" | ||
}, | ||
"dependencies": { | ||
"@types/request": "^2.48.2", | ||
"@types/request": "^2.48.3", | ||
"axios": "^0.19.0", | ||
"request": "^2.88.0", | ||
"typescript": "^3.5.3" | ||
"typescript": "^3.6.4" | ||
}, | ||
@@ -54,3 +52,3 @@ "bugs": { | ||
}, | ||
"author": "Roman Kutanov, Ilya Bodrov and Lokalise team" | ||
"author": "Roman Kutanov, Ilya Bodrov, and Lokalise team" | ||
} |
103
README.md
@@ -1,2 +0,2 @@ | ||
# Lokalise API 2.0 official Node.js client | ||
# Lokalise API v2 official Node.js client | ||
@@ -6,3 +6,3 @@ [![npm version](https://badge.fury.io/js/%40lokalise%2Fnode-api.svg)](https://badge.fury.io/js/%40lokalise%2Fnode-api) | ||
Official Node interface for the [Lokalise API](https://lokalise.co/api2docs/node/#resource-getting-started). | ||
Official Node interface for the [Lokalise API](https://lokalise.com/api2docs/curl/#resource-getting-started). | ||
@@ -14,3 +14,6 @@ ## Index | ||
- [Initializing Client](#initializing-client) | ||
- [Branching](#branching) | ||
- [Pagination](#pagination) | ||
* [Usage](#usage) | ||
+ [Branches](#branches) | ||
+ [Comments](#comments) | ||
@@ -50,3 +53,3 @@ + [Contributors](#contributors) | ||
In order to perform API requests, you require a special token that can be obtained in your [personal profile](https://lokalise.co/profile#apitokens) (*API tokens* section). Note that the owner of the token must have admin access rights. | ||
In order to perform API requests, you require a special token that can be obtained in your [personal profile](https://lokalise.com/profile#apitokens) (*API tokens* section). Note that the owner of the token must have admin access rights. | ||
@@ -70,5 +73,13 @@ After you've obtained the token, initialize the client: | ||
### Branching | ||
If you are using [project branching feature](https://docs.lokalise.com/en/articles/3391861-project-branching), simply add branch name separated by semicolon to your project ID in any endpoint to access the branch. For example, in order to access `new-feature` branch for the project with an id `123abcdef.01`: | ||
```js | ||
lokaliseApi.files.list({project_id: '123abcdef.01:new-feature'}); | ||
``` | ||
### Pagination | ||
Bulk fetches support [pagination](https://lokalise.co/api2docs/node/#resource-pagination). There are two common parameters available: | ||
Bulk fetches support [pagination](https://lokalise.com/api2docs/curl/#resource-pagination). There are two common parameters available: | ||
@@ -88,5 +99,45 @@ * `limit` (defaults to `100`, maximum is `5000`) - number of records to display per page | ||
### Branches | ||
[Documentation](https://lokalise.com/api2docs/curl/#resource-branches) | ||
#### List branches | ||
```js | ||
lokaliseApi.branches.list({project_id: project_id}); | ||
``` | ||
#### Retrieve branch | ||
```js | ||
lokaliseApi.branches.get(branch_id, {project_id: project_id}); | ||
``` | ||
#### Create branch | ||
```js | ||
lokaliseApi.branches.create( | ||
{"name": "hotfix/really-important"}, | ||
{ project_id: project_id} | ||
); | ||
``` | ||
#### Update branch | ||
```js | ||
lokaliseApi.branches.update(branch_id, | ||
{"name": "hotfix/not-really-important"}, | ||
{project_id: project_id} | ||
); | ||
``` | ||
#### Delete branch | ||
```js | ||
lokaliseApi.branches.delete(branch_id, {project_id: project_id}); | ||
``` | ||
### Comments | ||
[Documentation](https://lokalise.co/api2docs/node/#object-comments) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-comments) | ||
@@ -130,3 +181,3 @@ #### List project comments | ||
[Documentation](https://lokalise.co/api2docs/node/#object-contributors) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-contributors) | ||
@@ -182,3 +233,3 @@ #### List project contributors | ||
[Documentation](https://lokalise.co/api2docs/node/#object-files) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-files) | ||
@@ -205,3 +256,3 @@ #### List project files | ||
[Documentation](https://lokalise.co/api2docs/node/#object-keys) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-keys) | ||
@@ -294,3 +345,3 @@ #### List keys | ||
[Documentation](https://lokalise.co/api2docs/node/#object-languages) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-languages) | ||
@@ -341,3 +392,3 @@ #### List system languages | ||
[Documentation](https://lokalise.co/api2docs/node/#object-orders) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-orders) | ||
@@ -374,3 +425,3 @@ #### List orders | ||
[Documentation](https://lokalise.co/api2docs/node/#object-payment-cards) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-payment-cards) | ||
@@ -408,3 +459,3 @@ #### List payment cards | ||
[Documentation](https://lokalise.co/api2docs/node/#object-projects) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-projects) | ||
@@ -449,3 +500,3 @@ #### List projects | ||
[Documentation](https://lokalise.co/api2docs/node/#object-screenshots) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-screenshots) | ||
@@ -494,3 +545,3 @@ #### List screenshots | ||
[Documentation](https://lokalise.co/api2docs/node/#object-snapshots) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-snapshots) | ||
@@ -523,3 +574,3 @@ #### List snapshots | ||
[Documentation](https://lokalise.co/api2docs/node/#object-tasks) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-tasks) | ||
@@ -571,3 +622,3 @@ #### List tasks | ||
[Documentation](https://lokalise.co/api2docs/node/#object-teams) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-teams) | ||
@@ -582,3 +633,3 @@ #### List all teams | ||
[Documentation](https://lokalise.co/api2docs/node/#object-team-users) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-team-users) | ||
@@ -615,3 +666,3 @@ #### List team users | ||
[Documentation](https://lokalise.co/api2docs/node/#object-team-user-groups) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-team-user-groups) | ||
@@ -707,3 +758,3 @@ #### List team user groups | ||
[Documentation](https://lokalise.co/api2docs/node/#object-translations) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-translations) | ||
@@ -734,3 +785,3 @@ #### List translations | ||
[Documentation](https://lokalise.co/api2docs/node/#object-translation-providers) | ||
[Documentation](https://lokalise.com/api2docs/curl/#object-translation-providers) | ||
@@ -751,3 +802,3 @@ #### List translation providers | ||
[Documentation](https://lokalise.co/api2docs/node/#resource-translation-statuses) | ||
[Documentation](https://lokalise.com/api2docs/curl/#resource-translation-statuses) | ||
@@ -799,3 +850,3 @@ #### List translation statuses | ||
[Documentation](https://lokalise.co/api2docs/node/#resource-webhooks) | ||
[Documentation](https://lokalise.com/api2docs/curl/#resource-webhooks) | ||
@@ -846,11 +897,11 @@ #### List webhooks | ||
[Error codes](https://lokalise.co/api2docs/node/#resource-errors) are listed in the API docs. | ||
[Error codes](https://lokalise.com/api2docs/curl/#resource-errors) are listed in the API docs. | ||
### API Rate Limits | ||
Lokalise does not [rate-limit API requests](https://lokalise.co/api2docs/node/#resource-rate-limits), however retain a right to decline the service in case of excessive use. Only one concurrent request per token is allowed. To ensure data consistency, it is not recommended to access the same project simultaneously using multiple tokens. | ||
Lokalise does not [rate-limit API requests](https://lokalise.com/api2docs/curl/#resource-rate-limits), however retain a right to decline the service in case of excessive use. Only one concurrent request per token is allowed. To ensure data consistency, it is not recommended to access the same project simultaneously using multiple tokens. | ||
## Running Tests | ||
This library is tested with Node 8, 9, 10, 11, and 12. To test it locally: | ||
This library is tested with Node 8, 9, 10, 11, 12, and 13. To test it locally: | ||
@@ -869,2 +920,2 @@ 1. Copypaste `.env.example` file as `.env`. Put your API token inside. The `.env` file is excluded from version control so your token is safe. All in all, we use pre-recorded cassettes, so the actual API requests won't be sent. However, providing at least some token is required. | ||
Copyright (c) [Lokalise team](http://lokalise.co), Roman Kutanov, [Ilya Bodrov](http://bodrovis.tech) | ||
Copyright (c) [Lokalise team](http://lokalise.com), Roman Kutanov, [Ilya Bodrov](http://bodrovis.tech) |
@@ -0,1 +1,2 @@ | ||
import { Branches } from './branches'; | ||
import { Comments } from './comments'; | ||
@@ -21,2 +22,3 @@ import { Contributors } from './contributors'; | ||
export { | ||
Branches, | ||
Comments, | ||
@@ -23,0 +25,0 @@ Contributors, |
@@ -0,1 +1,2 @@ | ||
import { Branch } from './branch'; | ||
import { Language } from './language'; | ||
@@ -21,2 +22,3 @@ import { Project } from './project'; | ||
export { | ||
Branch, | ||
Comment, | ||
@@ -23,0 +25,0 @@ Contributor, |
@@ -5,2 +5,3 @@ import * as Collections from '../collections/index'; | ||
// TODO: Lazy loading | ||
public branches = new Collections.Branches(); | ||
public comments = new Collections.Comments(); | ||
@@ -7,0 +8,0 @@ public contributors = new Collections.Contributors(); |
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
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
767038
12
346
3604
898
Updated@types/request@^2.48.3
Updatedtypescript@^3.6.4