UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

147 lines 6.22 kB
import { serializeDateTime } from '../../internal/utils.js'; import { deserializeDateTime } from '../../internal/utils.js'; import { BoxSdkError } from '../../box/errors.js'; import { sdIsString } from '../../serialization/json.js'; import { sdIsList } from '../../serialization/json.js'; import { sdIsMap } from '../../serialization/json.js'; export function serializeExternalCollabSecuritySettingsV2025R0(val) { return { ['denylist_domains']: val.denylistDomains == void 0 ? val.denylistDomains : val.denylistDomains.map(function (item) { return item; }), ['denylist_emails']: val.denylistEmails == void 0 ? val.denylistEmails : val.denylistEmails.map(function (item) { return item; }), ['allowlist_domains']: val.allowlistDomains == void 0 ? val.allowlistDomains : val.allowlistDomains.map(function (item) { return item; }), ['allowlist_emails']: val.allowlistEmails == void 0 ? val.allowlistEmails : val.allowlistEmails.map(function (item) { return item; }), ['state']: val.state, ['scheduled_status']: val.scheduledStatus, ['scheduled_at']: val.scheduledAt == void 0 ? val.scheduledAt : serializeDateTime(val.scheduledAt), ['factor_type_settings']: val.factorTypeSettings, }; } export function deserializeExternalCollabSecuritySettingsV2025R0(val) { if (!sdIsMap(val)) { throw new BoxSdkError({ message: 'Expecting a map for "ExternalCollabSecuritySettingsV2025R0"', }); } if (!(val.denylist_domains == void 0) && !sdIsList(val.denylist_domains)) { throw new BoxSdkError({ message: 'Expecting array for "denylist_domains" of type "ExternalCollabSecuritySettingsV2025R0"', }); } const denylistDomains = val.denylist_domains == void 0 ? void 0 : sdIsList(val.denylist_domains) ? val.denylist_domains.map(function (itm) { if (!sdIsString(itm)) { throw new BoxSdkError({ message: 'Expecting string for "ExternalCollabSecuritySettingsV2025R0"', }); } return itm; }) : []; if (!(val.denylist_emails == void 0) && !sdIsList(val.denylist_emails)) { throw new BoxSdkError({ message: 'Expecting array for "denylist_emails" of type "ExternalCollabSecuritySettingsV2025R0"', }); } const denylistEmails = val.denylist_emails == void 0 ? void 0 : sdIsList(val.denylist_emails) ? val.denylist_emails.map(function (itm) { if (!sdIsString(itm)) { throw new BoxSdkError({ message: 'Expecting string for "ExternalCollabSecuritySettingsV2025R0"', }); } return itm; }) : []; if (!(val.allowlist_domains == void 0) && !sdIsList(val.allowlist_domains)) { throw new BoxSdkError({ message: 'Expecting array for "allowlist_domains" of type "ExternalCollabSecuritySettingsV2025R0"', }); } const allowlistDomains = val.allowlist_domains == void 0 ? void 0 : sdIsList(val.allowlist_domains) ? val.allowlist_domains.map(function (itm) { if (!sdIsString(itm)) { throw new BoxSdkError({ message: 'Expecting string for "ExternalCollabSecuritySettingsV2025R0"', }); } return itm; }) : []; if (!(val.allowlist_emails == void 0) && !sdIsList(val.allowlist_emails)) { throw new BoxSdkError({ message: 'Expecting array for "allowlist_emails" of type "ExternalCollabSecuritySettingsV2025R0"', }); } const allowlistEmails = val.allowlist_emails == void 0 ? void 0 : sdIsList(val.allowlist_emails) ? val.allowlist_emails.map(function (itm) { if (!sdIsString(itm)) { throw new BoxSdkError({ message: 'Expecting string for "ExternalCollabSecuritySettingsV2025R0"', }); } return itm; }) : []; if (!(val.state == void 0) && !sdIsString(val.state)) { throw new BoxSdkError({ message: 'Expecting string for "state" of type "ExternalCollabSecuritySettingsV2025R0"', }); } const state = val.state == void 0 ? void 0 : val.state; if (!(val.scheduled_status == void 0) && !sdIsString(val.scheduled_status)) { throw new BoxSdkError({ message: 'Expecting string for "scheduled_status" of type "ExternalCollabSecuritySettingsV2025R0"', }); } const scheduledStatus = val.scheduled_status == void 0 ? void 0 : val.scheduled_status; if (!(val.scheduled_at == void 0) && !sdIsString(val.scheduled_at)) { throw new BoxSdkError({ message: 'Expecting string for "scheduled_at" of type "ExternalCollabSecuritySettingsV2025R0"', }); } const scheduledAt = val.scheduled_at == void 0 ? void 0 : deserializeDateTime(val.scheduled_at); if (!(val.factor_type_settings == void 0) && !sdIsString(val.factor_type_settings)) { throw new BoxSdkError({ message: 'Expecting string for "factor_type_settings" of type "ExternalCollabSecuritySettingsV2025R0"', }); } const factorTypeSettings = val.factor_type_settings == void 0 ? void 0 : val.factor_type_settings; return { denylistDomains: denylistDomains, denylistEmails: denylistEmails, allowlistDomains: allowlistDomains, allowlistEmails: allowlistEmails, state: state, scheduledStatus: scheduledStatus, scheduledAt: scheduledAt, factorTypeSettings: factorTypeSettings, }; } //# sourceMappingURL=externalCollabSecuritySettingsV2025R0.js.map