smartling-api-sdk-nodejs 3.4.2 → 3.6.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.
Files changed (120) hide show
  1. package/.env.example +2 -1
  2. package/api/estimates/dto/effective-rates-range-dto.ts +7 -0
  3. package/api/estimates/dto/estimate-report-dto.ts +34 -0
  4. package/api/estimates/dto/estimate-report-status-dto.ts +13 -0
  5. package/api/estimates/dto/estimate-report-tags-dto.ts +5 -0
  6. package/api/estimates/dto/fuzzy-match-tier-dto.ts +17 -0
  7. package/api/estimates/dto/generated-estimate-report-dto.ts +10 -0
  8. package/api/estimates/dto/locale-estimate-dto.ts +17 -0
  9. package/api/estimates/dto/locale-workflow-pair-dto.ts +6 -0
  10. package/api/estimates/dto/locale-workflow-step-pair-dto.ts +6 -0
  11. package/api/estimates/dto/price-information-dto.ts +12 -0
  12. package/api/estimates/dto/workflow-estimate-dto.ts +18 -0
  13. package/api/estimates/dto/workflow-step-estimate-dto.ts +21 -0
  14. package/api/estimates/index.ts +102 -0
  15. package/api/estimates/params/estimate-report-content-coverage.ts +4 -0
  16. package/api/estimates/params/estimate-report-status.ts +9 -0
  17. package/api/estimates/params/estimate-report-type.ts +4 -0
  18. package/api/estimates/params/fuzzy-match-type-code.ts +4 -0
  19. package/api/estimates/params/generate-job-estimate-report-parameters.ts +46 -0
  20. package/api/estimates/params/job-content-type.ts +6 -0
  21. package/api/estimates/params/list-job-estimate-reports-parameters.ts +64 -0
  22. package/api/estimates/params/modify-estimate-report-tags-parameters.ts +9 -0
  23. package/api/translation-memory/index.ts +39 -0
  24. package/api/translation-memory/params/search-tms-parameters.ts +47 -0
  25. package/api/translation-memory/params/tm-sorting.ts +4 -0
  26. package/built/api/estimates/dto/effective-rates-range-dto.d.ts +6 -0
  27. package/built/api/estimates/dto/effective-rates-range-dto.js +3 -0
  28. package/built/api/estimates/dto/effective-rates-range-dto.js.map +1 -0
  29. package/built/api/estimates/dto/estimate-report-dto.d.ts +30 -0
  30. package/built/api/estimates/dto/estimate-report-dto.js +3 -0
  31. package/built/api/estimates/dto/estimate-report-dto.js.map +1 -0
  32. package/built/api/estimates/dto/estimate-report-status-dto.d.ts +11 -0
  33. package/built/api/estimates/dto/estimate-report-status-dto.js +3 -0
  34. package/built/api/estimates/dto/estimate-report-status-dto.js.map +1 -0
  35. package/built/api/estimates/dto/estimate-report-tags-dto.d.ts +4 -0
  36. package/built/api/estimates/dto/estimate-report-tags-dto.js +3 -0
  37. package/built/api/estimates/dto/estimate-report-tags-dto.js.map +1 -0
  38. package/built/api/estimates/dto/fuzzy-match-tier-dto.d.ts +12 -0
  39. package/built/api/estimates/dto/fuzzy-match-tier-dto.js +3 -0
  40. package/built/api/estimates/dto/fuzzy-match-tier-dto.js.map +1 -0
  41. package/built/api/estimates/dto/generated-estimate-report-dto.d.ts +8 -0
  42. package/built/api/estimates/dto/generated-estimate-report-dto.js +3 -0
  43. package/built/api/estimates/dto/generated-estimate-report-dto.js.map +1 -0
  44. package/built/api/estimates/dto/locale-estimate-dto.d.ts +13 -0
  45. package/built/api/estimates/dto/locale-estimate-dto.js +3 -0
  46. package/built/api/estimates/dto/locale-estimate-dto.js.map +1 -0
  47. package/built/api/estimates/dto/locale-workflow-pair-dto.d.ts +5 -0
  48. package/built/api/estimates/dto/locale-workflow-pair-dto.js +3 -0
  49. package/built/api/estimates/dto/locale-workflow-pair-dto.js.map +1 -0
  50. package/built/api/estimates/dto/locale-workflow-step-pair-dto.d.ts +5 -0
  51. package/built/api/estimates/dto/locale-workflow-step-pair-dto.js +3 -0
  52. package/built/api/estimates/dto/locale-workflow-step-pair-dto.js.map +1 -0
  53. package/built/api/estimates/dto/price-information-dto.d.ts +9 -0
  54. package/built/api/estimates/dto/price-information-dto.js +3 -0
  55. package/built/api/estimates/dto/price-information-dto.js.map +1 -0
  56. package/built/api/estimates/dto/workflow-estimate-dto.d.ts +13 -0
  57. package/built/api/estimates/dto/workflow-estimate-dto.js +3 -0
  58. package/built/api/estimates/dto/workflow-estimate-dto.js.map +1 -0
  59. package/built/api/estimates/dto/workflow-step-estimate-dto.d.ts +17 -0
  60. package/built/api/estimates/dto/workflow-step-estimate-dto.js +3 -0
  61. package/built/api/estimates/dto/workflow-step-estimate-dto.js.map +1 -0
  62. package/built/api/estimates/index.d.ts +23 -0
  63. package/built/api/estimates/index.js +68 -0
  64. package/built/api/estimates/index.js.map +1 -0
  65. package/built/api/estimates/params/estimate-report-content-coverage.d.ts +4 -0
  66. package/built/api/estimates/params/estimate-report-content-coverage.js +9 -0
  67. package/built/api/estimates/params/estimate-report-content-coverage.js.map +1 -0
  68. package/built/api/estimates/params/estimate-report-status.d.ts +9 -0
  69. package/built/api/estimates/params/estimate-report-status.js +14 -0
  70. package/built/api/estimates/params/estimate-report-status.js.map +1 -0
  71. package/built/api/estimates/params/estimate-report-type.d.ts +4 -0
  72. package/built/api/estimates/params/estimate-report-type.js +9 -0
  73. package/built/api/estimates/params/estimate-report-type.js.map +1 -0
  74. package/built/api/estimates/params/fuzzy-match-type-code.d.ts +4 -0
  75. package/built/api/estimates/params/fuzzy-match-type-code.js +9 -0
  76. package/built/api/estimates/params/fuzzy-match-type-code.js.map +1 -0
  77. package/built/api/estimates/params/generate-job-estimate-report-parameters.d.ts +12 -0
  78. package/built/api/estimates/params/generate-job-estimate-report-parameters.js +32 -0
  79. package/built/api/estimates/params/generate-job-estimate-report-parameters.js.map +1 -0
  80. package/built/api/estimates/params/job-content-type.d.ts +6 -0
  81. package/built/api/estimates/params/job-content-type.js +11 -0
  82. package/built/api/estimates/params/job-content-type.js.map +1 -0
  83. package/built/api/estimates/params/list-job-estimate-reports-parameters.d.ts +15 -0
  84. package/built/api/estimates/params/list-job-estimate-reports-parameters.js +44 -0
  85. package/built/api/estimates/params/list-job-estimate-reports-parameters.js.map +1 -0
  86. package/built/api/estimates/params/modify-estimate-report-tags-parameters.d.ts +4 -0
  87. package/built/api/estimates/params/modify-estimate-report-tags-parameters.js +12 -0
  88. package/built/api/estimates/params/modify-estimate-report-tags-parameters.js.map +1 -0
  89. package/built/api/translation-memory/index.d.ts +3 -0
  90. package/built/api/translation-memory/index.js +24 -0
  91. package/built/api/translation-memory/index.js.map +1 -1
  92. package/built/api/translation-memory/params/search-tms-parameters.d.ts +12 -0
  93. package/built/api/translation-memory/params/search-tms-parameters.js +36 -0
  94. package/built/api/translation-memory/params/search-tms-parameters.js.map +1 -0
  95. package/built/api/translation-memory/params/tm-sorting.d.ts +4 -0
  96. package/built/api/translation-memory/params/tm-sorting.js +9 -0
  97. package/built/api/translation-memory/params/tm-sorting.js.map +1 -0
  98. package/built/index.d.ts +23 -0
  99. package/built/index.js +23 -0
  100. package/built/index.js.map +1 -1
  101. package/built/package.json +1 -1
  102. package/built/test/estimates.spec.d.ts +1 -0
  103. package/built/test/estimates.spec.js +191 -0
  104. package/built/test/estimates.spec.js.map +1 -0
  105. package/built/test/integration/estimates.spec.d.ts +1 -0
  106. package/built/test/integration/estimates.spec.js +182 -0
  107. package/built/test/integration/estimates.spec.js.map +1 -0
  108. package/built/test/integration/helpers/log-response.js +1 -2
  109. package/built/test/integration/helpers/log-response.js.map +1 -1
  110. package/built/test/integration/translation-memory.spec.js +32 -1
  111. package/built/test/integration/translation-memory.spec.js.map +1 -1
  112. package/built/test/translation-memory.spec.js +60 -0
  113. package/built/test/translation-memory.spec.js.map +1 -1
  114. package/index.ts +23 -0
  115. package/package.json +1 -1
  116. package/test/estimates.spec.ts +242 -0
  117. package/test/integration/estimates.spec.ts +271 -0
  118. package/test/integration/helpers/log-response.ts +5 -3
  119. package/test/integration/translation-memory.spec.ts +52 -1
  120. package/test/translation-memory.spec.ts +79 -1
