box-node-sdk
Version:
Official SDK for Box Platform APIs
55 lines • 2.02 kB
JavaScript
import { BoxSdkError } from '../../box/errors.js';
import { sdIsString } from '../../serialization/json.js';
import { sdIsList } from '../../serialization/json.js';
import { sdIsMap } from '../../serialization/json.js';
export function serializeAutomateWorkflowStartRequestV2026R0(val) {
return {
['workflow_action_id']: val.workflowActionId,
['file_ids']: val.fileIds.map(function (item) {
return item;
}),
};
}
export function deserializeAutomateWorkflowStartRequestV2026R0(val) {
if (!sdIsMap(val)) {
throw new BoxSdkError({
message: 'Expecting a map for "AutomateWorkflowStartRequestV2026R0"',
});
}
if (val.workflow_action_id == void 0) {
throw new BoxSdkError({
message: 'Expecting "workflow_action_id" of type "AutomateWorkflowStartRequestV2026R0" to be defined',
});
}
if (!sdIsString(val.workflow_action_id)) {
throw new BoxSdkError({
message: 'Expecting string for "workflow_action_id" of type "AutomateWorkflowStartRequestV2026R0"',
});
}
const workflowActionId = val.workflow_action_id;
if (val.file_ids == void 0) {
throw new BoxSdkError({
message: 'Expecting "file_ids" of type "AutomateWorkflowStartRequestV2026R0" to be defined',
});
}
if (!sdIsList(val.file_ids)) {
throw new BoxSdkError({
message: 'Expecting array for "file_ids" of type "AutomateWorkflowStartRequestV2026R0"',
});
}
const fileIds = sdIsList(val.file_ids)
? val.file_ids.map(function (itm) {
if (!sdIsString(itm)) {
throw new BoxSdkError({
message: 'Expecting string for "AutomateWorkflowStartRequestV2026R0"',
});
}
return itm;
})
: [];
return {
workflowActionId: workflowActionId,
fileIds: fileIds,
};
}
//# sourceMappingURL=automateWorkflowStartRequestV2026R0.js.map