@kuflow/kuflow-rest
Version:
REST SDK for KuFlow.
159 lines • 7.13 kB
JavaScript
;
/**
* The MIT License
* Copyright © 2021-present KuFlow S.L.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProcessItemOperations = void 0;
/** Class containing TaskOperations operations. */
class ProcessItemOperations {
processItemOperations;
/**
* Initialize a new instance of the class TaskOperations class.
* @param clientGenerated Reference to the service client
*/
constructor(clientGenerated) {
this.processItemOperations = clientGenerated.processItemOperations;
}
/**
* List all Tasks that have been created and the credentials has access.
*
* Available sort query values: id, createdAt, lastModifiedAt, claimedAt, completedAt, cancelledAt
*
* @param options The options parameters.
*/
async findProcessItems(options) {
const { sort, tenantId, processId, type, taskState, processItemDefinitionCode, ...optionsRest } = options ?? {};
return await this.processItemOperations.findProcessItems({
...optionsRest,
sort: typeof sort === 'string' ? [sort] : sort,
tenantId: typeof tenantId === 'string' ? [tenantId] : tenantId,
processId: typeof processId === 'string' ? [processId] : processId,
type: typeof type === 'string' ? [type] : type,
taskState: typeof taskState === 'string' ? [taskState] : taskState,
processItemDefinitionCode: typeof processItemDefinitionCode === 'string' ? [processItemDefinitionCode] : processItemDefinitionCode,
});
}
/**
* Create a Process Item and optionally fill its value.
*
* If you want to add document type elements, you can pass a reference to an existing document type
* element
* indicating its 'uri'. This will copy that document into the element. In case you want to add a new
* document,
* please use the corresponding API method.
*
* If you want the method to be idempotent, please specify the `id` field in the request body.
*
* @param processItemCreateParams Process Item to be created
* @param options The options parameters.
*/
async createProcessItem(processItemCreateParams, options) {
return await this.processItemOperations.createProcessItem(processItemCreateParams, options);
}
/**
* Allow to get a task by ID.
* @param id The resource ID.
* @param options The options parameters.
*/
async retrieveProcessItem(id, options) {
return await this.processItemOperations.retrieveProcessItem(id, options);
}
/**
* Allow to claim a task.
* @param id The resource ID.
* @param options The options parameters.
*/
async claimProcessItemTask(id, options) {
return await this.processItemOperations.claimProcessItemTask(id, options);
}
/**
* Allow to assign a task to a user or application. Only one option will be necessary.
* @param id The resource ID.
* @param processItemTaskAssignParams Params to change the process item task owner.
* @param options The options parameters.
*/
async assignProcessItemTask(id, processItemTaskAssignParams, options) {
return await this.processItemOperations.assignProcessItemTask(id, processItemTaskAssignParams, options);
}
/**
* Allow to complete a claimed task by the principal.
* @param id The resource ID.
* @param options The options parameters.
*/
async completeProcessItemTask(id, options) {
return await this.processItemOperations.completeProcessItemTask(id, options);
}
/**
* A log entry is added to the task. If the number of log entries is reached, the oldest log entry is
* removed.
*
* @param id The resource ID.
* @param processItemTaskAppendLogParams Log to be created.
* @param options The options parameters.
*/
async appendProcessItemTaskLog(id, processItemTaskAppendLogParams, options) {
return await this.processItemOperations.appendProcessItemTaskLog(id, processItemTaskAppendLogParams, options);
}
/**
* Allow to save a JSON data validating that the data follow the related schema. If the data is
* invalid, then
* the json form is marked as invalid.
*
* @param id The resource ID.
* @param processItemTaskDataUpdateParams Params used to update the JSON value.
* @param options The options parameters.
*/
async updateProcessItemTaskData(id, processItemTaskDataUpdateParams, options) {
return await this.processItemOperations.updateProcessItemTaskData(id, processItemTaskDataUpdateParams, options);
}
/**
* Allow to patch a JSON data validating that the data follow the related schema. If the data is
* invalid, then
* the json is marked as invalid.
*
* @param id The resource ID.
* @param jsonPatch Params to save the JSON value.
* @param options The options parameters.
*/
async patchProcessItemTaskData(id, jsonPatch, options) {
return await this.processItemOperations.patchProcessItemTaskData(id, jsonPatch, options);
}
/**
* Given a task, generate a PDF from a Form type element with the data filled in, if any. If there are
* multiple form values, they are packed into a ZIP.
*
* Important!: To use this feature, please contact to kuflow@kuflow.com
*
* @param id The resource ID.
* @param propertyPath JSON pointer to the property with the error. See:
* https://datatracker.ietf.org/doc/html/rfc6901
*
* ie: /user/name or /users/1/name
*
* @param options The options parameters.
*/
async downloadProcessItemTaskDataWebformsAsDocument(id, propertyPath, options) {
return await this.processItemOperations.downloadProcessItemTaskDataWebformsAsDocument(id, propertyPath, options);
}
}
exports.ProcessItemOperations = ProcessItemOperations;
//# sourceMappingURL=processItemOperations.js.map