box-node-sdk
Version:
Official SDK for Box Platform APIs
51 lines • 1.74 kB
JavaScript
import { BoxSdkError } from '../box/errors.js';
import { sdIsString } from '../serialization/json.js';
import { sdIsMap } from '../serialization/json.js';
export function serializeAiTaxonomyFileReferenceTypeField(val) {
return val;
}
export function deserializeAiTaxonomyFileReferenceTypeField(val) {
if (val == 'file') {
return val;
}
throw new BoxSdkError({
message: "Can't deserialize AiTaxonomyFileReferenceTypeField",
});
}
export function serializeAiTaxonomyFileReference(val) {
return {
['type']: val.type == void 0
? val.type
: serializeAiTaxonomyFileReferenceTypeField(val.type),
['taxonomy_key']: val.taxonomyKey,
['id']: val.id,
};
}
export function deserializeAiTaxonomyFileReference(val) {
if (!sdIsMap(val)) {
throw new BoxSdkError({
message: 'Expecting a map for "AiTaxonomyFileReference"',
});
}
const type = val.type == void 0
? void 0
: deserializeAiTaxonomyFileReferenceTypeField(val.type);
if (!(val.taxonomy_key == void 0) && !sdIsString(val.taxonomy_key)) {
throw new BoxSdkError({
message: 'Expecting string for "taxonomy_key" of type "AiTaxonomyFileReference"',
});
}
const taxonomyKey = val.taxonomy_key == void 0 ? void 0 : val.taxonomy_key;
if (!(val.id == void 0) && !sdIsString(val.id)) {
throw new BoxSdkError({
message: 'Expecting string for "id" of type "AiTaxonomyFileReference"',
});
}
const id = val.id == void 0 ? void 0 : val.id;
return {
type: type,
taxonomyKey: taxonomyKey,
id: id,
};
}
//# sourceMappingURL=aiTaxonomyFileReference.js.map