UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

98 lines 3.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AiAgentReference = void 0; exports.serializeAiAgentReferenceTypeField = serializeAiAgentReferenceTypeField; exports.deserializeAiAgentReferenceTypeField = deserializeAiAgentReferenceTypeField; exports.serializeAiAgentReference = serializeAiAgentReference; exports.deserializeAiAgentReference = deserializeAiAgentReference; exports.serializeAiAgentReferenceInput = serializeAiAgentReferenceInput; exports.deserializeAiAgentReferenceInput = deserializeAiAgentReferenceInput; const errors_1 = require("../box/errors"); const json_1 = require("../serialization/json"); const json_2 = require("../serialization/json"); class AiAgentReference { /** * The type of AI agent used to handle queries. */ type = 'ai_agent_id'; /** * The ID of an Agent. This can be a numeric ID for custom agents (for example, `14031`) * or a unique identifier for pre-built agents (for example, `enhanced_extract_agent` * for the [Enhanced Extract Agent](https://developer.box.com/guides/box-ai/ai-tutorials/extract-metadata-structured#enhanced-extract-agent)). */ id; rawData; constructor(fields) { if (fields.type !== undefined) { this.type = fields.type; } if (fields.id !== undefined) { this.id = fields.id; } if (fields.rawData !== undefined) { this.rawData = fields.rawData; } } } exports.AiAgentReference = AiAgentReference; function serializeAiAgentReferenceTypeField(val) { return val; } function deserializeAiAgentReferenceTypeField(val) { if (val == 'ai_agent_id') { return val; } throw new errors_1.BoxSdkError({ message: "Can't deserialize AiAgentReferenceTypeField", }); } function serializeAiAgentReference(val) { return { ['type']: serializeAiAgentReferenceTypeField(val.type), ['id']: val.id, }; } function deserializeAiAgentReference(val) { if (!(0, json_2.sdIsMap)(val)) { throw new errors_1.BoxSdkError({ message: 'Expecting a map for "AiAgentReference"', }); } if (val.type == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "type" of type "AiAgentReference" to be defined', }); } const type = deserializeAiAgentReferenceTypeField(val.type); if (!(val.id == void 0) && !(0, json_1.sdIsString)(val.id)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "id" of type "AiAgentReference"', }); } const id = val.id == void 0 ? void 0 : val.id; return { type: type, id: id }; } function serializeAiAgentReferenceInput(val) { return { ['type']: val.type == void 0 ? val.type : serializeAiAgentReferenceTypeField(val.type), ['id']: val.id, }; } function deserializeAiAgentReferenceInput(val) { if (!(0, json_2.sdIsMap)(val)) { throw new errors_1.BoxSdkError({ message: 'Expecting a map for "AiAgentReferenceInput"', }); } const type = val.type == void 0 ? void 0 : deserializeAiAgentReferenceTypeField(val.type); if (!(val.id == void 0) && !(0, json_1.sdIsString)(val.id)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "id" of type "AiAgentReferenceInput"', }); } const id = val.id == void 0 ? void 0 : val.id; return { type: type, id: id }; } //# sourceMappingURL=aiAgentReference.js.map