smartling-api-sdk-nodejs 2.22.0 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.scannerwork/report-task.txt +2 -2
- package/api/jobs/dto/added-strings-dto.ts +6 -0
- package/api/jobs/dto/removed-strings-dto.ts +6 -0
- package/api/jobs/index.ts +24 -0
- package/api/jobs/params/add-strings-to-job-parameters.ts +18 -0
- package/api/jobs/params/remove-strings-from-job-parameters.ts +13 -0
- package/api/tags/dto/project-id-tag-dto.ts +5 -0
- package/api/tags/dto/string-tags-dto.ts +6 -0
- package/api/tags/dto/tag-dto.ts +3 -0
- package/api/tags/index.ts +87 -0
- package/api/tags/params/add-tags-to-strings-parameters.ts +4 -0
- package/api/tags/params/base-tags-strings-parameters.ts +40 -0
- package/api/tags/params/list-account-tags-parameters.ts +40 -0
- package/api/tags/params/list-project-tags-parameters.ts +30 -0
- package/api/tags/params/remove-all-tags-from-strings-parameters.ts +18 -0
- package/api/tags/params/remove-tags-from-strings-parameters.ts +4 -0
- package/api/tags/params/search-string-tags-parameters.ts +18 -0
- package/built/api/jobs/dto/added-strings-dto.d.ts +5 -0
- package/built/api/jobs/dto/added-strings-dto.js +3 -0
- package/built/api/jobs/dto/added-strings-dto.js.map +1 -0
- package/built/api/jobs/dto/removed-strings-dto.d.ts +5 -0
- package/built/api/jobs/dto/removed-strings-dto.js +3 -0
- package/built/api/jobs/dto/removed-strings-dto.js.map +1 -0
- package/built/api/jobs/index.d.ts +6 -0
- package/built/api/jobs/index.js +10 -0
- package/built/api/jobs/index.js.map +1 -1
- package/built/api/jobs/params/add-strings-to-job-parameters.d.ts +6 -0
- package/built/api/jobs/params/add-strings-to-job-parameters.js +20 -0
- package/built/api/jobs/params/add-strings-to-job-parameters.js.map +1 -0
- package/built/api/jobs/params/remove-strings-from-job-parameters.d.ts +5 -0
- package/built/api/jobs/params/remove-strings-from-job-parameters.js +16 -0
- package/built/api/jobs/params/remove-strings-from-job-parameters.js.map +1 -0
- package/built/api/tags/dto/project-id-tag-dto.d.ts +4 -0
- package/built/api/tags/dto/project-id-tag-dto.js +3 -0
- package/built/api/tags/dto/project-id-tag-dto.js.map +1 -0
- package/built/api/tags/dto/string-tags-dto.d.ts +5 -0
- package/built/api/tags/dto/string-tags-dto.js +3 -0
- package/built/api/tags/dto/string-tags-dto.js.map +1 -0
- package/built/api/tags/dto/tag-dto.d.ts +3 -0
- package/built/api/tags/dto/tag-dto.js +3 -0
- package/built/api/tags/dto/tag-dto.js.map +1 -0
- package/built/api/tags/index.d.ts +22 -0
- package/built/api/tags/index.js +52 -0
- package/built/api/tags/index.js.map +1 -0
- package/built/api/tags/params/add-tags-to-strings-parameters.d.ts +3 -0
- package/built/api/tags/params/add-tags-to-strings-parameters.js +8 -0
- package/built/api/tags/params/add-tags-to-strings-parameters.js.map +1 -0
- package/built/api/tags/params/base-tags-strings-parameters.d.ts +5 -0
- package/built/api/tags/params/base-tags-strings-parameters.js +34 -0
- package/built/api/tags/params/base-tags-strings-parameters.js.map +1 -0
- package/built/api/tags/params/list-account-tags-parameters.d.ts +7 -0
- package/built/api/tags/params/list-account-tags-parameters.js +34 -0
- package/built/api/tags/params/list-account-tags-parameters.js.map +1 -0
- package/built/api/tags/params/list-project-tags-parameters.d.ts +6 -0
- package/built/api/tags/params/list-project-tags-parameters.js +27 -0
- package/built/api/tags/params/list-project-tags-parameters.js.map +1 -0
- package/built/api/tags/params/remove-all-tags-from-strings-parameters.d.ts +4 -0
- package/built/api/tags/params/remove-all-tags-from-strings-parameters.js +19 -0
- package/built/api/tags/params/remove-all-tags-from-strings-parameters.js.map +1 -0
- package/built/api/tags/params/remove-tags-from-strings-parameters.d.ts +3 -0
- package/built/api/tags/params/remove-tags-from-strings-parameters.js +8 -0
- package/built/api/tags/params/remove-tags-from-strings-parameters.js.map +1 -0
- package/built/api/tags/params/search-string-tags-parameters.d.ts +4 -0
- package/built/api/tags/params/search-string-tags-parameters.js +19 -0
- package/built/api/tags/params/search-string-tags-parameters.js.map +1 -0
- package/built/index.d.ts +11 -0
- package/built/index.js +11 -0
- package/built/index.js.map +1 -1
- package/built/package.json +1 -1
- package/index.ts +11 -0
- package/package.json +1 -1
- package/test/jobs.spec.ts +55 -0
- package/test/tags.spec.ts +472 -0
|
@@ -2,5 +2,5 @@ projectKey=smartling-api-sdk-nodejs
|
|
|
2
2
|
serverUrl=https://sonar-next.connectors.stg.smartling.net
|
|
3
3
|
serverVersion=8.6.1.40680
|
|
4
4
|
dashboardUrl=https://sonar-next.connectors.stg.smartling.net/dashboard?id=smartling-api-sdk-nodejs
|
|
5
|
-
ceTaskId=
|
|
6
|
-
ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=
|
|
5
|
+
ceTaskId=AZikJtB19hT1tR3bPqfQ
|
|
6
|
+
ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AZikJtB19hT1tR3bPqfQ
|
package/api/jobs/index.ts
CHANGED
|
@@ -22,6 +22,10 @@ import { FullSourceFileDto } from "./dto/full-source-file-dto";
|
|
|
22
22
|
import { AddedFileDto } from "./dto/added-file-dto";
|
|
23
23
|
import { AuthorizeJobParameters } from "./params/authorize-job-parameters";
|
|
24
24
|
import { UpdateJobParameters } from "./params/update-job-parameters";
|
|
25
|
+
import { AddStringsToJobParameters } from "./params/add-strings-to-job-parameters";
|
|
26
|
+
import { RemoveStringsFromJobParameters } from "./params/remove-strings-from-job-parameters";
|
|
27
|
+
import { AddedStringsDto } from "./dto/added-strings-dto";
|
|
28
|
+
import { RemovedStringsDto } from "./dto/removed-strings-dto";
|
|
25
29
|
|
|
26
30
|
export class SmartlingJobsApi extends SmartlingBaseApi {
|
|
27
31
|
constructor(smartlingApiBaseUrl: string, authApi: AccessTokenProvider, logger: Logger) {
|
|
@@ -165,4 +169,24 @@ export class SmartlingJobsApi extends SmartlingBaseApi {
|
|
|
165
169
|
`${this.entrypoint}/${projectId}/jobs/${translationJobUid}`
|
|
166
170
|
);
|
|
167
171
|
}
|
|
172
|
+
|
|
173
|
+
async addStringsToJob(
|
|
174
|
+
projectId: string, translationJobUid: string, params: AddStringsToJobParameters
|
|
175
|
+
): Promise<AddedStringsDto> {
|
|
176
|
+
return await this.makeRequest(
|
|
177
|
+
"post",
|
|
178
|
+
`${this.entrypoint}/${projectId}/jobs/${translationJobUid}/strings/add`,
|
|
179
|
+
JSON.stringify(params.export())
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
async removeStringsFromJob(
|
|
184
|
+
projectId: string, translationJobUid: string, params: RemoveStringsFromJobParameters
|
|
185
|
+
): Promise<RemovedStringsDto> {
|
|
186
|
+
return await this.makeRequest(
|
|
187
|
+
"post",
|
|
188
|
+
`${this.entrypoint}/${projectId}/jobs/${translationJobUid}/strings/remove`,
|
|
189
|
+
JSON.stringify(params.export())
|
|
190
|
+
);
|
|
191
|
+
}
|
|
168
192
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters/index";
|
|
2
|
+
|
|
3
|
+
export class AddStringsToJobParameters extends BaseParameters {
|
|
4
|
+
setHashcodes(hashcodes: string[]): AddStringsToJobParameters {
|
|
5
|
+
this.set("hashcodes", hashcodes);
|
|
6
|
+
return this;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
setMoveEnabled(moveEnabled: boolean): AddStringsToJobParameters {
|
|
10
|
+
this.set("moveEnabled", moveEnabled);
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
setTargetLocaleIds(targetLocaleIds: string[]): AddStringsToJobParameters {
|
|
15
|
+
this.set("targetLocaleIds", targetLocaleIds);
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters/index";
|
|
2
|
+
|
|
3
|
+
export class RemoveStringsFromJobParameters extends BaseParameters {
|
|
4
|
+
setHashcodes(hashcodes: string[]): RemoveStringsFromJobParameters {
|
|
5
|
+
this.set("hashcodes", hashcodes);
|
|
6
|
+
return this;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
setTargetLocaleIds(targetLocaleIds: string[]): RemoveStringsFromJobParameters {
|
|
10
|
+
this.set("targetLocaleIds", targetLocaleIds);
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { SmartlingBaseApi } from "../base/index";
|
|
2
|
+
import { AccessTokenProvider } from "../auth/access-token-provider";
|
|
3
|
+
import { Logger } from "../logger";
|
|
4
|
+
import { SmartlingListResponse } from "../http/smartling-list-response";
|
|
5
|
+
import { TagDto } from "./dto/tag-dto";
|
|
6
|
+
import { StringTagsDto } from "./dto/string-tags-dto";
|
|
7
|
+
import { ListAccountTagsParameters } from "./params/list-account-tags-parameters";
|
|
8
|
+
import { ListProjectTagsParameters } from "./params/list-project-tags-parameters";
|
|
9
|
+
import { SearchStringTagsParameters } from "./params/search-string-tags-parameters";
|
|
10
|
+
import { AddTagsToStringsParameters } from "./params/add-tags-to-strings-parameters";
|
|
11
|
+
import { RemoveTagsFromStringsParameters } from "./params/remove-tags-from-strings-parameters";
|
|
12
|
+
import { RemoveAllTagsFromStringsParameters } from "./params/remove-all-tags-from-strings-parameters";
|
|
13
|
+
import { ProjectIdTagDto } from "./dto/project-id-tag-dto";
|
|
14
|
+
|
|
15
|
+
export class SmartlingTagsApi extends SmartlingBaseApi {
|
|
16
|
+
constructor(smartlingApiBaseUrl: string, authApi: AccessTokenProvider, logger: Logger) {
|
|
17
|
+
super(logger);
|
|
18
|
+
this.authApi = authApi;
|
|
19
|
+
this.entrypoint = `${smartlingApiBaseUrl}/tags-api/v2`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async listAccountTags(
|
|
23
|
+
accountUid: string,
|
|
24
|
+
params: ListAccountTagsParameters
|
|
25
|
+
): Promise<SmartlingListResponse<ProjectIdTagDto>> {
|
|
26
|
+
return await this.makeRequest(
|
|
27
|
+
"post",
|
|
28
|
+
`${this.entrypoint}/accounts/${accountUid}/tags`,
|
|
29
|
+
JSON.stringify(params.export())
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async listProjectTags(
|
|
34
|
+
projectId: string,
|
|
35
|
+
params: ListProjectTagsParameters
|
|
36
|
+
): Promise<SmartlingListResponse<TagDto>> {
|
|
37
|
+
return await this.makeRequest(
|
|
38
|
+
"get",
|
|
39
|
+
`${this.entrypoint}/projects/${projectId}/tags`,
|
|
40
|
+
params.export()
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async searchStringTags(
|
|
45
|
+
projectId: string,
|
|
46
|
+
params: SearchStringTagsParameters
|
|
47
|
+
): Promise<Array<StringTagsDto>> {
|
|
48
|
+
return await this.makeRequest(
|
|
49
|
+
"post",
|
|
50
|
+
`${this.entrypoint}/projects/${projectId}/strings/tags/search`,
|
|
51
|
+
JSON.stringify(params.export())
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async addTagsToStrings(
|
|
56
|
+
projectId: string,
|
|
57
|
+
params: AddTagsToStringsParameters
|
|
58
|
+
): Promise<void> {
|
|
59
|
+
return await this.makeRequest(
|
|
60
|
+
"post",
|
|
61
|
+
`${this.entrypoint}/projects/${projectId}/strings/tags/add`,
|
|
62
|
+
JSON.stringify(params.export())
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async removeTagsFromStrings(
|
|
67
|
+
projectId: string,
|
|
68
|
+
params: RemoveTagsFromStringsParameters
|
|
69
|
+
): Promise<void> {
|
|
70
|
+
return await this.makeRequest(
|
|
71
|
+
"post",
|
|
72
|
+
`${this.entrypoint}/projects/${projectId}/strings/tags/remove`,
|
|
73
|
+
JSON.stringify(params.export())
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async removeAllTagsFromStrings(
|
|
78
|
+
projectId: string,
|
|
79
|
+
params: RemoveAllTagsFromStringsParameters
|
|
80
|
+
): Promise<Record<string, unknown>> {
|
|
81
|
+
return await this.makeRequest(
|
|
82
|
+
"post",
|
|
83
|
+
`${this.entrypoint}/projects/${projectId}/strings/tags/remove/all`,
|
|
84
|
+
JSON.stringify(params.export())
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
|
+
import { SmartlingException } from "../../exception";
|
|
3
|
+
|
|
4
|
+
export abstract class BaseTagsStringsParameters<
|
|
5
|
+
T extends BaseTagsStringsParameters<T>
|
|
6
|
+
> extends BaseParameters {
|
|
7
|
+
setTags(tags: Array<string>): T {
|
|
8
|
+
if (!tags || tags.length === 0) {
|
|
9
|
+
throw new SmartlingException("Tags array is required");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (tags.length > 100) {
|
|
13
|
+
throw new SmartlingException("Tags array must not exceed 100 items");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
tags.forEach((tag) => {
|
|
17
|
+
if (tag.length > 128) {
|
|
18
|
+
throw new SmartlingException("Tag length must not exceed 128 characters");
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
this.set("tags", tags);
|
|
23
|
+
|
|
24
|
+
return this as unknown as T;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
setStringHashcodes(stringHashcodes: Array<string>): T {
|
|
28
|
+
if (!stringHashcodes || stringHashcodes.length === 0) {
|
|
29
|
+
throw new SmartlingException("String hashcodes array is required");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (stringHashcodes.length > 1000) {
|
|
33
|
+
throw new SmartlingException("String hashcodes array must not exceed 1000 items");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
this.set("stringHashcodes", stringHashcodes);
|
|
37
|
+
|
|
38
|
+
return this as unknown as T;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
|
+
import { SmartlingException } from "../../exception";
|
|
3
|
+
|
|
4
|
+
export class ListAccountTagsParameters extends BaseParameters {
|
|
5
|
+
setProjectIds(projectIds: Array<string>): ListAccountTagsParameters {
|
|
6
|
+
if (projectIds && projectIds.length > 1000) {
|
|
7
|
+
throw new SmartlingException("Project IDs array must not exceed 1000 items");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
this.set("projectIds", projectIds);
|
|
11
|
+
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
setTagMask(tagMask: string): ListAccountTagsParameters {
|
|
16
|
+
this.set("tagMask", tagMask);
|
|
17
|
+
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
setLimit(limit: number): ListAccountTagsParameters {
|
|
22
|
+
if (limit < 1 || limit > 1500) {
|
|
23
|
+
throw new SmartlingException("Limit must be between 1 and 1500");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
this.set("limit", limit);
|
|
27
|
+
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setOffset(offset: number): ListAccountTagsParameters {
|
|
32
|
+
if (offset < 0) {
|
|
33
|
+
throw new SmartlingException("Offset must be non-negative");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
this.set("offset", offset);
|
|
37
|
+
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
|
+
import { SmartlingException } from "../../exception";
|
|
3
|
+
|
|
4
|
+
export class ListProjectTagsParameters extends BaseParameters {
|
|
5
|
+
setTagMask(tagMask: string): ListProjectTagsParameters {
|
|
6
|
+
this.set("tagMask", tagMask);
|
|
7
|
+
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
setLimit(limit: number): ListProjectTagsParameters {
|
|
12
|
+
if (limit < 0 || limit > 100) {
|
|
13
|
+
throw new SmartlingException("Limit must be between 0 and 100");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
this.set("limit", limit);
|
|
17
|
+
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
setOffset(offset: number): ListProjectTagsParameters {
|
|
22
|
+
if (offset < 0) {
|
|
23
|
+
throw new SmartlingException("Offset must be non-negative");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
this.set("offset", offset);
|
|
27
|
+
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
|
+
import { SmartlingException } from "../../exception";
|
|
3
|
+
|
|
4
|
+
export class RemoveAllTagsFromStringsParameters extends BaseParameters {
|
|
5
|
+
setStringHashcodes(stringHashcodes: Array<string>): RemoveAllTagsFromStringsParameters {
|
|
6
|
+
if (!stringHashcodes || stringHashcodes.length === 0) {
|
|
7
|
+
throw new SmartlingException("String hashcodes array is required");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (stringHashcodes.length > 1000) {
|
|
11
|
+
throw new SmartlingException("String hashcodes array must not exceed 1000 items");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
this.set("stringHashcodes", stringHashcodes);
|
|
15
|
+
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
|
+
import { SmartlingException } from "../../exception";
|
|
3
|
+
|
|
4
|
+
export class SearchStringTagsParameters extends BaseParameters {
|
|
5
|
+
setStringHashcodes(stringHashcodes: Array<string>): SearchStringTagsParameters {
|
|
6
|
+
if (!stringHashcodes || stringHashcodes.length === 0) {
|
|
7
|
+
throw new SmartlingException("String hashcodes array is required");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (stringHashcodes.length > 1000) {
|
|
11
|
+
throw new SmartlingException("String hashcodes array must not exceed 1000 items");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
this.set("stringHashcodes", stringHashcodes);
|
|
15
|
+
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"added-strings-dto.js","sourceRoot":"","sources":["../../../../api/jobs/dto/added-strings-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removed-strings-dto.js","sourceRoot":"","sources":["../../../../api/jobs/dto/removed-strings-dto.ts"],"names":[],"mappings":""}
|
|
@@ -22,6 +22,10 @@ import { FullSourceFileDto } from "./dto/full-source-file-dto";
|
|
|
22
22
|
import { AddedFileDto } from "./dto/added-file-dto";
|
|
23
23
|
import { AuthorizeJobParameters } from "./params/authorize-job-parameters";
|
|
24
24
|
import { UpdateJobParameters } from "./params/update-job-parameters";
|
|
25
|
+
import { AddStringsToJobParameters } from "./params/add-strings-to-job-parameters";
|
|
26
|
+
import { RemoveStringsFromJobParameters } from "./params/remove-strings-from-job-parameters";
|
|
27
|
+
import { AddedStringsDto } from "./dto/added-strings-dto";
|
|
28
|
+
import { RemovedStringsDto } from "./dto/removed-strings-dto";
|
|
25
29
|
export declare class SmartlingJobsApi extends SmartlingBaseApi {
|
|
26
30
|
constructor(smartlingApiBaseUrl: string, authApi: AccessTokenProvider, logger: Logger);
|
|
27
31
|
createJob(projectId: string, params: CreateJobParameters): Promise<JobDto>;
|
|
@@ -38,4 +42,6 @@ export declare class SmartlingJobsApi extends SmartlingBaseApi {
|
|
|
38
42
|
cancelJob(projectId: string, translationJobUid: string, params: CancelJobParameters): Promise<void>;
|
|
39
43
|
closeJob(projectId: string, translationJobUid: string, params: CloseJobParameters): Promise<void>;
|
|
40
44
|
deleteJob(projectId: string, translationJobUid: string): Promise<void>;
|
|
45
|
+
addStringsToJob(projectId: string, translationJobUid: string, params: AddStringsToJobParameters): Promise<AddedStringsDto>;
|
|
46
|
+
removeStringsFromJob(projectId: string, translationJobUid: string, params: RemoveStringsFromJobParameters): Promise<RemovedStringsDto>;
|
|
41
47
|
}
|
package/built/api/jobs/index.js
CHANGED
|
@@ -87,6 +87,16 @@ class SmartlingJobsApi extends index_1.SmartlingBaseApi {
|
|
|
87
87
|
yield this.makeRequest("delete", `${this.entrypoint}/${projectId}/jobs/${translationJobUid}`);
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
|
+
addStringsToJob(projectId, translationJobUid, params) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
return yield this.makeRequest("post", `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/strings/add`, JSON.stringify(params.export()));
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
removeStringsFromJob(projectId, translationJobUid, params) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
return yield this.makeRequest("post", `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/strings/remove`, JSON.stringify(params.export()));
|
|
98
|
+
});
|
|
99
|
+
}
|
|
90
100
|
}
|
|
91
101
|
exports.SmartlingJobsApi = SmartlingJobsApi;
|
|
92
102
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/jobs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/jobs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiD;AA6BjD,MAAa,gBAAiB,SAAQ,wBAAgB;IAClD,YAAY,mBAA2B,EAAE,OAA4B,EAAE,MAAc;QACjF,KAAK,CAAC,MAAM,CAAC,CAAC;QAC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AS,SAAS,iBAAiB,iBAAiB,EAC1E,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAClC,CAAC;QACN,CAAC;KAAA;CACJ;AAlKD,4CAkKC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters/index";
|
|
2
|
+
export declare class AddStringsToJobParameters extends BaseParameters {
|
|
3
|
+
setHashcodes(hashcodes: string[]): AddStringsToJobParameters;
|
|
4
|
+
setMoveEnabled(moveEnabled: boolean): AddStringsToJobParameters;
|
|
5
|
+
setTargetLocaleIds(targetLocaleIds: string[]): AddStringsToJobParameters;
|
|
6
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddStringsToJobParameters = void 0;
|
|
4
|
+
const index_1 = require("../../parameters/index");
|
|
5
|
+
class AddStringsToJobParameters extends index_1.BaseParameters {
|
|
6
|
+
setHashcodes(hashcodes) {
|
|
7
|
+
this.set("hashcodes", hashcodes);
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
setMoveEnabled(moveEnabled) {
|
|
11
|
+
this.set("moveEnabled", moveEnabled);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
setTargetLocaleIds(targetLocaleIds) {
|
|
15
|
+
this.set("targetLocaleIds", targetLocaleIds);
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.AddStringsToJobParameters = AddStringsToJobParameters;
|
|
20
|
+
//# sourceMappingURL=add-strings-to-job-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-strings-to-job-parameters.js","sourceRoot":"","sources":["../../../../api/jobs/params/add-strings-to-job-parameters.ts"],"names":[],"mappings":";;;AAAA,kDAAwD;AAExD,MAAa,yBAA0B,SAAQ,sBAAc;IACzD,YAAY,CAAC,SAAmB;QAC5B,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,cAAc,CAAC,WAAoB;QAC/B,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kBAAkB,CAAC,eAAyB;QACxC,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAfD,8DAeC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters/index";
|
|
2
|
+
export declare class RemoveStringsFromJobParameters extends BaseParameters {
|
|
3
|
+
setHashcodes(hashcodes: string[]): RemoveStringsFromJobParameters;
|
|
4
|
+
setTargetLocaleIds(targetLocaleIds: string[]): RemoveStringsFromJobParameters;
|
|
5
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemoveStringsFromJobParameters = void 0;
|
|
4
|
+
const index_1 = require("../../parameters/index");
|
|
5
|
+
class RemoveStringsFromJobParameters extends index_1.BaseParameters {
|
|
6
|
+
setHashcodes(hashcodes) {
|
|
7
|
+
this.set("hashcodes", hashcodes);
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
setTargetLocaleIds(targetLocaleIds) {
|
|
11
|
+
this.set("targetLocaleIds", targetLocaleIds);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.RemoveStringsFromJobParameters = RemoveStringsFromJobParameters;
|
|
16
|
+
//# sourceMappingURL=remove-strings-from-job-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-strings-from-job-parameters.js","sourceRoot":"","sources":["../../../../api/jobs/params/remove-strings-from-job-parameters.ts"],"names":[],"mappings":";;;AAAA,kDAAwD;AAExD,MAAa,8BAA+B,SAAQ,sBAAc;IAC9D,YAAY,CAAC,SAAmB;QAC5B,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kBAAkB,CAAC,eAAyB;QACxC,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAVD,wEAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-id-tag-dto.js","sourceRoot":"","sources":["../../../../api/tags/dto/project-id-tag-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-tags-dto.js","sourceRoot":"","sources":["../../../../api/tags/dto/string-tags-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-dto.js","sourceRoot":"","sources":["../../../../api/tags/dto/tag-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SmartlingBaseApi } from "../base/index";
|
|
2
|
+
import { AccessTokenProvider } from "../auth/access-token-provider";
|
|
3
|
+
import { Logger } from "../logger";
|
|
4
|
+
import { SmartlingListResponse } from "../http/smartling-list-response";
|
|
5
|
+
import { TagDto } from "./dto/tag-dto";
|
|
6
|
+
import { StringTagsDto } from "./dto/string-tags-dto";
|
|
7
|
+
import { ListAccountTagsParameters } from "./params/list-account-tags-parameters";
|
|
8
|
+
import { ListProjectTagsParameters } from "./params/list-project-tags-parameters";
|
|
9
|
+
import { SearchStringTagsParameters } from "./params/search-string-tags-parameters";
|
|
10
|
+
import { AddTagsToStringsParameters } from "./params/add-tags-to-strings-parameters";
|
|
11
|
+
import { RemoveTagsFromStringsParameters } from "./params/remove-tags-from-strings-parameters";
|
|
12
|
+
import { RemoveAllTagsFromStringsParameters } from "./params/remove-all-tags-from-strings-parameters";
|
|
13
|
+
import { ProjectIdTagDto } from "./dto/project-id-tag-dto";
|
|
14
|
+
export declare class SmartlingTagsApi extends SmartlingBaseApi {
|
|
15
|
+
constructor(smartlingApiBaseUrl: string, authApi: AccessTokenProvider, logger: Logger);
|
|
16
|
+
listAccountTags(accountUid: string, params: ListAccountTagsParameters): Promise<SmartlingListResponse<ProjectIdTagDto>>;
|
|
17
|
+
listProjectTags(projectId: string, params: ListProjectTagsParameters): Promise<SmartlingListResponse<TagDto>>;
|
|
18
|
+
searchStringTags(projectId: string, params: SearchStringTagsParameters): Promise<Array<StringTagsDto>>;
|
|
19
|
+
addTagsToStrings(projectId: string, params: AddTagsToStringsParameters): Promise<void>;
|
|
20
|
+
removeTagsFromStrings(projectId: string, params: RemoveTagsFromStringsParameters): Promise<void>;
|
|
21
|
+
removeAllTagsFromStrings(projectId: string, params: RemoveAllTagsFromStringsParameters): Promise<Record<string, unknown>>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SmartlingTagsApi = void 0;
|
|
13
|
+
const index_1 = require("../base/index");
|
|
14
|
+
class SmartlingTagsApi extends index_1.SmartlingBaseApi {
|
|
15
|
+
constructor(smartlingApiBaseUrl, authApi, logger) {
|
|
16
|
+
super(logger);
|
|
17
|
+
this.authApi = authApi;
|
|
18
|
+
this.entrypoint = `${smartlingApiBaseUrl}/tags-api/v2`;
|
|
19
|
+
}
|
|
20
|
+
listAccountTags(accountUid, params) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return yield this.makeRequest("post", `${this.entrypoint}/accounts/${accountUid}/tags`, JSON.stringify(params.export()));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
listProjectTags(projectId, params) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
return yield this.makeRequest("get", `${this.entrypoint}/projects/${projectId}/tags`, params.export());
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
searchStringTags(projectId, params) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
return yield this.makeRequest("post", `${this.entrypoint}/projects/${projectId}/strings/tags/search`, JSON.stringify(params.export()));
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
addTagsToStrings(projectId, params) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
return yield this.makeRequest("post", `${this.entrypoint}/projects/${projectId}/strings/tags/add`, JSON.stringify(params.export()));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
removeTagsFromStrings(projectId, params) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
return yield this.makeRequest("post", `${this.entrypoint}/projects/${projectId}/strings/tags/remove`, JSON.stringify(params.export()));
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
removeAllTagsFromStrings(projectId, params) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
return yield this.makeRequest("post", `${this.entrypoint}/projects/${projectId}/strings/tags/remove/all`, JSON.stringify(params.export()));
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.SmartlingTagsApi = SmartlingTagsApi;
|
|
52
|
+
//# sourceMappingURL=index.js.map
|