box-node-sdk
Version:
Official SDK for Box Platform APIs
49 lines • 1.95 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeAiDialogueHistory = serializeAiDialogueHistory;
exports.deserializeAiDialogueHistory = deserializeAiDialogueHistory;
const utils_1 = require("../internal/utils");
const utils_2 = require("../internal/utils");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
const json_2 = require("../serialization/json");
function serializeAiDialogueHistory(val) {
return {
['prompt']: val.prompt,
['answer']: val.answer,
['created_at']: val.createdAt == void 0
? val.createdAt
: (0, utils_1.serializeDateTime)(val.createdAt),
};
}
function deserializeAiDialogueHistory(val) {
if (!(0, json_2.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "AiDialogueHistory"',
});
}
if (!(val.prompt == void 0) && !(0, json_1.sdIsString)(val.prompt)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "prompt" of type "AiDialogueHistory"',
});
}
const prompt = val.prompt == void 0 ? void 0 : val.prompt;
if (!(val.answer == void 0) && !(0, json_1.sdIsString)(val.answer)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "answer" of type "AiDialogueHistory"',
});
}
const answer = val.answer == void 0 ? void 0 : val.answer;
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 "AiDialogueHistory"',
});
}
const createdAt = val.created_at == void 0 ? void 0 : (0, utils_2.deserializeDateTime)(val.created_at);
return {
prompt: prompt,
answer: answer,
createdAt: createdAt,
};
}
//# sourceMappingURL=aiDialogueHistory.js.map