box-node-sdk
Version:
Official SDK for Box Platform APIs
55 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 serializeQueryOrderByV2026R0DirectionField(val) {
return val;
}
export function deserializeQueryOrderByV2026R0DirectionField(val) {
if (val == 'asc') {
return val;
}
if (val == 'desc') {
return val;
}
if (sdIsString(val)) {
return val;
}
throw new BoxSdkError({
message: "Can't deserialize QueryOrderByV2026R0DirectionField",
});
}
export function serializeQueryOrderByV2026R0(val) {
return {
['field_key']: val.fieldKey,
['direction']: serializeQueryOrderByV2026R0DirectionField(val.direction),
};
}
export function deserializeQueryOrderByV2026R0(val) {
if (!sdIsMap(val)) {
throw new BoxSdkError({
message: 'Expecting a map for "QueryOrderByV2026R0"',
});
}
if (val.field_key == void 0) {
throw new BoxSdkError({
message: 'Expecting "field_key" of type "QueryOrderByV2026R0" to be defined',
});
}
if (!sdIsString(val.field_key)) {
throw new BoxSdkError({
message: 'Expecting string for "field_key" of type "QueryOrderByV2026R0"',
});
}
const fieldKey = val.field_key;
if (val.direction == void 0) {
throw new BoxSdkError({
message: 'Expecting "direction" of type "QueryOrderByV2026R0" to be defined',
});
}
const direction = deserializeQueryOrderByV2026R0DirectionField(val.direction);
return {
fieldKey: fieldKey,
direction: direction,
};
}
//# sourceMappingURL=queryOrderByV2026R0.js.map