UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

74 lines 3.11 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 serializeKeysafeSettingsV2025R0(val) { return { ['keysafe_enabled']: val.keysafeEnabled, ['cloud_provider']: val.cloudProvider, ['key_id']: val.keyId, ['account_id']: val.accountId, ['location_id']: val.locationId, ['project_id']: val.projectId, ['keyring_id']: val.keyringId, }; } export function deserializeKeysafeSettingsV2025R0(val) { if (!sdIsMap(val)) { throw new BoxSdkError({ message: 'Expecting a map for "KeysafeSettingsV2025R0"', }); } if (!(val.keysafe_enabled == void 0) && !sdIsBoolean(val.keysafe_enabled)) { throw new BoxSdkError({ message: 'Expecting boolean for "keysafe_enabled" of type "KeysafeSettingsV2025R0"', }); } const keysafeEnabled = val.keysafe_enabled == void 0 ? void 0 : val.keysafe_enabled; if (!(val.cloud_provider == void 0) && !sdIsString(val.cloud_provider)) { throw new BoxSdkError({ message: 'Expecting string for "cloud_provider" of type "KeysafeSettingsV2025R0"', }); } const cloudProvider = val.cloud_provider == void 0 ? void 0 : val.cloud_provider; if (!(val.key_id == void 0) && !sdIsString(val.key_id)) { throw new BoxSdkError({ message: 'Expecting string for "key_id" of type "KeysafeSettingsV2025R0"', }); } const keyId = val.key_id == void 0 ? void 0 : val.key_id; if (!(val.account_id == void 0) && !sdIsString(val.account_id)) { throw new BoxSdkError({ message: 'Expecting string for "account_id" of type "KeysafeSettingsV2025R0"', }); } const accountId = val.account_id == void 0 ? void 0 : val.account_id; if (!(val.location_id == void 0) && !sdIsString(val.location_id)) { throw new BoxSdkError({ message: 'Expecting string for "location_id" of type "KeysafeSettingsV2025R0"', }); } const locationId = val.location_id == void 0 ? void 0 : val.location_id; if (!(val.project_id == void 0) && !sdIsString(val.project_id)) { throw new BoxSdkError({ message: 'Expecting string for "project_id" of type "KeysafeSettingsV2025R0"', }); } const projectId = val.project_id == void 0 ? void 0 : val.project_id; if (!(val.keyring_id == void 0) && !sdIsString(val.keyring_id)) { throw new BoxSdkError({ message: 'Expecting string for "keyring_id" of type "KeysafeSettingsV2025R0"', }); } const keyringId = val.keyring_id == void 0 ? void 0 : val.keyring_id; return { keysafeEnabled: keysafeEnabled, cloudProvider: cloudProvider, keyId: keyId, accountId: accountId, locationId: locationId, projectId: projectId, keyringId: keyringId, }; } //# sourceMappingURL=keysafeSettingsV2025R0.js.map