UNPKG

@crowdin/crowdin-api-client

Version:
71 lines (70 loc) 2.86 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Distributions = void 0; const core_1 = require("../core"); class Distributions extends core_1.CrowdinApi { listDistributions(projectId, options, deprecatedOffset) { if ((0, core_1.isOptionalNumber)(options, '1' in arguments)) { options = { limit: options, offset: deprecatedOffset }; } const url = `${this.url}/projects/${projectId}/distributions`; 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.distributions.post */ createDistribution(projectId, request) { const url = `${this.url}/projects/${projectId}/distributions`; return this.post(url, request, this.defaultConfig()); } /** * @param projectId project identifier * @param hash hash * @see https://developer.crowdin.com/api/v2/#operation/api.projects.distributions.get */ getDistribution(projectId, hash) { const url = `${this.url}/projects/${projectId}/distributions/${hash}`; return this.get(url, this.defaultConfig()); } /** * @param projectId project identifier * @param hash hash * @see https://developer.crowdin.com/api/v2/#operation/api.projects.distributions.delete */ deleteDistribution(projectId, hash) { const url = `${this.url}/projects/${projectId}/distributions/${hash}`; return this.delete(url, this.defaultConfig()); } /** * @param projectId project identifier * @param hash hash * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.projects.distributions.patch */ editDistribution(projectId, hash, request) { const url = `${this.url}/projects/${projectId}/distributions/${hash}`; return this.patch(url, request, this.defaultConfig()); } /** * @param projectId project identifier * @param hash hash * @see https://developer.crowdin.com/api/v2/#operation/api.projects.distributions.release.get */ getDistributionRelease(projectId, hash) { const url = `${this.url}/projects/${projectId}/distributions/${hash}/release`; return this.get(url, this.defaultConfig()); } /** * @param projectId project identifier * @param hash hash * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.projects.distributions.release.post */ createDistributionRelease(projectId, hash) { const url = `${this.url}/projects/${projectId}/distributions/${hash}/release`; return this.post(url, {}, this.defaultConfig()); } } exports.Distributions = Distributions;