box-node-sdk
Version:
Official SDK for Box Platform APIs
273 lines • 10.4 kB
JavaScript
import { serializeUserMiniV2026R0 } from './userMiniV2026R0.js';
import { deserializeUserMiniV2026R0 } from './userMiniV2026R0.js';
import { serializeAutomateWorkflowReferenceV2026R0 } from './automateWorkflowReferenceV2026R0.js';
import { deserializeAutomateWorkflowReferenceV2026R0 } from './automateWorkflowReferenceV2026R0.js';
import { serializeDateTime } from '../../internal/utils.js';
import { deserializeDateTime } from '../../internal/utils.js';
import { BoxSdkError } from '../../box/errors.js';
import { sdIsString } from '../../serialization/json.js';
import { sdIsMap } from '../../serialization/json.js';
export class AutomateWorkflowActionV2026R0 {
/**
* The identifier for the Automate action. */
id;
/**
* The object type for this workflow action wrapper. */
type = 'workflow_action';
/**
* The type that defines the behavior of this action. */
actionType = 'run_workflow';
/**
* A human-readable description of the workflow action. */
description;
/**
* The date and time when the action was created. */
createdAt;
/**
* The date and time when the action was last updated. */
updatedAt;
createdBy;
updatedBy;
workflow;
rawData;
constructor(fields) {
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;
}
}
}
export function serializeAutomateWorkflowActionV2026R0TypeField(val) {
return val;
}
export function deserializeAutomateWorkflowActionV2026R0TypeField(val) {
if (val == 'workflow_action') {
return val;
}
throw new BoxSdkError({
message: "Can't deserialize AutomateWorkflowActionV2026R0TypeField",
});
}
export function serializeAutomateWorkflowActionV2026R0ActionTypeField(val) {
return val;
}
export function deserializeAutomateWorkflowActionV2026R0ActionTypeField(val) {
if (val == 'run_workflow') {
return val;
}
if (sdIsString(val)) {
return val;
}
throw new BoxSdkError({
message: "Can't deserialize AutomateWorkflowActionV2026R0ActionTypeField",
});
}
export 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
: serializeDateTime(val.createdAt),
['updated_at']: val.updatedAt == void 0
? val.updatedAt
: serializeDateTime(val.updatedAt),
['created_by']: val.createdBy == void 0
? val.createdBy
: serializeUserMiniV2026R0(val.createdBy),
['updated_by']: val.updatedBy == void 0
? val.updatedBy
: serializeUserMiniV2026R0(val.updatedBy),
['workflow']: serializeAutomateWorkflowReferenceV2026R0(val.workflow),
};
}
export function deserializeAutomateWorkflowActionV2026R0(val) {
if (!sdIsMap(val)) {
throw new BoxSdkError({
message: 'Expecting a map for "AutomateWorkflowActionV2026R0"',
});
}
if (val.id == void 0) {
throw new BoxSdkError({
message: 'Expecting "id" of type "AutomateWorkflowActionV2026R0" to be defined',
});
}
if (!sdIsString(val.id)) {
throw new BoxSdkError({
message: 'Expecting string for "id" of type "AutomateWorkflowActionV2026R0"',
});
}
const id = val.id;
if (val.type == void 0) {
throw new BoxSdkError({
message: 'Expecting "type" of type "AutomateWorkflowActionV2026R0" to be defined',
});
}
const type = deserializeAutomateWorkflowActionV2026R0TypeField(val.type);
if (val.action_type == void 0) {
throw new BoxSdkError({
message: 'Expecting "action_type" of type "AutomateWorkflowActionV2026R0" to be defined',
});
}
const actionType = deserializeAutomateWorkflowActionV2026R0ActionTypeField(val.action_type);
if (!(val.description == void 0) && !sdIsString(val.description)) {
throw new 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) && !sdIsString(val.created_at)) {
throw new BoxSdkError({
message: 'Expecting string for "created_at" of type "AutomateWorkflowActionV2026R0"',
});
}
const createdAt = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at);
if (!(val.updated_at == void 0) && !sdIsString(val.updated_at)) {
throw new BoxSdkError({
message: 'Expecting string for "updated_at" of type "AutomateWorkflowActionV2026R0"',
});
}
const updatedAt = val.updated_at == void 0 ? void 0 : deserializeDateTime(val.updated_at);
const createdBy = val.created_by == void 0
? void 0
: deserializeUserMiniV2026R0(val.created_by);
const updatedBy = val.updated_by == void 0
? void 0
: deserializeUserMiniV2026R0(val.updated_by);
if (val.workflow == void 0) {
throw new BoxSdkError({
message: 'Expecting "workflow" of type "AutomateWorkflowActionV2026R0" to be defined',
});
}
const workflow = deserializeAutomateWorkflowReferenceV2026R0(val.workflow);
return {
id: id,
type: type,
actionType: actionType,
description: description,
createdAt: createdAt,
updatedAt: updatedAt,
createdBy: createdBy,
updatedBy: updatedBy,
workflow: workflow,
};
}
export 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
: serializeDateTime(val.createdAt),
['updated_at']: val.updatedAt == void 0
? val.updatedAt
: serializeDateTime(val.updatedAt),
['created_by']: val.createdBy == void 0
? val.createdBy
: serializeUserMiniV2026R0(val.createdBy),
['updated_by']: val.updatedBy == void 0
? val.updatedBy
: serializeUserMiniV2026R0(val.updatedBy),
['workflow']: serializeAutomateWorkflowReferenceV2026R0(val.workflow),
};
}
export function deserializeAutomateWorkflowActionV2026R0Input(val) {
if (!sdIsMap(val)) {
throw new BoxSdkError({
message: 'Expecting a map for "AutomateWorkflowActionV2026R0Input"',
});
}
if (val.id == void 0) {
throw new BoxSdkError({
message: 'Expecting "id" of type "AutomateWorkflowActionV2026R0Input" to be defined',
});
}
if (!sdIsString(val.id)) {
throw new 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) && !sdIsString(val.description)) {
throw new 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) && !sdIsString(val.created_at)) {
throw new BoxSdkError({
message: 'Expecting string for "created_at" of type "AutomateWorkflowActionV2026R0Input"',
});
}
const createdAt = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at);
if (!(val.updated_at == void 0) && !sdIsString(val.updated_at)) {
throw new BoxSdkError({
message: 'Expecting string for "updated_at" of type "AutomateWorkflowActionV2026R0Input"',
});
}
const updatedAt = val.updated_at == void 0 ? void 0 : deserializeDateTime(val.updated_at);
const createdBy = val.created_by == void 0
? void 0
: deserializeUserMiniV2026R0(val.created_by);
const updatedBy = val.updated_by == void 0
? void 0
: deserializeUserMiniV2026R0(val.updated_by);
if (val.workflow == void 0) {
throw new BoxSdkError({
message: 'Expecting "workflow" of type "AutomateWorkflowActionV2026R0Input" to be defined',
});
}
const workflow = 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