smartling-api-sdk-nodejs 2.22.0 → 2.23.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/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/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/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=AZh0732vF9ynshTVs21w
|
|
6
|
+
ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AZh0732vF9ynshTVs21w
|
|
@@ -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":"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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/tags/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiD;AAcjD,MAAa,gBAAiB,SAAQ,wBAAgB;IAClD,YAAY,mBAA2B,EAAE,OAA4B,EAAE,MAAc;QACjF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,GAAG,mBAAmB,cAAc,CAAC;IAC3D,CAAC;IAEK,eAAe,CACjB,UAAkB,EAClB,MAAiC;;YAEjC,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,aAAa,UAAU,OAAO,EAChD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAClC,CAAC;QACN,CAAC;KAAA;IAEK,eAAe,CACjB,SAAiB,EACjB,MAAiC;;YAEjC,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,aAAa,SAAS,OAAO,EAC/C,MAAM,CAAC,MAAM,EAAE,CAClB,CAAC;QACN,CAAC;KAAA;IAEK,gBAAgB,CAClB,SAAiB,EACjB,MAAkC;;YAElC,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,aAAa,SAAS,sBAAsB,EAC9D,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAClC,CAAC;QACN,CAAC;KAAA;IAEK,gBAAgB,CAClB,SAAiB,EACjB,MAAkC;;YAElC,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,aAAa,SAAS,mBAAmB,EAC3D,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAClC,CAAC;QACN,CAAC;KAAA;IAEK,qBAAqB,CACvB,SAAiB,EACjB,MAAuC;;YAEvC,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,aAAa,SAAS,sBAAsB,EAC9D,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAClC,CAAC;QACN,CAAC;KAAA;IAEK,wBAAwB,CAC1B,SAAiB,EACjB,MAA0C;;YAE1C,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,aAAa,SAAS,0BAA0B,EAClE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAClC,CAAC;QACN,CAAC;KAAA;CACJ;AAxED,4CAwEC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddTagsToStringsParameters = void 0;
|
|
4
|
+
const base_tags_strings_parameters_1 = require("./base-tags-strings-parameters");
|
|
5
|
+
class AddTagsToStringsParameters extends base_tags_strings_parameters_1.BaseTagsStringsParameters {
|
|
6
|
+
}
|
|
7
|
+
exports.AddTagsToStringsParameters = AddTagsToStringsParameters;
|
|
8
|
+
//# sourceMappingURL=add-tags-to-strings-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-tags-to-strings-parameters.js","sourceRoot":"","sources":["../../../../api/tags/params/add-tags-to-strings-parameters.ts"],"names":[],"mappings":";;;AAAA,iFAA2E;AAE3E,MAAa,0BACT,SAAQ,wDAAqD;CAAG;AADpE,gEACoE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseTagsStringsParameters = void 0;
|
|
4
|
+
const parameters_1 = require("../../parameters");
|
|
5
|
+
const exception_1 = require("../../exception");
|
|
6
|
+
class BaseTagsStringsParameters extends parameters_1.BaseParameters {
|
|
7
|
+
setTags(tags) {
|
|
8
|
+
if (!tags || tags.length === 0) {
|
|
9
|
+
throw new exception_1.SmartlingException("Tags array is required");
|
|
10
|
+
}
|
|
11
|
+
if (tags.length > 100) {
|
|
12
|
+
throw new exception_1.SmartlingException("Tags array must not exceed 100 items");
|
|
13
|
+
}
|
|
14
|
+
tags.forEach((tag) => {
|
|
15
|
+
if (tag.length > 128) {
|
|
16
|
+
throw new exception_1.SmartlingException("Tag length must not exceed 128 characters");
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
this.set("tags", tags);
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
setStringHashcodes(stringHashcodes) {
|
|
23
|
+
if (!stringHashcodes || stringHashcodes.length === 0) {
|
|
24
|
+
throw new exception_1.SmartlingException("String hashcodes array is required");
|
|
25
|
+
}
|
|
26
|
+
if (stringHashcodes.length > 1000) {
|
|
27
|
+
throw new exception_1.SmartlingException("String hashcodes array must not exceed 1000 items");
|
|
28
|
+
}
|
|
29
|
+
this.set("stringHashcodes", stringHashcodes);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.BaseTagsStringsParameters = BaseTagsStringsParameters;
|
|
34
|
+
//# sourceMappingURL=base-tags-strings-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-tags-strings-parameters.js","sourceRoot":"","sources":["../../../../api/tags/params/base-tags-strings-parameters.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAClD,+CAAqD;AAErD,MAAsB,yBAEpB,SAAQ,2BAAc;IACpB,OAAO,CAAC,IAAmB;QACvB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,MAAM,IAAI,8BAAkB,CAAC,wBAAwB,CAAC,CAAC;SAC1D;QAED,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,EAAE;YACnB,MAAM,IAAI,8BAAkB,CAAC,sCAAsC,CAAC,CAAC;SACxE;QAED,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACjB,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE;gBAClB,MAAM,IAAI,8BAAkB,CAAC,2CAA2C,CAAC,CAAC;aAC7E;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAEvB,OAAO,IAAoB,CAAC;IAChC,CAAC;IAED,kBAAkB,CAAC,eAA8B;QAC7C,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;YAClD,MAAM,IAAI,8BAAkB,CAAC,oCAAoC,CAAC,CAAC;SACtE;QAED,IAAI,eAAe,CAAC,MAAM,GAAG,IAAI,EAAE;YAC/B,MAAM,IAAI,8BAAkB,CAAC,mDAAmD,CAAC,CAAC;SACrF;QAED,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;QAE7C,OAAO,IAAoB,CAAC;IAChC,CAAC;CACJ;AApCD,8DAoCC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
|
+
export declare class ListAccountTagsParameters extends BaseParameters {
|
|
3
|
+
setProjectIds(projectIds: Array<string>): ListAccountTagsParameters;
|
|
4
|
+
setTagMask(tagMask: string): ListAccountTagsParameters;
|
|
5
|
+
setLimit(limit: number): ListAccountTagsParameters;
|
|
6
|
+
setOffset(offset: number): ListAccountTagsParameters;
|
|
7
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListAccountTagsParameters = void 0;
|
|
4
|
+
const parameters_1 = require("../../parameters");
|
|
5
|
+
const exception_1 = require("../../exception");
|
|
6
|
+
class ListAccountTagsParameters extends parameters_1.BaseParameters {
|
|
7
|
+
setProjectIds(projectIds) {
|
|
8
|
+
if (projectIds && projectIds.length > 1000) {
|
|
9
|
+
throw new exception_1.SmartlingException("Project IDs array must not exceed 1000 items");
|
|
10
|
+
}
|
|
11
|
+
this.set("projectIds", projectIds);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
setTagMask(tagMask) {
|
|
15
|
+
this.set("tagMask", tagMask);
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
setLimit(limit) {
|
|
19
|
+
if (limit < 1 || limit > 1500) {
|
|
20
|
+
throw new exception_1.SmartlingException("Limit must be between 1 and 1500");
|
|
21
|
+
}
|
|
22
|
+
this.set("limit", limit);
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
setOffset(offset) {
|
|
26
|
+
if (offset < 0) {
|
|
27
|
+
throw new exception_1.SmartlingException("Offset must be non-negative");
|
|
28
|
+
}
|
|
29
|
+
this.set("offset", offset);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.ListAccountTagsParameters = ListAccountTagsParameters;
|
|
34
|
+
//# sourceMappingURL=list-account-tags-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-account-tags-parameters.js","sourceRoot":"","sources":["../../../../api/tags/params/list-account-tags-parameters.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAClD,+CAAqD;AAErD,MAAa,yBAA0B,SAAQ,2BAAc;IACzD,aAAa,CAAC,UAAyB;QACnC,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,IAAI,EAAE;YACxC,MAAM,IAAI,8BAAkB,CAAC,8CAA8C,CAAC,CAAC;SAChF;QAED,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QAEnC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU,CAAC,OAAe;QACtB,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE7B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ,CAAC,KAAa;QAClB,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,IAAI,EAAE;YAC3B,MAAM,IAAI,8BAAkB,CAAC,kCAAkC,CAAC,CAAC;SACpE;QAED,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,SAAS,CAAC,MAAc;QACpB,IAAI,MAAM,GAAG,CAAC,EAAE;YACZ,MAAM,IAAI,8BAAkB,CAAC,6BAA6B,CAAC,CAAC;SAC/D;QAED,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAE3B,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AApCD,8DAoCC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
|
+
export declare class ListProjectTagsParameters extends BaseParameters {
|
|
3
|
+
setTagMask(tagMask: string): ListProjectTagsParameters;
|
|
4
|
+
setLimit(limit: number): ListProjectTagsParameters;
|
|
5
|
+
setOffset(offset: number): ListProjectTagsParameters;
|
|
6
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListProjectTagsParameters = void 0;
|
|
4
|
+
const parameters_1 = require("../../parameters");
|
|
5
|
+
const exception_1 = require("../../exception");
|
|
6
|
+
class ListProjectTagsParameters extends parameters_1.BaseParameters {
|
|
7
|
+
setTagMask(tagMask) {
|
|
8
|
+
this.set("tagMask", tagMask);
|
|
9
|
+
return this;
|
|
10
|
+
}
|
|
11
|
+
setLimit(limit) {
|
|
12
|
+
if (limit < 0 || limit > 100) {
|
|
13
|
+
throw new exception_1.SmartlingException("Limit must be between 0 and 100");
|
|
14
|
+
}
|
|
15
|
+
this.set("limit", limit);
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
setOffset(offset) {
|
|
19
|
+
if (offset < 0) {
|
|
20
|
+
throw new exception_1.SmartlingException("Offset must be non-negative");
|
|
21
|
+
}
|
|
22
|
+
this.set("offset", offset);
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.ListProjectTagsParameters = ListProjectTagsParameters;
|
|
27
|
+
//# sourceMappingURL=list-project-tags-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-project-tags-parameters.js","sourceRoot":"","sources":["../../../../api/tags/params/list-project-tags-parameters.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAClD,+CAAqD;AAErD,MAAa,yBAA0B,SAAQ,2BAAc;IACzD,UAAU,CAAC,OAAe;QACtB,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE7B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ,CAAC,KAAa;QAClB,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,GAAG,EAAE;YAC1B,MAAM,IAAI,8BAAkB,CAAC,iCAAiC,CAAC,CAAC;SACnE;QAED,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,SAAS,CAAC,MAAc;QACpB,IAAI,MAAM,GAAG,CAAC,EAAE;YACZ,MAAM,IAAI,8BAAkB,CAAC,6BAA6B,CAAC,CAAC;SAC/D;QAED,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAE3B,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA1BD,8DA0BC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemoveAllTagsFromStringsParameters = void 0;
|
|
4
|
+
const parameters_1 = require("../../parameters");
|
|
5
|
+
const exception_1 = require("../../exception");
|
|
6
|
+
class RemoveAllTagsFromStringsParameters extends parameters_1.BaseParameters {
|
|
7
|
+
setStringHashcodes(stringHashcodes) {
|
|
8
|
+
if (!stringHashcodes || stringHashcodes.length === 0) {
|
|
9
|
+
throw new exception_1.SmartlingException("String hashcodes array is required");
|
|
10
|
+
}
|
|
11
|
+
if (stringHashcodes.length > 1000) {
|
|
12
|
+
throw new exception_1.SmartlingException("String hashcodes array must not exceed 1000 items");
|
|
13
|
+
}
|
|
14
|
+
this.set("stringHashcodes", stringHashcodes);
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.RemoveAllTagsFromStringsParameters = RemoveAllTagsFromStringsParameters;
|
|
19
|
+
//# sourceMappingURL=remove-all-tags-from-strings-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-all-tags-from-strings-parameters.js","sourceRoot":"","sources":["../../../../api/tags/params/remove-all-tags-from-strings-parameters.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAClD,+CAAqD;AAErD,MAAa,kCAAmC,SAAQ,2BAAc;IAClE,kBAAkB,CAAC,eAA8B;QAC7C,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;YAClD,MAAM,IAAI,8BAAkB,CAAC,oCAAoC,CAAC,CAAC;SACtE;QAED,IAAI,eAAe,CAAC,MAAM,GAAG,IAAI,EAAE;YAC/B,MAAM,IAAI,8BAAkB,CAAC,mDAAmD,CAAC,CAAC;SACrF;QAED,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;QAE7C,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAdD,gFAcC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemoveTagsFromStringsParameters = void 0;
|
|
4
|
+
const base_tags_strings_parameters_1 = require("./base-tags-strings-parameters");
|
|
5
|
+
class RemoveTagsFromStringsParameters extends base_tags_strings_parameters_1.BaseTagsStringsParameters {
|
|
6
|
+
}
|
|
7
|
+
exports.RemoveTagsFromStringsParameters = RemoveTagsFromStringsParameters;
|
|
8
|
+
//# sourceMappingURL=remove-tags-from-strings-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-tags-from-strings-parameters.js","sourceRoot":"","sources":["../../../../api/tags/params/remove-tags-from-strings-parameters.ts"],"names":[],"mappings":";;;AAAA,iFAA2E;AAE3E,MAAa,+BACT,SAAQ,wDAA0D;CAAG;AADzE,0EACyE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchStringTagsParameters = void 0;
|
|
4
|
+
const parameters_1 = require("../../parameters");
|
|
5
|
+
const exception_1 = require("../../exception");
|
|
6
|
+
class SearchStringTagsParameters extends parameters_1.BaseParameters {
|
|
7
|
+
setStringHashcodes(stringHashcodes) {
|
|
8
|
+
if (!stringHashcodes || stringHashcodes.length === 0) {
|
|
9
|
+
throw new exception_1.SmartlingException("String hashcodes array is required");
|
|
10
|
+
}
|
|
11
|
+
if (stringHashcodes.length > 1000) {
|
|
12
|
+
throw new exception_1.SmartlingException("String hashcodes array must not exceed 1000 items");
|
|
13
|
+
}
|
|
14
|
+
this.set("stringHashcodes", stringHashcodes);
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.SearchStringTagsParameters = SearchStringTagsParameters;
|
|
19
|
+
//# sourceMappingURL=search-string-tags-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-string-tags-parameters.js","sourceRoot":"","sources":["../../../../api/tags/params/search-string-tags-parameters.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAClD,+CAAqD;AAErD,MAAa,0BAA2B,SAAQ,2BAAc;IAC1D,kBAAkB,CAAC,eAA8B;QAC7C,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;YAClD,MAAM,IAAI,8BAAkB,CAAC,oCAAoC,CAAC,CAAC;SACtE;QAED,IAAI,eAAe,CAAC,MAAM,GAAG,IAAI,EAAE;YAC/B,MAAM,IAAI,8BAAkB,CAAC,mDAAmD,CAAC,CAAC;SACrF;QAED,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;QAE7C,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAdD,gEAcC"}
|
package/built/index.d.ts
CHANGED
|
@@ -109,6 +109,17 @@ export * from "./api/strings/index";
|
|
|
109
109
|
export * from "./api/strings/dto/source-string-dto";
|
|
110
110
|
export * from "./api/strings/dto/source-string-key-dto";
|
|
111
111
|
export * from "./api/strings/params/fetch-source-strings-parameters";
|
|
112
|
+
export * from "./api/tags/index";
|
|
113
|
+
export * from "./api/tags/dto/tag-dto";
|
|
114
|
+
export * from "./api/tags/dto/project-id-tag-dto";
|
|
115
|
+
export * from "./api/tags/dto/string-tags-dto";
|
|
116
|
+
export * from "./api/tags/params/list-account-tags-parameters";
|
|
117
|
+
export * from "./api/tags/params/list-project-tags-parameters";
|
|
118
|
+
export * from "./api/tags/params/search-string-tags-parameters";
|
|
119
|
+
export * from "./api/tags/params/base-tags-strings-parameters";
|
|
120
|
+
export * from "./api/tags/params/add-tags-to-strings-parameters";
|
|
121
|
+
export * from "./api/tags/params/remove-tags-from-strings-parameters";
|
|
122
|
+
export * from "./api/tags/params/remove-all-tags-from-strings-parameters";
|
|
112
123
|
export * from "./api/logger";
|
|
113
124
|
export * from "./api/jobs/params/add-file-parameters";
|
|
114
125
|
export * from "./api/files/params/download-file-all-translations-parameters";
|
package/built/index.js
CHANGED
|
@@ -125,6 +125,17 @@ __exportStar(require("./api/strings/index"), exports);
|
|
|
125
125
|
__exportStar(require("./api/strings/dto/source-string-dto"), exports);
|
|
126
126
|
__exportStar(require("./api/strings/dto/source-string-key-dto"), exports);
|
|
127
127
|
__exportStar(require("./api/strings/params/fetch-source-strings-parameters"), exports);
|
|
128
|
+
__exportStar(require("./api/tags/index"), exports);
|
|
129
|
+
__exportStar(require("./api/tags/dto/tag-dto"), exports);
|
|
130
|
+
__exportStar(require("./api/tags/dto/project-id-tag-dto"), exports);
|
|
131
|
+
__exportStar(require("./api/tags/dto/string-tags-dto"), exports);
|
|
132
|
+
__exportStar(require("./api/tags/params/list-account-tags-parameters"), exports);
|
|
133
|
+
__exportStar(require("./api/tags/params/list-project-tags-parameters"), exports);
|
|
134
|
+
__exportStar(require("./api/tags/params/search-string-tags-parameters"), exports);
|
|
135
|
+
__exportStar(require("./api/tags/params/base-tags-strings-parameters"), exports);
|
|
136
|
+
__exportStar(require("./api/tags/params/add-tags-to-strings-parameters"), exports);
|
|
137
|
+
__exportStar(require("./api/tags/params/remove-tags-from-strings-parameters"), exports);
|
|
138
|
+
__exportStar(require("./api/tags/params/remove-all-tags-from-strings-parameters"), exports);
|
|
128
139
|
__exportStar(require("./api/logger"), exports);
|
|
129
140
|
__exportStar(require("./api/jobs/params/add-file-parameters"), exports);
|
|
130
141
|
__exportStar(require("./api/files/params/download-file-all-translations-parameters"), exports);
|
package/built/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,kEAAgD;AAChD,0EAAwD;AACxD,mEAAiD;AACjD,mDAAiC;AACjC,sDAAoC;AACpC,sDAAoC;AACpC,wEAAsD;AACtD,6EAA2D;AAC3D,gEAA8C;AAC9C,4EAA0D;AAC1D,uEAAqD;AACrD,0FAAwE;AACxE,oEAAkD;AAClD,iFAA+D;AAC/D,kFAAgE;AAChE,uEAAqD;AACrD,sEAAoD;AACpD,wDAAsC;AACtC,gEAA8C;AAC9C,wFAAsE;AACtE,qFAAmE;AACnE,4FAA0E;AAC1E,+FAA6E;AAC7E,2FAAyE;AACzE,oEAAkD;AAClD,oFAAkE;AAClE,qFAAmE;AACnE,uFAAqE;AACrE,4FAA0E;AAC1E,2EAAyD;AACzD,uEAAqD;AACrD,8EAA4D;AAC5D,4FAA0E;AAC1E,qFAAmE;AACnE,oDAAkC;AAClC,8EAA4D;AAC5D,6EAA2D;AAC3D,oEAAkD;AAClD,+DAA6C;AAC7C,4EAA0D;AAC1D,kFAAgE;AAChE,kFAAgE;AAChE,+EAA6D;AAC7D,oEAAkD;AAClD,yDAAuC;AACvC,oEAAkD;AAClD,2EAAyD;AACzD,sEAAoD;AACpD,mEAAiD;AACjD,uFAAqE;AACrE,qEAAmD;AACnD,0DAAwC;AACxC,kEAAgD;AAChD,uEAAqD;AACrD,yEAAuD;AACvD,yEAAuD;AACvD,4EAA0D;AAC1D,oFAAkE;AAClE,oFAAkE;AAClE,mFAAiE;AACjE,kFAAgE;AAChE,wFAAsE;AACtE,2FAAyE;AACzE,wFAAsE;AACtE,0FAAwE;AACxE,wEAAsD;AACtD,wEAAsD;AACtD,mFAAiE;AACjE,6EAA2D;AAC3D,mDAAiC;AACjC,8DAA4C;AAC5C,kFAAgE;AAChE,kEAAgD;AAChD,mEAAiD;AACjD,sEAAoD;AACpD,iEAA+C;AAC/C,yDAAuC;AACvC,iEAA+C;AAC/C,mFAAiE;AACjE,uFAAqE;AACrE,kEAAgD;AAChD,mEAAiD;AACjD,yEAAuD;AACvD,kEAAgD;AAChD,oEAAkD;AAClD,0EAAwD;AACxD,6EAA2D;AAC3D,4EAA0D;AAC1D,+DAA6C;AAC7C,8EAA4D;AAC5D,yEAAuD;AACvD,2EAAyD;AACzD,0EAAwD;AACxD,yEAAuD;AACvD,2EAAyD;AACzD,0EAAwD;AACxD,yDAAuC;AACvC,yDAAuC;AACvC,uDAAqC;AACrC,iEAA+C;AAC/C,wFAAsE;AACtE,gEAA8C;AAC9C,iFAA+D;AAC/D,8DAA4C;AAC5C,+EAA6D;AAC7D,mGAAiF;AACjF,sDAAoC;AACpC,sEAAoD;AACpD,0EAAwD;AACxD,uFAAqE;AACrE,+CAA6B;AAC7B,wEAAsD;AACtD,+FAA6E;AAC7E,6EAA2D;AAC3D,gEAA8C;AAC9C,2EAAyD;AACzD,yEAAuD;AACvD,8DAA4C;AAC5C,mEAAiD;AACjD,8EAA4D;AAC5D,sDAAoC;AACpC,iDAA+B;AAC/B,0EAAwD;AACxD,mEAAiD;AACjD,yEAAuD;AACvD,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,kEAAgD;AAChD,0EAAwD;AACxD,mEAAiD;AACjD,mDAAiC;AACjC,sDAAoC;AACpC,sDAAoC;AACpC,wEAAsD;AACtD,6EAA2D;AAC3D,gEAA8C;AAC9C,4EAA0D;AAC1D,uEAAqD;AACrD,0FAAwE;AACxE,oEAAkD;AAClD,iFAA+D;AAC/D,kFAAgE;AAChE,uEAAqD;AACrD,sEAAoD;AACpD,wDAAsC;AACtC,gEAA8C;AAC9C,wFAAsE;AACtE,qFAAmE;AACnE,4FAA0E;AAC1E,+FAA6E;AAC7E,2FAAyE;AACzE,oEAAkD;AAClD,oFAAkE;AAClE,qFAAmE;AACnE,uFAAqE;AACrE,4FAA0E;AAC1E,2EAAyD;AACzD,uEAAqD;AACrD,8EAA4D;AAC5D,4FAA0E;AAC1E,qFAAmE;AACnE,oDAAkC;AAClC,8EAA4D;AAC5D,6EAA2D;AAC3D,oEAAkD;AAClD,+DAA6C;AAC7C,4EAA0D;AAC1D,kFAAgE;AAChE,kFAAgE;AAChE,+EAA6D;AAC7D,oEAAkD;AAClD,yDAAuC;AACvC,oEAAkD;AAClD,2EAAyD;AACzD,sEAAoD;AACpD,mEAAiD;AACjD,uFAAqE;AACrE,qEAAmD;AACnD,0DAAwC;AACxC,kEAAgD;AAChD,uEAAqD;AACrD,yEAAuD;AACvD,yEAAuD;AACvD,4EAA0D;AAC1D,oFAAkE;AAClE,oFAAkE;AAClE,mFAAiE;AACjE,kFAAgE;AAChE,wFAAsE;AACtE,2FAAyE;AACzE,wFAAsE;AACtE,0FAAwE;AACxE,wEAAsD;AACtD,wEAAsD;AACtD,mFAAiE;AACjE,6EAA2D;AAC3D,mDAAiC;AACjC,8DAA4C;AAC5C,kFAAgE;AAChE,kEAAgD;AAChD,mEAAiD;AACjD,sEAAoD;AACpD,iEAA+C;AAC/C,yDAAuC;AACvC,iEAA+C;AAC/C,mFAAiE;AACjE,uFAAqE;AACrE,kEAAgD;AAChD,mEAAiD;AACjD,yEAAuD;AACvD,kEAAgD;AAChD,oEAAkD;AAClD,0EAAwD;AACxD,6EAA2D;AAC3D,4EAA0D;AAC1D,+DAA6C;AAC7C,8EAA4D;AAC5D,yEAAuD;AACvD,2EAAyD;AACzD,0EAAwD;AACxD,yEAAuD;AACvD,2EAAyD;AACzD,0EAAwD;AACxD,yDAAuC;AACvC,yDAAuC;AACvC,uDAAqC;AACrC,iEAA+C;AAC/C,wFAAsE;AACtE,gEAA8C;AAC9C,iFAA+D;AAC/D,8DAA4C;AAC5C,+EAA6D;AAC7D,mGAAiF;AACjF,sDAAoC;AACpC,sEAAoD;AACpD,0EAAwD;AACxD,uFAAqE;AACrE,mDAAiC;AACjC,yDAAuC;AACvC,oEAAkD;AAClD,iEAA+C;AAC/C,iFAA+D;AAC/D,iFAA+D;AAC/D,kFAAgE;AAChE,iFAA+D;AAC/D,mFAAiE;AACjE,wFAAsE;AACtE,4FAA0E;AAC1E,+CAA6B;AAC7B,wEAAsD;AACtD,+FAA6E;AAC7E,6EAA2D;AAC3D,gEAA8C;AAC9C,2EAAyD;AACzD,yEAAuD;AACvD,8DAA4C;AAC5C,mEAAiD;AACjD,8EAA4D;AAC5D,sDAAoC;AACpC,iDAA+B;AAC/B,0EAAwD;AACxD,mEAAiD;AACjD,yEAAuD;AACvD,iDAA+B"}
|
package/built/package.json
CHANGED
package/index.ts
CHANGED
|
@@ -109,6 +109,17 @@ export * from "./api/strings/index";
|
|
|
109
109
|
export * from "./api/strings/dto/source-string-dto";
|
|
110
110
|
export * from "./api/strings/dto/source-string-key-dto";
|
|
111
111
|
export * from "./api/strings/params/fetch-source-strings-parameters";
|
|
112
|
+
export * from "./api/tags/index";
|
|
113
|
+
export * from "./api/tags/dto/tag-dto";
|
|
114
|
+
export * from "./api/tags/dto/project-id-tag-dto";
|
|
115
|
+
export * from "./api/tags/dto/string-tags-dto";
|
|
116
|
+
export * from "./api/tags/params/list-account-tags-parameters";
|
|
117
|
+
export * from "./api/tags/params/list-project-tags-parameters";
|
|
118
|
+
export * from "./api/tags/params/search-string-tags-parameters";
|
|
119
|
+
export * from "./api/tags/params/base-tags-strings-parameters";
|
|
120
|
+
export * from "./api/tags/params/add-tags-to-strings-parameters";
|
|
121
|
+
export * from "./api/tags/params/remove-tags-from-strings-parameters";
|
|
122
|
+
export * from "./api/tags/params/remove-all-tags-from-strings-parameters";
|
|
112
123
|
export * from "./api/logger";
|
|
113
124
|
export * from "./api/jobs/params/add-file-parameters";
|
|
114
125
|
export * from "./api/files/params/download-file-all-translations-parameters";
|
package/package.json
CHANGED
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import * as sinon from "sinon";
|
|
2
|
+
import * as assert from "assert";
|
|
3
|
+
import { loggerMock, authMock, responseMock } from "./mock";
|
|
4
|
+
import { SmartlingTagsApi } from "../api/tags/index";
|
|
5
|
+
import { SmartlingAuthApi } from "../api/auth/index";
|
|
6
|
+
import { ListAccountTagsParameters } from "../api/tags/params/list-account-tags-parameters";
|
|
7
|
+
import { ListProjectTagsParameters } from "../api/tags/params/list-project-tags-parameters";
|
|
8
|
+
import { SearchStringTagsParameters } from "../api/tags/params/search-string-tags-parameters";
|
|
9
|
+
import { AddTagsToStringsParameters } from "../api/tags/params/add-tags-to-strings-parameters";
|
|
10
|
+
import { RemoveTagsFromStringsParameters } from "../api/tags/params/remove-tags-from-strings-parameters";
|
|
11
|
+
import { RemoveAllTagsFromStringsParameters } from "../api/tags/params/remove-all-tags-from-strings-parameters";
|
|
12
|
+
|
|
13
|
+
describe("SmartlingTagsAPI class tests.", () => {
|
|
14
|
+
const accountUid = "testAccountUid";
|
|
15
|
+
const projectId = "testProjectId";
|
|
16
|
+
let tagsApi;
|
|
17
|
+
let tagsServiceApiFetchStub;
|
|
18
|
+
let tagsServiceApiUaStub;
|
|
19
|
+
let responseMockJsonStub;
|
|
20
|
+
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
tagsApi = new SmartlingTagsApi("https://test.com", authMock as unknown as SmartlingAuthApi, loggerMock);
|
|
23
|
+
tagsServiceApiFetchStub = sinon.stub(tagsApi, "fetch");
|
|
24
|
+
tagsServiceApiUaStub = sinon.stub(tagsApi, "ua");
|
|
25
|
+
responseMockJsonStub = sinon.stub(responseMock, "json");
|
|
26
|
+
|
|
27
|
+
tagsServiceApiUaStub.returns("test_user_agent");
|
|
28
|
+
tagsServiceApiFetchStub.returns(responseMock);
|
|
29
|
+
responseMockJsonStub.returns({
|
|
30
|
+
response: {}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
afterEach(() => {
|
|
35
|
+
tagsServiceApiFetchStub.restore();
|
|
36
|
+
responseMockJsonStub.restore();
|
|
37
|
+
tagsServiceApiUaStub.restore();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe("Methods", () => {
|
|
41
|
+
it("List account tags", async () => {
|
|
42
|
+
const params = new ListAccountTagsParameters()
|
|
43
|
+
.setProjectIds(["project1", "project2"])
|
|
44
|
+
.setTagMask("test")
|
|
45
|
+
.setLimit(100)
|
|
46
|
+
.setOffset(0);
|
|
47
|
+
|
|
48
|
+
await tagsApi.listAccountTags(accountUid, params);
|
|
49
|
+
|
|
50
|
+
sinon.assert.calledOnce(tagsServiceApiFetchStub);
|
|
51
|
+
sinon.assert.calledWithExactly(
|
|
52
|
+
tagsServiceApiFetchStub,
|
|
53
|
+
`https://test.com/tags-api/v2/accounts/${accountUid}/tags`,
|
|
54
|
+
{
|
|
55
|
+
body: "{\"projectIds\":[\"project1\",\"project2\"],\"tagMask\":\"test\",\"limit\":100,\"offset\":0}",
|
|
56
|
+
headers: {
|
|
57
|
+
Authorization: "test_token_type test_access_token",
|
|
58
|
+
"Content-Type": "application/json",
|
|
59
|
+
"User-Agent": "test_user_agent"
|
|
60
|
+
},
|
|
61
|
+
method: "post"
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("List account tags with minimal parameters", async () => {
|
|
67
|
+
const params = new ListAccountTagsParameters()
|
|
68
|
+
.setLimit(50);
|
|
69
|
+
|
|
70
|
+
await tagsApi.listAccountTags(accountUid, params);
|
|
71
|
+
|
|
72
|
+
sinon.assert.calledOnce(tagsServiceApiFetchStub);
|
|
73
|
+
sinon.assert.calledWithExactly(
|
|
74
|
+
tagsServiceApiFetchStub,
|
|
75
|
+
`https://test.com/tags-api/v2/accounts/${accountUid}/tags`,
|
|
76
|
+
{
|
|
77
|
+
body: "{\"limit\":50}",
|
|
78
|
+
headers: {
|
|
79
|
+
Authorization: "test_token_type test_access_token",
|
|
80
|
+
"Content-Type": "application/json",
|
|
81
|
+
"User-Agent": "test_user_agent"
|
|
82
|
+
},
|
|
83
|
+
method: "post"
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("List project tags", async () => {
|
|
89
|
+
const params = new ListProjectTagsParameters()
|
|
90
|
+
.setTagMask("frontend")
|
|
91
|
+
.setLimit(50)
|
|
92
|
+
.setOffset(10);
|
|
93
|
+
|
|
94
|
+
await tagsApi.listProjectTags(projectId, params);
|
|
95
|
+
|
|
96
|
+
sinon.assert.calledOnce(tagsServiceApiFetchStub);
|
|
97
|
+
sinon.assert.calledWithExactly(
|
|
98
|
+
tagsServiceApiFetchStub,
|
|
99
|
+
`https://test.com/tags-api/v2/projects/${projectId}/tags?tagMask=frontend&limit=50&offset=10`,
|
|
100
|
+
{
|
|
101
|
+
headers: {
|
|
102
|
+
Authorization: "test_token_type test_access_token",
|
|
103
|
+
"Content-Type": "application/json",
|
|
104
|
+
"User-Agent": "test_user_agent"
|
|
105
|
+
},
|
|
106
|
+
method: "get"
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("List project tags with no parameters", async () => {
|
|
112
|
+
const params = new ListProjectTagsParameters();
|
|
113
|
+
|
|
114
|
+
await tagsApi.listProjectTags(projectId, params);
|
|
115
|
+
|
|
116
|
+
sinon.assert.calledOnce(tagsServiceApiFetchStub);
|
|
117
|
+
sinon.assert.calledWithExactly(
|
|
118
|
+
tagsServiceApiFetchStub,
|
|
119
|
+
`https://test.com/tags-api/v2/projects/${projectId}/tags?`,
|
|
120
|
+
{
|
|
121
|
+
headers: {
|
|
122
|
+
Authorization: "test_token_type test_access_token",
|
|
123
|
+
"Content-Type": "application/json",
|
|
124
|
+
"User-Agent": "test_user_agent"
|
|
125
|
+
},
|
|
126
|
+
method: "get"
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it("Search string tags", async () => {
|
|
132
|
+
const params = new SearchStringTagsParameters()
|
|
133
|
+
.setStringHashcodes(["hash1", "hash2", "hash3"]);
|
|
134
|
+
|
|
135
|
+
await tagsApi.searchStringTags(projectId, params);
|
|
136
|
+
|
|
137
|
+
sinon.assert.calledOnce(tagsServiceApiFetchStub);
|
|
138
|
+
sinon.assert.calledWithExactly(
|
|
139
|
+
tagsServiceApiFetchStub,
|
|
140
|
+
`https://test.com/tags-api/v2/projects/${projectId}/strings/tags/search`,
|
|
141
|
+
{
|
|
142
|
+
body: "{\"stringHashcodes\":[\"hash1\",\"hash2\",\"hash3\"]}",
|
|
143
|
+
headers: {
|
|
144
|
+
Authorization: "test_token_type test_access_token",
|
|
145
|
+
"Content-Type": "application/json",
|
|
146
|
+
"User-Agent": "test_user_agent"
|
|
147
|
+
},
|
|
148
|
+
method: "post"
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it("Add tags to strings", async () => {
|
|
154
|
+
const params = new AddTagsToStringsParameters()
|
|
155
|
+
.setTags(["urgent", "frontend", "ui"])
|
|
156
|
+
.setStringHashcodes(["hash1", "hash2"]);
|
|
157
|
+
|
|
158
|
+
await tagsApi.addTagsToStrings(projectId, params);
|
|
159
|
+
|
|
160
|
+
sinon.assert.calledOnce(tagsServiceApiFetchStub);
|
|
161
|
+
sinon.assert.calledWithExactly(
|
|
162
|
+
tagsServiceApiFetchStub,
|
|
163
|
+
`https://test.com/tags-api/v2/projects/${projectId}/strings/tags/add`,
|
|
164
|
+
{
|
|
165
|
+
body: "{\"tags\":[\"urgent\",\"frontend\",\"ui\"],\"stringHashcodes\":[\"hash1\",\"hash2\"]}",
|
|
166
|
+
headers: {
|
|
167
|
+
Authorization: "test_token_type test_access_token",
|
|
168
|
+
"Content-Type": "application/json",
|
|
169
|
+
"User-Agent": "test_user_agent"
|
|
170
|
+
},
|
|
171
|
+
method: "post"
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it("Remove tags from strings", async () => {
|
|
177
|
+
const params = new RemoveTagsFromStringsParameters()
|
|
178
|
+
.setTags(["urgent", "deprecated"])
|
|
179
|
+
.setStringHashcodes(["hash1", "hash2", "hash3"]);
|
|
180
|
+
|
|
181
|
+
await tagsApi.removeTagsFromStrings(projectId, params);
|
|
182
|
+
|
|
183
|
+
sinon.assert.calledOnce(tagsServiceApiFetchStub);
|
|
184
|
+
sinon.assert.calledWithExactly(
|
|
185
|
+
tagsServiceApiFetchStub,
|
|
186
|
+
`https://test.com/tags-api/v2/projects/${projectId}/strings/tags/remove`,
|
|
187
|
+
{
|
|
188
|
+
body: "{\"tags\":[\"urgent\",\"deprecated\"],\"stringHashcodes\":[\"hash1\",\"hash2\",\"hash3\"]}",
|
|
189
|
+
headers: {
|
|
190
|
+
Authorization: "test_token_type test_access_token",
|
|
191
|
+
"Content-Type": "application/json",
|
|
192
|
+
"User-Agent": "test_user_agent"
|
|
193
|
+
},
|
|
194
|
+
method: "post"
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it("Remove all tags from strings", async () => {
|
|
200
|
+
const params = new RemoveAllTagsFromStringsParameters()
|
|
201
|
+
.setStringHashcodes(["hash1", "hash2", "hash3", "hash4"]);
|
|
202
|
+
|
|
203
|
+
await tagsApi.removeAllTagsFromStrings(projectId, params);
|
|
204
|
+
|
|
205
|
+
sinon.assert.calledOnce(tagsServiceApiFetchStub);
|
|
206
|
+
sinon.assert.calledWithExactly(
|
|
207
|
+
tagsServiceApiFetchStub,
|
|
208
|
+
`https://test.com/tags-api/v2/projects/${projectId}/strings/tags/remove/all`,
|
|
209
|
+
{
|
|
210
|
+
body: "{\"stringHashcodes\":[\"hash1\",\"hash2\",\"hash3\",\"hash4\"]}",
|
|
211
|
+
headers: {
|
|
212
|
+
Authorization: "test_token_type test_access_token",
|
|
213
|
+
"Content-Type": "application/json",
|
|
214
|
+
"User-Agent": "test_user_agent"
|
|
215
|
+
},
|
|
216
|
+
method: "post"
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
describe("Parameter validation", () => {
|
|
223
|
+
it("ListAccountTagsParameters should validate project IDs limit", () => {
|
|
224
|
+
const params = new ListAccountTagsParameters();
|
|
225
|
+
const tooManyProjects = Array(1001).fill("project");
|
|
226
|
+
|
|
227
|
+
try {
|
|
228
|
+
params.setProjectIds(tooManyProjects);
|
|
229
|
+
throw new Error("Exception is not thrown.");
|
|
230
|
+
} catch (e) {
|
|
231
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
232
|
+
assert.equal(e.message, "Project IDs array must not exceed 1000 items");
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it("ListAccountTagsParameters should validate limit range", () => {
|
|
237
|
+
const params = new ListAccountTagsParameters();
|
|
238
|
+
|
|
239
|
+
try {
|
|
240
|
+
params.setLimit(0);
|
|
241
|
+
throw new Error("Exception is not thrown.");
|
|
242
|
+
} catch (e) {
|
|
243
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
244
|
+
assert.equal(e.message, "Limit must be between 1 and 1500");
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
try {
|
|
248
|
+
params.setLimit(1501);
|
|
249
|
+
throw new Error("Exception is not thrown.");
|
|
250
|
+
} catch (e) {
|
|
251
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
252
|
+
assert.equal(e.message, "Limit must be between 1 and 1500");
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
it("ListAccountTagsParameters should validate offset", () => {
|
|
257
|
+
const params = new ListAccountTagsParameters();
|
|
258
|
+
|
|
259
|
+
try {
|
|
260
|
+
params.setOffset(-1);
|
|
261
|
+
throw new Error("Exception is not thrown.");
|
|
262
|
+
} catch (e) {
|
|
263
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
264
|
+
assert.equal(e.message, "Offset must be non-negative");
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
it("ListProjectTagsParameters should validate limit range", () => {
|
|
269
|
+
const params = new ListProjectTagsParameters();
|
|
270
|
+
|
|
271
|
+
try {
|
|
272
|
+
params.setLimit(-1);
|
|
273
|
+
throw new Error("Exception is not thrown.");
|
|
274
|
+
} catch (e) {
|
|
275
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
276
|
+
assert.equal(e.message, "Limit must be between 0 and 100");
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
try {
|
|
280
|
+
params.setLimit(101);
|
|
281
|
+
throw new Error("Exception is not thrown.");
|
|
282
|
+
} catch (e) {
|
|
283
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
284
|
+
assert.equal(e.message, "Limit must be between 0 and 100");
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
it("SearchStringTagsParameters should require string hashcodes", () => {
|
|
289
|
+
const params = new SearchStringTagsParameters();
|
|
290
|
+
|
|
291
|
+
try {
|
|
292
|
+
params.setStringHashcodes([]);
|
|
293
|
+
throw new Error("Exception is not thrown.");
|
|
294
|
+
} catch (e) {
|
|
295
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
296
|
+
assert.equal(e.message, "String hashcodes array is required");
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
try {
|
|
300
|
+
params.setStringHashcodes(null as unknown as Array<string>);
|
|
301
|
+
throw new Error("Exception is not thrown.");
|
|
302
|
+
} catch (e) {
|
|
303
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
304
|
+
assert.equal(e.message, "String hashcodes array is required");
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
it("SearchStringTagsParameters should validate hashcodes limit", () => {
|
|
309
|
+
const params = new SearchStringTagsParameters();
|
|
310
|
+
const tooManyHashcodes = Array(1001).fill("hash");
|
|
311
|
+
|
|
312
|
+
try {
|
|
313
|
+
params.setStringHashcodes(tooManyHashcodes);
|
|
314
|
+
throw new Error("Exception is not thrown.");
|
|
315
|
+
} catch (e) {
|
|
316
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
317
|
+
assert.equal(e.message, "String hashcodes array must not exceed 1000 items");
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
it("AddTagsToStringsParameters should validate tags array", () => {
|
|
322
|
+
const params = new AddTagsToStringsParameters();
|
|
323
|
+
|
|
324
|
+
try {
|
|
325
|
+
params.setTags([]);
|
|
326
|
+
throw new Error("Exception is not thrown.");
|
|
327
|
+
} catch (e) {
|
|
328
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
329
|
+
assert.equal(e.message, "Tags array is required");
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
try {
|
|
333
|
+
params.setTags(null as unknown as Array<string>);
|
|
334
|
+
throw new Error("Exception is not thrown.");
|
|
335
|
+
} catch (e) {
|
|
336
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
337
|
+
assert.equal(e.message, "Tags array is required");
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const tooManyTags = Array(101).fill("tag");
|
|
341
|
+
try {
|
|
342
|
+
params.setTags(tooManyTags);
|
|
343
|
+
throw new Error("Exception is not thrown.");
|
|
344
|
+
} catch (e) {
|
|
345
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
346
|
+
assert.equal(e.message, "Tags array must not exceed 100 items");
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
it("AddTagsToStringsParameters should validate tag length", () => {
|
|
351
|
+
const params = new AddTagsToStringsParameters();
|
|
352
|
+
const longTag = "a".repeat(129);
|
|
353
|
+
|
|
354
|
+
try {
|
|
355
|
+
params.setTags([longTag]);
|
|
356
|
+
throw new Error("Exception is not thrown.");
|
|
357
|
+
} catch (e) {
|
|
358
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
359
|
+
assert.equal(e.message, "Tag length must not exceed 128 characters");
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
it("AddTagsToStringsParameters should validate string hashcodes", () => {
|
|
364
|
+
const params = new AddTagsToStringsParameters();
|
|
365
|
+
|
|
366
|
+
try {
|
|
367
|
+
params.setStringHashcodes([]);
|
|
368
|
+
throw new Error("Exception is not thrown.");
|
|
369
|
+
} catch (e) {
|
|
370
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
371
|
+
assert.equal(e.message, "String hashcodes array is required");
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const tooManyHashcodes = Array(1001).fill("hash");
|
|
375
|
+
try {
|
|
376
|
+
params.setStringHashcodes(tooManyHashcodes);
|
|
377
|
+
throw new Error("Exception is not thrown.");
|
|
378
|
+
} catch (e) {
|
|
379
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
380
|
+
assert.equal(e.message, "String hashcodes array must not exceed 1000 items");
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
it("RemoveTagsFromStringsParameters should validate tags and hashcodes", () => {
|
|
385
|
+
const params = new RemoveTagsFromStringsParameters();
|
|
386
|
+
|
|
387
|
+
try {
|
|
388
|
+
params.setTags([]);
|
|
389
|
+
throw new Error("Exception is not thrown.");
|
|
390
|
+
} catch (e) {
|
|
391
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
392
|
+
assert.equal(e.message, "Tags array is required");
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
try {
|
|
396
|
+
params.setStringHashcodes([]);
|
|
397
|
+
throw new Error("Exception is not thrown.");
|
|
398
|
+
} catch (e) {
|
|
399
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
400
|
+
assert.equal(e.message, "String hashcodes array is required");
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
const longTag = "a".repeat(129);
|
|
404
|
+
try {
|
|
405
|
+
params.setTags([longTag]);
|
|
406
|
+
throw new Error("Exception is not thrown.");
|
|
407
|
+
} catch (e) {
|
|
408
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
409
|
+
assert.equal(e.message, "Tag length must not exceed 128 characters");
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
it("RemoveAllTagsFromStringsParameters should validate string hashcodes", () => {
|
|
414
|
+
const params = new RemoveAllTagsFromStringsParameters();
|
|
415
|
+
|
|
416
|
+
try {
|
|
417
|
+
params.setStringHashcodes([]);
|
|
418
|
+
throw new Error("Exception is not thrown.");
|
|
419
|
+
} catch (e) {
|
|
420
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
421
|
+
assert.equal(e.message, "String hashcodes array is required");
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const tooManyHashcodes = Array(1001).fill("hash");
|
|
425
|
+
try {
|
|
426
|
+
params.setStringHashcodes(tooManyHashcodes);
|
|
427
|
+
throw new Error("Exception is not thrown.");
|
|
428
|
+
} catch (e) {
|
|
429
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
430
|
+
assert.equal(e.message, "String hashcodes array must not exceed 1000 items");
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
describe("Edge cases", () => {
|
|
436
|
+
it("Should handle maximum allowed project IDs", () => {
|
|
437
|
+
const params = new ListAccountTagsParameters();
|
|
438
|
+
const maxProjects = Array(1000).fill("project");
|
|
439
|
+
|
|
440
|
+
// Should not throw
|
|
441
|
+
params.setProjectIds(maxProjects);
|
|
442
|
+
assert.deepStrictEqual(params.export().projectIds, maxProjects);
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
it("Should handle maximum allowed tags", () => {
|
|
446
|
+
const params = new AddTagsToStringsParameters();
|
|
447
|
+
const maxTags = Array(100).fill("tag");
|
|
448
|
+
|
|
449
|
+
// Should not throw
|
|
450
|
+
params.setTags(maxTags);
|
|
451
|
+
assert.deepStrictEqual(params.export().tags, maxTags);
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
it("Should handle maximum allowed string hashcodes", () => {
|
|
455
|
+
const params = new SearchStringTagsParameters();
|
|
456
|
+
const maxHashcodes = Array(1000).fill("hash");
|
|
457
|
+
|
|
458
|
+
// Should not throw
|
|
459
|
+
params.setStringHashcodes(maxHashcodes);
|
|
460
|
+
assert.deepStrictEqual(params.export().stringHashcodes, maxHashcodes);
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
it("Should handle maximum tag length", () => {
|
|
464
|
+
const params = new AddTagsToStringsParameters();
|
|
465
|
+
const maxLengthTag = "a".repeat(128);
|
|
466
|
+
|
|
467
|
+
// Should not throw
|
|
468
|
+
params.setTags([maxLengthTag]);
|
|
469
|
+
assert.deepStrictEqual(params.export().tags, [maxLengthTag]);
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
});
|