package/.env.example CHANGED
@@ -1,4 +1,5 @@
1
- # Credentials for test/integration/glossaries.spec.ts and test/integration/translation-memory.spec.ts.
1
+ # Credentials for test/integration/glossaries.spec.ts, test/integration/translation-memory.spec.ts
2
+ # and test/integration/estimates.spec.ts.
2
3
  # Copy this file to .env and fill in real values to run: npm run test:integration
3
4
  # Without a real .env, the integration suite skips (shows as pending) rather than failing.
4
5
 
@@ -0,0 +1,7 @@
1
+ interface EffectiveRatesRangeDto {
2
+ rateMin: number | null;
3
+ rateMax: number | null;
4
+ currencyCode: string | null;
5
+ }
6
+
7
+ export { EffectiveRatesRangeDto };
@@ -0,0 +1,34 @@
1
+ import { EstimateReportType } from "../params/estimate-report-type";
2
+ import { EstimateReportStatus } from "../params/estimate-report-status";
3
+ import { EstimateReportContentCoverage } from "../params/estimate-report-content-coverage";
4
+ import { LocaleEstimateDto } from "./locale-estimate-dto";
5
+ import { PriceInformationDto } from "./price-information-dto";
6
+
7
+ interface EstimateReportDto {
8
+ reportUid: string;
9
+ projectId: string;
10
+ translationJobUid: string | null;
11
+ schemaType: string;
12
+ reportType: EstimateReportType;
13
+ schema: string;
14
+ reportStatus: EstimateReportStatus;
15
+ totalStrings: number;
16
+ creatorUserUid: string;
17
+ creatorUserRole: string;
18
+ contentCoverage: EstimateReportContentCoverage;
19
+ creatorAgencyUid: string | null;
20
+ createdDate: Date;
21
+ tags: Array<string> | null;
22
+ totalWordCount: number;
23
+ totalWeightedWordCount: number;
24
+ totalCharacterCount: number;
25
+ // Null unless the project bills by page (confirmed via a real response - unlike the
26
+ // word/character counters, which defaulted to 0 rather than null).
27
+ totalPageCount: number | null;
28
+ warnings: Array<string> | null;
29
+ errors: Array<string> | null;
30
+ localeEstimates: Array<LocaleEstimateDto> | null;
31
+ priceInformation: Array<PriceInformationDto> | null;
32
+ }
33
+
34
+ export { EstimateReportDto };
@@ -0,0 +1,13 @@
1
+ import { EstimateReportType } from "../params/estimate-report-type";
2
+ import { EstimateReportStatus } from "../params/estimate-report-status";
3
+
4
+ interface EstimateReportStatusDto {
5
+ reportUid: string;
6
+ reportStatus: EstimateReportStatus;
7
+ totalStrings: number;
8
+ percentComplete: number;
9
+ reportType: EstimateReportType;
10
+ createdDate: Date;
11
+ }
12
+
13
+ export { EstimateReportStatusDto };
@@ -0,0 +1,5 @@
1
+ interface EstimateReportTagsDto {
2
+ tags: Array<string>;
3
+ }
4
+
5
+ export { EstimateReportTagsDto };
@@ -0,0 +1,17 @@
1
+ import { FuzzyMatchTypeCode } from "../params/fuzzy-match-type-code";
2
+ import { PriceInformationDto } from "./price-information-dto";
3
+
4
+ interface FuzzyMatchTierDto {
5
+ threshold: number;
6
+ matchTypeCode: FuzzyMatchTypeCode;
7
+ stringsCount: number;
8
+ wordCount: number;
9
+ weightedWordCount: number;
10
+ // Nullable - FuzzyMatchTier.addWords()'s merge helper explicitly returns null when merging
11
+ // two tiers that both already lack a character count, a real reachable path (unlike the
12
+ // primitive-int stringsCount/wordCount/weightedWordCount fields, which can't be null).
13
+ characterCount: number | null;
14
+ priceInformation: PriceInformationDto | null;
15
+ }
16
+
17
+ export { FuzzyMatchTierDto };
@@ -0,0 +1,10 @@
1
+ import { EstimateReportType } from "../params/estimate-report-type";
2
+ import { EstimateReportStatus } from "../params/estimate-report-status";
3
+
4
+ interface GeneratedEstimateReportDto {
5
+ reportUid: string;
6
+ reportType: EstimateReportType;
7
+ reportStatus: EstimateReportStatus;
8
+ }
9
+
10
+ export { GeneratedEstimateReportDto };
@@ -0,0 +1,17 @@
1
+ import { PriceInformationDto } from "./price-information-dto";
2
+ import { WorkflowEstimateDto } from "./workflow-estimate-dto";
3
+
4
+ interface LocaleEstimateDto {
5
+ totalWordCount: number;
6
+ totalWeightedWordCount: number;
7
+ // Nullable per the real LocaleEstimate entity (Integer, unlike the primitive-int word-count
8
+ // fields), with no null-correcting fallback in LocaleEstimateConverter.
9
+ totalCharacterCount: number | null;
10
+ totalPageCount: number | null;
11
+ localeId: string;
12
+ localeDescription: string;
13
+ workflowEstimates: Array<WorkflowEstimateDto>;
14
+ priceInformation: PriceInformationDto | null;
15
+ }
16
+
17
+ export { LocaleEstimateDto };
@@ -0,0 +1,6 @@
1
+ interface LocaleWorkflowPairDto {
2
+ targetLocaleId: string;
3
+ workflowUid: string;
4
+ }
5
+
6
+ export { LocaleWorkflowPairDto };
@@ -0,0 +1,6 @@
1
+ interface LocaleWorkflowStepPairDto {
2
+ targetLocaleId: string;
3
+ workflowStepUid: string;
4
+ }
5
+
6
+ export { LocaleWorkflowStepPairDto };
@@ -0,0 +1,12 @@
1
+ interface PriceInformationDto {
2
+ priceMin: number;
3
+ priceMax: number;
4
+ priceMt: number | null;
5
+ priceAit: number | null;
6
+ perPage: boolean;
7
+ // Null for the ZERO_PRICE sentinel (e.g. a tier with no computed price) - confirmed via
8
+ // the real PriceInformationDTO.ZERO_PRICE constant, which has a null currencyCode.
9
+ currencyCode: string | null;
10
+ }
11
+
12
+ export { PriceInformationDto };
@@ -0,0 +1,18 @@
1
+ import { PriceInformationDto } from "./price-information-dto";
2
+ import { WorkflowStepEstimateDto } from "./workflow-step-estimate-dto";
3
+
4
+ interface WorkflowEstimateDto {
5
+ totalWordCount: number;
6
+ totalWeightedWordCount: number;
7
+ // Null when every step estimate it's aggregated from also had a null character count -
8
+ // confirmed via WorkflowEstimateConverter's explicit `.orElse(null)` fallback (the sibling
9
+ // word-count fields fall back to 0 instead).
10
+ totalCharacterCount: number | null;
11
+ totalPageCount: number | null;
12
+ workflowUid: string;
13
+ workflowName: string;
14
+ workflowStepEstimates: Array<WorkflowStepEstimateDto>;
15
+ priceInformation: PriceInformationDto | null;
16
+ }
17
+
18
+ export { WorkflowEstimateDto };
@@ -0,0 +1,21 @@
1
+ import { EffectiveRatesRangeDto } from "./effective-rates-range-dto";
2
+ import { FuzzyMatchTierDto } from "./fuzzy-match-tier-dto";
3
+ import { PriceInformationDto } from "./price-information-dto";
4
+
5
+ interface WorkflowStepEstimateDto {
6
+ totalWordCount: number;
7
+ totalWeightedWordCount: number;
8
+ // Nullable per the real WorkflowStepEstimate entity (Integer, unlike the primitive-int
9
+ // word-count fields), with no null-correcting fallback in WorkflowStepEstimateConverter.
10
+ totalCharacterCount: number | null;
11
+ totalPageCount: number | null;
12
+ workflowStepUid: string;
13
+ workflowStepName: string;
14
+ effectiveRatesRange: EffectiveRatesRangeDto;
15
+ fuzzyMatchTiers: Array<FuzzyMatchTierDto>;
16
+ priceInformation: PriceInformationDto | null;
17
+ warningType: string | null;
18
+ aiSubscriptionServiceType: string | null;
19
+ }
20
+
21
+ export { WorkflowStepEstimateDto };
@@ -0,0 +1,102 @@
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 { ResponseBodyType } from "../base/enum/response-body-type";
6
+ import { ListJobEstimateReportsParameters } from "./params/list-job-estimate-reports-parameters";
7
+ import { GenerateJobEstimateReportParameters } from "./params/generate-job-estimate-report-parameters";
8
+ import { ModifyEstimateReportTagsParameters } from "./params/modify-estimate-report-tags-parameters";
9
+ import { EstimateReportDto } from "./dto/estimate-report-dto";
10
+ import { GeneratedEstimateReportDto } from "./dto/generated-estimate-report-dto";
11
+ import { EstimateReportStatusDto } from "./dto/estimate-report-status-dto";
12
+ import { EstimateReportTagsDto } from "./dto/estimate-report-tags-dto";
13
+
14
+ export class SmartlingEstimatesApi extends SmartlingBaseApi {
15
+ constructor(smartlingApiBaseUrl: string, authApi: AccessTokenProvider, logger: Logger) {
16
+ super(logger);
17
+ this.authApi = authApi;
18
+ this.entrypoint = `${smartlingApiBaseUrl}/estimates-api/v2/projects`;
19
+ }
20
+
21
+ async getJobFuzzyEstimateReports(
22
+ projectId: string, translationJobUid: string, params: ListJobEstimateReportsParameters
23
+ ): Promise<SmartlingListResponse<EstimateReportDto>> {
24
+ return await this.makeRequest(
25
+ "get",
26
+ `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/reports/fuzzy`,
27
+ params.export()
28
+ );
29
+ }
30
+
31
+ async generateJobFuzzyEstimateReport(
32
+ projectId: string, translationJobUid: string, params: GenerateJobEstimateReportParameters
33
+ ): Promise<GeneratedEstimateReportDto> {
34
+ return await this.makeRequest(
35
+ "post",
36
+ `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/reports/fuzzy`,
37
+ JSON.stringify(params.export())
38
+ );
39
+ }
40
+
41
+ async getJobCostEstimateReports(
42
+ projectId: string, translationJobUid: string, params: ListJobEstimateReportsParameters
43
+ ): Promise<SmartlingListResponse<EstimateReportDto>> {
44
+ return await this.makeRequest(
45
+ "get",
46
+ `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/reports/cost`,
47
+ params.export()
48
+ );
49
+ }
50
+
51
+ async generateJobCostEstimateReport(
52
+ projectId: string, translationJobUid: string, params: GenerateJobEstimateReportParameters
53
+ ): Promise<GeneratedEstimateReportDto> {
54
+ return await this.makeRequest(
55
+ "post",
56
+ `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/reports/cost`,
57
+ JSON.stringify(params.export())
58
+ );
59
+ }
60
+
61
+ async getEstimateReport(projectId: string, reportUid: string): Promise<EstimateReportDto> {
62
+ return await this.makeRequest(
63
+ "get",
64
+ `${this.entrypoint}/${projectId}/reports/${reportUid}`
65
+ );
66
+ }
67
+
68
+ async deleteEstimateReport(projectId: string, reportUid: string): Promise<void> {
69
+ await this.makeRequest(
70
+ "delete",
71
+ `${this.entrypoint}/${projectId}/reports/${reportUid}`
72
+ );
73
+ }
74
+
75
+ async getEstimateReportStatus(
76
+ projectId: string, reportUid: string
77
+ ): Promise<EstimateReportStatusDto> {
78
+ return await this.makeRequest(
79
+ "get",
80
+ `${this.entrypoint}/${projectId}/reports/${reportUid}/status`
81
+ );
82
+ }
83
+
84
+ async modifyEstimateReportTags(
85
+ projectId: string, reportUid: string, params: ModifyEstimateReportTagsParameters
86
+ ): Promise<EstimateReportTagsDto> {
87
+ return await this.makeRequest(
88
+ "put",
89
+ `${this.entrypoint}/${projectId}/reports/${reportUid}/tags`,
90
+ JSON.stringify(params.export())
91
+ );
92
+ }
93
+
94
+ async downloadEstimateReport(projectId: string, reportUid: string): Promise<ArrayBuffer> {
95
+ return await this.makeRequest(
96
+ "get",
97
+ `${this.entrypoint}/${projectId}/reports/${reportUid}/download`,
98
+ { format: "csv" },
99
+ ResponseBodyType.ARRAY_BUFFER
100
+ );
101
+ }
102
+ }
@@ -0,0 +1,4 @@
1
+ export enum EstimateReportContentCoverage {
2
+ FULL = "FULL",
3
+ PARTIAL = "PARTIAL"
4
+ }
@@ -0,0 +1,9 @@
1
+ export enum EstimateReportStatus {
2
+ NOT_FOUND = "NOT_FOUND",
3
+ PENDING = "PENDING",
4
+ PROCESSING = "PROCESSING",
5
+ COMPLETED = "COMPLETED",
6
+ FAILED = "FAILED",
7
+ TIMEOUT = "TIMEOUT",
8
+ CANCELED = "CANCELED"
9
+ }
@@ -0,0 +1,4 @@
1
+ export enum EstimateReportType {
2
+ FUZZY = "FUZZY",
3
+ COST = "COST"
4
+ }
@@ -0,0 +1,4 @@
1
+ export enum FuzzyMatchTypeCode {
2
+ FUZZY = "FUZZY",
3
+ SMARTMATCH = "SMARTMATCH"
4
+ }
@@ -0,0 +1,46 @@
1
+ import { BaseParameters } from "../../parameters/index";
2
+ import { JobContentType } from "./job-content-type";
3
+ import { LocaleWorkflowPairDto } from "../dto/locale-workflow-pair-dto";
4
+ import { LocaleWorkflowStepPairDto } from "../dto/locale-workflow-step-pair-dto";
5
+
6
+ export class GenerateJobEstimateReportParameters extends BaseParameters {
7
+ setContentType(contentType: JobContentType): GenerateJobEstimateReportParameters {
8
+ this.set("contentType", contentType);
9
+
10
+ return this;
11
+ }
12
+
13
+ setTags(tags: Array<string>): GenerateJobEstimateReportParameters {
14
+ this.set("tags", tags);
15
+
16
+ return this;
17
+ }
18
+
19
+ setLocaleWorkflows(
20
+ localeWorkflows: Array<LocaleWorkflowPairDto>
21
+ ): GenerateJobEstimateReportParameters {
22
+ this.set("localeWorkflows", localeWorkflows);
23
+
24
+ return this;
25
+ }
26
+
27
+ setFuzzyProfileUid(fuzzyProfileUid: string): GenerateJobEstimateReportParameters {
28
+ this.set("fuzzyProfileUid", fuzzyProfileUid);
29
+
30
+ return this;
31
+ }
32
+
33
+ setRushRequest(rushRequest: boolean): GenerateJobEstimateReportParameters {
34
+ this.set("rushRequest", rushRequest);
35
+
36
+ return this;
37
+ }
38
+
39
+ setLocaleWorkflowStepsFilter(
40
+ localeWorkflowStepsFilter: Array<LocaleWorkflowStepPairDto>
41
+ ): GenerateJobEstimateReportParameters {
42
+ this.set("localeWorkflowStepsFilter", localeWorkflowStepsFilter);
43
+
44
+ return this;
45
+ }
46
+ }
@@ -0,0 +1,6 @@
1
+ export enum JobContentType {
2
+ TRANSLATION = "TRANSLATION",
3
+ ALL_CONTENT = "ALL_CONTENT",
4
+ CLAIMING = "CLAIMING",
5
+ UNAUTHORIZED = "UNAUTHORIZED"
6
+ }
@@ -0,0 +1,64 @@
1
+ import { BaseParameters } from "../../parameters/index";
2
+ import { EstimateReportStatus } from "./estimate-report-status";
3
+ import { EstimateReportContentCoverage } from "./estimate-report-content-coverage";
4
+ import { JobContentType } from "./job-content-type";
5
+
6
+ export class ListJobEstimateReportsParameters extends BaseParameters {
7
+ setReportStatus(reportStatus: EstimateReportStatus): ListJobEstimateReportsParameters {
8
+ this.set("reportStatus", reportStatus);
9
+
10
+ return this;
11
+ }
12
+
13
+ setContentCoverage(
14
+ contentCoverage: EstimateReportContentCoverage
15
+ ): ListJobEstimateReportsParameters {
16
+ this.set("contentCoverage", contentCoverage);
17
+
18
+ return this;
19
+ }
20
+
21
+ setCreatorUserUids(creatorUserUids: Array<string>): ListJobEstimateReportsParameters {
22
+ this.set("creatorUserUids", creatorUserUids);
23
+
24
+ return this;
25
+ }
26
+
27
+ setTranslationJobSchemaContents(
28
+ translationJobSchemaContents: Array<JobContentType>
29
+ ): ListJobEstimateReportsParameters {
30
+ this.set("translationJobSchemaContents", translationJobSchemaContents);
31
+
32
+ return this;
33
+ }
34
+
35
+ setTags(tags: Array<string>): ListJobEstimateReportsParameters {
36
+ this.set("tags", tags);
37
+
38
+ return this;
39
+ }
40
+
41
+ setCreatedFrom(createdFrom: Date): ListJobEstimateReportsParameters {
42
+ this.set("createdFrom", `${createdFrom.toISOString().split(".")[0]}Z`);
43
+
44
+ return this;
45
+ }
46
+
47
+ setCreatedTo(createdTo: Date): ListJobEstimateReportsParameters {
48
+ this.set("createdTo", `${createdTo.toISOString().split(".")[0]}Z`);
49
+
50
+ return this;
51
+ }
52
+
53
+ setLimit(limit: number): ListJobEstimateReportsParameters {
54
+ this.set("limit", limit);
55
+
56
+ return this;
57
+ }
58
+
59
+ setOffset(offset: number): ListJobEstimateReportsParameters {
60
+ this.set("offset", offset);
61
+
62
+ return this;
63
+ }
64
+ }
@@ -0,0 +1,9 @@
1
+ import { BaseParameters } from "../../parameters/index";
2
+
3
+ export class ModifyEstimateReportTagsParameters extends BaseParameters {
4
+ setTags(tags: Array<string>): ModifyEstimateReportTagsParameters {
5
+ this.set("tags", tags);
6
+
7
+ return this;
8
+ }
9
+ }
@@ -14,6 +14,7 @@ import { AsyncActionResultDto } from "./dto/async-action-result-dto";
14
14
  import { StringsExportAsyncActionResultDto } from "./dto/strings-export-async-action-result-dto";
