@crowdin/crowdin-api-client
Version:
JavaScript library for Crowdin API
246 lines (245 loc) • 11.8 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProjectsGroupsModel = exports.ProjectsGroups = void 0;
const core_1 = require("../core");
/**
* Using projects, you can keep your source files sorted.
*
* Use API to manage projects, change their settings, or remove them if required.
*
* Only Crowdin Enterprise: Groups allow you to organize your projects based on specific characteristics.
* Using projects, you can keep your source files sorted.
*/
class ProjectsGroups extends core_1.CrowdinApi {
listGroups(options, deprecatedOffset, deprecatedUserId, deprecatedLimit) {
if ((0, core_1.isOptionalNumber)(options, '0' in arguments)) {
options = {
parentId: options,
offset: deprecatedOffset,
userId: deprecatedUserId,
limit: deprecatedLimit,
};
}
let url = `${this.url}/groups`;
url = this.addQueryParam(url, 'parentId', options.parentId);
url = this.addQueryParam(url, 'userId', options.userId);
url = this.addQueryParam(url, 'orderBy', options.orderBy);
return this.getList(url, options.limit, options.offset);
}
/**
* @param request request body
* @see https://support.crowdin.com/enterprise/api/#operation/api.groups.post
*/
addGroup(request) {
const url = `${this.url}/groups`;
return this.post(url, request, this.defaultConfig());
}
/**
* @param group group identifier
* @see https://support.crowdin.com/enterprise/api/#operation/api.groups.get
*/
getGroup(groupId) {
const url = `${this.url}/groups/${groupId}`;
return this.get(url, this.defaultConfig());
}
/**
* @param groupId group identifier
* @see https://support.crowdin.com/enterprise/api/#operation/api.groups.delete
*/
deleteGroup(groupId) {
const url = `${this.url}/groups/${groupId}`;
return this.delete(url, this.defaultConfig());
}
/**
* @param groupId group identifier
* @param request request body
* @see https://support.crowdin.com/enterprise/api/#operation/api.groups.patch
*/
editGroup(groupId, request) {
const url = `${this.url}/groups/${groupId}`;
return this.patch(url, request, this.defaultConfig());
}
listProjects(options, deprecatedHasManagerAccess, deprecatedLimit, deprecatedOffset) {
if ((0, core_1.isOptionalNumber)(options, '0' in arguments)) {
options = {
groupId: options,
hasManagerAccess: deprecatedHasManagerAccess,
limit: deprecatedLimit,
offset: deprecatedOffset,
};
}
let url = `${this.url}/projects`;
url = this.addQueryParam(url, 'groupId', options.groupId);
url = this.addQueryParam(url, 'hasManagerAccess', options.hasManagerAccess);
url = this.addQueryParam(url, 'type', options.type);
url = this.addQueryParam(url, 'orderBy', options.orderBy);
return this.getList(url, options.limit, options.offset);
}
/**
* @param request request body
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.post
*/
addProject(request) {
const url = `${this.url}/projects`;
return this.post(url, request, this.defaultConfig());
}
/**
* @param projectId project identifier
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.get
*/
getProject(projectId) {
const url = `${this.url}/projects/${projectId}`;
return this.get(url, this.defaultConfig());
}
/**
* @param projectId project identifier
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.delete
*/
deleteProject(projectId) {
const url = `${this.url}/projects/${projectId}`;
return this.delete(url, this.defaultConfig());
}
/**
* @param projectId project identifier
* @param request request body
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.patch
*/
editProject(projectId, request) {
const url = `${this.url}/projects/${projectId}`;
return this.patch(url, request, this.defaultConfig());
}
/**
* @param projectId project identifier
* @param fileFormatSettingsId file format settings identifier
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.file-format-settings.custom-segmentations.get
*/
downloadProjectFileFormatSettingsCustomSegmentation(projectId, fileFormatSettingsId) {
const url = `${this.url}/projects/${projectId}/file-format-settings/${fileFormatSettingsId}/custom-segmentations`;
return this.get(url, this.defaultConfig());
}
/**
* @param projectId project identifier
* @param fileFormatSettingsId file format settings identifier
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.file-format-settings.custom-segmentations.delete
*/
resetProjectFileFormatSettingsCustomSegmentation(projectId, fileFormatSettingsId) {
const url = `${this.url}/projects/${projectId}/file-format-settings/${fileFormatSettingsId}/custom-segmentations`;
return this.delete(url, this.defaultConfig());
}
/**
* @param projectId project identifier
* @param options optional parameters for the request
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.file-format-settings.getMany
*/
listProjectFileFormatSettings(projectId, options) {
const url = `${this.url}/projects/${projectId}/file-format-settings`;
return this.getList(url, options === null || options === void 0 ? void 0 : options.limit, options === null || options === void 0 ? void 0 : options.offset);
}
/**
* @param projectId project identifier
* @param request request body
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.file-format-settings.post
*/
addProjectFileFormatSettings(projectId, request) {
const url = `${this.url}/projects/${projectId}/file-format-settings`;
return this.post(url, request, this.defaultConfig());
}
/**
* @param projectId project identifier
* @param fileFormatSettingsId file format settings identifier
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.file-format-settings.get
*/
getProjectFileFormatSettings(projectId, fileFormatSettingsId) {
const url = `${this.url}/projects/${projectId}/file-format-settings/${fileFormatSettingsId}`;
return this.get(url, this.defaultConfig());
}
/**
* @param projectId project identifier
* @param fileFormatSettingsId file format settings identifier
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.file-format-settings.delete
*/
deleteProjectFileFormatSettings(projectId, fileFormatSettingsId) {
const url = `${this.url}/projects/${projectId}/file-format-settings/${fileFormatSettingsId}`;
return this.delete(url, this.defaultConfig());
}
/**
* @param projectId project identifier
* @param fileFormatSettingsId file format settings identifier
* @param request request body
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.file-format-settings.patch
*/
editProjectFileFormatSettings(projectId, fileFormatSettingsId, request) {
const url = `${this.url}/projects/${projectId}/file-format-settings/${fileFormatSettingsId}`;
return this.patch(url, request, this.defaultConfig());
}
/**
* @param projectId project identifier
* @param options optional parameters for the request
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings-exporter-settings.getMany
*/
listProjectStringsExporterSettings(projectId, options) {
const url = `${this.url}/projects/${projectId}/strings-exporter-settings`;
return this.getList(url, options === null || options === void 0 ? void 0 : options.limit, options === null || options === void 0 ? void 0 : options.offset);
}
/**
* @param projectId project identifier
* @param request request body
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings-exporter-settings.post
*/
addProjectStringsExporterSettings(projectId, request) {
const url = `${this.url}/projects/${projectId}/strings-exporter-settings`;
return this.post(url, request, this.defaultConfig());
}
/**
* @param projectId project identifier
* @param systemStringsExporterSettingsId file format settings identifier
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings-exporter-settings.get
*/
getProjectStringsExporterSettings(projectId, systemStringsExporterSettingsId) {
const url = `${this.url}/projects/${projectId}/strings-exporter-settings/${systemStringsExporterSettingsId}`;
return this.get(url, this.defaultConfig());
}
/**
* @param projectId project identifier
* @param systemStringsExporterSettingsId file format settings identifier
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings-exporter-settings.delete
*/
deleteProjectStringsExporterSettings(projectId, systemStringsExporterSettingsId) {
const url = `${this.url}/projects/${projectId}/strings-exporter-settings/${systemStringsExporterSettingsId}`;
return this.delete(url, this.defaultConfig());
}
/**
* @param projectId project identifier
* @param systemStringsExporterSettingsId file format settings identifier
* @param request request body
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings-exporter-settings.patch
*/
editProjectStringsExporterSettings(projectId, systemStringsExporterSettingsId, request) {
const url = `${this.url}/projects/${projectId}/strings-exporter-settings/${systemStringsExporterSettingsId}`;
return this.patch(url, request, this.defaultConfig());
}
}
exports.ProjectsGroups = ProjectsGroups;
var ProjectsGroupsModel;
(function (ProjectsGroupsModel) {
let Type;
(function (Type) {
Type[Type["FILES_BASED"] = 0] = "FILES_BASED";
Type[Type["STRINGS_BASED"] = 1] = "STRINGS_BASED";
})(Type = ProjectsGroupsModel.Type || (ProjectsGroupsModel.Type = {}));
let TagDetection;
(function (TagDetection) {
TagDetection[TagDetection["AUTO"] = 0] = "AUTO";
TagDetection[TagDetection["COUNT_TAGS"] = 1] = "COUNT_TAGS";
TagDetection[TagDetection["SKIP_TAGS"] = 2] = "SKIP_TAGS";
})(TagDetection = ProjectsGroupsModel.TagDetection || (ProjectsGroupsModel.TagDetection = {}));
let TranslateDuplicates;
(function (TranslateDuplicates) {
TranslateDuplicates[TranslateDuplicates["SHOW"] = 0] = "SHOW";
TranslateDuplicates[TranslateDuplicates["HIDE_REGULAR_DETECTION"] = 1] = "HIDE_REGULAR_DETECTION";
TranslateDuplicates[TranslateDuplicates["SHOW_AUTO_TRANSLATE"] = 2] = "SHOW_AUTO_TRANSLATE";
TranslateDuplicates[TranslateDuplicates["SHOW_WITHIN_VERION_BRANCH_REGULAR_DETECTION"] = 3] = "SHOW_WITHIN_VERION_BRANCH_REGULAR_DETECTION";
TranslateDuplicates[TranslateDuplicates["HIDE_STRICT_DETECTION"] = 4] = "HIDE_STRICT_DETECTION";
TranslateDuplicates[TranslateDuplicates["SHOW_WITHIN_VERION_BRANCH_STRICT_DETECTION"] = 5] = "SHOW_WITHIN_VERION_BRANCH_STRICT_DETECTION";
})(TranslateDuplicates = ProjectsGroupsModel.TranslateDuplicates || (ProjectsGroupsModel.TranslateDuplicates = {}));
})(ProjectsGroupsModel = exports.ProjectsGroupsModel || (exports.ProjectsGroupsModel = {}));