@crowdin/crowdin-api-client
Version:
JavaScript library for Crowdin API
92 lines (91 loc) • 4.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TranslationStatus = void 0;
const core_1 = require("../core");
/**
* Status represents the general localization progress on both translations and proofreading.
*
* Use API to check translation and proofreading progress on different levels: file, language, branch, directory.
*/
class TranslationStatus extends core_1.CrowdinApi {
getBranchProgress(projectId, branchId, options, deprecatedOffset) {
if ((0, core_1.isOptionalNumber)(options, '2' in arguments)) {
options = { limit: options, offset: deprecatedOffset };
}
const url = `${this.url}/projects/${projectId}/branches/${branchId}/languages/progress`;
return this.getList(url, options.limit, options.offset);
}
getDirectoryProgress(projectId, directoryId, options, deprecatedOffset) {
if ((0, core_1.isOptionalNumber)(options, '2' in arguments)) {
options = { limit: options, offset: deprecatedOffset };
}
const url = `${this.url}/projects/${projectId}/directories/${directoryId}/languages/progress`;
return this.getList(url, options.limit, options.offset);
}
getFileProgress(projectId, fileId, options, deprecatedOffset) {
if ((0, core_1.isOptionalNumber)(options, '2' in arguments)) {
options = { limit: options, offset: deprecatedOffset };
}
const url = `${this.url}/projects/${projectId}/files/${fileId}/languages/progress`;
return this.getList(url, options.limit, options.offset);
}
getLanguageProgress(projectId, languageId, options, deprecatedOffset) {
if ((0, core_1.isOptionalNumber)(options, '2' in arguments)) {
options = { limit: options, offset: deprecatedOffset };
}
const url = `${this.url}/projects/${projectId}/languages/${languageId}/progress`;
return this.getList(url, options.limit, options.offset);
}
getProjectProgress(projectId, options, deprecatedOffset, deprecatedLanguageIds) {
if ((0, core_1.isOptionalNumber)(options, '1' in arguments)) {
options = { limit: options, offset: deprecatedOffset, languageIds: deprecatedLanguageIds };
}
let url = `${this.url}/projects/${projectId}/languages/progress`;
url = this.addQueryParam(url, 'languageIds', options.languageIds);
return this.getList(url, options.limit, options.offset);
}
listQaCheckIssues(projectId, options, deprecatedOffset, deprecatedCategory, deprecatedValidation, deprecatedLanguageIds) {
let url = `${this.url}/projects/${projectId}/qa-checks`;
if ((0, core_1.isOptionalNumber)(options, '1' in arguments)) {
options = {
limit: options,
offset: deprecatedOffset,
category: deprecatedCategory,
validation: deprecatedValidation,
languageIds: deprecatedLanguageIds,
};
}
url = this.addQueryParam(url, 'category', Array.isArray(options.category) ? options.category.join(',') : options.category);
url = this.addQueryParam(url, 'validation', Array.isArray(options.validation) ? options.validation.join(',') : options.validation);
url = this.addQueryParam(url, 'languageIds', options.languageIds);
return this.getList(url, options.limit, options.offset);
}
/**
* @param projectId project identifier
* @param request request body
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.qa-checks.revalidate.post
*/
revalidateQaChecks(projectId, request) {
const url = `${this.url}/projects/${projectId}/qa-checks/revalidate`;
return this.post(url, request, this.defaultConfig());
}
/**
* @param projectId project identifier
* @param revalidationId QA checks revalidation identifier
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.qa-checks.revalidate.get
*/
getQaChecksRevalidationStatus(projectId, revalidationId) {
const url = `${this.url}/projects/${projectId}/qa-checks/revalidate/${revalidationId}`;
return this.get(url, this.defaultConfig());
}
/**
* @param projectId project identifier
* @param revalidationId QA checks revalidation identifier
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.qa-checks.revalidate.delete
*/
cancelQaChecksRevalidation(projectId, revalidationId) {
const url = `${this.url}/projects/${projectId}/qa-checks/revalidate/${revalidationId}`;
return this.delete(url, this.defaultConfig());
}
}
exports.TranslationStatus = TranslationStatus;