Skip to content

Commit 65b8307

Browse files
committed
v14.6.0
1 parent c6ec931 commit 65b8307

File tree

13 files changed

+102
-14
lines changed

13 files changed

+102
-14
lines changed

dist/main.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2925,7 +2925,9 @@ declare class Teams extends BaseCollection<Team> {
29252925
protected static prefixURI: string;
29262926
protected get elementClass(): new (json: Record<string, unknown>) => Team;
29272927
protected get rootElementName(): string;
2928+
protected get rootElementNameSingular(): string | null;
29282929
list(request_params?: PaginationParams): Promise<PaginatedResult$1<Team>>;
2930+
get(id: number | string): Promise<Team>;
29292931
}
29302932

29312933
declare class TranslationProvider extends BaseModel implements TranslationProvider$1 {

dist/main.js

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/_data/api_items.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
path: fetch-contributors
4747
- title: Fetch a single contributor
4848
path: fetch-a-single-contributor
49+
- title: Fetch current contributor (token-based)
50+
path: fetch-current-contributor-token-based
4951
- title: Create contributors
5052
path: create-contributors
5153
- title: Update contributor
@@ -213,6 +215,8 @@
213215
sub_paths:
214216
- title: Fetch teams
215217
path: fetch-teams
218+
- title: Fetch a single team
219+
path: fetch-a-single-team
216220
- title: Team users
217221
path: team-users
218222
sub_paths:

docs/additional_info/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 14.6.0 (08-May-2025)
4+
5+
* Added support for [Get team details](https://developers.lokalise.com/reference/get-team-details) endpoint
6+
37
## 14.5.2 (05-May-2025)
48

59
* Display a warning message for files downloads when the request is too big (thanks, @kosmos2uh)

docs/api/contributors.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ const contributor = await lokaliseApi.contributors().get(user_id, {project_id: p
2626
contributor.email;
2727
```
2828

29+
## Fetch current contributor (token-based)
30+
31+
[API doc](https://developers.lokalise.com/reference/retrieve-me-as-a-contributor)
32+
33+
This endpoint returns contributor in the given project based on the user whose token is used to send the request. In other words, it returns information about self in scope of a project.
34+
35+
```js
36+
const current_contributor = await lokaliseApi.contributors().me({
37+
project_id: projectId,
38+
});
39+
40+
current_contributor.fullname; // => "John Doe"
41+
```
42+
2943
## Create contributors
3044

3145
[API doc](https://developers.lokalise.com/reference/create-contributors)

docs/api/teams.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,15 @@ const teams = await lokaliseApi.teams().list({ page: 2, limit: 1 });
1111

1212
teams.items[0].team_id;
1313
```
14+
15+
## Fetch a single team
16+
17+
[API doc](https://developers.lokalise.com/reference/get-team-details)
18+
19+
```js
20+
const teamId = 12345;
21+
const team = await lokaliseApi.teams().get(teamId);
22+
23+
team.team_id; // => 12345
24+
team.name; // => "My Team"
25+
```

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lokalise/node-api",
3-
"version": "14.5.2",
3+
"version": "14.6.0",
44
"description": "Official Lokalise API 2.0 Node.js client",
55
"license": "BSD-3-Clause",
66
"repository": {

src/collections/teams.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { PaginationParams } from "../types/common_get_params.js";
44
import { BaseCollection } from "./base_collection.js";
55

66
export class Teams extends BaseCollection<Team> {
7-
protected static override prefixURI = "teams";
7+
protected static override prefixURI = "teams/{:id}";
88

99
protected get elementClass(): new (
1010
json: Record<string, unknown>,
@@ -16,7 +16,15 @@ export class Teams extends BaseCollection<Team> {
1616
return "teams";
1717
}
1818

19+
protected override get rootElementNameSingular(): string | null {
20+
return "team";
21+
}
22+
1923
list(request_params: PaginationParams = {}): Promise<PaginatedResult<Team>> {
2024
return this.doList(request_params) as Promise<PaginatedResult<Team>>;
2125
}
26+
27+
get(id: number | string): Promise<Team> {
28+
return this.doGet(id);
29+
}
2230
}

test/files/files.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ describe("Files", () => {
219219
expect(response.responseTooBig).to.be.true;
220220

221221
expect(warnSpy).toHaveBeenCalledWith(
222-
"\x1b[33m\x1b[1mWarning:\x1b[0m Project too big for sync export. Please use our async export lokaliseApi.files().async_download() method."
222+
"\x1b[33m\x1b[1mWarning:\x1b[0m Project too big for sync export. Please use our async export lokaliseApi.files().async_download() method.",
223223
);
224-
224+
225225
warnSpy.mockRestore();
226226
});
227227

test/fixtures/teams/retreive.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"team": {
3+
"team_id": 176692,
4+
"name": "Ilya's Team",
5+
"plan": "Trial",
6+
"created_at": "2018-08-21 15:35:25 (Etc/UTC)",
7+
"created_at_timestamp": 1534865725,
8+
"quota_usage": {
9+
"users": 24,
10+
"keys": 183,
11+
"projects": 13,
12+
"mau": 0,
13+
"ai_words": 1234
14+
},
15+
"quota_allowed": {
16+
"users": 999999999,
17+
"keys": 999999999,
18+
"projects": 999999999,
19+
"mau": 0,
20+
"ai_words": 4000
21+
}
22+
}
23+
}

test/teams/teams.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { LokaliseApi, Stub, describe, expect, it } from "../setup.js";
22

33
describe("Teams", () => {
44
const lokaliseApi = new LokaliseApi({ apiKey: process.env.API_KEY });
5+
const teamId = 176692;
56

67
it("lists", async () => {
78
const stub = new Stub({
@@ -55,4 +56,18 @@ describe("Teams", () => {
5556
expect(teams.resultsPerPage).to.eq(1);
5657
expect(teams.currentPage).to.eq(2);
5758
});
59+
60+
it("retreives", async () => {
61+
const stub = new Stub({
62+
fixture: "teams/retreive.json",
63+
uri: `teams/${teamId}`,
64+
});
65+
66+
await stub.setStub();
67+
68+
const team = await lokaliseApi.teams().get(teamId);
69+
70+
expect(team.team_id).toEqual(teamId);
71+
expect(team.name).toEqual("Ilya's Team");
72+
});
5873
});

0 commit comments

Comments
 (0)