UNPKG

@crowdin/crowdin-api-client

Version:
68 lines (67 loc) 3.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StringCorrections = void 0; const core_1 = require("../core"); class StringCorrections extends core_1.CrowdinApi { /** * @param projectId project identifier * @param options optional pagination parameters for the request * @see https://support.crowdin.com/developer/enterprise/api/v2/#tag/String-Corrections/operation/api.projects.corrections.getMany */ listStringCorrections(projectId, options) { let url = `${this.url}/projects/${projectId}/corrections`; url = this.addQueryParam(url, 'stringId', options.stringId); url = this.addQueryParam(url, 'denormalizePlaceholders', options.denormalizePlaceholders); url = this.addQueryParam(url, 'orderBy', options.orderBy); return this.getList(url, options.limit, options.offset); } /** * @param projectId project identifier * @param request request body * @see https://support.crowdin.com/developer/enterprise/api/v2/#tag/String-Corrections/operation/api.projects.corrections.post */ addStringCorrection(projectId, request) { const url = `${this.url}/projects/${projectId}/corrections`; return this.post(url, request, this.defaultConfig()); } /** * @param projectId project identifier * @param stringId string identifier * @see https://support.crowdin.com/developer/enterprise/api/v2/#tag/String-Corrections/operation/api.projects.corrections.deleteMany */ deleteStringCorrections(projectId, stringId) { let url = `${this.url}/projects/${projectId}/corrections`; url = this.addQueryParam(url, 'stringId', stringId); return this.delete(url, this.defaultConfig()); } /** * @param projectId project identifier * @param correctionId correction identifier * @param params query params * @see https://support.crowdin.com/developer/enterprise/api/v2/#tag/String-Corrections/operation/api.projects.corrections.get */ getStringCorrection(projectId, correctionId, params) { let url = `${this.url}/projects/${projectId}/corrections/${correctionId}`; url = this.addQueryParam(url, 'denormalizePlaceholders', params === null || params === void 0 ? void 0 : params.denormalizePlaceholders); return this.get(url, this.defaultConfig()); } /** * @param projectId project identifier * @param correctionId correction identifier * @see https://support.crowdin.com/developer/enterprise/api/v2/#tag/String-Corrections/operation/api.projects.corrections.put */ restoreStringCorrection(projectId, correctionId) { const url = `${this.url}/projects/${projectId}/corrections/${correctionId}`; return this.put(url, undefined, this.defaultConfig()); } /** * @param projectId project identifier * @param correctionId correction identifier * @see https://support.crowdin.com/developer/enterprise/api/v2/#tag/String-Corrections/operation/api.projects.corrections.delete */ deleteStringCorrection(projectId, correctionId) { const url = `${this.url}/projects/${projectId}/corrections/${correctionId}`; return this.delete(url, this.defaultConfig()); } } exports.StringCorrections = StringCorrections;