box-node-sdk
Version:
Official SDK for Box Platform APIs
269 lines • 11.8 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AutomateWorkflowActionV2026R0 = void 0;
exports.serializeAutomateWorkflowActionV2026R0TypeField = serializeAutomateWorkflowActionV2026R0TypeField;
exports.deserializeAutomateWorkflowActionV2026R0TypeField = deserializeAutomateWorkflowActionV2026R0TypeField;
exports.serializeAutomateWorkflowActionV2026R0ActionTypeField = serializeAutomateWorkflowActionV2026R0ActionTypeField;
exports.deserializeAutomateWorkflowActionV2026R0ActionTypeField = deserializeAutomateWorkflowActionV2026R0ActionTypeField;
exports.serializeAutomateWorkflowActionV2026R0 = serializeAutomateWorkflowActionV2026R0;
exports.deserializeAutomateWorkflowActionV2026R0 = deserializeAutomateWorkflowActionV2026R0;
exports.serializeAutomateWorkflowActionV2026R0Input = serializeAutomateWorkflowActionV2026R0Input;
exports.deserializeAutomateWorkflowActionV2026R0Input = deserializeAutomateWorkflowActionV2026R0Input;
const userMiniV2026R0_1 = require("./userMiniV2026R0.js");
const userMiniV2026R0_2 = require("./userMiniV2026R0.js");
const automateWorkflowReferenceV2026R0_1 = require("./automateWorkflowReferenceV2026R0.js");
const automateWorkflowReferenceV2026R0_2 = require("./automateWorkflowReferenceV2026R0.js");
const utils_1 = require("../../internal/utils.js");
const utils_2 = require("../../internal/utils.js");
const errors_1 = require("../../box/errors.js");
const json_1 = require("../../serialization/json.js");
const json_2 = require("../../serialization/json.js");
class AutomateWorkflowActionV2026R0 {
constructor(fields) {
/**
* The object type for this workflow action wrapper. */
this.type = 'workflow_action';
/**
* The type that defines the behavior of this action. */
this.actionType = 'run_workflow';
if (fields.id !== undefined) {
this.id = fields.id;
}
if (fields.type !== undefined) {
this.type = fields.type;
}
if (fields.actionType !== undefined) {
this.actionType = fields.actionType;
}
if (fields.description !== undefined) {
this.description = fields.description;
}
if (fields.createdAt !== undefined) {
this.createdAt = fields.createdAt;
}
if (fields.updatedAt !== undefined) {
this.updatedAt = fields.updatedAt;
}
if (fields.createdBy !== undefined) {
this.createdBy = fields.createdBy;
}
if (fields.updatedBy !== undefined) {
this.updatedBy = fields.updatedBy;
}
if (fields.workflow !== undefined) {
this.workflow = fields.workflow;
}
if (fields.rawData !== undefined) {
this.rawData = fields.rawData;
}
}
}
exports.AutomateWorkflowActionV2026R0 = AutomateWorkflowActionV2026R0;
function serializeAutomateWorkflowActionV2026R0TypeField(val) {
return val;
}
function deserializeAutomateWorkflowActionV2026R0TypeField(val) {
if (val == 'workflow_action') {
return val;
}
throw new errors_1.BoxSdkError({
message: "Can't deserialize AutomateWorkflowActionV2026R0TypeField",
});
}
function serializeAutomateWorkflowActionV2026R0ActionTypeField(val) {
return val;
}
function deserializeAutomateWorkflowActionV2026R0ActionTypeField(val) {
if (val == 'run_workflow') {
return val;
}
if ((0, json_1.sdIsString)(val)) {
return val;
}
throw new errors_1.BoxSdkError({
message: "Can't deserialize AutomateWorkflowActionV2026R0ActionTypeField",
});
}
function serializeAutomateWorkflowActionV2026R0(val) {
return {
['id']: val.id,
['type']: serializeAutomateWorkflowActionV2026R0TypeField(val.type),
['action_type']: serializeAutomateWorkflowActionV2026R0ActionTypeField(val.actionType),
['description']: val.description,
['created_at']: val.createdAt == void 0
? val.createdAt
: (0, utils_1.serializeDateTime)(val.createdAt),
['updated_at']: val.updatedAt == void 0
? val.updatedAt
: (0, utils_1.serializeDateTime)(val.updatedAt),
['created_by']: val.createdBy == void 0
? val.createdBy
: (0, userMiniV2026R0_1.serializeUserMiniV2026R0)(val.createdBy),
['updated_by']: val.updatedBy == void 0
? val.updatedBy
: (0, userMiniV2026R0_1.serializeUserMiniV2026R0)(val.updatedBy),
['workflow']: (0, automateWorkflowReferenceV2026R0_1.serializeAutomateWorkflowReferenceV2026R0)(val.workflow),
};
}
function deserializeAutomateWorkflowActionV2026R0(val) {
if (!(0, json_2.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "AutomateWorkflowActionV2026R0"',
});
}
if (val.id == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "id" of type "AutomateWorkflowActionV2026R0" to be defined',
});
}
if (!(0, json_1.sdIsString)(val.id)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "id" of type "AutomateWorkflowActionV2026R0"',
});
}
const id = val.id;
if (val.type == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "type" of type "AutomateWorkflowActionV2026R0" to be defined',
});
}
const type = deserializeAutomateWorkflowActionV2026R0TypeField(val.type);
if (val.action_type == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "action_type" of type "AutomateWorkflowActionV2026R0" to be defined',
});
}
const actionType = deserializeAutomateWorkflowActionV2026R0ActionTypeField(val.action_type);
if (!(val.description == void 0) && !(0, json_1.sdIsString)(val.description)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "description" of type "AutomateWorkflowActionV2026R0"',
});
}
const description = val.description == void 0 ? void 0 : val.description;
if (!(val.created_at == void 0) && !(0, json_1.sdIsString)(val.created_at)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "created_at" of type "AutomateWorkflowActionV2026R0"',
});
}
const createdAt = val.created_at == void 0 ? void 0 : (0, utils_2.deserializeDateTime)(val.created_at);
if (!(val.updated_at == void 0) && !(0, json_1.sdIsString)(val.updated_at)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "updated_at" of type "AutomateWorkflowActionV2026R0"',
});
}
const updatedAt = val.updated_at == void 0 ? void 0 : (0, utils_2.deserializeDateTime)(val.updated_at);
const createdBy = val.created_by == void 0
? void 0
: (0, userMiniV2026R0_2.deserializeUserMiniV2026R0)(val.created_by);
const updatedBy = val.updated_by == void 0
? void 0
: (0, userMiniV2026R0_2.deserializeUserMiniV2026R0)(val.updated_by);
if (val.workflow == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "workflow" of type "AutomateWorkflowActionV2026R0" to be defined',
});
}
const workflow = (0, automateWorkflowReferenceV2026R0_2.deserializeAutomateWorkflowReferenceV2026R0)(val.workflow);
return {
id: id,
type: type,
actionType: actionType,
description: description,
createdAt: createdAt,
updatedAt: updatedAt,
createdBy: createdBy,
updatedBy: updatedBy,
workflow: workflow,
};
}
function serializeAutomateWorkflowActionV2026R0Input(val) {
return {
['id']: val.id,
['type']: val.type == void 0
? val.type
: serializeAutomateWorkflowActionV2026R0TypeField(val.type),
['actionType']: val.actionType == void 0
? val.actionType
: serializeAutomateWorkflowActionV2026R0ActionTypeField(val.actionType),
['description']: val.description,
['created_at']: val.createdAt == void 0
? val.createdAt
: (0, utils_1.serializeDateTime)(val.createdAt),
['updated_at']: val.updatedAt == void 0
? val.updatedAt
: (0, utils_1.serializeDateTime)(val.updatedAt),
['created_by']: val.createdBy == void 0
? val.createdBy
: (0, userMiniV2026R0_1.serializeUserMiniV2026R0)(val.createdBy),
['updated_by']: val.updatedBy == void 0
? val.updatedBy
: (0, userMiniV2026R0_1.serializeUserMiniV2026R0)(val.updatedBy),
['workflow']: (0, automateWorkflowReferenceV2026R0_1.serializeAutomateWorkflowReferenceV2026R0)(val.workflow),
};
}
function deserializeAutomateWorkflowActionV2026R0Input(val) {
if (!(0, json_2.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "AutomateWorkflowActionV2026R0Input"',
});
}
if (val.id == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "id" of type "AutomateWorkflowActionV2026R0Input" to be defined',
});
}
if (!(0, json_1.sdIsString)(val.id)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "id" of type "AutomateWorkflowActionV2026R0Input"',
});
}
const id = val.id;
const type = val.type == void 0
? void 0
: deserializeAutomateWorkflowActionV2026R0TypeField(val.type);
const actionType = val.actionType == void 0
? void 0
: deserializeAutomateWorkflowActionV2026R0ActionTypeField(val.actionType);
if (!(val.description == void 0) && !(0, json_1.sdIsString)(val.description)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "description" of type "AutomateWorkflowActionV2026R0Input"',
});
}
const description = val.description == void 0 ? void 0 : val.description;
if (!(val.created_at == void 0) && !(0, json_1.sdIsString)(val.created_at)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "created_at" of type "AutomateWorkflowActionV2026R0Input"',
});
}
const createdAt = val.created_at == void 0 ? void 0 : (0, utils_2.deserializeDateTime)(val.created_at);
if (!(val.updated_at == void 0) && !(0, json_1.sdIsString)(val.updated_at)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "updated_at" of type "AutomateWorkflowActionV2026R0Input"',
});
}
const updatedAt = val.updated_at == void 0 ? void 0 : (0, utils_2.deserializeDateTime)(val.updated_at);
const createdBy = val.created_by == void 0
? void 0
: (0, userMiniV2026R0_2.deserializeUserMiniV2026R0)(val.created_by);
const updatedBy = val.updated_by == void 0
? void 0
: (0, userMiniV2026R0_2.deserializeUserMiniV2026R0)(val.updated_by);
if (val.workflow == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "workflow" of type "AutomateWorkflowActionV2026R0Input" to be defined',
});
}
const workflow = (0, automateWorkflowReferenceV2026R0_2.deserializeAutomateWorkflowReferenceV2026R0)(val.workflow);
return {
id: id,
type: type,
actionType: actionType,
description: description,
createdAt: createdAt,
updatedAt: updatedAt,
createdBy: createdBy,
updatedBy: updatedBy,
workflow: workflow,
};
}
//# sourceMappingURL=automateWorkflowActionV2026R0.js.map