UNPKG

@crowdin/crowdin-api-client

Version:
59 lines (58 loc) 3.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Workflows = void 0; const core_1 = require("../core"); /** * Workflows are the sequences of steps that content in your project should go through (e.g. pre-translation, translation, proofreading). * You can use a default template or create the one that works best for you and assign it to the needed projects. * * Use API to get the list of workflow templates available in your organization and to check the details of a specific template. */ class Workflows extends core_1.CrowdinApi { listWorkflowSteps(projectId, options, deprecatedOffset) { if ((0, core_1.isOptionalNumber)(options, '1' in arguments)) { options = { limit: options, offset: deprecatedOffset }; } const url = `${this.url}/projects/${projectId}/workflow-steps`; return this.getList(url, options.limit, options.offset); } /** * @param projectId project identifier * @param stepId workflow step identifier * @see https://support.crowdin.com/enterprise/api/#operation/api.projects.workflow-steps.getMany */ getWorkflowStep(projectId, stepId) { const url = `${this.url}/projects/${projectId}/workflow-steps/${stepId}`; return this.get(url, this.defaultConfig()); } /** * @param projectId project identifier * @param stepId workflow step identifier * @param options optional parameters for the request * @see https://support.crowdin.com/developer/enterprise/api/v2/#tag/Workflows/operation/api.projects.workflow-steps.strings.getMany */ listStringsOnTheWorkflowStep(projectId, stepId, options) { let url = `${this.url}/projects/${projectId}/workflow-steps/${stepId}/strings`; url = this.addQueryParam(url, 'languageIds', options === null || options === void 0 ? void 0 : options.languageIds); url = this.addQueryParam(url, 'orderBy', options === null || options === void 0 ? void 0 : options.orderBy); url = this.addQueryParam(url, 'status', options === null || options === void 0 ? void 0 : options.status); return this.getList(url, options === null || options === void 0 ? void 0 : options.limit, options === null || options === void 0 ? void 0 : options.offset); } listWorkflowTemplates(options, deprecatedLimit, deprecatedOffset) { let url = `${this.url}/workflow-templates`; if ((0, core_1.isOptionalNumber)(options, '0' in arguments)) { options = { groupId: options, limit: deprecatedLimit, offset: deprecatedOffset }; } url = this.addQueryParam(url, 'groupId', options.groupId); return this.getList(url, options.limit, options.offset); } /** * @param templateId workflow template identifier * @see https://support.crowdin.com/enterprise/api/#operation/api.workflow-templates.get */ getWorkflowTemplateInfo(templateId) { const url = `${this.url}/workflow-templates/${templateId}`; return this.get(url, this.defaultConfig()); } } exports.Workflows = Workflows;