box-node-sdk
Version:
Official SDK for Box Platform APIs
77 lines • 2.1 kB
JavaScript
import { serializeResource } from './resource.js';
import { deserializeResource } from './resource.js';
import { BoxSdkError } from '../box/errors.js';
import { sdIsString } from '../serialization/json.js';
import { sdIsMap } from '../serialization/json.js';
export function serializeResourceScopeScopeField(val) {
return val;
}
export function deserializeResourceScopeScopeField(val) {
if (val == 'annotation_edit') {
return val;
}
if (val == 'annotation_view_all') {
return val;
}
if (val == 'annotation_view_self') {
return val;
}
if (val == 'base_explorer') {
return val;
}
if (val == 'base_picker') {
return val;
}
if (val == 'base_preview') {
return val;
}
if (val == 'base_upload') {
return val;
}
if (val == 'item_delete') {
return val;
}
if (val == 'item_download') {
return val;
}
if (val == 'item_preview') {
return val;
}
if (val == 'item_rename') {
return val;
}
if (val == 'item_share') {
return val;
}
if (val == 'item_upload') {
return val;
}
if (val == 'item_read') {
return val;
}
if (sdIsString(val)) {
return val;
}
throw new BoxSdkError({
message: "Can't deserialize ResourceScopeScopeField",
});
}
export function serializeResourceScope(val) {
return {
['scope']: val.scope == void 0
? val.scope
: serializeResourceScopeScopeField(val.scope),
['object']: val.object == void 0 ? val.object : serializeResource(val.object),
};
}
export function deserializeResourceScope(val) {
if (!sdIsMap(val)) {
throw new BoxSdkError({ message: 'Expecting a map for "ResourceScope"' });
}
const scope = val.scope == void 0
? void 0
: deserializeResourceScopeScopeField(val.scope);
const object = val.object == void 0 ? void 0 : deserializeResource(val.object);
return { scope: scope, object: object };
}
//# sourceMappingURL=resourceScope.js.map