UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

111 lines 4.77 kB
import { BoxSdkError } from '../../box/errors.js'; import { sdIsBoolean } from '../../serialization/json.js'; import { sdIsString } from '../../serialization/json.js'; import { sdIsMap } from '../../serialization/json.js'; export function serializeHubUpdateRequestV2025R0CopyHubAccessField(val) { return val; } export function deserializeHubUpdateRequestV2025R0CopyHubAccessField(val) { if (val == 'all') { return val; } if (val == 'company') { return val; } if (val == 'none') { return val; } if (sdIsString(val)) { return val; } throw new BoxSdkError({ message: "Can't deserialize HubUpdateRequestV2025R0CopyHubAccessField", }); } export function serializeHubUpdateRequestV2025R0(val) { return { ['title']: val.title, ['description']: val.description, ['is_ai_enabled']: val.isAiEnabled, ['is_collaboration_restricted_to_enterprise']: val.isCollaborationRestrictedToEnterprise, ['can_non_owners_invite']: val.canNonOwnersInvite, ['can_shared_link_be_created']: val.canSharedLinkBeCreated, ['can_public_shared_link_be_created']: val.canPublicSharedLinkBeCreated, ['copy_hub_access']: val.copyHubAccess == void 0 ? val.copyHubAccess : serializeHubUpdateRequestV2025R0CopyHubAccessField(val.copyHubAccess), }; } export function deserializeHubUpdateRequestV2025R0(val) { if (!sdIsMap(val)) { throw new BoxSdkError({ message: 'Expecting a map for "HubUpdateRequestV2025R0"', }); } if (!(val.title == void 0) && !sdIsString(val.title)) { throw new BoxSdkError({ message: 'Expecting string for "title" of type "HubUpdateRequestV2025R0"', }); } const title = val.title == void 0 ? void 0 : val.title; if (!(val.description == void 0) && !sdIsString(val.description)) { throw new BoxSdkError({ message: 'Expecting string for "description" of type "HubUpdateRequestV2025R0"', }); } const description = val.description == void 0 ? void 0 : val.description; if (!(val.is_ai_enabled == void 0) && !sdIsBoolean(val.is_ai_enabled)) { throw new BoxSdkError({ message: 'Expecting boolean for "is_ai_enabled" of type "HubUpdateRequestV2025R0"', }); } const isAiEnabled = val.is_ai_enabled == void 0 ? void 0 : val.is_ai_enabled; if (!(val.is_collaboration_restricted_to_enterprise == void 0) && !sdIsBoolean(val.is_collaboration_restricted_to_enterprise)) { throw new BoxSdkError({ message: 'Expecting boolean for "is_collaboration_restricted_to_enterprise" of type "HubUpdateRequestV2025R0"', }); } const isCollaborationRestrictedToEnterprise = val.is_collaboration_restricted_to_enterprise == void 0 ? void 0 : val.is_collaboration_restricted_to_enterprise; if (!(val.can_non_owners_invite == void 0) && !sdIsBoolean(val.can_non_owners_invite)) { throw new BoxSdkError({ message: 'Expecting boolean for "can_non_owners_invite" of type "HubUpdateRequestV2025R0"', }); } const canNonOwnersInvite = val.can_non_owners_invite == void 0 ? void 0 : val.can_non_owners_invite; if (!(val.can_shared_link_be_created == void 0) && !sdIsBoolean(val.can_shared_link_be_created)) { throw new BoxSdkError({ message: 'Expecting boolean for "can_shared_link_be_created" of type "HubUpdateRequestV2025R0"', }); } const canSharedLinkBeCreated = val.can_shared_link_be_created == void 0 ? void 0 : val.can_shared_link_be_created; if (!(val.can_public_shared_link_be_created == void 0) && !sdIsBoolean(val.can_public_shared_link_be_created)) { throw new BoxSdkError({ message: 'Expecting boolean for "can_public_shared_link_be_created" of type "HubUpdateRequestV2025R0"', }); } const canPublicSharedLinkBeCreated = val.can_public_shared_link_be_created == void 0 ? void 0 : val.can_public_shared_link_be_created; const copyHubAccess = val.copy_hub_access == void 0 ? void 0 : deserializeHubUpdateRequestV2025R0CopyHubAccessField(val.copy_hub_access); return { title: title, description: description, isAiEnabled: isAiEnabled, isCollaborationRestrictedToEnterprise: isCollaborationRestrictedToEnterprise, canNonOwnersInvite: canNonOwnersInvite, canSharedLinkBeCreated: canSharedLinkBeCreated, canPublicSharedLinkBeCreated: canPublicSharedLinkBeCreated, copyHubAccess: copyHubAccess, }; } //# sourceMappingURL=hubUpdateRequestV2025R0.js.map