15
15
  import { CreateTmParameters } from "./params/create-tm-parameters";
16
16
  import { UpdateTmParameters } from "./params/update-tm-parameters";
17
+ import { SearchTmsParameters } from "./params/search-tms-parameters";
17
18
  import { TmDto } from "./dto/tm-dto";
18
19
 
19
20
  const TM_FIELDS = `
@@ -76,6 +77,22 @@ const DELETE_TM_QUERY = `
76
77
  }
77
78
  `;
78
79
 
80
+ const GET_TM_QUERY = `
81
+ query tm($tmUid: ID!) {
82
+ tm(tmUid: $tmUid) {
83
+ ${TM_FIELDS}
84
+ }
85
+ }
86
+ `;
87
+
88
+ const SEARCH_TMS_QUERY = `
89
+ query searchTms($searchTmFilter: SearchTmFilter!) {
90
+ searchTms(searchTmFilter: $searchTmFilter) {
91
+ ${TM_FIELDS}
92
+ }
93
+ }
94
+ `;
95
+
79
96
  const CREATE_STRING_SEARCH_QUERY = `
80
97
  mutation createStringSearch($createStringSearchFilter: CreateStringSearchFilter!) {
81
98
  createStringSearch(createStringSearchFilter: $createStringSearchFilter) {
@@ -261,6 +278,28 @@ export class SmartlingTranslationMemoryApi extends SmartlingBaseFileApi {
261
278
  );
262
279
  }
263
280
 
281
+ async getTm(accountUid: string, tmUid: string): Promise<TmDto | null> {
282
+ return await this.executeGraphQl(
283
+ accountUid,
284
+ GET_TM_QUERY,
285
+ { tmUid },
286
+ "tm"
287
+ );
288
+ }
289
+
290
+ // Array<TmDto | null> (not Array<TmDto>): the real schema's searchTms(...): [TM] has no "!"
291
+ // on the inner TM, so an individual list entry is nullable too, not just the list itself.
292
+ async searchTms(
293
+ accountUid: string, params: SearchTmsParameters
294
+ ): Promise<Array<TmDto | null> | null> {
295
+ return await this.executeGraphQl(
296
+ accountUid,
297
+ SEARCH_TMS_QUERY,
298
+ { searchTmFilter: params.export() },
299
+ "searchTms"
300
+ );
301
+ }
302
+
264
303
  // makeRequest()'s own JSON handling assumes the REST envelope shape ({response: {data}}) and
265
304
  // unwraps it automatically - a GraphQL response's {data, errors} envelope doesn't match that,
266
305
  // so this method requests the raw Response via ResponseBodyType.RAW_RESPONSE and parses the
@@ -0,0 +1,47 @@
1
+ import { BaseParameters } from "../../parameters/index";
2
+ import { TmSorting } from "./tm-sorting";
3
+ import { TranslationQualityType } from "./translation-quality-type";
4
+
5
+ export class SearchTmsParameters extends BaseParameters {
6
+ setFirst(first: number): SearchTmsParameters {
7
+ this.set("first", first);
8
+
9
+ return this;
10
+ }
11
+
12
+ setOffset(offset: number): SearchTmsParameters {
13
+ this.set("offset", offset);
14
+
15
+ return this;
16
+ }
17
+
18
+ setSortBy(sortBy: TmSorting): SearchTmsParameters {
19
+ this.set("sortBy", sortBy);
20
+
21
+ return this;
22
+ }
23
+
24
+ setSourceLocaleId(sourceLocaleId: string): SearchTmsParameters {
25
+ this.set("sourceLocaleId", sourceLocaleId);
26
+
27
+ return this;
28
+ }
29
+
30
+ setNameFilter(nameFilter: string): SearchTmsParameters {
31
+ this.set("nameFilter", nameFilter);
32
+
33
+ return this;
34
+ }
35
+
36
+ setSourceLanguageId(sourceLanguageId: string): SearchTmsParameters {
37
+ this.set("sourceLanguageId", sourceLanguageId);
38
+
39
+ return this;
40
+ }
41
+
42
+ setTranslationQuality(translationQuality: TranslationQualityType): SearchTmsParameters {
43
+ this.set("translationQuality", translationQuality);
44
+
45
+ return this;
46
+ }
47
+ }
@@ -0,0 +1,4 @@
1
+ export enum TmSorting {
2
+ BY_NAME_ASC = "BY_NAME_ASC",
3
+ BY_NAME_DESC = "BY_NAME_DESC"
4
+ }
@@ -0,0 +1,6 @@
1
+ interface EffectiveRatesRangeDto {
2
+ rateMin: number | null;
3
+ rateMax: number | null;
4
+ currencyCode: string | null;
5
+ }
6
+ export { EffectiveRatesRangeDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=effective-rates-range-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effective-rates-range-dto.js","sourceRoot":"","sources":["../../../../api/estimates/dto/effective-rates-range-dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ import { EstimateReportType } from "../params/estimate-report-type";
2
+ import { EstimateReportStatus } from "../params/estimate-report-status";
3
+ import { EstimateReportContentCoverage } from "../params/estimate-report-content-coverage";
4
+ import { LocaleEstimateDto } from "./locale-estimate-dto";
5
+ import { PriceInformationDto } from "./price-information-dto";
6
+ interface EstimateReportDto {
7
+ reportUid: string;
8
+ projectId: string;
9
+ translationJobUid: string | null;
10
+ schemaType: string;
11
+ reportType: EstimateReportType;
12
+ schema: string;
13
+ reportStatus: EstimateReportStatus;
14
+ totalStrings: number;
15
+ creatorUserUid: string;
16
+ creatorUserRole: string;
17
+ contentCoverage: EstimateReportContentCoverage;
18
+ creatorAgencyUid: string | null;
19
+ createdDate: Date;
20
+ tags: Array<string> | null;
21
+ totalWordCount: number;
22
+ totalWeightedWordCount: number;
23
+ totalCharacterCount: number;
24
+ totalPageCount: number | null;
25
+ warnings: Array<string> | null;
26
+ errors: Array<string> | null;
27
+ localeEstimates: Array<LocaleEstimateDto> | null;
28
+ priceInformation: Array<PriceInformationDto> | null;
29
+ }
30
+ export { EstimateReportDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=estimate-report-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimate-report-dto.js","sourceRoot":"","sources":["../../../../api/estimates/dto/estimate-report-dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { EstimateReportType } from "../params/estimate-report-type";
2
+ import { EstimateReportStatus } from "../params/estimate-report-status";
3
+ interface EstimateReportStatusDto {
4
+ reportUid: string;
5
+ reportStatus: EstimateReportStatus;
6
+ totalStrings: number;
7
+ percentComplete: number;
8
+ reportType: EstimateReportType;
9
+ createdDate: Date;
10
+ }
11
+ export { EstimateReportStatusDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=estimate-report-status-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimate-report-status-dto.js","sourceRoot":"","sources":["../../../../api/estimates/dto/estimate-report-status-dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ interface EstimateReportTagsDto {
2
+ tags: Array<string>;
3
+ }
4
+ export { EstimateReportTagsDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=estimate-report-tags-dto.js.map