diff --git a/.codegen.json b/.codegen.json index 96dd42d3..aeee49c4 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "5012b13", "specHash": "d5769a1", "version": "0.5.4" } +{ "engineHash": "3d5462a", "specHash": "d5769a1", "version": "0.5.4" } diff --git a/package-lock.json b/package-lock.json index b981903a..26772052 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2130,9 +2130,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.762", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.762.tgz", - "integrity": "sha512-rrFvGweLxPwwSwJOjIopy3Vr+J3cIPtZzuc74bmlvmBIgQO3VYJDvVrlj94iKZ3ukXUH64Ex31hSfRTLqvjYJQ==", + "version": "1.4.763", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.763.tgz", + "integrity": "sha512-k4J8NrtJ9QrvHLRo8Q18OncqBCB7tIUyqxRcJnlonQ0ioHKYB988GcDFF3ZePmnb8eHEopDs/wPHR/iGAFgoUQ==", "dev": true }, "node_modules/emittery": { @@ -6219,9 +6219,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.4.762", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.762.tgz", - "integrity": "sha512-rrFvGweLxPwwSwJOjIopy3Vr+J3cIPtZzuc74bmlvmBIgQO3VYJDvVrlj94iKZ3ukXUH64Ex31hSfRTLqvjYJQ==", + "version": "1.4.763", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.763.tgz", + "integrity": "sha512-k4J8NrtJ9QrvHLRo8Q18OncqBCB7tIUyqxRcJnlonQ0ioHKYB988GcDFF3ZePmnb8eHEopDs/wPHR/iGAFgoUQ==", "dev": true }, "emittery": { diff --git a/src/box/jwtAuth.generated.ts b/src/box/jwtAuth.generated.ts index 9d14a743..de8644a6 100644 --- a/src/box/jwtAuth.generated.ts +++ b/src/box/jwtAuth.generated.ts @@ -318,10 +318,51 @@ export function serializeJwtConfigAppSettingsAppAuth( }; } export function deserializeJwtConfigAppSettingsAppAuth( - val: any + val: SerializedData ): JwtConfigAppSettingsAppAuth { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "JwtConfigAppSettingsAppAuth"', + }); + } + if (val.publicKeyID == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "publicKeyID" of type "JwtConfigAppSettingsAppAuth" to be defined', + }); + } + if (!sdIsString(val.publicKeyID)) { + throw new BoxSdkError({ + message: + 'Expecting string for "publicKeyID" of type "JwtConfigAppSettingsAppAuth"', + }); + } const publicKeyId: string = val.publicKeyID; + if (val.privateKey == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "privateKey" of type "JwtConfigAppSettingsAppAuth" to be defined', + }); + } + if (!sdIsString(val.privateKey)) { + throw new BoxSdkError({ + message: + 'Expecting string for "privateKey" of type "JwtConfigAppSettingsAppAuth"', + }); + } const privateKey: string = val.privateKey; + if (val.passphrase == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "passphrase" of type "JwtConfigAppSettingsAppAuth" to be defined', + }); + } + if (!sdIsString(val.passphrase)) { + throw new BoxSdkError({ + message: + 'Expecting string for "passphrase" of type "JwtConfigAppSettingsAppAuth"', + }); + } const passphrase: string = val.passphrase; return { publicKeyId: publicKeyId, @@ -339,10 +380,44 @@ export function serializeJwtConfigAppSettings( }; } export function deserializeJwtConfigAppSettings( - val: any + val: SerializedData ): JwtConfigAppSettings { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "JwtConfigAppSettings"', + }); + } + if (val.clientID == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "clientID" of type "JwtConfigAppSettings" to be defined', + }); + } + if (!sdIsString(val.clientID)) { + throw new BoxSdkError({ + message: 'Expecting string for "clientID" of type "JwtConfigAppSettings"', + }); + } const clientId: string = val.clientID; + if (val.clientSecret == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "clientSecret" of type "JwtConfigAppSettings" to be defined', + }); + } + if (!sdIsString(val.clientSecret)) { + throw new BoxSdkError({ + message: + 'Expecting string for "clientSecret" of type "JwtConfigAppSettings"', + }); + } const clientSecret: string = val.clientSecret; + if (val.appAuth == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "appAuth" of type "JwtConfigAppSettings" to be defined', + }); + } const appAuth: JwtConfigAppSettingsAppAuth = deserializeJwtConfigAppSettingsAppAuth(val.appAuth); return { @@ -358,10 +433,29 @@ export function serializeJwtConfigFile(val: JwtConfigFile): SerializedData { ['boxAppSettings']: serializeJwtConfigAppSettings(val.boxAppSettings), }; } -export function deserializeJwtConfigFile(val: any): JwtConfigFile { +export function deserializeJwtConfigFile(val: SerializedData): JwtConfigFile { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "JwtConfigFile"' }); + } + if (!(val.enterpriseID == void 0) && !sdIsString(val.enterpriseID)) { + throw new BoxSdkError({ + message: 'Expecting string for "enterpriseID" of type "JwtConfigFile"', + }); + } const enterpriseId: undefined | string = val.enterpriseID == void 0 ? void 0 : val.enterpriseID; + if (!(val.userID == void 0) && !sdIsString(val.userID)) { + throw new BoxSdkError({ + message: 'Expecting string for "userID" of type "JwtConfigFile"', + }); + } const userId: undefined | string = val.userID == void 0 ? void 0 : val.userID; + if (val.boxAppSettings == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "boxAppSettings" of type "JwtConfigFile" to be defined', + }); + } const boxAppSettings: JwtConfigAppSettings = deserializeJwtConfigAppSettings( val.boxAppSettings ); diff --git a/src/managers/authorization.generated.ts b/src/managers/authorization.generated.ts index 56589f60..cc3855b4 100644 --- a/src/managers/authorization.generated.ts +++ b/src/managers/authorization.generated.ts @@ -366,7 +366,7 @@ export function serializeAuthorizeUserQueryParamsResponseTypeField( return val; } export function deserializeAuthorizeUserQueryParamsResponseTypeField( - val: any + val: SerializedData ): AuthorizeUserQueryParamsResponseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ diff --git a/src/managers/chunkedUploads.generated.ts b/src/managers/chunkedUploads.generated.ts index 8a7f69af..1cb59e4c 100644 --- a/src/managers/chunkedUploads.generated.ts +++ b/src/managers/chunkedUploads.generated.ts @@ -40,6 +40,7 @@ import { readByteStream } from '../internal/utils.js'; import { reduceIterator } from '../internal/utils.js'; import { Hash } from '../internal/utils.js'; import { bufferLength } from '../internal/utils.js'; +import { BoxSdkError } from '../box/errors.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; import { sdIsNumber } from '../serialization/json.js'; @@ -833,10 +834,51 @@ export function serializeCreateFileUploadSessionRequestBody( }; } export function deserializeCreateFileUploadSessionRequestBody( - val: any + val: SerializedData ): CreateFileUploadSessionRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateFileUploadSessionRequestBody"', + }); + } + if (val.folder_id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "folder_id" of type "CreateFileUploadSessionRequestBody" to be defined', + }); + } + if (!sdIsString(val.folder_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "folder_id" of type "CreateFileUploadSessionRequestBody"', + }); + } const folderId: string = val.folder_id; + if (val.file_size == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "file_size" of type "CreateFileUploadSessionRequestBody" to be defined', + }); + } + if (!sdIsNumber(val.file_size)) { + throw new BoxSdkError({ + message: + 'Expecting number for "file_size" of type "CreateFileUploadSessionRequestBody"', + }); + } const fileSize: number = val.file_size; + if (val.file_name == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "file_name" of type "CreateFileUploadSessionRequestBody" to be defined', + }); + } + if (!sdIsString(val.file_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "file_name" of type "CreateFileUploadSessionRequestBody"', + }); + } const fileName: string = val.file_name; return { folderId: folderId, @@ -853,9 +895,33 @@ export function serializeCreateFileUploadSessionForExistingFileRequestBody( }; } export function deserializeCreateFileUploadSessionForExistingFileRequestBody( - val: any + val: SerializedData ): CreateFileUploadSessionForExistingFileRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateFileUploadSessionForExistingFileRequestBody"', + }); + } + if (val.file_size == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "file_size" of type "CreateFileUploadSessionForExistingFileRequestBody" to be defined', + }); + } + if (!sdIsNumber(val.file_size)) { + throw new BoxSdkError({ + message: + 'Expecting number for "file_size" of type "CreateFileUploadSessionForExistingFileRequestBody"', + }); + } const fileSize: number = val.file_size; + if (!(val.file_name == void 0) && !sdIsString(val.file_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "file_name" of type "CreateFileUploadSessionForExistingFileRequestBody"', + }); + } const fileName: undefined | string = val.file_name == void 0 ? void 0 : val.file_name; return { @@ -873,8 +939,25 @@ export function serializeCreateFileUploadSessionCommitRequestBody( }; } export function deserializeCreateFileUploadSessionCommitRequestBody( - val: any + val: SerializedData ): CreateFileUploadSessionCommitRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateFileUploadSessionCommitRequestBody"', + }); + } + if (val.parts == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "parts" of type "CreateFileUploadSessionCommitRequestBody" to be defined', + }); + } + if (!sdIsList(val.parts)) { + throw new BoxSdkError({ + message: + 'Expecting array for "parts" of type "CreateFileUploadSessionCommitRequestBody"', + }); + } const parts: readonly UploadPart[] = sdIsList(val.parts) ? (val.parts.map(function (itm: SerializedData): UploadPart { return deserializeUploadPart(itm); diff --git a/src/managers/classifications.generated.ts b/src/managers/classifications.generated.ts index fd3b8386..2bd5abb1 100644 --- a/src/managers/classifications.generated.ts +++ b/src/managers/classifications.generated.ts @@ -544,7 +544,7 @@ export function serializeAddClassificationRequestBodyOpField( return val; } export function deserializeAddClassificationRequestBodyOpField( - val: any + val: SerializedData ): AddClassificationRequestBodyOpField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -564,7 +564,7 @@ export function serializeAddClassificationRequestBodyFieldKeyField( return val; } export function deserializeAddClassificationRequestBodyFieldKeyField( - val: any + val: SerializedData ): AddClassificationRequestBodyFieldKeyField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -591,12 +591,33 @@ export function serializeAddClassificationRequestBodyDataStaticConfigClassificat }; } export function deserializeAddClassificationRequestBodyDataStaticConfigClassificationField( - val: any + val: SerializedData ): AddClassificationRequestBodyDataStaticConfigClassificationField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "AddClassificationRequestBodyDataStaticConfigClassificationField"', + }); + } + if ( + !(val.classificationDefinition == void 0) && + !sdIsString(val.classificationDefinition) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "classificationDefinition" of type "AddClassificationRequestBodyDataStaticConfigClassificationField"', + }); + } const classificationDefinition: undefined | string = val.classificationDefinition == void 0 ? void 0 : val.classificationDefinition; + if (!(val.colorID == void 0) && !sdIsNumber(val.colorID)) { + throw new BoxSdkError({ + message: + 'Expecting number for "colorID" of type "AddClassificationRequestBodyDataStaticConfigClassificationField"', + }); + } const colorId: undefined | number = val.colorID == void 0 ? void 0 : val.colorID; return { @@ -617,8 +638,14 @@ export function serializeAddClassificationRequestBodyDataStaticConfigField( }; } export function deserializeAddClassificationRequestBodyDataStaticConfigField( - val: any + val: SerializedData ): AddClassificationRequestBodyDataStaticConfigField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "AddClassificationRequestBodyDataStaticConfigField"', + }); + } const classification: | undefined | AddClassificationRequestBodyDataStaticConfigClassificationField = @@ -645,8 +672,25 @@ export function serializeAddClassificationRequestBodyDataField( }; } export function deserializeAddClassificationRequestBodyDataField( - val: any + val: SerializedData ): AddClassificationRequestBodyDataField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AddClassificationRequestBodyDataField"', + }); + } + if (val.key == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "key" of type "AddClassificationRequestBodyDataField" to be defined', + }); + } + if (!sdIsString(val.key)) { + throw new BoxSdkError({ + message: + 'Expecting string for "key" of type "AddClassificationRequestBodyDataField"', + }); + } const key: string = val.key; const staticConfig: | undefined @@ -673,12 +717,35 @@ export function serializeAddClassificationRequestBody( }; } export function deserializeAddClassificationRequestBody( - val: any + val: SerializedData ): AddClassificationRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AddClassificationRequestBody"', + }); + } + if (val.op == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "op" of type "AddClassificationRequestBody" to be defined', + }); + } const op: AddClassificationRequestBodyOpField = deserializeAddClassificationRequestBodyOpField(val.op); + if (val.fieldKey == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "fieldKey" of type "AddClassificationRequestBody" to be defined', + }); + } const fieldKey: AddClassificationRequestBodyFieldKeyField = deserializeAddClassificationRequestBodyFieldKeyField(val.fieldKey); + if (val.data == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "data" of type "AddClassificationRequestBody" to be defined', + }); + } const data: AddClassificationRequestBodyDataField = deserializeAddClassificationRequestBodyDataField(val.data); return { @@ -703,8 +770,13 @@ export function serializeAddClassificationRequestBodyInput( }; } export function deserializeAddClassificationRequestBodyInput( - val: any + val: SerializedData ): AddClassificationRequestBodyInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AddClassificationRequestBodyInput"', + }); + } const op: undefined | AddClassificationRequestBodyOpField = val.op == void 0 ? void 0 @@ -713,6 +785,12 @@ export function deserializeAddClassificationRequestBodyInput( val.fieldKey == void 0 ? void 0 : deserializeAddClassificationRequestBodyFieldKeyField(val.fieldKey); + if (val.data == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "data" of type "AddClassificationRequestBodyInput" to be defined', + }); + } const data: AddClassificationRequestBodyDataField = deserializeAddClassificationRequestBodyDataField(val.data); return { @@ -727,7 +805,7 @@ export function serializeUpdateClassificationRequestBodyOpField( return val; } export function deserializeUpdateClassificationRequestBodyOpField( - val: any + val: SerializedData ): UpdateClassificationRequestBodyOpField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -748,7 +826,7 @@ export function serializeUpdateClassificationRequestBodyFieldKeyField( return val; } export function deserializeUpdateClassificationRequestBodyFieldKeyField( - val: any + val: SerializedData ): UpdateClassificationRequestBodyFieldKeyField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -775,12 +853,33 @@ export function serializeUpdateClassificationRequestBodyDataStaticConfigClassifi }; } export function deserializeUpdateClassificationRequestBodyDataStaticConfigClassificationField( - val: any + val: SerializedData ): UpdateClassificationRequestBodyDataStaticConfigClassificationField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateClassificationRequestBodyDataStaticConfigClassificationField"', + }); + } + if ( + !(val.classificationDefinition == void 0) && + !sdIsString(val.classificationDefinition) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "classificationDefinition" of type "UpdateClassificationRequestBodyDataStaticConfigClassificationField"', + }); + } const classificationDefinition: undefined | string = val.classificationDefinition == void 0 ? void 0 : val.classificationDefinition; + if (!(val.colorID == void 0) && !sdIsNumber(val.colorID)) { + throw new BoxSdkError({ + message: + 'Expecting number for "colorID" of type "UpdateClassificationRequestBodyDataStaticConfigClassificationField"', + }); + } const colorId: undefined | number = val.colorID == void 0 ? void 0 : val.colorID; return { @@ -801,8 +900,14 @@ export function serializeUpdateClassificationRequestBodyDataStaticConfigField( }; } export function deserializeUpdateClassificationRequestBodyDataStaticConfigField( - val: any + val: SerializedData ): UpdateClassificationRequestBodyDataStaticConfigField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateClassificationRequestBodyDataStaticConfigField"', + }); + } const classification: | undefined | UpdateClassificationRequestBodyDataStaticConfigClassificationField = @@ -829,8 +934,25 @@ export function serializeUpdateClassificationRequestBodyDataField( }; } export function deserializeUpdateClassificationRequestBodyDataField( - val: any + val: SerializedData ): UpdateClassificationRequestBodyDataField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateClassificationRequestBodyDataField"', + }); + } + if (val.key == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "key" of type "UpdateClassificationRequestBodyDataField" to be defined', + }); + } + if (!sdIsString(val.key)) { + throw new BoxSdkError({ + message: + 'Expecting string for "key" of type "UpdateClassificationRequestBodyDataField"', + }); + } const key: string = val.key; const staticConfig: | undefined @@ -858,13 +980,48 @@ export function serializeUpdateClassificationRequestBody( }; } export function deserializeUpdateClassificationRequestBody( - val: any + val: SerializedData ): UpdateClassificationRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateClassificationRequestBody"', + }); + } + if (val.op == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "op" of type "UpdateClassificationRequestBody" to be defined', + }); + } const op: UpdateClassificationRequestBodyOpField = deserializeUpdateClassificationRequestBodyOpField(val.op); + if (val.fieldKey == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "fieldKey" of type "UpdateClassificationRequestBody" to be defined', + }); + } const fieldKey: UpdateClassificationRequestBodyFieldKeyField = deserializeUpdateClassificationRequestBodyFieldKeyField(val.fieldKey); + if (val.enumOptionKey == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "enumOptionKey" of type "UpdateClassificationRequestBody" to be defined', + }); + } + if (!sdIsString(val.enumOptionKey)) { + throw new BoxSdkError({ + message: + 'Expecting string for "enumOptionKey" of type "UpdateClassificationRequestBody"', + }); + } const enumOptionKey: string = val.enumOptionKey; + if (val.data == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "data" of type "UpdateClassificationRequestBody" to be defined', + }); + } const data: UpdateClassificationRequestBodyDataField = deserializeUpdateClassificationRequestBodyDataField(val.data); return { @@ -891,8 +1048,13 @@ export function serializeUpdateClassificationRequestBodyInput( }; } export function deserializeUpdateClassificationRequestBodyInput( - val: any + val: SerializedData ): UpdateClassificationRequestBodyInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateClassificationRequestBodyInput"', + }); + } const op: undefined | UpdateClassificationRequestBodyOpField = val.op == void 0 ? void 0 @@ -901,7 +1063,25 @@ export function deserializeUpdateClassificationRequestBodyInput( val.fieldKey == void 0 ? void 0 : deserializeUpdateClassificationRequestBodyFieldKeyField(val.fieldKey); + if (val.enumOptionKey == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "enumOptionKey" of type "UpdateClassificationRequestBodyInput" to be defined', + }); + } + if (!sdIsString(val.enumOptionKey)) { + throw new BoxSdkError({ + message: + 'Expecting string for "enumOptionKey" of type "UpdateClassificationRequestBodyInput"', + }); + } const enumOptionKey: string = val.enumOptionKey; + if (val.data == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "data" of type "UpdateClassificationRequestBodyInput" to be defined', + }); + } const data: UpdateClassificationRequestBodyDataField = deserializeUpdateClassificationRequestBodyDataField(val.data); return { @@ -917,7 +1097,7 @@ export function serializeCreateClassificationTemplateRequestBodyScopeField( return val; } export function deserializeCreateClassificationTemplateRequestBodyScopeField( - val: any + val: SerializedData ): CreateClassificationTemplateRequestBodyScopeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -938,7 +1118,7 @@ export function serializeCreateClassificationTemplateRequestBodyTemplateKeyField return val; } export function deserializeCreateClassificationTemplateRequestBodyTemplateKeyField( - val: any + val: SerializedData ): CreateClassificationTemplateRequestBodyTemplateKeyField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -959,7 +1139,7 @@ export function serializeCreateClassificationTemplateRequestBodyDisplayNameField return val; } export function deserializeCreateClassificationTemplateRequestBodyDisplayNameField( - val: any + val: SerializedData ): CreateClassificationTemplateRequestBodyDisplayNameField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -980,7 +1160,7 @@ export function serializeCreateClassificationTemplateRequestBodyFieldsTypeField( return val; } export function deserializeCreateClassificationTemplateRequestBodyFieldsTypeField( - val: any + val: SerializedData ): CreateClassificationTemplateRequestBodyFieldsTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -1001,7 +1181,7 @@ export function serializeCreateClassificationTemplateRequestBodyFieldsKeyField( return val; } export function deserializeCreateClassificationTemplateRequestBodyFieldsKeyField( - val: any + val: SerializedData ): CreateClassificationTemplateRequestBodyFieldsKeyField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -1022,7 +1202,7 @@ export function serializeCreateClassificationTemplateRequestBodyFieldsDisplayNam return val; } export function deserializeCreateClassificationTemplateRequestBodyFieldsDisplayNameField( - val: any + val: SerializedData ): CreateClassificationTemplateRequestBodyFieldsDisplayNameField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -1049,12 +1229,33 @@ export function serializeCreateClassificationTemplateRequestBodyFieldsOptionsSta }; } export function deserializeCreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField( - val: any + val: SerializedData ): CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField"', + }); + } + if ( + !(val.classificationDefinition == void 0) && + !sdIsString(val.classificationDefinition) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "classificationDefinition" of type "CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField"', + }); + } const classificationDefinition: undefined | string = val.classificationDefinition == void 0 ? void 0 : val.classificationDefinition; + if (!(val.colorID == void 0) && !sdIsNumber(val.colorID)) { + throw new BoxSdkError({ + message: + 'Expecting number for "colorID" of type "CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField"', + }); + } const colorId: undefined | number = val.colorID == void 0 ? void 0 : val.colorID; return { @@ -1075,8 +1276,14 @@ export function serializeCreateClassificationTemplateRequestBodyFieldsOptionsSta }; } export function deserializeCreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField( - val: any + val: SerializedData ): CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField"', + }); + } const classification: | undefined | CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField = @@ -1103,8 +1310,26 @@ export function serializeCreateClassificationTemplateRequestBodyFieldsOptionsFie }; } export function deserializeCreateClassificationTemplateRequestBodyFieldsOptionsField( - val: any + val: SerializedData ): CreateClassificationTemplateRequestBodyFieldsOptionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateClassificationTemplateRequestBodyFieldsOptionsField"', + }); + } + if (val.key == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "key" of type "CreateClassificationTemplateRequestBodyFieldsOptionsField" to be defined', + }); + } + if (!sdIsString(val.key)) { + throw new BoxSdkError({ + message: + 'Expecting string for "key" of type "CreateClassificationTemplateRequestBodyFieldsOptionsField"', + }); + } const key: string = val.key; const staticConfig: | undefined @@ -1144,18 +1369,60 @@ export function serializeCreateClassificationTemplateRequestBodyFieldsField( }; } export function deserializeCreateClassificationTemplateRequestBodyFieldsField( - val: any + val: SerializedData ): CreateClassificationTemplateRequestBodyFieldsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateClassificationTemplateRequestBodyFieldsField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CreateClassificationTemplateRequestBodyFieldsField" to be defined', + }); + } const type: CreateClassificationTemplateRequestBodyFieldsTypeField = deserializeCreateClassificationTemplateRequestBodyFieldsTypeField(val.type); + if (val.key == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "key" of type "CreateClassificationTemplateRequestBodyFieldsField" to be defined', + }); + } const key: CreateClassificationTemplateRequestBodyFieldsKeyField = deserializeCreateClassificationTemplateRequestBodyFieldsKeyField(val.key); + if (val.displayName == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "displayName" of type "CreateClassificationTemplateRequestBodyFieldsField" to be defined', + }); + } const displayName: CreateClassificationTemplateRequestBodyFieldsDisplayNameField = deserializeCreateClassificationTemplateRequestBodyFieldsDisplayNameField( val.displayName ); + if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "hidden" of type "CreateClassificationTemplateRequestBodyFieldsField"', + }); + } const hidden: undefined | boolean = val.hidden == void 0 ? void 0 : val.hidden; + if (val.options == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "options" of type "CreateClassificationTemplateRequestBodyFieldsField" to be defined', + }); + } + if (!sdIsList(val.options)) { + throw new BoxSdkError({ + message: + 'Expecting array for "options" of type "CreateClassificationTemplateRequestBodyFieldsField"', + }); + } const options: readonly CreateClassificationTemplateRequestBodyFieldsOptionsField[] = sdIsList(val.options) ? (val.options.map(function ( @@ -1207,8 +1474,14 @@ export function serializeCreateClassificationTemplateRequestBodyFieldsFieldInput }; } export function deserializeCreateClassificationTemplateRequestBodyFieldsFieldInput( - val: any + val: SerializedData ): CreateClassificationTemplateRequestBodyFieldsFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateClassificationTemplateRequestBodyFieldsFieldInput"', + }); + } const type: | undefined | CreateClassificationTemplateRequestBodyFieldsTypeField = @@ -1231,8 +1504,26 @@ export function deserializeCreateClassificationTemplateRequestBodyFieldsFieldInp : deserializeCreateClassificationTemplateRequestBodyFieldsDisplayNameField( val.displayName ); + if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "hidden" of type "CreateClassificationTemplateRequestBodyFieldsFieldInput"', + }); + } const hidden: undefined | boolean = val.hidden == void 0 ? void 0 : val.hidden; + if (val.options == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "options" of type "CreateClassificationTemplateRequestBodyFieldsFieldInput" to be defined', + }); + } + if (!sdIsList(val.options)) { + throw new BoxSdkError({ + message: + 'Expecting array for "options" of type "CreateClassificationTemplateRequestBodyFieldsFieldInput"', + }); + } const options: readonly CreateClassificationTemplateRequestBodyFieldsOptionsField[] = sdIsList(val.options) ? (val.options.map(function ( @@ -1279,22 +1570,72 @@ export function serializeCreateClassificationTemplateRequestBody( }; } export function deserializeCreateClassificationTemplateRequestBody( - val: any + val: SerializedData ): CreateClassificationTemplateRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateClassificationTemplateRequestBody"', + }); + } + if (val.scope == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "scope" of type "CreateClassificationTemplateRequestBody" to be defined', + }); + } const scope: CreateClassificationTemplateRequestBodyScopeField = deserializeCreateClassificationTemplateRequestBodyScopeField(val.scope); + if (val.templateKey == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "templateKey" of type "CreateClassificationTemplateRequestBody" to be defined', + }); + } const templateKey: CreateClassificationTemplateRequestBodyTemplateKeyField = deserializeCreateClassificationTemplateRequestBodyTemplateKeyField( val.templateKey ); + if (val.displayName == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "displayName" of type "CreateClassificationTemplateRequestBody" to be defined', + }); + } const displayName: CreateClassificationTemplateRequestBodyDisplayNameField = deserializeCreateClassificationTemplateRequestBodyDisplayNameField( val.displayName ); + if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "hidden" of type "CreateClassificationTemplateRequestBody"', + }); + } const hidden: undefined | boolean = val.hidden == void 0 ? void 0 : val.hidden; + if ( + !(val.copyInstanceOnItemCopy == void 0) && + !sdIsBoolean(val.copyInstanceOnItemCopy) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "copyInstanceOnItemCopy" of type "CreateClassificationTemplateRequestBody"', + }); + } const copyInstanceOnItemCopy: undefined | boolean = val.copyInstanceOnItemCopy == void 0 ? void 0 : val.copyInstanceOnItemCopy; + if (val.fields == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "fields" of type "CreateClassificationTemplateRequestBody" to be defined', + }); + } + if (!sdIsList(val.fields)) { + throw new BoxSdkError({ + message: + 'Expecting array for "fields" of type "CreateClassificationTemplateRequestBody"', + }); + } const fields: readonly CreateClassificationTemplateRequestBodyFieldsField[] = sdIsList(val.fields) ? (val.fields.map(function ( @@ -1347,8 +1688,14 @@ export function serializeCreateClassificationTemplateRequestBodyInput( }; } export function deserializeCreateClassificationTemplateRequestBodyInput( - val: any + val: SerializedData ): CreateClassificationTemplateRequestBodyInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateClassificationTemplateRequestBodyInput"', + }); + } const scope: undefined | CreateClassificationTemplateRequestBodyScopeField = val.scope == void 0 ? void 0 @@ -1369,10 +1716,37 @@ export function deserializeCreateClassificationTemplateRequestBodyInput( : deserializeCreateClassificationTemplateRequestBodyDisplayNameField( val.displayName ); + if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "hidden" of type "CreateClassificationTemplateRequestBodyInput"', + }); + } const hidden: undefined | boolean = val.hidden == void 0 ? void 0 : val.hidden; + if ( + !(val.copyInstanceOnItemCopy == void 0) && + !sdIsBoolean(val.copyInstanceOnItemCopy) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "copyInstanceOnItemCopy" of type "CreateClassificationTemplateRequestBodyInput"', + }); + } const copyInstanceOnItemCopy: undefined | boolean = val.copyInstanceOnItemCopy == void 0 ? void 0 : val.copyInstanceOnItemCopy; + if (val.fields == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "fields" of type "CreateClassificationTemplateRequestBodyInput" to be defined', + }); + } + if (!sdIsList(val.fields)) { + throw new BoxSdkError({ + message: + 'Expecting array for "fields" of type "CreateClassificationTemplateRequestBodyInput"', + }); + } const fields: readonly CreateClassificationTemplateRequestBodyFieldsField[] = sdIsList(val.fields) ? (val.fields.map(function ( diff --git a/src/managers/collaborationAllowlistEntries.generated.ts b/src/managers/collaborationAllowlistEntries.generated.ts index 3dba0f15..10638526 100644 --- a/src/managers/collaborationAllowlistEntries.generated.ts +++ b/src/managers/collaborationAllowlistEntries.generated.ts @@ -368,7 +368,7 @@ export function serializeCreateCollaborationWhitelistEntryRequestBodyDirectionFi return val; } export function deserializeCreateCollaborationWhitelistEntryRequestBodyDirectionField( - val: any + val: SerializedData ): CreateCollaborationWhitelistEntryRequestBodyDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -401,9 +401,33 @@ export function serializeCreateCollaborationWhitelistEntryRequestBody( }; } export function deserializeCreateCollaborationWhitelistEntryRequestBody( - val: any + val: SerializedData ): CreateCollaborationWhitelistEntryRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateCollaborationWhitelistEntryRequestBody"', + }); + } + if (val.domain == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "domain" of type "CreateCollaborationWhitelistEntryRequestBody" to be defined', + }); + } + if (!sdIsString(val.domain)) { + throw new BoxSdkError({ + message: + 'Expecting string for "domain" of type "CreateCollaborationWhitelistEntryRequestBody"', + }); + } const domain: string = val.domain; + if (val.direction == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "direction" of type "CreateCollaborationWhitelistEntryRequestBody" to be defined', + }); + } const direction: CreateCollaborationWhitelistEntryRequestBodyDirectionField = deserializeCreateCollaborationWhitelistEntryRequestBodyDirectionField( val.direction diff --git a/src/managers/collaborationAllowlistExemptTargets.generated.ts b/src/managers/collaborationAllowlistExemptTargets.generated.ts index 7d67e55e..9c0f1b18 100644 --- a/src/managers/collaborationAllowlistExemptTargets.generated.ts +++ b/src/managers/collaborationAllowlistExemptTargets.generated.ts @@ -18,6 +18,7 @@ import { FetchOptions } from '../networking/fetch.js'; import { FetchResponse } from '../networking/fetch.js'; import { fetch } from '../networking/fetch.js'; import { SerializedData } from '../serialization/json.js'; +import { BoxSdkError } from '../box/errors.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; import { sdIsNumber } from '../serialization/json.js'; @@ -388,8 +389,26 @@ export function serializeCreateCollaborationWhitelistExemptTargetRequestBodyUser return { ['id']: val.id }; } export function deserializeCreateCollaborationWhitelistExemptTargetRequestBodyUserField( - val: any + val: SerializedData ): CreateCollaborationWhitelistExemptTargetRequestBodyUserField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateCollaborationWhitelistExemptTargetRequestBodyUserField"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateCollaborationWhitelistExemptTargetRequestBodyUserField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateCollaborationWhitelistExemptTargetRequestBodyUserField"', + }); + } const id: string = val.id; return { id: id, @@ -406,8 +425,20 @@ export function serializeCreateCollaborationWhitelistExemptTargetRequestBody( }; } export function deserializeCreateCollaborationWhitelistExemptTargetRequestBody( - val: any + val: SerializedData ): CreateCollaborationWhitelistExemptTargetRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateCollaborationWhitelistExemptTargetRequestBody"', + }); + } + if (val.user == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "user" of type "CreateCollaborationWhitelistExemptTargetRequestBody" to be defined', + }); + } const user: CreateCollaborationWhitelistExemptTargetRequestBodyUserField = deserializeCreateCollaborationWhitelistExemptTargetRequestBodyUserField( val.user diff --git a/src/managers/comments.generated.ts b/src/managers/comments.generated.ts index 0023f8c0..923f3cd4 100644 --- a/src/managers/comments.generated.ts +++ b/src/managers/comments.generated.ts @@ -539,8 +539,19 @@ export function serializeUpdateCommentByIdRequestBody( return { ['message']: val.message == void 0 ? void 0 : val.message }; } export function deserializeUpdateCommentByIdRequestBody( - val: any + val: SerializedData ): UpdateCommentByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateCommentByIdRequestBody"', + }); + } + if (!(val.message == void 0) && !sdIsString(val.message)) { + throw new BoxSdkError({ + message: + 'Expecting string for "message" of type "UpdateCommentByIdRequestBody"', + }); + } const message: undefined | string = val.message == void 0 ? void 0 : val.message; return { message: message } satisfies UpdateCommentByIdRequestBody; @@ -551,7 +562,7 @@ export function serializeCreateCommentRequestBodyItemTypeField( return val; } export function deserializeCreateCommentRequestBodyItemTypeField( - val: any + val: SerializedData ): CreateCommentRequestBodyItemTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -577,9 +588,32 @@ export function serializeCreateCommentRequestBodyItemField( }; } export function deserializeCreateCommentRequestBodyItemField( - val: any + val: SerializedData ): CreateCommentRequestBodyItemField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateCommentRequestBodyItemField"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateCommentRequestBodyItemField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateCommentRequestBodyItemField"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CreateCommentRequestBodyItemField" to be defined', + }); + } const type: CreateCommentRequestBodyItemTypeField = deserializeCreateCommentRequestBodyItemTypeField(val.type); return { id: id, type: type } satisfies CreateCommentRequestBodyItemField; @@ -595,11 +629,40 @@ export function serializeCreateCommentRequestBody( }; } export function deserializeCreateCommentRequestBody( - val: any + val: SerializedData ): CreateCommentRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateCommentRequestBody"', + }); + } + if (val.message == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "message" of type "CreateCommentRequestBody" to be defined', + }); + } + if (!sdIsString(val.message)) { + throw new BoxSdkError({ + message: + 'Expecting string for "message" of type "CreateCommentRequestBody"', + }); + } const message: string = val.message; + if (!(val.tagged_message == void 0) && !sdIsString(val.tagged_message)) { + throw new BoxSdkError({ + message: + 'Expecting string for "tagged_message" of type "CreateCommentRequestBody"', + }); + } const taggedMessage: undefined | string = val.tagged_message == void 0 ? void 0 : val.tagged_message; + if (val.item == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "item" of type "CreateCommentRequestBody" to be defined', + }); + } const item: CreateCommentRequestBodyItemField = deserializeCreateCommentRequestBodyItemField(val.item); return { diff --git a/src/managers/devicePinners.generated.ts b/src/managers/devicePinners.generated.ts index d78d43c9..3fdc0e15 100644 --- a/src/managers/devicePinners.generated.ts +++ b/src/managers/devicePinners.generated.ts @@ -313,7 +313,7 @@ export function serializeGetEnterpriseDevicePinnersQueryParamsDirectionField( return val; } export function deserializeGetEnterpriseDevicePinnersQueryParamsDirectionField( - val: any + val: SerializedData ): GetEnterpriseDevicePinnersQueryParamsDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ diff --git a/src/managers/emailAliases.generated.ts b/src/managers/emailAliases.generated.ts index d85e359a..e4959ca5 100644 --- a/src/managers/emailAliases.generated.ts +++ b/src/managers/emailAliases.generated.ts @@ -18,6 +18,7 @@ import { FetchResponse } from '../networking/fetch.js'; import { fetch } from '../networking/fetch.js'; import { sdToJson } from '../serialization/json.js'; import { SerializedData } from '../serialization/json.js'; +import { BoxSdkError } from '../box/errors.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; import { sdIsNumber } from '../serialization/json.js'; @@ -295,8 +296,25 @@ export function serializeCreateUserEmailAliasRequestBody( return { ['email']: val.email }; } export function deserializeCreateUserEmailAliasRequestBody( - val: any + val: SerializedData ): CreateUserEmailAliasRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateUserEmailAliasRequestBody"', + }); + } + if (val.email == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "email" of type "CreateUserEmailAliasRequestBody" to be defined', + }); + } + if (!sdIsString(val.email)) { + throw new BoxSdkError({ + message: + 'Expecting string for "email" of type "CreateUserEmailAliasRequestBody"', + }); + } const email: string = val.email; return { email: email } satisfies CreateUserEmailAliasRequestBody; } diff --git a/src/managers/events.generated.ts b/src/managers/events.generated.ts index 7cf5201d..5debf8d4 100644 --- a/src/managers/events.generated.ts +++ b/src/managers/events.generated.ts @@ -295,7 +295,7 @@ export function serializeGetEventsQueryParamsStreamTypeField( return val; } export function deserializeGetEventsQueryParamsStreamTypeField( - val: any + val: SerializedData ): GetEventsQueryParamsStreamTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -327,7 +327,7 @@ export function serializeGetEventsQueryParamsEventTypeField( return val; } export function deserializeGetEventsQueryParamsEventTypeField( - val: any + val: SerializedData ): GetEventsQueryParamsEventTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ diff --git a/src/managers/fileClassifications.generated.ts b/src/managers/fileClassifications.generated.ts index 074aeb74..c466b4ea 100644 --- a/src/managers/fileClassifications.generated.ts +++ b/src/managers/fileClassifications.generated.ts @@ -423,8 +423,22 @@ export function serializeAddClassificationToFileRequestBody( }; } export function deserializeAddClassificationToFileRequestBody( - val: any + val: SerializedData ): AddClassificationToFileRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AddClassificationToFileRequestBody"', + }); + } + if ( + !(val.Box__Security__Classification__Key == void 0) && + !sdIsString(val.Box__Security__Classification__Key) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "Box__Security__Classification__Key" of type "AddClassificationToFileRequestBody"', + }); + } const boxSecurityClassificationKey: undefined | string = val.Box__Security__Classification__Key == void 0 ? void 0 @@ -439,7 +453,7 @@ export function serializeUpdateClassificationOnFileRequestBodyOpField( return val; } export function deserializeUpdateClassificationOnFileRequestBodyOpField( - val: any + val: SerializedData ): UpdateClassificationOnFileRequestBodyOpField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -460,7 +474,7 @@ export function serializeUpdateClassificationOnFileRequestBodyPathField( return val; } export function deserializeUpdateClassificationOnFileRequestBodyPathField( - val: any + val: SerializedData ): UpdateClassificationOnFileRequestBodyPathField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -485,12 +499,41 @@ export function serializeUpdateClassificationOnFileRequestBody( }; } export function deserializeUpdateClassificationOnFileRequestBody( - val: any + val: SerializedData ): UpdateClassificationOnFileRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateClassificationOnFileRequestBody"', + }); + } + if (val.op == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "op" of type "UpdateClassificationOnFileRequestBody" to be defined', + }); + } const op: UpdateClassificationOnFileRequestBodyOpField = deserializeUpdateClassificationOnFileRequestBodyOpField(val.op); + if (val.path == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "path" of type "UpdateClassificationOnFileRequestBody" to be defined', + }); + } const path: UpdateClassificationOnFileRequestBodyPathField = deserializeUpdateClassificationOnFileRequestBodyPathField(val.path); + if (val.value == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "value" of type "UpdateClassificationOnFileRequestBody" to be defined', + }); + } + if (!sdIsString(val.value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "value" of type "UpdateClassificationOnFileRequestBody"', + }); + } const value: string = val.value; return { op: op, @@ -514,8 +557,14 @@ export function serializeUpdateClassificationOnFileRequestBodyInput( }; } export function deserializeUpdateClassificationOnFileRequestBodyInput( - val: any + val: SerializedData ): UpdateClassificationOnFileRequestBodyInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateClassificationOnFileRequestBodyInput"', + }); + } const op: undefined | UpdateClassificationOnFileRequestBodyOpField = val.op == void 0 ? void 0 @@ -524,6 +573,18 @@ export function deserializeUpdateClassificationOnFileRequestBodyInput( val.path == void 0 ? void 0 : deserializeUpdateClassificationOnFileRequestBodyPathField(val.path); + if (val.value == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "value" of type "UpdateClassificationOnFileRequestBodyInput" to be defined', + }); + } + if (!sdIsString(val.value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "value" of type "UpdateClassificationOnFileRequestBodyInput"', + }); + } const value: string = val.value; return { op: op, diff --git a/src/managers/fileMetadata.generated.ts b/src/managers/fileMetadata.generated.ts index 6584b0ff..67f0b47c 100644 --- a/src/managers/fileMetadata.generated.ts +++ b/src/managers/fileMetadata.generated.ts @@ -485,7 +485,7 @@ export function serializeGetFileMetadataByIdScope( return val; } export function deserializeGetFileMetadataByIdScope( - val: any + val: SerializedData ): GetFileMetadataByIdScope { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -508,7 +508,7 @@ export function serializeCreateFileMetadataByIdScope( return val; } export function deserializeCreateFileMetadataByIdScope( - val: any + val: SerializedData ): CreateFileMetadataByIdScope { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -540,9 +540,20 @@ export function serializeCreateFileMetadataByIdRequestBody( }; } export function deserializeCreateFileMetadataByIdRequestBody( - val: any + val: SerializedData ): CreateFileMetadataByIdRequestBody { - return val; + return sdIsMap(val) + ? (Object.fromEntries( + Object.entries(val).map(([k, v]: [string, any]) => [ + k, + (function (v: any): any { + return v; + })(v), + ]) + ) as { + readonly [key: string]: any; + }) + : {}; } export function serializeUpdateFileMetadataByIdScope( val: UpdateFileMetadataByIdScope @@ -550,7 +561,7 @@ export function serializeUpdateFileMetadataByIdScope( return val; } export function deserializeUpdateFileMetadataByIdScope( - val: any + val: SerializedData ): UpdateFileMetadataByIdScope { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -573,7 +584,7 @@ export function serializeUpdateFileMetadataByIdRequestBodyOpField( return val; } export function deserializeUpdateFileMetadataByIdRequestBodyOpField( - val: any + val: SerializedData ): UpdateFileMetadataByIdRequestBodyOpField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -617,14 +628,37 @@ export function serializeUpdateFileMetadataByIdRequestBody( }; } export function deserializeUpdateFileMetadataByIdRequestBody( - val: any + val: SerializedData ): UpdateFileMetadataByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateFileMetadataByIdRequestBody"', + }); + } const op: undefined | UpdateFileMetadataByIdRequestBodyOpField = val.op == void 0 ? void 0 : deserializeUpdateFileMetadataByIdRequestBodyOpField(val.op); + if (!(val.path == void 0) && !sdIsString(val.path)) { + throw new BoxSdkError({ + message: + 'Expecting string for "path" of type "UpdateFileMetadataByIdRequestBody"', + }); + } const path: undefined | string = val.path == void 0 ? void 0 : val.path; + if (!(val.value == void 0) && !sdIsString(val.value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "value" of type "UpdateFileMetadataByIdRequestBody"', + }); + } const value: undefined | string = val.value == void 0 ? void 0 : val.value; + if (!(val.from == void 0) && !sdIsString(val.from)) { + throw new BoxSdkError({ + message: + 'Expecting string for "from" of type "UpdateFileMetadataByIdRequestBody"', + }); + } const from: undefined | string = val.from == void 0 ? void 0 : val.from; return { op: op, @@ -639,7 +673,7 @@ export function serializeDeleteFileMetadataByIdScope( return val; } export function deserializeDeleteFileMetadataByIdScope( - val: any + val: SerializedData ): DeleteFileMetadataByIdScope { if (!sdIsString(val)) { throw new BoxSdkError({ diff --git a/src/managers/fileVersionRetentions.generated.ts b/src/managers/fileVersionRetentions.generated.ts index 30087685..0af55597 100644 --- a/src/managers/fileVersionRetentions.generated.ts +++ b/src/managers/fileVersionRetentions.generated.ts @@ -210,7 +210,7 @@ export function serializeGetFileVersionRetentionsQueryParamsDispositionActionFie return val; } export function deserializeGetFileVersionRetentionsQueryParamsDispositionActionField( - val: any + val: SerializedData ): GetFileVersionRetentionsQueryParamsDispositionActionField { if (!sdIsString(val)) { throw new BoxSdkError({ diff --git a/src/managers/fileVersions.generated.ts b/src/managers/fileVersions.generated.ts index f19d63e2..bdbb12ea 100644 --- a/src/managers/fileVersions.generated.ts +++ b/src/managers/fileVersions.generated.ts @@ -558,8 +558,19 @@ export function serializeUpdateFileVersionByIdRequestBody( return { ['trashed_at']: val.trashedAt == void 0 ? void 0 : val.trashedAt }; } export function deserializeUpdateFileVersionByIdRequestBody( - val: any + val: SerializedData ): UpdateFileVersionByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateFileVersionByIdRequestBody"', + }); + } + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "trashed_at" of type "UpdateFileVersionByIdRequestBody"', + }); + } const trashedAt: undefined | string = val.trashed_at == void 0 ? void 0 : val.trashed_at; return { trashedAt: trashedAt } satisfies UpdateFileVersionByIdRequestBody; @@ -570,7 +581,7 @@ export function serializePromoteFileVersionRequestBodyTypeField( return val; } export function deserializePromoteFileVersionRequestBodyTypeField( - val: any + val: SerializedData ): PromoteFileVersionRequestBodyTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -597,8 +608,19 @@ export function serializePromoteFileVersionRequestBody( }; } export function deserializePromoteFileVersionRequestBody( - val: any + val: SerializedData ): PromoteFileVersionRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "PromoteFileVersionRequestBody"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "PromoteFileVersionRequestBody"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | PromoteFileVersionRequestBodyTypeField = val.type == void 0 diff --git a/src/managers/fileWatermarks.generated.ts b/src/managers/fileWatermarks.generated.ts index 128a2b81..c4f22e51 100644 --- a/src/managers/fileWatermarks.generated.ts +++ b/src/managers/fileWatermarks.generated.ts @@ -301,7 +301,7 @@ export function serializeUpdateFileWatermarkRequestBodyWatermarkImprintField( return val; } export function deserializeUpdateFileWatermarkRequestBodyWatermarkImprintField( - val: any + val: SerializedData ): UpdateFileWatermarkRequestBodyWatermarkImprintField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -326,8 +326,20 @@ export function serializeUpdateFileWatermarkRequestBodyWatermarkField( }; } export function deserializeUpdateFileWatermarkRequestBodyWatermarkField( - val: any + val: SerializedData ): UpdateFileWatermarkRequestBodyWatermarkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateFileWatermarkRequestBodyWatermarkField"', + }); + } + if (val.imprint == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "imprint" of type "UpdateFileWatermarkRequestBodyWatermarkField" to be defined', + }); + } const imprint: UpdateFileWatermarkRequestBodyWatermarkImprintField = deserializeUpdateFileWatermarkRequestBodyWatermarkImprintField(val.imprint); return { @@ -347,8 +359,14 @@ export function serializeUpdateFileWatermarkRequestBodyWatermarkFieldInput( }; } export function deserializeUpdateFileWatermarkRequestBodyWatermarkFieldInput( - val: any + val: SerializedData ): UpdateFileWatermarkRequestBodyWatermarkFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateFileWatermarkRequestBodyWatermarkFieldInput"', + }); + } const imprint: | undefined | UpdateFileWatermarkRequestBodyWatermarkImprintField = @@ -371,8 +389,19 @@ export function serializeUpdateFileWatermarkRequestBody( }; } export function deserializeUpdateFileWatermarkRequestBody( - val: any + val: SerializedData ): UpdateFileWatermarkRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateFileWatermarkRequestBody"', + }); + } + if (val.watermark == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "watermark" of type "UpdateFileWatermarkRequestBody" to be defined', + }); + } const watermark: UpdateFileWatermarkRequestBodyWatermarkField = deserializeUpdateFileWatermarkRequestBodyWatermarkField(val.watermark); return { watermark: watermark } satisfies UpdateFileWatermarkRequestBody; diff --git a/src/managers/files.generated.ts b/src/managers/files.generated.ts index 1f6b9bb0..26e2a11e 100644 --- a/src/managers/files.generated.ts +++ b/src/managers/files.generated.ts @@ -621,8 +621,19 @@ export function serializeUpdateFileByIdRequestBodyParentField( return { ['id']: val.id == void 0 ? void 0 : val.id }; } export function deserializeUpdateFileByIdRequestBodyParentField( - val: any + val: SerializedData ): UpdateFileByIdRequestBodyParentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateFileByIdRequestBodyParentField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "UpdateFileByIdRequestBodyParentField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { id: id } satisfies UpdateFileByIdRequestBodyParentField; } @@ -632,7 +643,7 @@ export function serializeUpdateFileByIdRequestBodySharedLinkAccessField( return val; } export function deserializeUpdateFileByIdRequestBodySharedLinkAccessField( - val: any + val: SerializedData ): UpdateFileByIdRequestBodySharedLinkAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -661,8 +672,20 @@ export function serializeUpdateFileByIdRequestBodySharedLinkPermissionsField( }; } export function deserializeUpdateFileByIdRequestBodySharedLinkPermissionsField( - val: any + val: SerializedData ): UpdateFileByIdRequestBodySharedLinkPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateFileByIdRequestBodySharedLinkPermissionsField"', + }); + } + if (!(val.can_download == void 0) && !sdIsBoolean(val.can_download)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_download" of type "UpdateFileByIdRequestBodySharedLinkPermissionsField"', + }); + } const canDownload: undefined | boolean = val.can_download == void 0 ? void 0 : val.can_download; return { @@ -690,16 +713,39 @@ export function serializeUpdateFileByIdRequestBodySharedLinkField( }; } export function deserializeUpdateFileByIdRequestBodySharedLinkField( - val: any + val: SerializedData ): UpdateFileByIdRequestBodySharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateFileByIdRequestBodySharedLinkField"', + }); + } const access: undefined | UpdateFileByIdRequestBodySharedLinkAccessField = val.access == void 0 ? void 0 : deserializeUpdateFileByIdRequestBodySharedLinkAccessField(val.access); + if (!(val.password == void 0) && !sdIsString(val.password)) { + throw new BoxSdkError({ + message: + 'Expecting string for "password" of type "UpdateFileByIdRequestBodySharedLinkField"', + }); + } const password: undefined | string = val.password == void 0 ? void 0 : val.password; + if (!(val.vanity_name == void 0) && !sdIsString(val.vanity_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_name" of type "UpdateFileByIdRequestBodySharedLinkField"', + }); + } const vanityName: undefined | string = val.vanity_name == void 0 ? void 0 : val.vanity_name; + if (!(val.unshared_at == void 0) && !sdIsString(val.unshared_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "unshared_at" of type "UpdateFileByIdRequestBodySharedLinkField"', + }); + } const unsharedAt: undefined | DateTime = val.unshared_at == void 0 ? void 0 : deserializeDateTime(val.unshared_at); const permissions: @@ -724,7 +770,7 @@ export function serializeUpdateFileByIdRequestBodyLockAccessField( return val; } export function deserializeUpdateFileByIdRequestBodyLockAccessField( - val: any + val: SerializedData ): UpdateFileByIdRequestBodyLockAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -754,14 +800,34 @@ export function serializeUpdateFileByIdRequestBodyLockField( }; } export function deserializeUpdateFileByIdRequestBodyLockField( - val: any + val: SerializedData ): UpdateFileByIdRequestBodyLockField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateFileByIdRequestBodyLockField"', + }); + } const access: undefined | UpdateFileByIdRequestBodyLockAccessField = val.access == void 0 ? void 0 : deserializeUpdateFileByIdRequestBodyLockAccessField(val.access); + if (!(val.expires_at == void 0) && !sdIsString(val.expires_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "expires_at" of type "UpdateFileByIdRequestBodyLockField"', + }); + } const expiresAt: undefined | DateTime = val.expires_at == void 0 ? void 0 : deserializeDateTime(val.expires_at); + if ( + !(val.is_download_prevented == void 0) && + !sdIsBoolean(val.is_download_prevented) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_download_prevented" of type "UpdateFileByIdRequestBodyLockField"', + }); + } const isDownloadPrevented: undefined | boolean = val.is_download_prevented == void 0 ? void 0 : val.is_download_prevented; return { @@ -776,7 +842,7 @@ export function serializeUpdateFileByIdRequestBodyPermissionsCanDownloadField( return val; } export function deserializeUpdateFileByIdRequestBodyPermissionsCanDownloadField( - val: any + val: SerializedData ): UpdateFileByIdRequestBodyPermissionsCanDownloadField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -807,8 +873,14 @@ export function serializeUpdateFileByIdRequestBodyPermissionsField( }; } export function deserializeUpdateFileByIdRequestBodyPermissionsField( - val: any + val: SerializedData ): UpdateFileByIdRequestBodyPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateFileByIdRequestBodyPermissionsField"', + }); + } const canDownload: | undefined | UpdateFileByIdRequestBodyPermissionsCanDownloadField = @@ -830,9 +902,27 @@ export function serializeUpdateFileByIdRequestBodyCollectionsField( }; } export function deserializeUpdateFileByIdRequestBodyCollectionsField( - val: any + val: SerializedData ): UpdateFileByIdRequestBodyCollectionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateFileByIdRequestBodyCollectionsField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "UpdateFileByIdRequestBodyCollectionsField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (!(val.type == void 0) && !sdIsString(val.type)) { + throw new BoxSdkError({ + message: + 'Expecting string for "type" of type "UpdateFileByIdRequestBodyCollectionsField"', + }); + } const type: undefined | string = val.type == void 0 ? void 0 : val.type; return { id: id, @@ -882,9 +972,26 @@ export function serializeUpdateFileByIdRequestBody( }; } export function deserializeUpdateFileByIdRequestBody( - val: any + val: SerializedData ): UpdateFileByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateFileByIdRequestBody"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "UpdateFileByIdRequestBody"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "UpdateFileByIdRequestBody"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; const parent: undefined | UpdateFileByIdRequestBodyParentField = @@ -899,6 +1006,12 @@ export function deserializeUpdateFileByIdRequestBody( val.lock == void 0 ? void 0 : deserializeUpdateFileByIdRequestBodyLockField(val.lock); + if (!(val.disposition_at == void 0) && !sdIsString(val.disposition_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "disposition_at" of type "UpdateFileByIdRequestBody"', + }); + } const dispositionAt: undefined | DateTime = val.disposition_at == void 0 ? void 0 @@ -907,6 +1020,12 @@ export function deserializeUpdateFileByIdRequestBody( val.permissions == void 0 ? void 0 : deserializeUpdateFileByIdRequestBodyPermissionsField(val.permissions); + if (!(val.collections == void 0) && !sdIsList(val.collections)) { + throw new BoxSdkError({ + message: + 'Expecting array for "collections" of type "UpdateFileByIdRequestBody"', + }); + } const collections: | undefined | readonly UpdateFileByIdRequestBodyCollectionsField[] = @@ -919,8 +1038,24 @@ export function deserializeUpdateFileByIdRequestBody( return deserializeUpdateFileByIdRequestBodyCollectionsField(itm); }) as readonly any[]) : []; + if (!(val.tags == void 0) && !sdIsList(val.tags)) { + throw new BoxSdkError({ + message: 'Expecting array for "tags" of type "UpdateFileByIdRequestBody"', + }); + } const tags: undefined | readonly string[] = - val.tags == void 0 ? void 0 : sdIsList(val.tags) ? val.tags : []; + val.tags == void 0 + ? void 0 + : sdIsList(val.tags) + ? (val.tags.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: 'Expecting string for "UpdateFileByIdRequestBody"', + }); + } + return itm; + }) as readonly any[]) + : []; return { name: name, description: description, @@ -939,8 +1074,25 @@ export function serializeCopyFileRequestBodyParentField( return { ['id']: val.id }; } export function deserializeCopyFileRequestBodyParentField( - val: any + val: SerializedData ): CopyFileRequestBodyParentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CopyFileRequestBodyParentField"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CopyFileRequestBodyParentField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CopyFileRequestBodyParentField"', + }); + } const id: string = val.id; return { id: id } satisfies CopyFileRequestBodyParentField; } @@ -953,10 +1105,32 @@ export function serializeCopyFileRequestBody( ['parent']: serializeCopyFileRequestBodyParentField(val.parent), }; } -export function deserializeCopyFileRequestBody(val: any): CopyFileRequestBody { +export function deserializeCopyFileRequestBody( + val: SerializedData +): CopyFileRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CopyFileRequestBody"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "CopyFileRequestBody"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.version == void 0) && !sdIsString(val.version)) { + throw new BoxSdkError({ + message: 'Expecting string for "version" of type "CopyFileRequestBody"', + }); + } const version: undefined | string = val.version == void 0 ? void 0 : val.version; + if (val.parent == void 0) { + throw new BoxSdkError({ + message: 'Expecting "parent" of type "CopyFileRequestBody" to be defined', + }); + } const parent: CopyFileRequestBodyParentField = deserializeCopyFileRequestBodyParentField(val.parent); return { @@ -971,7 +1145,7 @@ export function serializeGetFileThumbnailByIdExtension( return val; } export function deserializeGetFileThumbnailByIdExtension( - val: any + val: SerializedData ): GetFileThumbnailByIdExtension { if (!sdIsString(val)) { throw new BoxSdkError({ diff --git a/src/managers/folderClassifications.generated.ts b/src/managers/folderClassifications.generated.ts index e63c2c4e..7d24685e 100644 --- a/src/managers/folderClassifications.generated.ts +++ b/src/managers/folderClassifications.generated.ts @@ -426,8 +426,22 @@ export function serializeAddClassificationToFolderRequestBody( }; } export function deserializeAddClassificationToFolderRequestBody( - val: any + val: SerializedData ): AddClassificationToFolderRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AddClassificationToFolderRequestBody"', + }); + } + if ( + !(val.Box__Security__Classification__Key == void 0) && + !sdIsString(val.Box__Security__Classification__Key) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "Box__Security__Classification__Key" of type "AddClassificationToFolderRequestBody"', + }); + } const boxSecurityClassificationKey: undefined | string = val.Box__Security__Classification__Key == void 0 ? void 0 @@ -442,7 +456,7 @@ export function serializeUpdateClassificationOnFolderRequestBodyOpField( return val; } export function deserializeUpdateClassificationOnFolderRequestBodyOpField( - val: any + val: SerializedData ): UpdateClassificationOnFolderRequestBodyOpField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -463,7 +477,7 @@ export function serializeUpdateClassificationOnFolderRequestBodyPathField( return val; } export function deserializeUpdateClassificationOnFolderRequestBodyPathField( - val: any + val: SerializedData ): UpdateClassificationOnFolderRequestBodyPathField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -490,12 +504,41 @@ export function serializeUpdateClassificationOnFolderRequestBody( }; } export function deserializeUpdateClassificationOnFolderRequestBody( - val: any + val: SerializedData ): UpdateClassificationOnFolderRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateClassificationOnFolderRequestBody"', + }); + } + if (val.op == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "op" of type "UpdateClassificationOnFolderRequestBody" to be defined', + }); + } const op: UpdateClassificationOnFolderRequestBodyOpField = deserializeUpdateClassificationOnFolderRequestBodyOpField(val.op); + if (val.path == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "path" of type "UpdateClassificationOnFolderRequestBody" to be defined', + }); + } const path: UpdateClassificationOnFolderRequestBodyPathField = deserializeUpdateClassificationOnFolderRequestBodyPathField(val.path); + if (val.value == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "value" of type "UpdateClassificationOnFolderRequestBody" to be defined', + }); + } + if (!sdIsString(val.value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "value" of type "UpdateClassificationOnFolderRequestBody"', + }); + } const value: string = val.value; return { op: op, @@ -519,8 +562,14 @@ export function serializeUpdateClassificationOnFolderRequestBodyInput( }; } export function deserializeUpdateClassificationOnFolderRequestBodyInput( - val: any + val: SerializedData ): UpdateClassificationOnFolderRequestBodyInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateClassificationOnFolderRequestBodyInput"', + }); + } const op: undefined | UpdateClassificationOnFolderRequestBodyOpField = val.op == void 0 ? void 0 @@ -529,6 +578,18 @@ export function deserializeUpdateClassificationOnFolderRequestBodyInput( val.path == void 0 ? void 0 : deserializeUpdateClassificationOnFolderRequestBodyPathField(val.path); + if (val.value == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "value" of type "UpdateClassificationOnFolderRequestBodyInput" to be defined', + }); + } + if (!sdIsString(val.value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "value" of type "UpdateClassificationOnFolderRequestBodyInput"', + }); + } const value: string = val.value; return { op: op, diff --git a/src/managers/folderLocks.generated.ts b/src/managers/folderLocks.generated.ts index eeaf1ed6..51a3b2f0 100644 --- a/src/managers/folderLocks.generated.ts +++ b/src/managers/folderLocks.generated.ts @@ -18,6 +18,7 @@ import { FetchOptions } from '../networking/fetch.js'; import { FetchResponse } from '../networking/fetch.js'; import { fetch } from '../networking/fetch.js'; import { SerializedData } from '../serialization/json.js'; +import { BoxSdkError } from '../box/errors.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; import { sdIsNumber } from '../serialization/json.js'; @@ -290,9 +291,39 @@ export function serializeCreateFolderLockRequestBodyLockedOperationsField( return { ['move']: val.move, ['delete']: val.delete }; } export function deserializeCreateFolderLockRequestBodyLockedOperationsField( - val: any + val: SerializedData ): CreateFolderLockRequestBodyLockedOperationsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateFolderLockRequestBodyLockedOperationsField"', + }); + } + if (val.move == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "move" of type "CreateFolderLockRequestBodyLockedOperationsField" to be defined', + }); + } + if (!sdIsBoolean(val.move)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "move" of type "CreateFolderLockRequestBodyLockedOperationsField"', + }); + } const move: boolean = val.move; + if (val.delete == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "delete" of type "CreateFolderLockRequestBodyLockedOperationsField" to be defined', + }); + } + if (!sdIsBoolean(val.delete)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "delete" of type "CreateFolderLockRequestBodyLockedOperationsField"', + }); + } const _delete: boolean = val.delete; return { move: move, @@ -305,9 +336,38 @@ export function serializeCreateFolderLockRequestBodyFolderField( return { ['type']: val.type, ['id']: val.id }; } export function deserializeCreateFolderLockRequestBodyFolderField( - val: any + val: SerializedData ): CreateFolderLockRequestBodyFolderField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateFolderLockRequestBodyFolderField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CreateFolderLockRequestBodyFolderField" to be defined', + }); + } + if (!sdIsString(val.type)) { + throw new BoxSdkError({ + message: + 'Expecting string for "type" of type "CreateFolderLockRequestBodyFolderField"', + }); + } const type: string = val.type; + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateFolderLockRequestBodyFolderField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateFolderLockRequestBodyFolderField"', + }); + } const id: string = val.id; return { type: type, @@ -328,8 +388,13 @@ export function serializeCreateFolderLockRequestBody( }; } export function deserializeCreateFolderLockRequestBody( - val: any + val: SerializedData ): CreateFolderLockRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateFolderLockRequestBody"', + }); + } const lockedOperations: | undefined | CreateFolderLockRequestBodyLockedOperationsField = @@ -338,6 +403,12 @@ export function deserializeCreateFolderLockRequestBody( : deserializeCreateFolderLockRequestBodyLockedOperationsField( val.locked_operations ); + if (val.folder == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "folder" of type "CreateFolderLockRequestBody" to be defined', + }); + } const folder: CreateFolderLockRequestBodyFolderField = deserializeCreateFolderLockRequestBodyFolderField(val.folder); return { diff --git a/src/managers/folderMetadata.generated.ts b/src/managers/folderMetadata.generated.ts index 6f891d98..21e3fcbf 100644 --- a/src/managers/folderMetadata.generated.ts +++ b/src/managers/folderMetadata.generated.ts @@ -485,7 +485,7 @@ export function serializeGetFolderMetadataByIdScope( return val; } export function deserializeGetFolderMetadataByIdScope( - val: any + val: SerializedData ): GetFolderMetadataByIdScope { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -508,7 +508,7 @@ export function serializeCreateFolderMetadataByIdScope( return val; } export function deserializeCreateFolderMetadataByIdScope( - val: any + val: SerializedData ): CreateFolderMetadataByIdScope { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -540,9 +540,20 @@ export function serializeCreateFolderMetadataByIdRequestBody( }; } export function deserializeCreateFolderMetadataByIdRequestBody( - val: any + val: SerializedData ): CreateFolderMetadataByIdRequestBody { - return val; + return sdIsMap(val) + ? (Object.fromEntries( + Object.entries(val).map(([k, v]: [string, any]) => [ + k, + (function (v: any): any { + return v; + })(v), + ]) + ) as { + readonly [key: string]: any; + }) + : {}; } export function serializeUpdateFolderMetadataByIdScope( val: UpdateFolderMetadataByIdScope @@ -550,7 +561,7 @@ export function serializeUpdateFolderMetadataByIdScope( return val; } export function deserializeUpdateFolderMetadataByIdScope( - val: any + val: SerializedData ): UpdateFolderMetadataByIdScope { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -573,7 +584,7 @@ export function serializeUpdateFolderMetadataByIdRequestBodyOpField( return val; } export function deserializeUpdateFolderMetadataByIdRequestBodyOpField( - val: any + val: SerializedData ): UpdateFolderMetadataByIdRequestBodyOpField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -617,14 +628,37 @@ export function serializeUpdateFolderMetadataByIdRequestBody( }; } export function deserializeUpdateFolderMetadataByIdRequestBody( - val: any + val: SerializedData ): UpdateFolderMetadataByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateFolderMetadataByIdRequestBody"', + }); + } const op: undefined | UpdateFolderMetadataByIdRequestBodyOpField = val.op == void 0 ? void 0 : deserializeUpdateFolderMetadataByIdRequestBodyOpField(val.op); + if (!(val.path == void 0) && !sdIsString(val.path)) { + throw new BoxSdkError({ + message: + 'Expecting string for "path" of type "UpdateFolderMetadataByIdRequestBody"', + }); + } const path: undefined | string = val.path == void 0 ? void 0 : val.path; + if (!(val.value == void 0) && !sdIsString(val.value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "value" of type "UpdateFolderMetadataByIdRequestBody"', + }); + } const value: undefined | string = val.value == void 0 ? void 0 : val.value; + if (!(val.from == void 0) && !sdIsString(val.from)) { + throw new BoxSdkError({ + message: + 'Expecting string for "from" of type "UpdateFolderMetadataByIdRequestBody"', + }); + } const from: undefined | string = val.from == void 0 ? void 0 : val.from; return { op: op, @@ -639,7 +673,7 @@ export function serializeDeleteFolderMetadataByIdScope( return val; } export function deserializeDeleteFolderMetadataByIdScope( - val: any + val: SerializedData ): DeleteFolderMetadataByIdScope { if (!sdIsString(val)) { throw new BoxSdkError({ diff --git a/src/managers/folderWatermarks.generated.ts b/src/managers/folderWatermarks.generated.ts index 08a3911c..c3159e9e 100644 --- a/src/managers/folderWatermarks.generated.ts +++ b/src/managers/folderWatermarks.generated.ts @@ -304,7 +304,7 @@ export function serializeUpdateFolderWatermarkRequestBodyWatermarkImprintField( return val; } export function deserializeUpdateFolderWatermarkRequestBodyWatermarkImprintField( - val: any + val: SerializedData ): UpdateFolderWatermarkRequestBodyWatermarkImprintField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -329,8 +329,20 @@ export function serializeUpdateFolderWatermarkRequestBodyWatermarkField( }; } export function deserializeUpdateFolderWatermarkRequestBodyWatermarkField( - val: any + val: SerializedData ): UpdateFolderWatermarkRequestBodyWatermarkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateFolderWatermarkRequestBodyWatermarkField"', + }); + } + if (val.imprint == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "imprint" of type "UpdateFolderWatermarkRequestBodyWatermarkField" to be defined', + }); + } const imprint: UpdateFolderWatermarkRequestBodyWatermarkImprintField = deserializeUpdateFolderWatermarkRequestBodyWatermarkImprintField( val.imprint @@ -352,8 +364,14 @@ export function serializeUpdateFolderWatermarkRequestBodyWatermarkFieldInput( }; } export function deserializeUpdateFolderWatermarkRequestBodyWatermarkFieldInput( - val: any + val: SerializedData ): UpdateFolderWatermarkRequestBodyWatermarkFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateFolderWatermarkRequestBodyWatermarkFieldInput"', + }); + } const imprint: | undefined | UpdateFolderWatermarkRequestBodyWatermarkImprintField = @@ -376,8 +394,19 @@ export function serializeUpdateFolderWatermarkRequestBody( }; } export function deserializeUpdateFolderWatermarkRequestBody( - val: any + val: SerializedData ): UpdateFolderWatermarkRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateFolderWatermarkRequestBody"', + }); + } + if (val.watermark == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "watermark" of type "UpdateFolderWatermarkRequestBody" to be defined', + }); + } const watermark: UpdateFolderWatermarkRequestBodyWatermarkField = deserializeUpdateFolderWatermarkRequestBodyWatermarkField(val.watermark); return { watermark: watermark } satisfies UpdateFolderWatermarkRequestBody; diff --git a/src/managers/folders.generated.ts b/src/managers/folders.generated.ts index a8375c00..edb7a725 100644 --- a/src/managers/folders.generated.ts +++ b/src/managers/folders.generated.ts @@ -787,7 +787,7 @@ export function serializeGetFolderByIdQueryParamsSortField( return val; } export function deserializeGetFolderByIdQueryParamsSortField( - val: any + val: SerializedData ): GetFolderByIdQueryParamsSortField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -816,7 +816,7 @@ export function serializeGetFolderByIdQueryParamsDirectionField( return val; } export function deserializeGetFolderByIdQueryParamsDirectionField( - val: any + val: SerializedData ): GetFolderByIdQueryParamsDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -840,7 +840,7 @@ export function serializeUpdateFolderByIdRequestBodySyncStateField( return val; } export function deserializeUpdateFolderByIdRequestBodySyncStateField( - val: any + val: SerializedData ): UpdateFolderByIdRequestBodySyncStateField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -867,8 +867,19 @@ export function serializeUpdateFolderByIdRequestBodyParentField( return { ['id']: val.id == void 0 ? void 0 : val.id }; } export function deserializeUpdateFolderByIdRequestBodyParentField( - val: any + val: SerializedData ): UpdateFolderByIdRequestBodyParentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateFolderByIdRequestBodyParentField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "UpdateFolderByIdRequestBodyParentField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { id: id } satisfies UpdateFolderByIdRequestBodyParentField; } @@ -878,7 +889,7 @@ export function serializeUpdateFolderByIdRequestBodySharedLinkAccessField( return val; } export function deserializeUpdateFolderByIdRequestBodySharedLinkAccessField( - val: any + val: SerializedData ): UpdateFolderByIdRequestBodySharedLinkAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -907,8 +918,20 @@ export function serializeUpdateFolderByIdRequestBodySharedLinkPermissionsField( }; } export function deserializeUpdateFolderByIdRequestBodySharedLinkPermissionsField( - val: any + val: SerializedData ): UpdateFolderByIdRequestBodySharedLinkPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateFolderByIdRequestBodySharedLinkPermissionsField"', + }); + } + if (!(val.can_download == void 0) && !sdIsBoolean(val.can_download)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_download" of type "UpdateFolderByIdRequestBodySharedLinkPermissionsField"', + }); + } const canDownload: undefined | boolean = val.can_download == void 0 ? void 0 : val.can_download; return { @@ -936,16 +959,40 @@ export function serializeUpdateFolderByIdRequestBodySharedLinkField( }; } export function deserializeUpdateFolderByIdRequestBodySharedLinkField( - val: any + val: SerializedData ): UpdateFolderByIdRequestBodySharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateFolderByIdRequestBodySharedLinkField"', + }); + } const access: undefined | UpdateFolderByIdRequestBodySharedLinkAccessField = val.access == void 0 ? void 0 : deserializeUpdateFolderByIdRequestBodySharedLinkAccessField(val.access); + if (!(val.password == void 0) && !sdIsString(val.password)) { + throw new BoxSdkError({ + message: + 'Expecting string for "password" of type "UpdateFolderByIdRequestBodySharedLinkField"', + }); + } const password: undefined | string = val.password == void 0 ? void 0 : val.password; + if (!(val.vanity_name == void 0) && !sdIsString(val.vanity_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_name" of type "UpdateFolderByIdRequestBodySharedLinkField"', + }); + } const vanityName: undefined | string = val.vanity_name == void 0 ? void 0 : val.vanity_name; + if (!(val.unshared_at == void 0) && !sdIsString(val.unshared_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "unshared_at" of type "UpdateFolderByIdRequestBodySharedLinkField"', + }); + } const unsharedAt: undefined | DateTime = val.unshared_at == void 0 ? void 0 : deserializeDateTime(val.unshared_at); const permissions: @@ -970,7 +1017,7 @@ export function serializeUpdateFolderByIdRequestBodyFolderUploadEmailAccessField return val; } export function deserializeUpdateFolderByIdRequestBodyFolderUploadEmailAccessField( - val: any + val: SerializedData ): UpdateFolderByIdRequestBodyFolderUploadEmailAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -1001,8 +1048,14 @@ export function serializeUpdateFolderByIdRequestBodyFolderUploadEmailField( }; } export function deserializeUpdateFolderByIdRequestBodyFolderUploadEmailField( - val: any + val: SerializedData ): UpdateFolderByIdRequestBodyFolderUploadEmailField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateFolderByIdRequestBodyFolderUploadEmailField"', + }); + } const access: | undefined | UpdateFolderByIdRequestBodyFolderUploadEmailAccessField = @@ -1024,9 +1077,27 @@ export function serializeUpdateFolderByIdRequestBodyCollectionsField( }; } export function deserializeUpdateFolderByIdRequestBodyCollectionsField( - val: any + val: SerializedData ): UpdateFolderByIdRequestBodyCollectionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateFolderByIdRequestBodyCollectionsField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "UpdateFolderByIdRequestBodyCollectionsField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (!(val.type == void 0) && !sdIsString(val.type)) { + throw new BoxSdkError({ + message: + 'Expecting string for "type" of type "UpdateFolderByIdRequestBodyCollectionsField"', + }); + } const type: undefined | string = val.type == void 0 ? void 0 : val.type; return { id: id, @@ -1084,15 +1155,41 @@ export function serializeUpdateFolderByIdRequestBody( }; } export function deserializeUpdateFolderByIdRequestBody( - val: any + val: SerializedData ): UpdateFolderByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateFolderByIdRequestBody"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "UpdateFolderByIdRequestBody"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "UpdateFolderByIdRequestBody"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; const syncState: undefined | UpdateFolderByIdRequestBodySyncStateField = val.sync_state == void 0 ? void 0 : deserializeUpdateFolderByIdRequestBodySyncStateField(val.sync_state); + 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 "UpdateFolderByIdRequestBody"', + }); + } const canNonOwnersInvite: undefined | boolean = val.can_non_owners_invite == void 0 ? void 0 : val.can_non_owners_invite; const parent: undefined | UpdateFolderByIdRequestBodyParentField = @@ -1111,12 +1208,44 @@ export function deserializeUpdateFolderByIdRequestBody( : deserializeUpdateFolderByIdRequestBodyFolderUploadEmailField( val.folder_upload_email ); + if (!(val.tags == void 0) && !sdIsList(val.tags)) { + throw new BoxSdkError({ + message: + 'Expecting array for "tags" of type "UpdateFolderByIdRequestBody"', + }); + } const tags: undefined | readonly string[] = - val.tags == void 0 ? void 0 : sdIsList(val.tags) ? val.tags : []; + val.tags == void 0 + ? void 0 + : sdIsList(val.tags) + ? (val.tags.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: 'Expecting string for "UpdateFolderByIdRequestBody"', + }); + } + return itm; + }) as readonly any[]) + : []; + 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 "UpdateFolderByIdRequestBody"', + }); + } const isCollaborationRestrictedToEnterprise: undefined | boolean = val.is_collaboration_restricted_to_enterprise == void 0 ? void 0 : val.is_collaboration_restricted_to_enterprise; + if (!(val.collections == void 0) && !sdIsList(val.collections)) { + throw new BoxSdkError({ + message: + 'Expecting array for "collections" of type "UpdateFolderByIdRequestBody"', + }); + } const collections: | undefined | readonly UpdateFolderByIdRequestBodyCollectionsField[] = @@ -1129,6 +1258,15 @@ export function deserializeUpdateFolderByIdRequestBody( return deserializeUpdateFolderByIdRequestBodyCollectionsField(itm); }) as readonly any[]) : []; + if ( + !(val.can_non_owners_view_collaborators == void 0) && + !sdIsBoolean(val.can_non_owners_view_collaborators) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_non_owners_view_collaborators" of type "UpdateFolderByIdRequestBody"', + }); + } const canNonOwnersViewCollaborators: undefined | boolean = val.can_non_owners_view_collaborators == void 0 ? void 0 @@ -1154,7 +1292,7 @@ export function serializeGetFolderItemsQueryParamsSortField( return val; } export function deserializeGetFolderItemsQueryParamsSortField( - val: any + val: SerializedData ): GetFolderItemsQueryParamsSortField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -1183,7 +1321,7 @@ export function serializeGetFolderItemsQueryParamsDirectionField( return val; } export function deserializeGetFolderItemsQueryParamsDirectionField( - val: any + val: SerializedData ): GetFolderItemsQueryParamsDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -1207,8 +1345,25 @@ export function serializeCreateFolderRequestBodyParentField( return { ['id']: val.id }; } export function deserializeCreateFolderRequestBodyParentField( - val: any + val: SerializedData ): CreateFolderRequestBodyParentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateFolderRequestBodyParentField"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateFolderRequestBodyParentField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateFolderRequestBodyParentField"', + }); + } const id: string = val.id; return { id: id } satisfies CreateFolderRequestBodyParentField; } @@ -1218,7 +1373,7 @@ export function serializeCreateFolderRequestBodyFolderUploadEmailAccessField( return val; } export function deserializeCreateFolderRequestBodyFolderUploadEmailAccessField( - val: any + val: SerializedData ): CreateFolderRequestBodyFolderUploadEmailAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -1249,8 +1404,14 @@ export function serializeCreateFolderRequestBodyFolderUploadEmailField( }; } export function deserializeCreateFolderRequestBodyFolderUploadEmailField( - val: any + val: SerializedData ): CreateFolderRequestBodyFolderUploadEmailField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateFolderRequestBodyFolderUploadEmailField"', + }); + } const access: | undefined | CreateFolderRequestBodyFolderUploadEmailAccessField = @@ -1269,7 +1430,7 @@ export function serializeCreateFolderRequestBodySyncStateField( return val; } export function deserializeCreateFolderRequestBodySyncStateField( - val: any + val: SerializedData ): CreateFolderRequestBodySyncStateField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -1308,9 +1469,31 @@ export function serializeCreateFolderRequestBody( }; } export function deserializeCreateFolderRequestBody( - val: any + val: SerializedData ): CreateFolderRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateFolderRequestBody"', + }); + } + if (val.name == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "name" of type "CreateFolderRequestBody" to be defined', + }); + } + if (!sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "CreateFolderRequestBody"', + }); + } const name: string = val.name; + if (val.parent == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "parent" of type "CreateFolderRequestBody" to be defined', + }); + } const parent: CreateFolderRequestBodyParentField = deserializeCreateFolderRequestBodyParentField(val.parent); const folderUploadEmail: @@ -1338,8 +1521,25 @@ export function serializeCopyFolderRequestBodyParentField( return { ['id']: val.id }; } export function deserializeCopyFolderRequestBodyParentField( - val: any + val: SerializedData ): CopyFolderRequestBodyParentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CopyFolderRequestBodyParentField"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CopyFolderRequestBodyParentField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CopyFolderRequestBodyParentField"', + }); + } const id: string = val.id; return { id: id } satisfies CopyFolderRequestBodyParentField; } @@ -1352,9 +1552,25 @@ export function serializeCopyFolderRequestBody( }; } export function deserializeCopyFolderRequestBody( - val: any + val: SerializedData ): CopyFolderRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CopyFolderRequestBody"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "CopyFolderRequestBody"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (val.parent == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "parent" of type "CopyFolderRequestBody" to be defined', + }); + } const parent: CopyFolderRequestBodyParentField = deserializeCopyFolderRequestBodyParentField(val.parent); return { name: name, parent: parent } satisfies CopyFolderRequestBody; diff --git a/src/managers/groups.generated.ts b/src/managers/groups.generated.ts index 37814dea..39ac833b 100644 --- a/src/managers/groups.generated.ts +++ b/src/managers/groups.generated.ts @@ -516,7 +516,7 @@ export function serializeCreateGroupRequestBodyInvitabilityLevelField( return val; } export function deserializeCreateGroupRequestBodyInvitabilityLevelField( - val: any + val: SerializedData ): CreateGroupRequestBodyInvitabilityLevelField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -543,7 +543,7 @@ export function serializeCreateGroupRequestBodyMemberViewabilityLevelField( return val; } export function deserializeCreateGroupRequestBodyMemberViewabilityLevelField( - val: any + val: SerializedData ): CreateGroupRequestBodyMemberViewabilityLevelField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -590,15 +590,52 @@ export function serializeCreateGroupRequestBody( }; } export function deserializeCreateGroupRequestBody( - val: any + val: SerializedData ): CreateGroupRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateGroupRequestBody"', + }); + } + if (val.name == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "name" of type "CreateGroupRequestBody" to be defined', + }); + } + if (!sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "CreateGroupRequestBody"', + }); + } const name: string = val.name; + if (!(val.provenance == void 0) && !sdIsString(val.provenance)) { + throw new BoxSdkError({ + message: + 'Expecting string for "provenance" of type "CreateGroupRequestBody"', + }); + } const provenance: undefined | string = val.provenance == void 0 ? void 0 : val.provenance; + if ( + !(val.external_sync_identifier == void 0) && + !sdIsString(val.external_sync_identifier) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "external_sync_identifier" of type "CreateGroupRequestBody"', + }); + } const externalSyncIdentifier: undefined | string = val.external_sync_identifier == void 0 ? void 0 : val.external_sync_identifier; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "CreateGroupRequestBody"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; const invitabilityLevel: @@ -632,7 +669,7 @@ export function serializeUpdateGroupByIdRequestBodyInvitabilityLevelField( return val; } export function deserializeUpdateGroupByIdRequestBodyInvitabilityLevelField( - val: any + val: SerializedData ): UpdateGroupByIdRequestBodyInvitabilityLevelField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -659,7 +696,7 @@ export function serializeUpdateGroupByIdRequestBodyMemberViewabilityLevelField( return val; } export function deserializeUpdateGroupByIdRequestBodyMemberViewabilityLevelField( - val: any + val: SerializedData ): UpdateGroupByIdRequestBodyMemberViewabilityLevelField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -706,15 +743,47 @@ export function serializeUpdateGroupByIdRequestBody( }; } export function deserializeUpdateGroupByIdRequestBody( - val: any + val: SerializedData ): UpdateGroupByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateGroupByIdRequestBody"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "UpdateGroupByIdRequestBody"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.provenance == void 0) && !sdIsString(val.provenance)) { + throw new BoxSdkError({ + message: + 'Expecting string for "provenance" of type "UpdateGroupByIdRequestBody"', + }); + } const provenance: undefined | string = val.provenance == void 0 ? void 0 : val.provenance; + if ( + !(val.external_sync_identifier == void 0) && + !sdIsString(val.external_sync_identifier) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "external_sync_identifier" of type "UpdateGroupByIdRequestBody"', + }); + } const externalSyncIdentifier: undefined | string = val.external_sync_identifier == void 0 ? void 0 : val.external_sync_identifier; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "UpdateGroupByIdRequestBody"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; const invitabilityLevel: diff --git a/src/managers/integrationMappings.generated.ts b/src/managers/integrationMappings.generated.ts index b3dbe551..94b81d4e 100644 --- a/src/managers/integrationMappings.generated.ts +++ b/src/managers/integrationMappings.generated.ts @@ -396,7 +396,7 @@ export function serializeGetSlackIntegrationMappingQueryParamsPartnerItemTypeFie return val; } export function deserializeGetSlackIntegrationMappingQueryParamsPartnerItemTypeField( - val: any + val: SerializedData ): GetSlackIntegrationMappingQueryParamsPartnerItemTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -417,7 +417,7 @@ export function serializeGetSlackIntegrationMappingQueryParamsBoxItemTypeField( return val; } export function deserializeGetSlackIntegrationMappingQueryParamsBoxItemTypeField( - val: any + val: SerializedData ): GetSlackIntegrationMappingQueryParamsBoxItemTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -447,8 +447,14 @@ export function serializeUpdateSlackIntegrationMappingByIdRequestBody( }; } export function deserializeUpdateSlackIntegrationMappingByIdRequestBody( - val: any + val: SerializedData ): UpdateSlackIntegrationMappingByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateSlackIntegrationMappingByIdRequestBody"', + }); + } const boxItem: undefined | IntegrationMappingBoxItemSlack = val.box_item == void 0 ? void 0 diff --git a/src/managers/invites.generated.ts b/src/managers/invites.generated.ts index 6c38af6e..4d0519b4 100644 --- a/src/managers/invites.generated.ts +++ b/src/managers/invites.generated.ts @@ -15,6 +15,7 @@ import { FetchOptions } from '../networking/fetch.js'; import { FetchResponse } from '../networking/fetch.js'; import { fetch } from '../networking/fetch.js'; import { SerializedData } from '../serialization/json.js'; +import { BoxSdkError } from '../box/errors.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; import { sdIsNumber } from '../serialization/json.js'; @@ -249,8 +250,25 @@ export function serializeCreateInviteRequestBodyEnterpriseField( return { ['id']: val.id }; } export function deserializeCreateInviteRequestBodyEnterpriseField( - val: any + val: SerializedData ): CreateInviteRequestBodyEnterpriseField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateInviteRequestBodyEnterpriseField"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateInviteRequestBodyEnterpriseField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateInviteRequestBodyEnterpriseField"', + }); + } const id: string = val.id; return { id: id } satisfies CreateInviteRequestBodyEnterpriseField; } @@ -260,8 +278,19 @@ export function serializeCreateInviteRequestBodyActionableByField( return { ['login']: val.login == void 0 ? void 0 : val.login }; } export function deserializeCreateInviteRequestBodyActionableByField( - val: any + val: SerializedData ): CreateInviteRequestBodyActionableByField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateInviteRequestBodyActionableByField"', + }); + } + if (!(val.login == void 0) && !sdIsString(val.login)) { + throw new BoxSdkError({ + message: + 'Expecting string for "login" of type "CreateInviteRequestBodyActionableByField"', + }); + } const login: undefined | string = val.login == void 0 ? void 0 : val.login; return { login: login } satisfies CreateInviteRequestBodyActionableByField; } @@ -278,10 +307,27 @@ export function serializeCreateInviteRequestBody( }; } export function deserializeCreateInviteRequestBody( - val: any + val: SerializedData ): CreateInviteRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateInviteRequestBody"', + }); + } + if (val.enterprise == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "enterprise" of type "CreateInviteRequestBody" to be defined', + }); + } const enterprise: CreateInviteRequestBodyEnterpriseField = deserializeCreateInviteRequestBodyEnterpriseField(val.enterprise); + if (val.actionable_by == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "actionable_by" of type "CreateInviteRequestBody" to be defined', + }); + } const actionableBy: CreateInviteRequestBodyActionableByField = deserializeCreateInviteRequestBodyActionableByField(val.actionable_by); return { diff --git a/src/managers/legalHoldPolicies.generated.ts b/src/managers/legalHoldPolicies.generated.ts index e57ffa75..5011959a 100644 --- a/src/managers/legalHoldPolicies.generated.ts +++ b/src/managers/legalHoldPolicies.generated.ts @@ -21,6 +21,7 @@ import { FetchResponse } from '../networking/fetch.js'; import { fetch } from '../networking/fetch.js'; import { SerializedData } from '../serialization/json.js'; import { DateTime } from '../internal/utils.js'; +import { BoxSdkError } from '../box/errors.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; import { sdIsNumber } from '../serialization/json.js'; @@ -472,19 +473,63 @@ export function serializeCreateLegalHoldPolicyRequestBody( }; } export function deserializeCreateLegalHoldPolicyRequestBody( - val: any + val: SerializedData ): CreateLegalHoldPolicyRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateLegalHoldPolicyRequestBody"', + }); + } + if (val.policy_name == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "policy_name" of type "CreateLegalHoldPolicyRequestBody" to be defined', + }); + } + if (!sdIsString(val.policy_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "policy_name" of type "CreateLegalHoldPolicyRequestBody"', + }); + } const policyName: string = val.policy_name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "CreateLegalHoldPolicyRequestBody"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if ( + !(val.filter_started_at == void 0) && + !sdIsString(val.filter_started_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "filter_started_at" of type "CreateLegalHoldPolicyRequestBody"', + }); + } const filterStartedAt: undefined | DateTime = val.filter_started_at == void 0 ? void 0 : deserializeDateTime(val.filter_started_at); + if (!(val.filter_ended_at == void 0) && !sdIsString(val.filter_ended_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "filter_ended_at" of type "CreateLegalHoldPolicyRequestBody"', + }); + } const filterEndedAt: undefined | DateTime = val.filter_ended_at == void 0 ? void 0 : deserializeDateTime(val.filter_ended_at); + if (!(val.is_ongoing == void 0) && !sdIsBoolean(val.is_ongoing)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_ongoing" of type "CreateLegalHoldPolicyRequestBody"', + }); + } const isOngoing: undefined | boolean = val.is_ongoing == void 0 ? void 0 : val.is_ongoing; return { @@ -505,12 +550,35 @@ export function serializeUpdateLegalHoldPolicyByIdRequestBody( }; } export function deserializeUpdateLegalHoldPolicyByIdRequestBody( - val: any + val: SerializedData ): UpdateLegalHoldPolicyByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateLegalHoldPolicyByIdRequestBody"', + }); + } + if (!(val.policy_name == void 0) && !sdIsString(val.policy_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "policy_name" of type "UpdateLegalHoldPolicyByIdRequestBody"', + }); + } const policyName: undefined | string = val.policy_name == void 0 ? void 0 : val.policy_name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "UpdateLegalHoldPolicyByIdRequestBody"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if (!(val.release_notes == void 0) && !sdIsString(val.release_notes)) { + throw new BoxSdkError({ + message: + 'Expecting string for "release_notes" of type "UpdateLegalHoldPolicyByIdRequestBody"', + }); + } const releaseNotes: undefined | string = val.release_notes == void 0 ? void 0 : val.release_notes; return { diff --git a/src/managers/legalHoldPolicyAssignments.generated.ts b/src/managers/legalHoldPolicyAssignments.generated.ts index 2e63e345..9fb2ca99 100644 --- a/src/managers/legalHoldPolicyAssignments.generated.ts +++ b/src/managers/legalHoldPolicyAssignments.generated.ts @@ -524,7 +524,7 @@ export function serializeGetLegalHoldPolicyAssignmentsQueryParamsAssignToTypeFie return val; } export function deserializeGetLegalHoldPolicyAssignmentsQueryParamsAssignToTypeField( - val: any + val: SerializedData ): GetLegalHoldPolicyAssignmentsQueryParamsAssignToTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -554,7 +554,7 @@ export function serializeCreateLegalHoldPolicyAssignmentRequestBodyAssignToTypeF return val; } export function deserializeCreateLegalHoldPolicyAssignmentRequestBodyAssignToTypeField( - val: any + val: SerializedData ): CreateLegalHoldPolicyAssignmentRequestBodyAssignToTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -590,12 +590,36 @@ export function serializeCreateLegalHoldPolicyAssignmentRequestBodyAssignToField }; } export function deserializeCreateLegalHoldPolicyAssignmentRequestBodyAssignToField( - val: any + val: SerializedData ): CreateLegalHoldPolicyAssignmentRequestBodyAssignToField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateLegalHoldPolicyAssignmentRequestBodyAssignToField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CreateLegalHoldPolicyAssignmentRequestBodyAssignToField" to be defined', + }); + } const type: CreateLegalHoldPolicyAssignmentRequestBodyAssignToTypeField = deserializeCreateLegalHoldPolicyAssignmentRequestBodyAssignToTypeField( val.type ); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateLegalHoldPolicyAssignmentRequestBodyAssignToField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateLegalHoldPolicyAssignmentRequestBodyAssignToField"', + }); + } const id: string = val.id; return { type: type, @@ -614,9 +638,33 @@ export function serializeCreateLegalHoldPolicyAssignmentRequestBody( }; } export function deserializeCreateLegalHoldPolicyAssignmentRequestBody( - val: any + val: SerializedData ): CreateLegalHoldPolicyAssignmentRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateLegalHoldPolicyAssignmentRequestBody"', + }); + } + if (val.policy_id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "policy_id" of type "CreateLegalHoldPolicyAssignmentRequestBody" to be defined', + }); + } + if (!sdIsString(val.policy_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "policy_id" of type "CreateLegalHoldPolicyAssignmentRequestBody"', + }); + } const policyId: string = val.policy_id; + if (val.assign_to == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "assign_to" of type "CreateLegalHoldPolicyAssignmentRequestBody" to be defined', + }); + } const assignTo: CreateLegalHoldPolicyAssignmentRequestBodyAssignToField = deserializeCreateLegalHoldPolicyAssignmentRequestBodyAssignToField( val.assign_to diff --git a/src/managers/listCollaborations.generated.ts b/src/managers/listCollaborations.generated.ts index f44f5265..078b9597 100644 --- a/src/managers/listCollaborations.generated.ts +++ b/src/managers/listCollaborations.generated.ts @@ -442,7 +442,7 @@ export function serializeGetCollaborationsQueryParamsStatusField( return val; } export function deserializeGetCollaborationsQueryParamsStatusField( - val: any + val: SerializedData ): GetCollaborationsQueryParamsStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ diff --git a/src/managers/memberships.generated.ts b/src/managers/memberships.generated.ts index fd2a31c8..9d532e5a 100644 --- a/src/managers/memberships.generated.ts +++ b/src/managers/memberships.generated.ts @@ -665,8 +665,26 @@ export function serializeCreateGroupMembershipRequestBodyUserField( return { ['id']: val.id }; } export function deserializeCreateGroupMembershipRequestBodyUserField( - val: any + val: SerializedData ): CreateGroupMembershipRequestBodyUserField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateGroupMembershipRequestBodyUserField"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateGroupMembershipRequestBodyUserField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateGroupMembershipRequestBodyUserField"', + }); + } const id: string = val.id; return { id: id } satisfies CreateGroupMembershipRequestBodyUserField; } @@ -676,8 +694,26 @@ export function serializeCreateGroupMembershipRequestBodyGroupField( return { ['id']: val.id }; } export function deserializeCreateGroupMembershipRequestBodyGroupField( - val: any + val: SerializedData ): CreateGroupMembershipRequestBodyGroupField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateGroupMembershipRequestBodyGroupField"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateGroupMembershipRequestBodyGroupField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateGroupMembershipRequestBodyGroupField"', + }); + } const id: string = val.id; return { id: id } satisfies CreateGroupMembershipRequestBodyGroupField; } @@ -687,7 +723,7 @@ export function serializeCreateGroupMembershipRequestBodyRoleField( return val; } export function deserializeCreateGroupMembershipRequestBodyRoleField( - val: any + val: SerializedData ): CreateGroupMembershipRequestBodyRoleField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -722,16 +758,42 @@ export function serializeCreateGroupMembershipRequestBody( }; } export function deserializeCreateGroupMembershipRequestBody( - val: any + val: SerializedData ): CreateGroupMembershipRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateGroupMembershipRequestBody"', + }); + } + if (val.user == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "user" of type "CreateGroupMembershipRequestBody" to be defined', + }); + } const user: CreateGroupMembershipRequestBodyUserField = deserializeCreateGroupMembershipRequestBodyUserField(val.user); + if (val.group == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "group" of type "CreateGroupMembershipRequestBody" to be defined', + }); + } const group: CreateGroupMembershipRequestBodyGroupField = deserializeCreateGroupMembershipRequestBodyGroupField(val.group); const role: undefined | CreateGroupMembershipRequestBodyRoleField = val.role == void 0 ? void 0 : deserializeCreateGroupMembershipRequestBodyRoleField(val.role); + if ( + !(val.configurable_permissions == void 0) && + !sdIsMap(val.configurable_permissions) + ) { + throw new BoxSdkError({ + message: + 'Expecting object for "configurable_permissions" of type "CreateGroupMembershipRequestBody"', + }); + } const configurablePermissions: | undefined | { @@ -739,7 +801,26 @@ export function deserializeCreateGroupMembershipRequestBody( } = val.configurable_permissions == void 0 ? void 0 - : val.configurable_permissions; + : sdIsMap(val.configurable_permissions) + ? (Object.fromEntries( + Object.entries(val.configurable_permissions).map( + ([k, v]: [string, any]) => [ + k, + (function (v: any): any { + if (!sdIsBoolean(v)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "CreateGroupMembershipRequestBody"', + }); + } + return v; + })(v), + ] + ) + ) as { + readonly [key: string]: any; + }) + : {}; return { user: user, group: group, @@ -753,7 +834,7 @@ export function serializeUpdateGroupMembershipByIdRequestBodyRoleField( return val; } export function deserializeUpdateGroupMembershipByIdRequestBodyRoleField( - val: any + val: SerializedData ): UpdateGroupMembershipByIdRequestBodyRoleField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -786,12 +867,26 @@ export function serializeUpdateGroupMembershipByIdRequestBody( }; } export function deserializeUpdateGroupMembershipByIdRequestBody( - val: any + val: SerializedData ): UpdateGroupMembershipByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateGroupMembershipByIdRequestBody"', + }); + } const role: undefined | UpdateGroupMembershipByIdRequestBodyRoleField = val.role == void 0 ? void 0 : deserializeUpdateGroupMembershipByIdRequestBodyRoleField(val.role); + if ( + !(val.configurable_permissions == void 0) && + !sdIsMap(val.configurable_permissions) + ) { + throw new BoxSdkError({ + message: + 'Expecting object for "configurable_permissions" of type "UpdateGroupMembershipByIdRequestBody"', + }); + } const configurablePermissions: | undefined | { @@ -799,7 +894,26 @@ export function deserializeUpdateGroupMembershipByIdRequestBody( } = val.configurable_permissions == void 0 ? void 0 - : val.configurable_permissions; + : sdIsMap(val.configurable_permissions) + ? (Object.fromEntries( + Object.entries(val.configurable_permissions).map( + ([k, v]: [string, any]) => [ + k, + (function (v: any): any { + if (!sdIsBoolean(v)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "UpdateGroupMembershipByIdRequestBody"', + }); + } + return v; + })(v), + ] + ) + ) as { + readonly [key: string]: any; + }) + : {}; return { role: role, configurablePermissions: configurablePermissions, diff --git a/src/managers/metadataCascadePolicies.generated.ts b/src/managers/metadataCascadePolicies.generated.ts index d6c22fa6..f7294626 100644 --- a/src/managers/metadataCascadePolicies.generated.ts +++ b/src/managers/metadataCascadePolicies.generated.ts @@ -491,7 +491,7 @@ export function serializeCreateMetadataCascadePolicyRequestBodyScopeField( return val; } export function deserializeCreateMetadataCascadePolicyRequestBodyScopeField( - val: any + val: SerializedData ): CreateMetadataCascadePolicyRequestBodyScopeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -521,11 +521,46 @@ export function serializeCreateMetadataCascadePolicyRequestBody( }; } export function deserializeCreateMetadataCascadePolicyRequestBody( - val: any + val: SerializedData ): CreateMetadataCascadePolicyRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateMetadataCascadePolicyRequestBody"', + }); + } + if (val.folder_id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "folder_id" of type "CreateMetadataCascadePolicyRequestBody" to be defined', + }); + } + if (!sdIsString(val.folder_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "folder_id" of type "CreateMetadataCascadePolicyRequestBody"', + }); + } const folderId: string = val.folder_id; + if (val.scope == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "scope" of type "CreateMetadataCascadePolicyRequestBody" to be defined', + }); + } const scope: CreateMetadataCascadePolicyRequestBodyScopeField = deserializeCreateMetadataCascadePolicyRequestBodyScopeField(val.scope); + if (val.templateKey == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "templateKey" of type "CreateMetadataCascadePolicyRequestBody" to be defined', + }); + } + if (!sdIsString(val.templateKey)) { + throw new BoxSdkError({ + message: + 'Expecting string for "templateKey" of type "CreateMetadataCascadePolicyRequestBody"', + }); + } const templateKey: string = val.templateKey; return { folderId: folderId, @@ -539,7 +574,7 @@ export function serializeApplyMetadataCascadePolicyRequestBodyConflictResolution return val; } export function deserializeApplyMetadataCascadePolicyRequestBodyConflictResolutionField( - val: any + val: SerializedData ): ApplyMetadataCascadePolicyRequestBodyConflictResolutionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -568,8 +603,19 @@ export function serializeApplyMetadataCascadePolicyRequestBody( }; } export function deserializeApplyMetadataCascadePolicyRequestBody( - val: any + val: SerializedData ): ApplyMetadataCascadePolicyRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ApplyMetadataCascadePolicyRequestBody"', + }); + } + if (val.conflict_resolution == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "conflict_resolution" of type "ApplyMetadataCascadePolicyRequestBody" to be defined', + }); + } const conflictResolution: ApplyMetadataCascadePolicyRequestBodyConflictResolutionField = deserializeApplyMetadataCascadePolicyRequestBodyConflictResolutionField( val.conflict_resolution diff --git a/src/managers/metadataTemplates.generated.ts b/src/managers/metadataTemplates.generated.ts index 54b1c9cd..1a45b90f 100644 --- a/src/managers/metadataTemplates.generated.ts +++ b/src/managers/metadataTemplates.generated.ts @@ -725,7 +725,7 @@ export function serializeGetMetadataTemplateScope( return val; } export function deserializeGetMetadataTemplateScope( - val: any + val: SerializedData ): GetMetadataTemplateScope { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -748,7 +748,7 @@ export function serializeUpdateMetadataTemplateScope( return val; } export function deserializeUpdateMetadataTemplateScope( - val: any + val: SerializedData ): UpdateMetadataTemplateScope { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -771,7 +771,7 @@ export function serializeUpdateMetadataTemplateRequestBodyOpField( return val; } export function deserializeUpdateMetadataTemplateRequestBodyOpField( - val: any + val: SerializedData ): UpdateMetadataTemplateRequestBodyOpField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -867,38 +867,135 @@ export function serializeUpdateMetadataTemplateRequestBody( }; } export function deserializeUpdateMetadataTemplateRequestBody( - val: any + val: SerializedData ): UpdateMetadataTemplateRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateMetadataTemplateRequestBody"', + }); + } + if (val.op == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "op" of type "UpdateMetadataTemplateRequestBody" to be defined', + }); + } const op: UpdateMetadataTemplateRequestBodyOpField = deserializeUpdateMetadataTemplateRequestBodyOpField(val.op); + if (!(val.data == void 0) && !sdIsMap(val.data)) { + throw new BoxSdkError({ + message: + 'Expecting object for "data" of type "UpdateMetadataTemplateRequestBody"', + }); + } const data: | undefined | { readonly [key: string]: any; - } = val.data == void 0 ? void 0 : val.data; + } = + val.data == void 0 + ? void 0 + : sdIsMap(val.data) + ? (Object.fromEntries( + Object.entries(val.data).map(([k, v]: [string, any]) => [ + k, + (function (v: any): any { + return v; + })(v), + ]) + ) as { + readonly [key: string]: any; + }) + : {}; + if (!(val.fieldKey == void 0) && !sdIsString(val.fieldKey)) { + throw new BoxSdkError({ + message: + 'Expecting string for "fieldKey" of type "UpdateMetadataTemplateRequestBody"', + }); + } const fieldKey: undefined | string = val.fieldKey == void 0 ? void 0 : val.fieldKey; + if (!(val.fieldKeys == void 0) && !sdIsList(val.fieldKeys)) { + throw new BoxSdkError({ + message: + 'Expecting array for "fieldKeys" of type "UpdateMetadataTemplateRequestBody"', + }); + } const fieldKeys: undefined | readonly string[] = val.fieldKeys == void 0 ? void 0 : sdIsList(val.fieldKeys) - ? val.fieldKeys + ? (val.fieldKeys.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: + 'Expecting string for "UpdateMetadataTemplateRequestBody"', + }); + } + return itm; + }) as readonly any[]) : []; + if (!(val.enumOptionKey == void 0) && !sdIsString(val.enumOptionKey)) { + throw new BoxSdkError({ + message: + 'Expecting string for "enumOptionKey" of type "UpdateMetadataTemplateRequestBody"', + }); + } const enumOptionKey: undefined | string = val.enumOptionKey == void 0 ? void 0 : val.enumOptionKey; + if (!(val.enumOptionKeys == void 0) && !sdIsList(val.enumOptionKeys)) { + throw new BoxSdkError({ + message: + 'Expecting array for "enumOptionKeys" of type "UpdateMetadataTemplateRequestBody"', + }); + } const enumOptionKeys: undefined | readonly string[] = val.enumOptionKeys == void 0 ? void 0 : sdIsList(val.enumOptionKeys) - ? val.enumOptionKeys + ? (val.enumOptionKeys.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: + 'Expecting string for "UpdateMetadataTemplateRequestBody"', + }); + } + return itm; + }) as readonly any[]) : []; + if ( + !(val.multiSelectOptionKey == void 0) && + !sdIsString(val.multiSelectOptionKey) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "multiSelectOptionKey" of type "UpdateMetadataTemplateRequestBody"', + }); + } const multiSelectOptionKey: undefined | string = val.multiSelectOptionKey == void 0 ? void 0 : val.multiSelectOptionKey; + if ( + !(val.multiSelectOptionKeys == void 0) && + !sdIsList(val.multiSelectOptionKeys) + ) { + throw new BoxSdkError({ + message: + 'Expecting array for "multiSelectOptionKeys" of type "UpdateMetadataTemplateRequestBody"', + }); + } const multiSelectOptionKeys: undefined | readonly string[] = val.multiSelectOptionKeys == void 0 ? void 0 : sdIsList(val.multiSelectOptionKeys) - ? val.multiSelectOptionKeys + ? (val.multiSelectOptionKeys.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: + 'Expecting string for "UpdateMetadataTemplateRequestBody"', + }); + } + return itm; + }) as readonly any[]) : []; return { op: op, @@ -917,7 +1014,7 @@ export function serializeDeleteMetadataTemplateScope( return val; } export function deserializeDeleteMetadataTemplateScope( - val: any + val: SerializedData ): DeleteMetadataTemplateScope { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -940,7 +1037,7 @@ export function serializeCreateMetadataTemplateRequestBodyFieldsTypeField( return val; } export function deserializeCreateMetadataTemplateRequestBodyFieldsTypeField( - val: any + val: SerializedData ): CreateMetadataTemplateRequestBodyFieldsTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -973,8 +1070,26 @@ export function serializeCreateMetadataTemplateRequestBodyFieldsOptionsField( return { ['key']: val.key }; } export function deserializeCreateMetadataTemplateRequestBodyFieldsOptionsField( - val: any + val: SerializedData ): CreateMetadataTemplateRequestBodyFieldsOptionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateMetadataTemplateRequestBodyFieldsOptionsField"', + }); + } + if (val.key == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "key" of type "CreateMetadataTemplateRequestBodyFieldsOptionsField" to be defined', + }); + } + if (!sdIsString(val.key)) { + throw new BoxSdkError({ + message: + 'Expecting string for "key" of type "CreateMetadataTemplateRequestBodyFieldsOptionsField"', + }); + } const key: string = val.key; return { key: key, @@ -1004,16 +1119,70 @@ export function serializeCreateMetadataTemplateRequestBodyFieldsField( }; } export function deserializeCreateMetadataTemplateRequestBodyFieldsField( - val: any + val: SerializedData ): CreateMetadataTemplateRequestBodyFieldsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateMetadataTemplateRequestBodyFieldsField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CreateMetadataTemplateRequestBodyFieldsField" to be defined', + }); + } const type: CreateMetadataTemplateRequestBodyFieldsTypeField = deserializeCreateMetadataTemplateRequestBodyFieldsTypeField(val.type); + if (val.key == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "key" of type "CreateMetadataTemplateRequestBodyFieldsField" to be defined', + }); + } + if (!sdIsString(val.key)) { + throw new BoxSdkError({ + message: + 'Expecting string for "key" of type "CreateMetadataTemplateRequestBodyFieldsField"', + }); + } const key: string = val.key; + if (val.displayName == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "displayName" of type "CreateMetadataTemplateRequestBodyFieldsField" to be defined', + }); + } + if (!sdIsString(val.displayName)) { + throw new BoxSdkError({ + message: + 'Expecting string for "displayName" of type "CreateMetadataTemplateRequestBodyFieldsField"', + }); + } const displayName: string = val.displayName; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "CreateMetadataTemplateRequestBodyFieldsField"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "hidden" of type "CreateMetadataTemplateRequestBodyFieldsField"', + }); + } const hidden: undefined | boolean = val.hidden == void 0 ? void 0 : val.hidden; + if (!(val.options == void 0) && !sdIsList(val.options)) { + throw new BoxSdkError({ + message: + 'Expecting array for "options" of type "CreateMetadataTemplateRequestBodyFieldsField"', + }); + } const options: | undefined | readonly CreateMetadataTemplateRequestBodyFieldsOptionsField[] = @@ -1060,14 +1229,61 @@ export function serializeCreateMetadataTemplateRequestBody( }; } export function deserializeCreateMetadataTemplateRequestBody( - val: any + val: SerializedData ): CreateMetadataTemplateRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateMetadataTemplateRequestBody"', + }); + } + if (val.scope == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "scope" of type "CreateMetadataTemplateRequestBody" to be defined', + }); + } + if (!sdIsString(val.scope)) { + throw new BoxSdkError({ + message: + 'Expecting string for "scope" of type "CreateMetadataTemplateRequestBody"', + }); + } const scope: string = val.scope; + if (!(val.templateKey == void 0) && !sdIsString(val.templateKey)) { + throw new BoxSdkError({ + message: + 'Expecting string for "templateKey" of type "CreateMetadataTemplateRequestBody"', + }); + } const templateKey: undefined | string = val.templateKey == void 0 ? void 0 : val.templateKey; + if (val.displayName == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "displayName" of type "CreateMetadataTemplateRequestBody" to be defined', + }); + } + if (!sdIsString(val.displayName)) { + throw new BoxSdkError({ + message: + 'Expecting string for "displayName" of type "CreateMetadataTemplateRequestBody"', + }); + } const displayName: string = val.displayName; + if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "hidden" of type "CreateMetadataTemplateRequestBody"', + }); + } const hidden: undefined | boolean = val.hidden == void 0 ? void 0 : val.hidden; + if (!(val.fields == void 0) && !sdIsList(val.fields)) { + throw new BoxSdkError({ + message: + 'Expecting array for "fields" of type "CreateMetadataTemplateRequestBody"', + }); + } const fields: | undefined | readonly CreateMetadataTemplateRequestBodyFieldsField[] = @@ -1080,6 +1296,15 @@ export function deserializeCreateMetadataTemplateRequestBody( return deserializeCreateMetadataTemplateRequestBodyFieldsField(itm); }) as readonly any[]) : []; + if ( + !(val.copyInstanceOnItemCopy == void 0) && + !sdIsBoolean(val.copyInstanceOnItemCopy) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "copyInstanceOnItemCopy" of type "CreateMetadataTemplateRequestBody"', + }); + } const copyInstanceOnItemCopy: undefined | boolean = val.copyInstanceOnItemCopy == void 0 ? void 0 : val.copyInstanceOnItemCopy; return { diff --git a/src/managers/retentionPolicies.generated.ts b/src/managers/retentionPolicies.generated.ts index 2ab45c08..18df69f9 100644 --- a/src/managers/retentionPolicies.generated.ts +++ b/src/managers/retentionPolicies.generated.ts @@ -512,7 +512,7 @@ export function serializeGetRetentionPoliciesQueryParamsPolicyTypeField( return val; } export function deserializeGetRetentionPoliciesQueryParamsPolicyTypeField( - val: any + val: SerializedData ): GetRetentionPoliciesQueryParamsPolicyTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -536,7 +536,7 @@ export function serializeCreateRetentionPolicyRequestBodyPolicyTypeField( return val; } export function deserializeCreateRetentionPolicyRequestBodyPolicyTypeField( - val: any + val: SerializedData ): CreateRetentionPolicyRequestBodyPolicyTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -560,7 +560,7 @@ export function serializeCreateRetentionPolicyRequestBodyDispositionActionField( return val; } export function deserializeCreateRetentionPolicyRequestBodyDispositionActionField( - val: any + val: SerializedData ): CreateRetentionPolicyRequestBodyDispositionActionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -584,7 +584,7 @@ export function serializeCreateRetentionPolicyRequestBodyRetentionTypeField( return val; } export function deserializeCreateRetentionPolicyRequestBodyRetentionTypeField( - val: any + val: SerializedData ): CreateRetentionPolicyRequestBodyRetentionTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -640,17 +640,58 @@ export function serializeCreateRetentionPolicyRequestBody( }; } export function deserializeCreateRetentionPolicyRequestBody( - val: any + val: SerializedData ): CreateRetentionPolicyRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateRetentionPolicyRequestBody"', + }); + } + if (val.policy_name == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "policy_name" of type "CreateRetentionPolicyRequestBody" to be defined', + }); + } + if (!sdIsString(val.policy_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "policy_name" of type "CreateRetentionPolicyRequestBody"', + }); + } const policyName: string = val.policy_name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "CreateRetentionPolicyRequestBody"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if (val.policy_type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "policy_type" of type "CreateRetentionPolicyRequestBody" to be defined', + }); + } const policyType: CreateRetentionPolicyRequestBodyPolicyTypeField = deserializeCreateRetentionPolicyRequestBodyPolicyTypeField(val.policy_type); + if (val.disposition_action == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "disposition_action" of type "CreateRetentionPolicyRequestBody" to be defined', + }); + } const dispositionAction: CreateRetentionPolicyRequestBodyDispositionActionField = deserializeCreateRetentionPolicyRequestBodyDispositionActionField( val.disposition_action ); + if (!(val.retention_length == void 0) && !sdIsString(val.retention_length)) { + throw new BoxSdkError({ + message: + 'Expecting string for "retention_length" of type "CreateRetentionPolicyRequestBody"', + }); + } const retentionLength: undefined | string = val.retention_length == void 0 ? void 0 : val.retention_length; const retentionType: @@ -661,12 +702,39 @@ export function deserializeCreateRetentionPolicyRequestBody( : deserializeCreateRetentionPolicyRequestBodyRetentionTypeField( val.retention_type ); + if ( + !(val.can_owner_extend_retention == void 0) && + !sdIsBoolean(val.can_owner_extend_retention) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_owner_extend_retention" of type "CreateRetentionPolicyRequestBody"', + }); + } const canOwnerExtendRetention: undefined | boolean = val.can_owner_extend_retention == void 0 ? void 0 : val.can_owner_extend_retention; + if ( + !(val.are_owners_notified == void 0) && + !sdIsBoolean(val.are_owners_notified) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "are_owners_notified" of type "CreateRetentionPolicyRequestBody"', + }); + } const areOwnersNotified: undefined | boolean = val.are_owners_notified == void 0 ? void 0 : val.are_owners_notified; + if ( + !(val.custom_notification_recipients == void 0) && + !sdIsList(val.custom_notification_recipients) + ) { + throw new BoxSdkError({ + message: + 'Expecting array for "custom_notification_recipients" of type "CreateRetentionPolicyRequestBody"', + }); + } const customNotificationRecipients: undefined | readonly UserMini[] = val.custom_notification_recipients == void 0 ? void 0 @@ -719,25 +787,96 @@ export function serializeUpdateRetentionPolicyByIdRequestBody( }; } export function deserializeUpdateRetentionPolicyByIdRequestBody( - val: any + val: SerializedData ): UpdateRetentionPolicyByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateRetentionPolicyByIdRequestBody"', + }); + } + if (!(val.policy_name == void 0) && !sdIsString(val.policy_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "policy_name" of type "UpdateRetentionPolicyByIdRequestBody"', + }); + } const policyName: undefined | string = val.policy_name == void 0 ? void 0 : val.policy_name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "UpdateRetentionPolicyByIdRequestBody"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if ( + !(val.disposition_action == void 0) && + !sdIsString(val.disposition_action) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "disposition_action" of type "UpdateRetentionPolicyByIdRequestBody"', + }); + } const dispositionAction: undefined | string = val.disposition_action == void 0 ? void 0 : val.disposition_action; + if (!(val.retention_type == void 0) && !sdIsString(val.retention_type)) { + throw new BoxSdkError({ + message: + 'Expecting string for "retention_type" of type "UpdateRetentionPolicyByIdRequestBody"', + }); + } const retentionType: undefined | string = val.retention_type == void 0 ? void 0 : val.retention_type; + if (!(val.retention_length == void 0) && !sdIsString(val.retention_length)) { + throw new BoxSdkError({ + message: + 'Expecting string for "retention_length" of type "UpdateRetentionPolicyByIdRequestBody"', + }); + } const retentionLength: undefined | string = val.retention_length == void 0 ? void 0 : val.retention_length; + if (!(val.status == void 0) && !sdIsString(val.status)) { + throw new BoxSdkError({ + message: + 'Expecting string for "status" of type "UpdateRetentionPolicyByIdRequestBody"', + }); + } const status: undefined | string = val.status == void 0 ? void 0 : val.status; + if ( + !(val.can_owner_extend_retention == void 0) && + !sdIsBoolean(val.can_owner_extend_retention) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_owner_extend_retention" of type "UpdateRetentionPolicyByIdRequestBody"', + }); + } const canOwnerExtendRetention: undefined | boolean = val.can_owner_extend_retention == void 0 ? void 0 : val.can_owner_extend_retention; + if ( + !(val.are_owners_notified == void 0) && + !sdIsBoolean(val.are_owners_notified) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "are_owners_notified" of type "UpdateRetentionPolicyByIdRequestBody"', + }); + } const areOwnersNotified: undefined | boolean = val.are_owners_notified == void 0 ? void 0 : val.are_owners_notified; + if ( + !(val.custom_notification_recipients == void 0) && + !sdIsList(val.custom_notification_recipients) + ) { + throw new BoxSdkError({ + message: + 'Expecting array for "custom_notification_recipients" of type "UpdateRetentionPolicyByIdRequestBody"', + }); + } const customNotificationRecipients: undefined | readonly UserBase[] = val.custom_notification_recipients == void 0 ? void 0 diff --git a/src/managers/retentionPolicyAssignments.generated.ts b/src/managers/retentionPolicyAssignments.generated.ts index c23dee20..b4a7e56b 100644 --- a/src/managers/retentionPolicyAssignments.generated.ts +++ b/src/managers/retentionPolicyAssignments.generated.ts @@ -549,7 +549,7 @@ export function serializeGetRetentionPolicyAssignmentsQueryParamsTypeField( return val; } export function deserializeGetRetentionPolicyAssignmentsQueryParamsTypeField( - val: any + val: SerializedData ): GetRetentionPolicyAssignmentsQueryParamsTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -576,7 +576,7 @@ export function serializeCreateRetentionPolicyAssignmentRequestBodyAssignToTypeF return val; } export function deserializeCreateRetentionPolicyAssignmentRequestBodyAssignToTypeField( - val: any + val: SerializedData ): CreateRetentionPolicyAssignmentRequestBodyAssignToTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -609,12 +609,30 @@ export function serializeCreateRetentionPolicyAssignmentRequestBodyAssignToField }; } export function deserializeCreateRetentionPolicyAssignmentRequestBodyAssignToField( - val: any + val: SerializedData ): CreateRetentionPolicyAssignmentRequestBodyAssignToField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateRetentionPolicyAssignmentRequestBodyAssignToField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CreateRetentionPolicyAssignmentRequestBodyAssignToField" to be defined', + }); + } const type: CreateRetentionPolicyAssignmentRequestBodyAssignToTypeField = deserializeCreateRetentionPolicyAssignmentRequestBodyAssignToTypeField( val.type ); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateRetentionPolicyAssignmentRequestBodyAssignToField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { type: type, @@ -630,9 +648,27 @@ export function serializeCreateRetentionPolicyAssignmentRequestBodyFilterFieldsF }; } export function deserializeCreateRetentionPolicyAssignmentRequestBodyFilterFieldsField( - val: any + val: SerializedData ): CreateRetentionPolicyAssignmentRequestBodyFilterFieldsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateRetentionPolicyAssignmentRequestBodyFilterFieldsField"', + }); + } + if (!(val.field == void 0) && !sdIsString(val.field)) { + throw new BoxSdkError({ + message: + 'Expecting string for "field" of type "CreateRetentionPolicyAssignmentRequestBodyFilterFieldsField"', + }); + } const field: undefined | string = val.field == void 0 ? void 0 : val.field; + if (!(val.value == void 0) && !sdIsString(val.value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "value" of type "CreateRetentionPolicyAssignmentRequestBodyFilterFieldsField"', + }); + } const value: undefined | string = val.value == void 0 ? void 0 : val.value; return { field: field, @@ -663,13 +699,43 @@ export function serializeCreateRetentionPolicyAssignmentRequestBody( }; } export function deserializeCreateRetentionPolicyAssignmentRequestBody( - val: any + val: SerializedData ): CreateRetentionPolicyAssignmentRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateRetentionPolicyAssignmentRequestBody"', + }); + } + if (val.policy_id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "policy_id" of type "CreateRetentionPolicyAssignmentRequestBody" to be defined', + }); + } + if (!sdIsString(val.policy_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "policy_id" of type "CreateRetentionPolicyAssignmentRequestBody"', + }); + } const policyId: string = val.policy_id; + if (val.assign_to == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "assign_to" of type "CreateRetentionPolicyAssignmentRequestBody" to be defined', + }); + } const assignTo: CreateRetentionPolicyAssignmentRequestBodyAssignToField = deserializeCreateRetentionPolicyAssignmentRequestBodyAssignToField( val.assign_to ); + if (!(val.filter_fields == void 0) && !sdIsList(val.filter_fields)) { + throw new BoxSdkError({ + message: + 'Expecting array for "filter_fields" of type "CreateRetentionPolicyAssignmentRequestBody"', + }); + } const filterFields: | undefined | readonly CreateRetentionPolicyAssignmentRequestBodyFilterFieldsField[] = @@ -684,6 +750,12 @@ export function deserializeCreateRetentionPolicyAssignmentRequestBody( ); }) as readonly any[]) : []; + if (!(val.start_date_field == void 0) && !sdIsString(val.start_date_field)) { + throw new BoxSdkError({ + message: + 'Expecting string for "start_date_field" of type "CreateRetentionPolicyAssignmentRequestBody"', + }); + } const startDateField: undefined | string = val.start_date_field == void 0 ? void 0 : val.start_date_field; return { diff --git a/src/managers/search.generated.ts b/src/managers/search.generated.ts index 6a52111e..54434aba 100644 --- a/src/managers/search.generated.ts +++ b/src/managers/search.generated.ts @@ -278,7 +278,7 @@ export function serializeSearchForContentQueryParamsScopeField( return val; } export function deserializeSearchForContentQueryParamsScopeField( - val: any + val: SerializedData ): SearchForContentQueryParamsScopeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -301,7 +301,7 @@ export function serializeSearchForContentQueryParamsContentTypesField( return val; } export function deserializeSearchForContentQueryParamsContentTypesField( - val: any + val: SerializedData ): SearchForContentQueryParamsContentTypesField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -334,7 +334,7 @@ export function serializeSearchForContentQueryParamsTypeField( return val; } export function deserializeSearchForContentQueryParamsTypeField( - val: any + val: SerializedData ): SearchForContentQueryParamsTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -360,7 +360,7 @@ export function serializeSearchForContentQueryParamsTrashContentField( return val; } export function deserializeSearchForContentQueryParamsTrashContentField( - val: any + val: SerializedData ): SearchForContentQueryParamsTrashContentField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -387,7 +387,7 @@ export function serializeSearchForContentQueryParamsSortField( return val; } export function deserializeSearchForContentQueryParamsSortField( - val: any + val: SerializedData ): SearchForContentQueryParamsSortField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -410,7 +410,7 @@ export function serializeSearchForContentQueryParamsDirectionField( return val; } export function deserializeSearchForContentQueryParamsDirectionField( - val: any + val: SerializedData ): SearchForContentQueryParamsDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ diff --git a/src/managers/sessionTermination.generated.ts b/src/managers/sessionTermination.generated.ts index 629c31f3..35087034 100644 --- a/src/managers/sessionTermination.generated.ts +++ b/src/managers/sessionTermination.generated.ts @@ -14,6 +14,7 @@ import { FetchOptions } from '../networking/fetch.js'; import { FetchResponse } from '../networking/fetch.js'; import { fetch } from '../networking/fetch.js'; import { SerializedData } from '../serialization/json.js'; +import { BoxSdkError } from '../box/errors.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; import { sdIsNumber } from '../serialization/json.js'; @@ -218,11 +219,56 @@ export function serializeTerminateUsersSessionsRequestBody( }; } export function deserializeTerminateUsersSessionsRequestBody( - val: any + val: SerializedData ): TerminateUsersSessionsRequestBody { - const userIds: readonly string[] = sdIsList(val.user_ids) ? val.user_ids : []; + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TerminateUsersSessionsRequestBody"', + }); + } + if (val.user_ids == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "user_ids" of type "TerminateUsersSessionsRequestBody" to be defined', + }); + } + if (!sdIsList(val.user_ids)) { + throw new BoxSdkError({ + message: + 'Expecting array for "user_ids" of type "TerminateUsersSessionsRequestBody"', + }); + } + const userIds: readonly string[] = sdIsList(val.user_ids) + ? (val.user_ids.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: 'Expecting string for "TerminateUsersSessionsRequestBody"', + }); + } + return itm; + }) as readonly any[]) + : []; + if (val.user_logins == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "user_logins" of type "TerminateUsersSessionsRequestBody" to be defined', + }); + } + if (!sdIsList(val.user_logins)) { + throw new BoxSdkError({ + message: + 'Expecting array for "user_logins" of type "TerminateUsersSessionsRequestBody"', + }); + } const userLogins: readonly string[] = sdIsList(val.user_logins) - ? val.user_logins + ? (val.user_logins.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: 'Expecting string for "TerminateUsersSessionsRequestBody"', + }); + } + return itm; + }) as readonly any[]) : []; return { userIds: userIds, @@ -239,10 +285,35 @@ export function serializeTerminateGroupsSessionsRequestBody( }; } export function deserializeTerminateGroupsSessionsRequestBody( - val: any + val: SerializedData ): TerminateGroupsSessionsRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TerminateGroupsSessionsRequestBody"', + }); + } + if (val.group_ids == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "group_ids" of type "TerminateGroupsSessionsRequestBody" to be defined', + }); + } + if (!sdIsList(val.group_ids)) { + throw new BoxSdkError({ + message: + 'Expecting array for "group_ids" of type "TerminateGroupsSessionsRequestBody"', + }); + } const groupIds: readonly string[] = sdIsList(val.group_ids) - ? val.group_ids + ? (val.group_ids.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: + 'Expecting string for "TerminateGroupsSessionsRequestBody"', + }); + } + return itm; + }) as readonly any[]) : []; return { groupIds: groupIds } satisfies TerminateGroupsSessionsRequestBody; } diff --git a/src/managers/sharedLinksFiles.generated.ts b/src/managers/sharedLinksFiles.generated.ts index 5cd28fb2..a3c72e01 100644 --- a/src/managers/sharedLinksFiles.generated.ts +++ b/src/managers/sharedLinksFiles.generated.ts @@ -543,7 +543,7 @@ export function serializeAddShareLinkToFileRequestBodySharedLinkAccessField( return val; } export function deserializeAddShareLinkToFileRequestBodySharedLinkAccessField( - val: any + val: SerializedData ): AddShareLinkToFileRequestBodySharedLinkAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -574,12 +574,36 @@ export function serializeAddShareLinkToFileRequestBodySharedLinkPermissionsField }; } export function deserializeAddShareLinkToFileRequestBodySharedLinkPermissionsField( - val: any + val: SerializedData ): AddShareLinkToFileRequestBodySharedLinkPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "AddShareLinkToFileRequestBodySharedLinkPermissionsField"', + }); + } + if (!(val.can_download == void 0) && !sdIsBoolean(val.can_download)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_download" of type "AddShareLinkToFileRequestBodySharedLinkPermissionsField"', + }); + } const canDownload: undefined | boolean = val.can_download == void 0 ? void 0 : val.can_download; + if (!(val.can_preview == void 0) && !sdIsBoolean(val.can_preview)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_preview" of type "AddShareLinkToFileRequestBodySharedLinkPermissionsField"', + }); + } const canPreview: undefined | boolean = val.can_preview == void 0 ? void 0 : val.can_preview; + if (!(val.can_edit == void 0) && !sdIsBoolean(val.can_edit)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_edit" of type "AddShareLinkToFileRequestBodySharedLinkPermissionsField"', + }); + } const canEdit: undefined | boolean = val.can_edit == void 0 ? void 0 : val.can_edit; return { @@ -611,18 +635,42 @@ export function serializeAddShareLinkToFileRequestBodySharedLinkField( }; } export function deserializeAddShareLinkToFileRequestBodySharedLinkField( - val: any + val: SerializedData ): AddShareLinkToFileRequestBodySharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "AddShareLinkToFileRequestBodySharedLinkField"', + }); + } const access: undefined | AddShareLinkToFileRequestBodySharedLinkAccessField = val.access == void 0 ? void 0 : deserializeAddShareLinkToFileRequestBodySharedLinkAccessField( val.access ); + if (!(val.password == void 0) && !sdIsString(val.password)) { + throw new BoxSdkError({ + message: + 'Expecting string for "password" of type "AddShareLinkToFileRequestBodySharedLinkField"', + }); + } const password: undefined | string = val.password == void 0 ? void 0 : val.password; + if (!(val.vanity_name == void 0) && !sdIsString(val.vanity_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_name" of type "AddShareLinkToFileRequestBodySharedLinkField"', + }); + } const vanityName: undefined | string = val.vanity_name == void 0 ? void 0 : val.vanity_name; + if (!(val.unshared_at == void 0) && !sdIsString(val.unshared_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "unshared_at" of type "AddShareLinkToFileRequestBodySharedLinkField"', + }); + } const unsharedAt: undefined | DateTime = val.unshared_at == void 0 ? void 0 : deserializeDateTime(val.unshared_at); const permissions: @@ -652,8 +700,13 @@ export function serializeAddShareLinkToFileRequestBody( }; } export function deserializeAddShareLinkToFileRequestBody( - val: any + val: SerializedData ): AddShareLinkToFileRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AddShareLinkToFileRequestBody"', + }); + } const sharedLink: undefined | AddShareLinkToFileRequestBodySharedLinkField = val.shared_link == void 0 ? void 0 @@ -668,7 +721,7 @@ export function serializeUpdateSharedLinkOnFileRequestBodySharedLinkAccessField( return val; } export function deserializeUpdateSharedLinkOnFileRequestBodySharedLinkAccessField( - val: any + val: SerializedData ): UpdateSharedLinkOnFileRequestBodySharedLinkAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -699,12 +752,36 @@ export function serializeUpdateSharedLinkOnFileRequestBodySharedLinkPermissionsF }; } export function deserializeUpdateSharedLinkOnFileRequestBodySharedLinkPermissionsField( - val: any + val: SerializedData ): UpdateSharedLinkOnFileRequestBodySharedLinkPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateSharedLinkOnFileRequestBodySharedLinkPermissionsField"', + }); + } + if (!(val.can_download == void 0) && !sdIsBoolean(val.can_download)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_download" of type "UpdateSharedLinkOnFileRequestBodySharedLinkPermissionsField"', + }); + } const canDownload: undefined | boolean = val.can_download == void 0 ? void 0 : val.can_download; + if (!(val.can_preview == void 0) && !sdIsBoolean(val.can_preview)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_preview" of type "UpdateSharedLinkOnFileRequestBodySharedLinkPermissionsField"', + }); + } const canPreview: undefined | boolean = val.can_preview == void 0 ? void 0 : val.can_preview; + if (!(val.can_edit == void 0) && !sdIsBoolean(val.can_edit)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_edit" of type "UpdateSharedLinkOnFileRequestBodySharedLinkPermissionsField"', + }); + } const canEdit: undefined | boolean = val.can_edit == void 0 ? void 0 : val.can_edit; return { @@ -736,8 +813,14 @@ export function serializeUpdateSharedLinkOnFileRequestBodySharedLinkField( }; } export function deserializeUpdateSharedLinkOnFileRequestBodySharedLinkField( - val: any + val: SerializedData ): UpdateSharedLinkOnFileRequestBodySharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateSharedLinkOnFileRequestBodySharedLinkField"', + }); + } const access: | undefined | UpdateSharedLinkOnFileRequestBodySharedLinkAccessField = @@ -746,10 +829,28 @@ export function deserializeUpdateSharedLinkOnFileRequestBodySharedLinkField( : deserializeUpdateSharedLinkOnFileRequestBodySharedLinkAccessField( val.access ); + if (!(val.password == void 0) && !sdIsString(val.password)) { + throw new BoxSdkError({ + message: + 'Expecting string for "password" of type "UpdateSharedLinkOnFileRequestBodySharedLinkField"', + }); + } const password: undefined | string = val.password == void 0 ? void 0 : val.password; + if (!(val.vanity_name == void 0) && !sdIsString(val.vanity_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_name" of type "UpdateSharedLinkOnFileRequestBodySharedLinkField"', + }); + } const vanityName: undefined | string = val.vanity_name == void 0 ? void 0 : val.vanity_name; + if (!(val.unshared_at == void 0) && !sdIsString(val.unshared_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "unshared_at" of type "UpdateSharedLinkOnFileRequestBodySharedLinkField"', + }); + } const unsharedAt: undefined | DateTime = val.unshared_at == void 0 ? void 0 : deserializeDateTime(val.unshared_at); const permissions: @@ -781,8 +882,13 @@ export function serializeUpdateSharedLinkOnFileRequestBody( }; } export function deserializeUpdateSharedLinkOnFileRequestBody( - val: any + val: SerializedData ): UpdateSharedLinkOnFileRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateSharedLinkOnFileRequestBody"', + }); + } const sharedLink: | undefined | UpdateSharedLinkOnFileRequestBodySharedLinkField = @@ -799,8 +905,14 @@ export function serializeRemoveSharedLinkFromFileRequestBodySharedLinkField( return {}; } export function deserializeRemoveSharedLinkFromFileRequestBodySharedLinkField( - val: any + val: SerializedData ): RemoveSharedLinkFromFileRequestBodySharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "RemoveSharedLinkFromFileRequestBodySharedLinkField"', + }); + } return {} satisfies RemoveSharedLinkFromFileRequestBodySharedLinkField; } export function serializeRemoveSharedLinkFromFileRequestBody( @@ -816,8 +928,13 @@ export function serializeRemoveSharedLinkFromFileRequestBody( }; } export function deserializeRemoveSharedLinkFromFileRequestBody( - val: any + val: SerializedData ): RemoveSharedLinkFromFileRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RemoveSharedLinkFromFileRequestBody"', + }); + } const sharedLink: | undefined | RemoveSharedLinkFromFileRequestBodySharedLinkField = diff --git a/src/managers/sharedLinksFolders.generated.ts b/src/managers/sharedLinksFolders.generated.ts index 3619cdb5..51ab8f27 100644 --- a/src/managers/sharedLinksFolders.generated.ts +++ b/src/managers/sharedLinksFolders.generated.ts @@ -548,7 +548,7 @@ export function serializeAddShareLinkToFolderRequestBodySharedLinkAccessField( return val; } export function deserializeAddShareLinkToFolderRequestBodySharedLinkAccessField( - val: any + val: SerializedData ): AddShareLinkToFolderRequestBodySharedLinkAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -579,12 +579,36 @@ export function serializeAddShareLinkToFolderRequestBodySharedLinkPermissionsFie }; } export function deserializeAddShareLinkToFolderRequestBodySharedLinkPermissionsField( - val: any + val: SerializedData ): AddShareLinkToFolderRequestBodySharedLinkPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "AddShareLinkToFolderRequestBodySharedLinkPermissionsField"', + }); + } + if (!(val.can_download == void 0) && !sdIsBoolean(val.can_download)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_download" of type "AddShareLinkToFolderRequestBodySharedLinkPermissionsField"', + }); + } const canDownload: undefined | boolean = val.can_download == void 0 ? void 0 : val.can_download; + if (!(val.can_preview == void 0) && !sdIsBoolean(val.can_preview)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_preview" of type "AddShareLinkToFolderRequestBodySharedLinkPermissionsField"', + }); + } const canPreview: undefined | boolean = val.can_preview == void 0 ? void 0 : val.can_preview; + if (!(val.can_edit == void 0) && !sdIsBoolean(val.can_edit)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_edit" of type "AddShareLinkToFolderRequestBodySharedLinkPermissionsField"', + }); + } const canEdit: undefined | boolean = val.can_edit == void 0 ? void 0 : val.can_edit; return { @@ -616,8 +640,14 @@ export function serializeAddShareLinkToFolderRequestBodySharedLinkField( }; } export function deserializeAddShareLinkToFolderRequestBodySharedLinkField( - val: any + val: SerializedData ): AddShareLinkToFolderRequestBodySharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "AddShareLinkToFolderRequestBodySharedLinkField"', + }); + } const access: | undefined | AddShareLinkToFolderRequestBodySharedLinkAccessField = @@ -626,10 +656,28 @@ export function deserializeAddShareLinkToFolderRequestBodySharedLinkField( : deserializeAddShareLinkToFolderRequestBodySharedLinkAccessField( val.access ); + if (!(val.password == void 0) && !sdIsString(val.password)) { + throw new BoxSdkError({ + message: + 'Expecting string for "password" of type "AddShareLinkToFolderRequestBodySharedLinkField"', + }); + } const password: undefined | string = val.password == void 0 ? void 0 : val.password; + if (!(val.vanity_name == void 0) && !sdIsString(val.vanity_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_name" of type "AddShareLinkToFolderRequestBodySharedLinkField"', + }); + } const vanityName: undefined | string = val.vanity_name == void 0 ? void 0 : val.vanity_name; + if (!(val.unshared_at == void 0) && !sdIsString(val.unshared_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "unshared_at" of type "AddShareLinkToFolderRequestBodySharedLinkField"', + }); + } const unsharedAt: undefined | DateTime = val.unshared_at == void 0 ? void 0 : deserializeDateTime(val.unshared_at); const permissions: @@ -661,8 +709,13 @@ export function serializeAddShareLinkToFolderRequestBody( }; } export function deserializeAddShareLinkToFolderRequestBody( - val: any + val: SerializedData ): AddShareLinkToFolderRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AddShareLinkToFolderRequestBody"', + }); + } const sharedLink: undefined | AddShareLinkToFolderRequestBodySharedLinkField = val.shared_link == void 0 ? void 0 @@ -677,7 +730,7 @@ export function serializeUpdateSharedLinkOnFolderRequestBodySharedLinkAccessFiel return val; } export function deserializeUpdateSharedLinkOnFolderRequestBodySharedLinkAccessField( - val: any + val: SerializedData ): UpdateSharedLinkOnFolderRequestBodySharedLinkAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -708,12 +761,36 @@ export function serializeUpdateSharedLinkOnFolderRequestBodySharedLinkPermission }; } export function deserializeUpdateSharedLinkOnFolderRequestBodySharedLinkPermissionsField( - val: any + val: SerializedData ): UpdateSharedLinkOnFolderRequestBodySharedLinkPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateSharedLinkOnFolderRequestBodySharedLinkPermissionsField"', + }); + } + if (!(val.can_download == void 0) && !sdIsBoolean(val.can_download)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_download" of type "UpdateSharedLinkOnFolderRequestBodySharedLinkPermissionsField"', + }); + } const canDownload: undefined | boolean = val.can_download == void 0 ? void 0 : val.can_download; + if (!(val.can_preview == void 0) && !sdIsBoolean(val.can_preview)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_preview" of type "UpdateSharedLinkOnFolderRequestBodySharedLinkPermissionsField"', + }); + } const canPreview: undefined | boolean = val.can_preview == void 0 ? void 0 : val.can_preview; + if (!(val.can_edit == void 0) && !sdIsBoolean(val.can_edit)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_edit" of type "UpdateSharedLinkOnFolderRequestBodySharedLinkPermissionsField"', + }); + } const canEdit: undefined | boolean = val.can_edit == void 0 ? void 0 : val.can_edit; return { @@ -745,8 +822,14 @@ export function serializeUpdateSharedLinkOnFolderRequestBodySharedLinkField( }; } export function deserializeUpdateSharedLinkOnFolderRequestBodySharedLinkField( - val: any + val: SerializedData ): UpdateSharedLinkOnFolderRequestBodySharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateSharedLinkOnFolderRequestBodySharedLinkField"', + }); + } const access: | undefined | UpdateSharedLinkOnFolderRequestBodySharedLinkAccessField = @@ -755,10 +838,28 @@ export function deserializeUpdateSharedLinkOnFolderRequestBodySharedLinkField( : deserializeUpdateSharedLinkOnFolderRequestBodySharedLinkAccessField( val.access ); + if (!(val.password == void 0) && !sdIsString(val.password)) { + throw new BoxSdkError({ + message: + 'Expecting string for "password" of type "UpdateSharedLinkOnFolderRequestBodySharedLinkField"', + }); + } const password: undefined | string = val.password == void 0 ? void 0 : val.password; + if (!(val.vanity_name == void 0) && !sdIsString(val.vanity_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_name" of type "UpdateSharedLinkOnFolderRequestBodySharedLinkField"', + }); + } const vanityName: undefined | string = val.vanity_name == void 0 ? void 0 : val.vanity_name; + if (!(val.unshared_at == void 0) && !sdIsString(val.unshared_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "unshared_at" of type "UpdateSharedLinkOnFolderRequestBodySharedLinkField"', + }); + } const unsharedAt: undefined | DateTime = val.unshared_at == void 0 ? void 0 : deserializeDateTime(val.unshared_at); const permissions: @@ -790,8 +891,13 @@ export function serializeUpdateSharedLinkOnFolderRequestBody( }; } export function deserializeUpdateSharedLinkOnFolderRequestBody( - val: any + val: SerializedData ): UpdateSharedLinkOnFolderRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateSharedLinkOnFolderRequestBody"', + }); + } const sharedLink: | undefined | UpdateSharedLinkOnFolderRequestBodySharedLinkField = @@ -810,8 +916,14 @@ export function serializeRemoveSharedLinkFromFolderRequestBodySharedLinkField( return {}; } export function deserializeRemoveSharedLinkFromFolderRequestBodySharedLinkField( - val: any + val: SerializedData ): RemoveSharedLinkFromFolderRequestBodySharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "RemoveSharedLinkFromFolderRequestBodySharedLinkField"', + }); + } return {} satisfies RemoveSharedLinkFromFolderRequestBodySharedLinkField; } export function serializeRemoveSharedLinkFromFolderRequestBody( @@ -827,8 +939,13 @@ export function serializeRemoveSharedLinkFromFolderRequestBody( }; } export function deserializeRemoveSharedLinkFromFolderRequestBody( - val: any + val: SerializedData ): RemoveSharedLinkFromFolderRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RemoveSharedLinkFromFolderRequestBody"', + }); + } const sharedLink: | undefined | RemoveSharedLinkFromFolderRequestBodySharedLinkField = diff --git a/src/managers/sharedLinksWebLinks.generated.ts b/src/managers/sharedLinksWebLinks.generated.ts index b9793785..6da903fc 100644 --- a/src/managers/sharedLinksWebLinks.generated.ts +++ b/src/managers/sharedLinksWebLinks.generated.ts @@ -551,7 +551,7 @@ export function serializeAddShareLinkToWebLinkRequestBodySharedLinkAccessField( return val; } export function deserializeAddShareLinkToWebLinkRequestBodySharedLinkAccessField( - val: any + val: SerializedData ): AddShareLinkToWebLinkRequestBodySharedLinkAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -582,12 +582,36 @@ export function serializeAddShareLinkToWebLinkRequestBodySharedLinkPermissionsFi }; } export function deserializeAddShareLinkToWebLinkRequestBodySharedLinkPermissionsField( - val: any + val: SerializedData ): AddShareLinkToWebLinkRequestBodySharedLinkPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "AddShareLinkToWebLinkRequestBodySharedLinkPermissionsField"', + }); + } + if (!(val.can_download == void 0) && !sdIsBoolean(val.can_download)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_download" of type "AddShareLinkToWebLinkRequestBodySharedLinkPermissionsField"', + }); + } const canDownload: undefined | boolean = val.can_download == void 0 ? void 0 : val.can_download; + if (!(val.can_preview == void 0) && !sdIsBoolean(val.can_preview)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_preview" of type "AddShareLinkToWebLinkRequestBodySharedLinkPermissionsField"', + }); + } const canPreview: undefined | boolean = val.can_preview == void 0 ? void 0 : val.can_preview; + if (!(val.can_edit == void 0) && !sdIsBoolean(val.can_edit)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_edit" of type "AddShareLinkToWebLinkRequestBodySharedLinkPermissionsField"', + }); + } const canEdit: undefined | boolean = val.can_edit == void 0 ? void 0 : val.can_edit; return { @@ -619,8 +643,14 @@ export function serializeAddShareLinkToWebLinkRequestBodySharedLinkField( }; } export function deserializeAddShareLinkToWebLinkRequestBodySharedLinkField( - val: any + val: SerializedData ): AddShareLinkToWebLinkRequestBodySharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "AddShareLinkToWebLinkRequestBodySharedLinkField"', + }); + } const access: | undefined | AddShareLinkToWebLinkRequestBodySharedLinkAccessField = @@ -629,10 +659,28 @@ export function deserializeAddShareLinkToWebLinkRequestBodySharedLinkField( : deserializeAddShareLinkToWebLinkRequestBodySharedLinkAccessField( val.access ); + if (!(val.password == void 0) && !sdIsString(val.password)) { + throw new BoxSdkError({ + message: + 'Expecting string for "password" of type "AddShareLinkToWebLinkRequestBodySharedLinkField"', + }); + } const password: undefined | string = val.password == void 0 ? void 0 : val.password; + if (!(val.vanity_name == void 0) && !sdIsString(val.vanity_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_name" of type "AddShareLinkToWebLinkRequestBodySharedLinkField"', + }); + } const vanityName: undefined | string = val.vanity_name == void 0 ? void 0 : val.vanity_name; + if (!(val.unshared_at == void 0) && !sdIsString(val.unshared_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "unshared_at" of type "AddShareLinkToWebLinkRequestBodySharedLinkField"', + }); + } const unsharedAt: undefined | DateTime = val.unshared_at == void 0 ? void 0 : deserializeDateTime(val.unshared_at); const permissions: @@ -664,8 +712,13 @@ export function serializeAddShareLinkToWebLinkRequestBody( }; } export function deserializeAddShareLinkToWebLinkRequestBody( - val: any + val: SerializedData ): AddShareLinkToWebLinkRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AddShareLinkToWebLinkRequestBody"', + }); + } const sharedLink: | undefined | AddShareLinkToWebLinkRequestBodySharedLinkField = @@ -682,7 +735,7 @@ export function serializeUpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessFie return val; } export function deserializeUpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessField( - val: any + val: SerializedData ): UpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -713,12 +766,36 @@ export function serializeUpdateSharedLinkOnWebLinkRequestBodySharedLinkPermissio }; } export function deserializeUpdateSharedLinkOnWebLinkRequestBodySharedLinkPermissionsField( - val: any + val: SerializedData ): UpdateSharedLinkOnWebLinkRequestBodySharedLinkPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateSharedLinkOnWebLinkRequestBodySharedLinkPermissionsField"', + }); + } + if (!(val.can_download == void 0) && !sdIsBoolean(val.can_download)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_download" of type "UpdateSharedLinkOnWebLinkRequestBodySharedLinkPermissionsField"', + }); + } const canDownload: undefined | boolean = val.can_download == void 0 ? void 0 : val.can_download; + if (!(val.can_preview == void 0) && !sdIsBoolean(val.can_preview)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_preview" of type "UpdateSharedLinkOnWebLinkRequestBodySharedLinkPermissionsField"', + }); + } const canPreview: undefined | boolean = val.can_preview == void 0 ? void 0 : val.can_preview; + if (!(val.can_edit == void 0) && !sdIsBoolean(val.can_edit)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_edit" of type "UpdateSharedLinkOnWebLinkRequestBodySharedLinkPermissionsField"', + }); + } const canEdit: undefined | boolean = val.can_edit == void 0 ? void 0 : val.can_edit; return { @@ -750,8 +827,14 @@ export function serializeUpdateSharedLinkOnWebLinkRequestBodySharedLinkField( }; } export function deserializeUpdateSharedLinkOnWebLinkRequestBodySharedLinkField( - val: any + val: SerializedData ): UpdateSharedLinkOnWebLinkRequestBodySharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateSharedLinkOnWebLinkRequestBodySharedLinkField"', + }); + } const access: | undefined | UpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessField = @@ -760,10 +843,28 @@ export function deserializeUpdateSharedLinkOnWebLinkRequestBodySharedLinkField( : deserializeUpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessField( val.access ); + if (!(val.password == void 0) && !sdIsString(val.password)) { + throw new BoxSdkError({ + message: + 'Expecting string for "password" of type "UpdateSharedLinkOnWebLinkRequestBodySharedLinkField"', + }); + } const password: undefined | string = val.password == void 0 ? void 0 : val.password; + if (!(val.vanity_name == void 0) && !sdIsString(val.vanity_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_name" of type "UpdateSharedLinkOnWebLinkRequestBodySharedLinkField"', + }); + } const vanityName: undefined | string = val.vanity_name == void 0 ? void 0 : val.vanity_name; + if (!(val.unshared_at == void 0) && !sdIsString(val.unshared_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "unshared_at" of type "UpdateSharedLinkOnWebLinkRequestBodySharedLinkField"', + }); + } const unsharedAt: undefined | DateTime = val.unshared_at == void 0 ? void 0 : deserializeDateTime(val.unshared_at); const permissions: @@ -795,8 +896,13 @@ export function serializeUpdateSharedLinkOnWebLinkRequestBody( }; } export function deserializeUpdateSharedLinkOnWebLinkRequestBody( - val: any + val: SerializedData ): UpdateSharedLinkOnWebLinkRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateSharedLinkOnWebLinkRequestBody"', + }); + } const sharedLink: | undefined | UpdateSharedLinkOnWebLinkRequestBodySharedLinkField = @@ -815,8 +921,14 @@ export function serializeRemoveSharedLinkFromWebLinkRequestBodySharedLinkField( return {}; } export function deserializeRemoveSharedLinkFromWebLinkRequestBodySharedLinkField( - val: any + val: SerializedData ): RemoveSharedLinkFromWebLinkRequestBodySharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "RemoveSharedLinkFromWebLinkRequestBodySharedLinkField"', + }); + } return {} satisfies RemoveSharedLinkFromWebLinkRequestBodySharedLinkField; } export function serializeRemoveSharedLinkFromWebLinkRequestBody( @@ -832,8 +944,13 @@ export function serializeRemoveSharedLinkFromWebLinkRequestBody( }; } export function deserializeRemoveSharedLinkFromWebLinkRequestBody( - val: any + val: SerializedData ): RemoveSharedLinkFromWebLinkRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RemoveSharedLinkFromWebLinkRequestBody"', + }); + } const sharedLink: | undefined | RemoveSharedLinkFromWebLinkRequestBodySharedLinkField = diff --git a/src/managers/shieldInformationBarrierSegmentMembers.generated.ts b/src/managers/shieldInformationBarrierSegmentMembers.generated.ts index d30acfcd..e09404d5 100644 --- a/src/managers/shieldInformationBarrierSegmentMembers.generated.ts +++ b/src/managers/shieldInformationBarrierSegmentMembers.generated.ts @@ -438,7 +438,7 @@ export function serializeCreateShieldInformationBarrierSegmentMemberRequestBodyT return val; } export function deserializeCreateShieldInformationBarrierSegmentMemberRequestBodyTypeField( - val: any + val: SerializedData ): CreateShieldInformationBarrierSegmentMemberRequestBodyTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -459,7 +459,7 @@ export function serializeCreateShieldInformationBarrierSegmentMemberRequestBodyS return val; } export function deserializeCreateShieldInformationBarrierSegmentMemberRequestBodyShieldInformationBarrierSegmentTypeField( - val: any + val: SerializedData ): CreateShieldInformationBarrierSegmentMemberRequestBodyShieldInformationBarrierSegmentTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -488,8 +488,20 @@ export function serializeCreateShieldInformationBarrierSegmentMemberRequestBodyS }; } export function deserializeCreateShieldInformationBarrierSegmentMemberRequestBodyShieldInformationBarrierSegmentField( - val: any + val: SerializedData ): CreateShieldInformationBarrierSegmentMemberRequestBodyShieldInformationBarrierSegmentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateShieldInformationBarrierSegmentMemberRequestBodyShieldInformationBarrierSegmentField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateShieldInformationBarrierSegmentMemberRequestBodyShieldInformationBarrierSegmentField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: | undefined @@ -526,8 +538,14 @@ export function serializeCreateShieldInformationBarrierSegmentMemberRequestBody( }; } export function deserializeCreateShieldInformationBarrierSegmentMemberRequestBody( - val: any + val: SerializedData ): CreateShieldInformationBarrierSegmentMemberRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateShieldInformationBarrierSegmentMemberRequestBody"', + }); + } const type: | undefined | CreateShieldInformationBarrierSegmentMemberRequestBodyTypeField = @@ -540,10 +558,22 @@ export function deserializeCreateShieldInformationBarrierSegmentMemberRequestBod val.shield_information_barrier == void 0 ? void 0 : deserializeShieldInformationBarrierBase(val.shield_information_barrier); + if (val.shield_information_barrier_segment == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "shield_information_barrier_segment" of type "CreateShieldInformationBarrierSegmentMemberRequestBody" to be defined', + }); + } const shieldInformationBarrierSegment: CreateShieldInformationBarrierSegmentMemberRequestBodyShieldInformationBarrierSegmentField = deserializeCreateShieldInformationBarrierSegmentMemberRequestBodyShieldInformationBarrierSegmentField( val.shield_information_barrier_segment ); + if (val.user == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "user" of type "CreateShieldInformationBarrierSegmentMemberRequestBody" to be defined', + }); + } const user: UserBase = deserializeUserBase(val.user); return { type: type, diff --git a/src/managers/shieldInformationBarrierSegmentRestrictions.generated.ts b/src/managers/shieldInformationBarrierSegmentRestrictions.generated.ts index 3cce760a..d3624354 100644 --- a/src/managers/shieldInformationBarrierSegmentRestrictions.generated.ts +++ b/src/managers/shieldInformationBarrierSegmentRestrictions.generated.ts @@ -493,7 +493,7 @@ export function serializeCreateShieldInformationBarrierSegmentRestrictionRequest return val; } export function deserializeCreateShieldInformationBarrierSegmentRestrictionRequestBodyTypeField( - val: any + val: SerializedData ): CreateShieldInformationBarrierSegmentRestrictionRequestBodyTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -514,7 +514,7 @@ export function serializeCreateShieldInformationBarrierSegmentRestrictionRequest return val; } export function deserializeCreateShieldInformationBarrierSegmentRestrictionRequestBodyShieldInformationBarrierSegmentTypeField( - val: any + val: SerializedData ): CreateShieldInformationBarrierSegmentRestrictionRequestBodyShieldInformationBarrierSegmentTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -543,8 +543,20 @@ export function serializeCreateShieldInformationBarrierSegmentRestrictionRequest }; } export function deserializeCreateShieldInformationBarrierSegmentRestrictionRequestBodyShieldInformationBarrierSegmentField( - val: any + val: SerializedData ): CreateShieldInformationBarrierSegmentRestrictionRequestBodyShieldInformationBarrierSegmentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateShieldInformationBarrierSegmentRestrictionRequestBodyShieldInformationBarrierSegmentField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateShieldInformationBarrierSegmentRestrictionRequestBodyShieldInformationBarrierSegmentField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: | undefined @@ -565,7 +577,7 @@ export function serializeCreateShieldInformationBarrierSegmentRestrictionRequest return val; } export function deserializeCreateShieldInformationBarrierSegmentRestrictionRequestBodyRestrictedSegmentTypeField( - val: any + val: SerializedData ): CreateShieldInformationBarrierSegmentRestrictionRequestBodyRestrictedSegmentTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -594,8 +606,20 @@ export function serializeCreateShieldInformationBarrierSegmentRestrictionRequest }; } export function deserializeCreateShieldInformationBarrierSegmentRestrictionRequestBodyRestrictedSegmentField( - val: any + val: SerializedData ): CreateShieldInformationBarrierSegmentRestrictionRequestBodyRestrictedSegmentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateShieldInformationBarrierSegmentRestrictionRequestBodyRestrictedSegmentField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateShieldInformationBarrierSegmentRestrictionRequestBodyRestrictedSegmentField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: | undefined @@ -633,8 +657,20 @@ export function serializeCreateShieldInformationBarrierSegmentRestrictionRequest }; } export function deserializeCreateShieldInformationBarrierSegmentRestrictionRequestBody( - val: any + val: SerializedData ): CreateShieldInformationBarrierSegmentRestrictionRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateShieldInformationBarrierSegmentRestrictionRequestBody"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CreateShieldInformationBarrierSegmentRestrictionRequestBody" to be defined', + }); + } const type: CreateShieldInformationBarrierSegmentRestrictionRequestBodyTypeField = deserializeCreateShieldInformationBarrierSegmentRestrictionRequestBodyTypeField( val.type @@ -643,10 +679,22 @@ export function deserializeCreateShieldInformationBarrierSegmentRestrictionReque val.shield_information_barrier == void 0 ? void 0 : deserializeShieldInformationBarrierBase(val.shield_information_barrier); + if (val.shield_information_barrier_segment == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "shield_information_barrier_segment" of type "CreateShieldInformationBarrierSegmentRestrictionRequestBody" to be defined', + }); + } const shieldInformationBarrierSegment: CreateShieldInformationBarrierSegmentRestrictionRequestBodyShieldInformationBarrierSegmentField = deserializeCreateShieldInformationBarrierSegmentRestrictionRequestBodyShieldInformationBarrierSegmentField( val.shield_information_barrier_segment ); + if (val.restricted_segment == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "restricted_segment" of type "CreateShieldInformationBarrierSegmentRestrictionRequestBody" to be defined', + }); + } const restrictedSegment: CreateShieldInformationBarrierSegmentRestrictionRequestBodyRestrictedSegmentField = deserializeCreateShieldInformationBarrierSegmentRestrictionRequestBodyRestrictedSegmentField( val.restricted_segment @@ -683,8 +731,14 @@ export function serializeCreateShieldInformationBarrierSegmentRestrictionRequest }; } export function deserializeCreateShieldInformationBarrierSegmentRestrictionRequestBodyInput( - val: any + val: SerializedData ): CreateShieldInformationBarrierSegmentRestrictionRequestBodyInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateShieldInformationBarrierSegmentRestrictionRequestBodyInput"', + }); + } const type: | undefined | CreateShieldInformationBarrierSegmentRestrictionRequestBodyTypeField = @@ -697,10 +751,22 @@ export function deserializeCreateShieldInformationBarrierSegmentRestrictionReque val.shield_information_barrier == void 0 ? void 0 : deserializeShieldInformationBarrierBase(val.shield_information_barrier); + if (val.shield_information_barrier_segment == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "shield_information_barrier_segment" of type "CreateShieldInformationBarrierSegmentRestrictionRequestBodyInput" to be defined', + }); + } const shieldInformationBarrierSegment: CreateShieldInformationBarrierSegmentRestrictionRequestBodyShieldInformationBarrierSegmentField = deserializeCreateShieldInformationBarrierSegmentRestrictionRequestBodyShieldInformationBarrierSegmentField( val.shield_information_barrier_segment ); + if (val.restricted_segment == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "restricted_segment" of type "CreateShieldInformationBarrierSegmentRestrictionRequestBodyInput" to be defined', + }); + } const restrictedSegment: CreateShieldInformationBarrierSegmentRestrictionRequestBodyRestrictedSegmentField = deserializeCreateShieldInformationBarrierSegmentRestrictionRequestBodyRestrictedSegmentField( val.restricted_segment diff --git a/src/managers/shieldInformationBarrierSegments.generated.ts b/src/managers/shieldInformationBarrierSegments.generated.ts index cb987e5d..a4dc9fca 100644 --- a/src/managers/shieldInformationBarrierSegments.generated.ts +++ b/src/managers/shieldInformationBarrierSegments.generated.ts @@ -21,6 +21,7 @@ import { FetchResponse } from '../networking/fetch.js'; import { fetch } from '../networking/fetch.js'; import { sdToJson } from '../serialization/json.js'; import { SerializedData } from '../serialization/json.js'; +import { BoxSdkError } from '../box/errors.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; import { sdIsNumber } from '../serialization/json.js'; @@ -513,9 +514,27 @@ export function serializeUpdateShieldInformationBarrierSegmentByIdRequestBody( }; } export function deserializeUpdateShieldInformationBarrierSegmentByIdRequestBody( - val: any + val: SerializedData ): UpdateShieldInformationBarrierSegmentByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateShieldInformationBarrierSegmentByIdRequestBody"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "UpdateShieldInformationBarrierSegmentByIdRequestBody"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "UpdateShieldInformationBarrierSegmentByIdRequestBody"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; return { @@ -535,11 +554,41 @@ export function serializeCreateShieldInformationBarrierSegmentRequestBody( }; } export function deserializeCreateShieldInformationBarrierSegmentRequestBody( - val: any + val: SerializedData ): CreateShieldInformationBarrierSegmentRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateShieldInformationBarrierSegmentRequestBody"', + }); + } + if (val.shield_information_barrier == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "shield_information_barrier" of type "CreateShieldInformationBarrierSegmentRequestBody" to be defined', + }); + } const shieldInformationBarrier: ShieldInformationBarrierBase = deserializeShieldInformationBarrierBase(val.shield_information_barrier); + if (val.name == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "name" of type "CreateShieldInformationBarrierSegmentRequestBody" to be defined', + }); + } + if (!sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "CreateShieldInformationBarrierSegmentRequestBody"', + }); + } const name: string = val.name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "CreateShieldInformationBarrierSegmentRequestBody"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; return { diff --git a/src/managers/shieldInformationBarriers.generated.ts b/src/managers/shieldInformationBarriers.generated.ts index b4eda3da..54e7ceb2 100644 --- a/src/managers/shieldInformationBarriers.generated.ts +++ b/src/managers/shieldInformationBarriers.generated.ts @@ -372,7 +372,7 @@ export function serializeUpdateShieldInformationBarrierStatusRequestBodyStatusFi return val; } export function deserializeUpdateShieldInformationBarrierStatusRequestBodyStatusField( - val: any + val: SerializedData ): UpdateShieldInformationBarrierStatusRequestBodyStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -402,9 +402,33 @@ export function serializeUpdateShieldInformationBarrierStatusRequestBody( }; } export function deserializeUpdateShieldInformationBarrierStatusRequestBody( - val: any + val: SerializedData ): UpdateShieldInformationBarrierStatusRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateShieldInformationBarrierStatusRequestBody"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "UpdateShieldInformationBarrierStatusRequestBody" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "UpdateShieldInformationBarrierStatusRequestBody"', + }); + } const id: string = val.id; + if (val.status == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "status" of type "UpdateShieldInformationBarrierStatusRequestBody" to be defined', + }); + } const status: UpdateShieldInformationBarrierStatusRequestBodyStatusField = deserializeUpdateShieldInformationBarrierStatusRequestBodyStatusField( val.status @@ -420,8 +444,20 @@ export function serializeCreateShieldInformationBarrierRequestBody( return { ['enterprise']: serializeEnterpriseBase(val.enterprise) }; } export function deserializeCreateShieldInformationBarrierRequestBody( - val: any + val: SerializedData ): CreateShieldInformationBarrierRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateShieldInformationBarrierRequestBody"', + }); + } + if (val.enterprise == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "enterprise" of type "CreateShieldInformationBarrierRequestBody" to be defined', + }); + } const enterprise: EnterpriseBase = deserializeEnterpriseBase(val.enterprise); return { enterprise: enterprise, diff --git a/src/managers/skills.generated.ts b/src/managers/skills.generated.ts index 393a5d66..9710e1b6 100644 --- a/src/managers/skills.generated.ts +++ b/src/managers/skills.generated.ts @@ -513,8 +513,25 @@ export function serializeCreateBoxSkillCardsOnFileRequestBody( }; } export function deserializeCreateBoxSkillCardsOnFileRequestBody( - val: any + val: SerializedData ): CreateBoxSkillCardsOnFileRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateBoxSkillCardsOnFileRequestBody"', + }); + } + if (val.cards == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "cards" of type "CreateBoxSkillCardsOnFileRequestBody" to be defined', + }); + } + if (!sdIsList(val.cards)) { + throw new BoxSdkError({ + message: + 'Expecting array for "cards" of type "CreateBoxSkillCardsOnFileRequestBody"', + }); + } const cards: readonly KeywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard[] = sdIsList(val.cards) ? (val.cards.map(function ( @@ -533,7 +550,7 @@ export function serializeUpdateBoxSkillCardsOnFileRequestBodyOpField( return val; } export function deserializeUpdateBoxSkillCardsOnFileRequestBodyOpField( - val: any + val: SerializedData ): UpdateBoxSkillCardsOnFileRequestBodyOpField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -566,12 +583,23 @@ export function serializeUpdateBoxSkillCardsOnFileRequestBody( }; } export function deserializeUpdateBoxSkillCardsOnFileRequestBody( - val: any + val: SerializedData ): UpdateBoxSkillCardsOnFileRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateBoxSkillCardsOnFileRequestBody"', + }); + } const op: undefined | UpdateBoxSkillCardsOnFileRequestBodyOpField = val.op == void 0 ? void 0 : deserializeUpdateBoxSkillCardsOnFileRequestBodyOpField(val.op); + if (!(val.path == void 0) && !sdIsString(val.path)) { + throw new BoxSdkError({ + message: + 'Expecting string for "path" of type "UpdateBoxSkillCardsOnFileRequestBody"', + }); + } const path: undefined | string = val.path == void 0 ? void 0 : val.path; const value: | undefined @@ -593,7 +621,7 @@ export function serializeUpdateAllSkillCardsOnFileRequestBodyStatusField( return val; } export function deserializeUpdateAllSkillCardsOnFileRequestBodyStatusField( - val: any + val: SerializedData ): UpdateAllSkillCardsOnFileRequestBodyStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -637,8 +665,20 @@ export function serializeUpdateAllSkillCardsOnFileRequestBodyMetadataField( }; } export function deserializeUpdateAllSkillCardsOnFileRequestBodyMetadataField( - val: any + val: SerializedData ): UpdateAllSkillCardsOnFileRequestBodyMetadataField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateAllSkillCardsOnFileRequestBodyMetadataField"', + }); + } + if (!(val.cards == void 0) && !sdIsList(val.cards)) { + throw new BoxSdkError({ + message: + 'Expecting array for "cards" of type "UpdateAllSkillCardsOnFileRequestBodyMetadataField"', + }); + } const cards: | undefined | readonly KeywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard[] = @@ -663,7 +703,7 @@ export function serializeUpdateAllSkillCardsOnFileRequestBodyFileTypeField( return val; } export function deserializeUpdateAllSkillCardsOnFileRequestBodyFileTypeField( - val: any + val: SerializedData ): UpdateAllSkillCardsOnFileRequestBodyFileTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -690,12 +730,24 @@ export function serializeUpdateAllSkillCardsOnFileRequestBodyFileField( }; } export function deserializeUpdateAllSkillCardsOnFileRequestBodyFileField( - val: any + val: SerializedData ): UpdateAllSkillCardsOnFileRequestBodyFileField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateAllSkillCardsOnFileRequestBodyFileField"', + }); + } const type: undefined | UpdateAllSkillCardsOnFileRequestBodyFileTypeField = val.type == void 0 ? void 0 : deserializeUpdateAllSkillCardsOnFileRequestBodyFileTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "UpdateAllSkillCardsOnFileRequestBodyFileField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { type: type, @@ -708,7 +760,7 @@ export function serializeUpdateAllSkillCardsOnFileRequestBodyFileVersionTypeFiel return val; } export function deserializeUpdateAllSkillCardsOnFileRequestBodyFileVersionTypeField( - val: any + val: SerializedData ): UpdateAllSkillCardsOnFileRequestBodyFileVersionTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -737,8 +789,14 @@ export function serializeUpdateAllSkillCardsOnFileRequestBodyFileVersionField( }; } export function deserializeUpdateAllSkillCardsOnFileRequestBodyFileVersionField( - val: any + val: SerializedData ): UpdateAllSkillCardsOnFileRequestBodyFileVersionField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateAllSkillCardsOnFileRequestBodyFileVersionField"', + }); + } const type: | undefined | UpdateAllSkillCardsOnFileRequestBodyFileVersionTypeField = @@ -747,6 +805,12 @@ export function deserializeUpdateAllSkillCardsOnFileRequestBodyFileVersionField( : deserializeUpdateAllSkillCardsOnFileRequestBodyFileVersionTypeField( val.type ); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "UpdateAllSkillCardsOnFileRequestBodyFileVersionField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { type: type, @@ -762,9 +826,27 @@ export function serializeUpdateAllSkillCardsOnFileRequestBodyUsageField( }; } export function deserializeUpdateAllSkillCardsOnFileRequestBodyUsageField( - val: any + val: SerializedData ): UpdateAllSkillCardsOnFileRequestBodyUsageField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateAllSkillCardsOnFileRequestBodyUsageField"', + }); + } + if (!(val.unit == void 0) && !sdIsString(val.unit)) { + throw new BoxSdkError({ + message: + 'Expecting string for "unit" of type "UpdateAllSkillCardsOnFileRequestBodyUsageField"', + }); + } const unit: undefined | string = val.unit == void 0 ? void 0 : val.unit; + if (!(val.value == void 0) && !sdIsNumber(val.value)) { + throw new BoxSdkError({ + message: + 'Expecting number for "value" of type "UpdateAllSkillCardsOnFileRequestBodyUsageField"', + }); + } const value: undefined | number = val.value == void 0 ? void 0 : val.value; return { unit: unit, @@ -795,12 +877,35 @@ export function serializeUpdateAllSkillCardsOnFileRequestBody( }; } export function deserializeUpdateAllSkillCardsOnFileRequestBody( - val: any + val: SerializedData ): UpdateAllSkillCardsOnFileRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateAllSkillCardsOnFileRequestBody"', + }); + } + if (val.status == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "status" of type "UpdateAllSkillCardsOnFileRequestBody" to be defined', + }); + } const status: UpdateAllSkillCardsOnFileRequestBodyStatusField = deserializeUpdateAllSkillCardsOnFileRequestBodyStatusField(val.status); + if (val.metadata == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "metadata" of type "UpdateAllSkillCardsOnFileRequestBody" to be defined', + }); + } const metadata: UpdateAllSkillCardsOnFileRequestBodyMetadataField = deserializeUpdateAllSkillCardsOnFileRequestBodyMetadataField(val.metadata); + if (val.file == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "file" of type "UpdateAllSkillCardsOnFileRequestBody" to be defined', + }); + } const file: UpdateAllSkillCardsOnFileRequestBodyFileField = deserializeUpdateAllSkillCardsOnFileRequestBodyFileField(val.file); const fileVersion: diff --git a/src/managers/storagePolicyAssignments.generated.ts b/src/managers/storagePolicyAssignments.generated.ts index 6ac2c102..75f4ec3a 100644 --- a/src/managers/storagePolicyAssignments.generated.ts +++ b/src/managers/storagePolicyAssignments.generated.ts @@ -545,7 +545,7 @@ export function serializeGetStoragePolicyAssignmentsQueryParamsResolvedForTypeFi return val; } export function deserializeGetStoragePolicyAssignmentsQueryParamsResolvedForTypeField( - val: any + val: SerializedData ): GetStoragePolicyAssignmentsQueryParamsResolvedForTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -569,7 +569,7 @@ export function serializeCreateStoragePolicyAssignmentRequestBodyStoragePolicyTy return val; } export function deserializeCreateStoragePolicyAssignmentRequestBodyStoragePolicyTypeField( - val: any + val: SerializedData ): CreateStoragePolicyAssignmentRequestBodyStoragePolicyTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -596,12 +596,36 @@ export function serializeCreateStoragePolicyAssignmentRequestBodyStoragePolicyFi }; } export function deserializeCreateStoragePolicyAssignmentRequestBodyStoragePolicyField( - val: any + val: SerializedData ): CreateStoragePolicyAssignmentRequestBodyStoragePolicyField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateStoragePolicyAssignmentRequestBodyStoragePolicyField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CreateStoragePolicyAssignmentRequestBodyStoragePolicyField" to be defined', + }); + } const type: CreateStoragePolicyAssignmentRequestBodyStoragePolicyTypeField = deserializeCreateStoragePolicyAssignmentRequestBodyStoragePolicyTypeField( val.type ); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateStoragePolicyAssignmentRequestBodyStoragePolicyField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateStoragePolicyAssignmentRequestBodyStoragePolicyField"', + }); + } const id: string = val.id; return { type: type, @@ -622,8 +646,14 @@ export function serializeCreateStoragePolicyAssignmentRequestBodyStoragePolicyFi }; } export function deserializeCreateStoragePolicyAssignmentRequestBodyStoragePolicyFieldInput( - val: any + val: SerializedData ): CreateStoragePolicyAssignmentRequestBodyStoragePolicyFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateStoragePolicyAssignmentRequestBodyStoragePolicyFieldInput"', + }); + } const type: | undefined | CreateStoragePolicyAssignmentRequestBodyStoragePolicyTypeField = @@ -632,6 +662,18 @@ export function deserializeCreateStoragePolicyAssignmentRequestBodyStoragePolicy : deserializeCreateStoragePolicyAssignmentRequestBodyStoragePolicyTypeField( val.type ); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateStoragePolicyAssignmentRequestBodyStoragePolicyFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateStoragePolicyAssignmentRequestBodyStoragePolicyFieldInput"', + }); + } const id: string = val.id; return { type: type, @@ -644,7 +686,7 @@ export function serializeCreateStoragePolicyAssignmentRequestBodyAssignedToTypeF return val; } export function deserializeCreateStoragePolicyAssignmentRequestBodyAssignedToTypeField( - val: any + val: SerializedData ): CreateStoragePolicyAssignmentRequestBodyAssignedToTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -674,12 +716,36 @@ export function serializeCreateStoragePolicyAssignmentRequestBodyAssignedToField }; } export function deserializeCreateStoragePolicyAssignmentRequestBodyAssignedToField( - val: any + val: SerializedData ): CreateStoragePolicyAssignmentRequestBodyAssignedToField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateStoragePolicyAssignmentRequestBodyAssignedToField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CreateStoragePolicyAssignmentRequestBodyAssignedToField" to be defined', + }); + } const type: CreateStoragePolicyAssignmentRequestBodyAssignedToTypeField = deserializeCreateStoragePolicyAssignmentRequestBodyAssignedToTypeField( val.type ); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateStoragePolicyAssignmentRequestBodyAssignedToField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateStoragePolicyAssignmentRequestBodyAssignedToField"', + }); + } const id: string = val.id; return { type: type, @@ -701,12 +767,29 @@ export function serializeCreateStoragePolicyAssignmentRequestBody( }; } export function deserializeCreateStoragePolicyAssignmentRequestBody( - val: any + val: SerializedData ): CreateStoragePolicyAssignmentRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateStoragePolicyAssignmentRequestBody"', + }); + } + if (val.storage_policy == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "storage_policy" of type "CreateStoragePolicyAssignmentRequestBody" to be defined', + }); + } const storagePolicy: CreateStoragePolicyAssignmentRequestBodyStoragePolicyField = deserializeCreateStoragePolicyAssignmentRequestBodyStoragePolicyField( val.storage_policy ); + if (val.assigned_to == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "assigned_to" of type "CreateStoragePolicyAssignmentRequestBody" to be defined', + }); + } const assignedTo: CreateStoragePolicyAssignmentRequestBodyAssignedToField = deserializeCreateStoragePolicyAssignmentRequestBodyAssignedToField( val.assigned_to @@ -722,7 +805,7 @@ export function serializeUpdateStoragePolicyAssignmentByIdRequestBodyStoragePoli return val; } export function deserializeUpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyTypeField( - val: any + val: SerializedData ): UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -749,12 +832,36 @@ export function serializeUpdateStoragePolicyAssignmentByIdRequestBodyStoragePoli }; } export function deserializeUpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyField( - val: any + val: SerializedData ): UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyField" to be defined', + }); + } const type: UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyTypeField = deserializeUpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyTypeField( val.type ); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyField"', + }); + } const id: string = val.id; return { type: type, @@ -775,8 +882,14 @@ export function serializeUpdateStoragePolicyAssignmentByIdRequestBodyStoragePoli }; } export function deserializeUpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyFieldInput( - val: any + val: SerializedData ): UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyFieldInput"', + }); + } const type: | undefined | UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyTypeField = @@ -785,6 +898,18 @@ export function deserializeUpdateStoragePolicyAssignmentByIdRequestBodyStoragePo : deserializeUpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyTypeField( val.type ); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyFieldInput"', + }); + } const id: string = val.id; return { type: type, @@ -802,8 +927,20 @@ export function serializeUpdateStoragePolicyAssignmentByIdRequestBody( }; } export function deserializeUpdateStoragePolicyAssignmentByIdRequestBody( - val: any + val: SerializedData ): UpdateStoragePolicyAssignmentByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateStoragePolicyAssignmentByIdRequestBody"', + }); + } + if (val.storage_policy == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "storage_policy" of type "UpdateStoragePolicyAssignmentByIdRequestBody" to be defined', + }); + } const storagePolicy: UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyField = deserializeUpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyField( val.storage_policy diff --git a/src/managers/taskAssignments.generated.ts b/src/managers/taskAssignments.generated.ts index 4bd676ec..8694598c 100644 --- a/src/managers/taskAssignments.generated.ts +++ b/src/managers/taskAssignments.generated.ts @@ -489,7 +489,7 @@ export function serializeCreateTaskAssignmentRequestBodyTaskTypeField( return val; } export function deserializeCreateTaskAssignmentRequestBodyTaskTypeField( - val: any + val: SerializedData ): CreateTaskAssignmentRequestBodyTaskTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -513,9 +513,32 @@ export function serializeCreateTaskAssignmentRequestBodyTaskField( }; } export function deserializeCreateTaskAssignmentRequestBodyTaskField( - val: any + val: SerializedData ): CreateTaskAssignmentRequestBodyTaskField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateTaskAssignmentRequestBodyTaskField"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateTaskAssignmentRequestBodyTaskField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateTaskAssignmentRequestBodyTaskField"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CreateTaskAssignmentRequestBodyTaskField" to be defined', + }); + } const type: CreateTaskAssignmentRequestBodyTaskTypeField = deserializeCreateTaskAssignmentRequestBodyTaskTypeField(val.type); return { @@ -535,8 +558,26 @@ export function serializeCreateTaskAssignmentRequestBodyTaskFieldInput( }; } export function deserializeCreateTaskAssignmentRequestBodyTaskFieldInput( - val: any + val: SerializedData ): CreateTaskAssignmentRequestBodyTaskFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateTaskAssignmentRequestBodyTaskFieldInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateTaskAssignmentRequestBodyTaskFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateTaskAssignmentRequestBodyTaskFieldInput"', + }); + } const id: string = val.id; const type: undefined | CreateTaskAssignmentRequestBodyTaskTypeField = val.type == void 0 @@ -556,9 +597,27 @@ export function serializeCreateTaskAssignmentRequestBodyAssignToField( }; } export function deserializeCreateTaskAssignmentRequestBodyAssignToField( - val: any + val: SerializedData ): CreateTaskAssignmentRequestBodyAssignToField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateTaskAssignmentRequestBodyAssignToField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateTaskAssignmentRequestBodyAssignToField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (!(val.login == void 0) && !sdIsString(val.login)) { + throw new BoxSdkError({ + message: + 'Expecting string for "login" of type "CreateTaskAssignmentRequestBodyAssignToField"', + }); + } const login: undefined | string = val.login == void 0 ? void 0 : val.login; return { id: id, @@ -576,10 +635,27 @@ export function serializeCreateTaskAssignmentRequestBody( }; } export function deserializeCreateTaskAssignmentRequestBody( - val: any + val: SerializedData ): CreateTaskAssignmentRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateTaskAssignmentRequestBody"', + }); + } + if (val.task == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "task" of type "CreateTaskAssignmentRequestBody" to be defined', + }); + } const task: CreateTaskAssignmentRequestBodyTaskField = deserializeCreateTaskAssignmentRequestBodyTaskField(val.task); + if (val.assign_to == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "assign_to" of type "CreateTaskAssignmentRequestBody" to be defined', + }); + } const assignTo: CreateTaskAssignmentRequestBodyAssignToField = deserializeCreateTaskAssignmentRequestBodyAssignToField(val.assign_to); return { @@ -593,7 +669,7 @@ export function serializeUpdateTaskAssignmentByIdRequestBodyResolutionStateField return val; } export function deserializeUpdateTaskAssignmentByIdRequestBodyResolutionStateField( - val: any + val: SerializedData ): UpdateTaskAssignmentByIdRequestBodyResolutionStateField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -631,8 +707,19 @@ export function serializeUpdateTaskAssignmentByIdRequestBody( }; } export function deserializeUpdateTaskAssignmentByIdRequestBody( - val: any + val: SerializedData ): UpdateTaskAssignmentByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateTaskAssignmentByIdRequestBody"', + }); + } + if (!(val.message == void 0) && !sdIsString(val.message)) { + throw new BoxSdkError({ + message: + 'Expecting string for "message" of type "UpdateTaskAssignmentByIdRequestBody"', + }); + } const message: undefined | string = val.message == void 0 ? void 0 : val.message; const resolutionState: diff --git a/src/managers/tasks.generated.ts b/src/managers/tasks.generated.ts index c1c0fc7b..c06a311e 100644 --- a/src/managers/tasks.generated.ts +++ b/src/managers/tasks.generated.ts @@ -449,7 +449,7 @@ export function serializeCreateTaskRequestBodyItemTypeField( return val; } export function deserializeCreateTaskRequestBodyItemTypeField( - val: any + val: SerializedData ): CreateTaskRequestBodyItemTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -475,8 +475,19 @@ export function serializeCreateTaskRequestBodyItemField( }; } export function deserializeCreateTaskRequestBodyItemField( - val: any + val: SerializedData ): CreateTaskRequestBodyItemField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateTaskRequestBodyItemField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateTaskRequestBodyItemField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | CreateTaskRequestBodyItemTypeField = val.type == void 0 @@ -490,7 +501,7 @@ export function serializeCreateTaskRequestBodyActionField( return val; } export function deserializeCreateTaskRequestBodyActionField( - val: any + val: SerializedData ): CreateTaskRequestBodyActionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -513,7 +524,7 @@ export function serializeCreateTaskRequestBodyCompletionRuleField( return val; } export function deserializeCreateTaskRequestBodyCompletionRuleField( - val: any + val: SerializedData ): CreateTaskRequestBodyCompletionRuleField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -549,16 +560,36 @@ export function serializeCreateTaskRequestBody( }; } export function deserializeCreateTaskRequestBody( - val: any + val: SerializedData ): CreateTaskRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateTaskRequestBody"', + }); + } + if (val.item == void 0) { + throw new BoxSdkError({ + message: 'Expecting "item" of type "CreateTaskRequestBody" to be defined', + }); + } const item: CreateTaskRequestBodyItemField = deserializeCreateTaskRequestBodyItemField(val.item); const action: undefined | CreateTaskRequestBodyActionField = val.action == void 0 ? void 0 : deserializeCreateTaskRequestBodyActionField(val.action); + if (!(val.message == void 0) && !sdIsString(val.message)) { + throw new BoxSdkError({ + message: 'Expecting string for "message" of type "CreateTaskRequestBody"', + }); + } const message: undefined | string = val.message == void 0 ? void 0 : val.message; + if (!(val.due_at == void 0) && !sdIsString(val.due_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "due_at" of type "CreateTaskRequestBody"', + }); + } const dueAt: undefined | DateTime = val.due_at == void 0 ? void 0 : deserializeDateTime(val.due_at); const completionRule: undefined | CreateTaskRequestBodyCompletionRuleField = @@ -581,7 +612,7 @@ export function serializeUpdateTaskByIdRequestBodyActionField( return val; } export function deserializeUpdateTaskByIdRequestBodyActionField( - val: any + val: SerializedData ): UpdateTaskByIdRequestBodyActionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -604,7 +635,7 @@ export function serializeUpdateTaskByIdRequestBodyCompletionRuleField( return val; } export function deserializeUpdateTaskByIdRequestBodyCompletionRuleField( - val: any + val: SerializedData ): UpdateTaskByIdRequestBodyCompletionRuleField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -641,14 +672,31 @@ export function serializeUpdateTaskByIdRequestBody( }; } export function deserializeUpdateTaskByIdRequestBody( - val: any + val: SerializedData ): UpdateTaskByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateTaskByIdRequestBody"', + }); + } const action: undefined | UpdateTaskByIdRequestBodyActionField = val.action == void 0 ? void 0 : deserializeUpdateTaskByIdRequestBodyActionField(val.action); + if (!(val.message == void 0) && !sdIsString(val.message)) { + throw new BoxSdkError({ + message: + 'Expecting string for "message" of type "UpdateTaskByIdRequestBody"', + }); + } const message: undefined | string = val.message == void 0 ? void 0 : val.message; + if (!(val.due_at == void 0) && !sdIsString(val.due_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "due_at" of type "UpdateTaskByIdRequestBody"', + }); + } const dueAt: undefined | DateTime = val.due_at == void 0 ? void 0 : deserializeDateTime(val.due_at); const completionRule: diff --git a/src/managers/termsOfServiceUserStatuses.generated.ts b/src/managers/termsOfServiceUserStatuses.generated.ts index d416d59b..a28d2f1e 100644 --- a/src/managers/termsOfServiceUserStatuses.generated.ts +++ b/src/managers/termsOfServiceUserStatuses.generated.ts @@ -371,7 +371,7 @@ export function serializeCreateTermsOfServiceStatusForUserRequestBodyTosTypeFiel return val; } export function deserializeCreateTermsOfServiceStatusForUserRequestBodyTosTypeField( - val: any + val: SerializedData ): CreateTermsOfServiceStatusForUserRequestBodyTosTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -397,12 +397,36 @@ export function serializeCreateTermsOfServiceStatusForUserRequestBodyTosField( }; } export function deserializeCreateTermsOfServiceStatusForUserRequestBodyTosField( - val: any + val: SerializedData ): CreateTermsOfServiceStatusForUserRequestBodyTosField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateTermsOfServiceStatusForUserRequestBodyTosField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CreateTermsOfServiceStatusForUserRequestBodyTosField" to be defined', + }); + } const type: CreateTermsOfServiceStatusForUserRequestBodyTosTypeField = deserializeCreateTermsOfServiceStatusForUserRequestBodyTosTypeField( val.type ); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateTermsOfServiceStatusForUserRequestBodyTosField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateTermsOfServiceStatusForUserRequestBodyTosField"', + }); + } const id: string = val.id; return { type: type, @@ -423,8 +447,14 @@ export function serializeCreateTermsOfServiceStatusForUserRequestBodyTosFieldInp }; } export function deserializeCreateTermsOfServiceStatusForUserRequestBodyTosFieldInput( - val: any + val: SerializedData ): CreateTermsOfServiceStatusForUserRequestBodyTosFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateTermsOfServiceStatusForUserRequestBodyTosFieldInput"', + }); + } const type: | undefined | CreateTermsOfServiceStatusForUserRequestBodyTosTypeField = @@ -433,6 +463,18 @@ export function deserializeCreateTermsOfServiceStatusForUserRequestBodyTosFieldI : deserializeCreateTermsOfServiceStatusForUserRequestBodyTosTypeField( val.type ); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateTermsOfServiceStatusForUserRequestBodyTosFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateTermsOfServiceStatusForUserRequestBodyTosFieldInput"', + }); + } const id: string = val.id; return { type: type, @@ -445,7 +487,7 @@ export function serializeCreateTermsOfServiceStatusForUserRequestBodyUserTypeFie return val; } export function deserializeCreateTermsOfServiceStatusForUserRequestBodyUserTypeField( - val: any + val: SerializedData ): CreateTermsOfServiceStatusForUserRequestBodyUserTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -472,12 +514,36 @@ export function serializeCreateTermsOfServiceStatusForUserRequestBodyUserField( }; } export function deserializeCreateTermsOfServiceStatusForUserRequestBodyUserField( - val: any + val: SerializedData ): CreateTermsOfServiceStatusForUserRequestBodyUserField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateTermsOfServiceStatusForUserRequestBodyUserField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CreateTermsOfServiceStatusForUserRequestBodyUserField" to be defined', + }); + } const type: CreateTermsOfServiceStatusForUserRequestBodyUserTypeField = deserializeCreateTermsOfServiceStatusForUserRequestBodyUserTypeField( val.type ); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateTermsOfServiceStatusForUserRequestBodyUserField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateTermsOfServiceStatusForUserRequestBodyUserField"', + }); + } const id: string = val.id; return { type: type, @@ -498,8 +564,14 @@ export function serializeCreateTermsOfServiceStatusForUserRequestBodyUserFieldIn }; } export function deserializeCreateTermsOfServiceStatusForUserRequestBodyUserFieldInput( - val: any + val: SerializedData ): CreateTermsOfServiceStatusForUserRequestBodyUserFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateTermsOfServiceStatusForUserRequestBodyUserFieldInput"', + }); + } const type: | undefined | CreateTermsOfServiceStatusForUserRequestBodyUserTypeField = @@ -508,6 +580,18 @@ export function deserializeCreateTermsOfServiceStatusForUserRequestBodyUserField : deserializeCreateTermsOfServiceStatusForUserRequestBodyUserTypeField( val.type ); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateTermsOfServiceStatusForUserRequestBodyUserFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateTermsOfServiceStatusForUserRequestBodyUserFieldInput"', + }); + } const id: string = val.id; return { type: type, @@ -528,12 +612,42 @@ export function serializeCreateTermsOfServiceStatusForUserRequestBody( }; } export function deserializeCreateTermsOfServiceStatusForUserRequestBody( - val: any + val: SerializedData ): CreateTermsOfServiceStatusForUserRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateTermsOfServiceStatusForUserRequestBody"', + }); + } + if (val.tos == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "tos" of type "CreateTermsOfServiceStatusForUserRequestBody" to be defined', + }); + } const tos: CreateTermsOfServiceStatusForUserRequestBodyTosField = deserializeCreateTermsOfServiceStatusForUserRequestBodyTosField(val.tos); + if (val.user == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "user" of type "CreateTermsOfServiceStatusForUserRequestBody" to be defined', + }); + } const user: CreateTermsOfServiceStatusForUserRequestBodyUserField = deserializeCreateTermsOfServiceStatusForUserRequestBodyUserField(val.user); + if (val.is_accepted == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "is_accepted" of type "CreateTermsOfServiceStatusForUserRequestBody" to be defined', + }); + } + if (!sdIsBoolean(val.is_accepted)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_accepted" of type "CreateTermsOfServiceStatusForUserRequestBody"', + }); + } const isAccepted: boolean = val.is_accepted; return { tos: tos, @@ -547,8 +661,26 @@ export function serializeUpdateTermsOfServiceStatusForUserByIdRequestBody( return { ['is_accepted']: val.isAccepted }; } export function deserializeUpdateTermsOfServiceStatusForUserByIdRequestBody( - val: any + val: SerializedData ): UpdateTermsOfServiceStatusForUserByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateTermsOfServiceStatusForUserByIdRequestBody"', + }); + } + if (val.is_accepted == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "is_accepted" of type "UpdateTermsOfServiceStatusForUserByIdRequestBody" to be defined', + }); + } + if (!sdIsBoolean(val.is_accepted)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_accepted" of type "UpdateTermsOfServiceStatusForUserByIdRequestBody"', + }); + } const isAccepted: boolean = val.is_accepted; return { isAccepted: isAccepted, diff --git a/src/managers/termsOfServices.generated.ts b/src/managers/termsOfServices.generated.ts index 547f6e39..6c597197 100644 --- a/src/managers/termsOfServices.generated.ts +++ b/src/managers/termsOfServices.generated.ts @@ -364,7 +364,7 @@ export function serializeGetTermsOfServiceQueryParamsTosTypeField( return val; } export function deserializeGetTermsOfServiceQueryParamsTosTypeField( - val: any + val: SerializedData ): GetTermsOfServiceQueryParamsTosTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -388,7 +388,7 @@ export function serializeCreateTermsOfServiceRequestBodyStatusField( return val; } export function deserializeCreateTermsOfServiceRequestBodyStatusField( - val: any + val: SerializedData ): CreateTermsOfServiceRequestBodyStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -412,7 +412,7 @@ export function serializeCreateTermsOfServiceRequestBodyTosTypeField( return val; } export function deserializeCreateTermsOfServiceRequestBodyTosTypeField( - val: any + val: SerializedData ): CreateTermsOfServiceRequestBodyTosTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -443,14 +443,37 @@ export function serializeCreateTermsOfServiceRequestBody( }; } export function deserializeCreateTermsOfServiceRequestBody( - val: any + val: SerializedData ): CreateTermsOfServiceRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateTermsOfServiceRequestBody"', + }); + } + if (val.status == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "status" of type "CreateTermsOfServiceRequestBody" to be defined', + }); + } const status: CreateTermsOfServiceRequestBodyStatusField = deserializeCreateTermsOfServiceRequestBodyStatusField(val.status); const tosType: undefined | CreateTermsOfServiceRequestBodyTosTypeField = val.tos_type == void 0 ? void 0 : deserializeCreateTermsOfServiceRequestBodyTosTypeField(val.tos_type); + if (val.text == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "text" of type "CreateTermsOfServiceRequestBody" to be defined', + }); + } + if (!sdIsString(val.text)) { + throw new BoxSdkError({ + message: + 'Expecting string for "text" of type "CreateTermsOfServiceRequestBody"', + }); + } const text: string = val.text; return { status: status, @@ -464,7 +487,7 @@ export function serializeUpdateTermsOfServiceByIdRequestBodyStatusField( return val; } export function deserializeUpdateTermsOfServiceByIdRequestBodyStatusField( - val: any + val: SerializedData ): UpdateTermsOfServiceByIdRequestBodyStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -493,10 +516,33 @@ export function serializeUpdateTermsOfServiceByIdRequestBody( }; } export function deserializeUpdateTermsOfServiceByIdRequestBody( - val: any + val: SerializedData ): UpdateTermsOfServiceByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateTermsOfServiceByIdRequestBody"', + }); + } + if (val.status == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "status" of type "UpdateTermsOfServiceByIdRequestBody" to be defined', + }); + } const status: UpdateTermsOfServiceByIdRequestBodyStatusField = deserializeUpdateTermsOfServiceByIdRequestBodyStatusField(val.status); + if (val.text == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "text" of type "UpdateTermsOfServiceByIdRequestBody" to be defined', + }); + } + if (!sdIsString(val.text)) { + throw new BoxSdkError({ + message: + 'Expecting string for "text" of type "UpdateTermsOfServiceByIdRequestBody"', + }); + } const text: string = val.text; return { status: status, diff --git a/src/managers/transfer.generated.ts b/src/managers/transfer.generated.ts index d2ef48d2..3d7f1b7b 100644 --- a/src/managers/transfer.generated.ts +++ b/src/managers/transfer.generated.ts @@ -15,6 +15,7 @@ import { FetchOptions } from '../networking/fetch.js'; import { FetchResponse } from '../networking/fetch.js'; import { fetch } from '../networking/fetch.js'; import { SerializedData } from '../serialization/json.js'; +import { BoxSdkError } from '../box/errors.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; import { sdIsNumber } from '../serialization/json.js'; @@ -157,8 +158,26 @@ export function serializeTransferOwnedFolderRequestBodyOwnedByField( return { ['id']: val.id }; } export function deserializeTransferOwnedFolderRequestBodyOwnedByField( - val: any + val: SerializedData ): TransferOwnedFolderRequestBodyOwnedByField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "TransferOwnedFolderRequestBodyOwnedByField"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "TransferOwnedFolderRequestBodyOwnedByField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "TransferOwnedFolderRequestBodyOwnedByField"', + }); + } const id: string = val.id; return { id: id } satisfies TransferOwnedFolderRequestBodyOwnedByField; } @@ -172,8 +191,19 @@ export function serializeTransferOwnedFolderRequestBody( }; } export function deserializeTransferOwnedFolderRequestBody( - val: any + val: SerializedData ): TransferOwnedFolderRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TransferOwnedFolderRequestBody"', + }); + } + if (val.owned_by == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "owned_by" of type "TransferOwnedFolderRequestBody" to be defined', + }); + } const ownedBy: TransferOwnedFolderRequestBodyOwnedByField = deserializeTransferOwnedFolderRequestBodyOwnedByField(val.owned_by); return { ownedBy: ownedBy } satisfies TransferOwnedFolderRequestBody; diff --git a/src/managers/trashedFiles.generated.ts b/src/managers/trashedFiles.generated.ts index bc1c8d1b..2597f411 100644 --- a/src/managers/trashedFiles.generated.ts +++ b/src/managers/trashedFiles.generated.ts @@ -18,6 +18,7 @@ import { FetchOptions } from '../networking/fetch.js'; import { FetchResponse } from '../networking/fetch.js'; import { fetch } from '../networking/fetch.js'; import { SerializedData } from '../serialization/json.js'; +import { BoxSdkError } from '../box/errors.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; import { sdIsNumber } from '../serialization/json.js'; @@ -347,8 +348,20 @@ export function serializeRestoreFileFromTrashRequestBodyParentField( return { ['id']: val.id == void 0 ? void 0 : val.id }; } export function deserializeRestoreFileFromTrashRequestBodyParentField( - val: any + val: SerializedData ): RestoreFileFromTrashRequestBodyParentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "RestoreFileFromTrashRequestBodyParentField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "RestoreFileFromTrashRequestBodyParentField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { id: id } satisfies RestoreFileFromTrashRequestBodyParentField; } @@ -364,8 +377,19 @@ export function serializeRestoreFileFromTrashRequestBody( }; } export function deserializeRestoreFileFromTrashRequestBody( - val: any + val: SerializedData ): RestoreFileFromTrashRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RestoreFileFromTrashRequestBody"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "RestoreFileFromTrashRequestBody"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; const parent: undefined | RestoreFileFromTrashRequestBodyParentField = val.parent == void 0 diff --git a/src/managers/trashedFolders.generated.ts b/src/managers/trashedFolders.generated.ts index 5b4fb8c8..7146abd9 100644 --- a/src/managers/trashedFolders.generated.ts +++ b/src/managers/trashedFolders.generated.ts @@ -18,6 +18,7 @@ import { FetchOptions } from '../networking/fetch.js'; import { FetchResponse } from '../networking/fetch.js'; import { fetch } from '../networking/fetch.js'; import { SerializedData } from '../serialization/json.js'; +import { BoxSdkError } from '../box/errors.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; import { sdIsNumber } from '../serialization/json.js'; @@ -346,8 +347,20 @@ export function serializeRestoreFolderFromTrashRequestBodyParentField( return { ['id']: val.id == void 0 ? void 0 : val.id }; } export function deserializeRestoreFolderFromTrashRequestBodyParentField( - val: any + val: SerializedData ): RestoreFolderFromTrashRequestBodyParentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "RestoreFolderFromTrashRequestBodyParentField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "RestoreFolderFromTrashRequestBodyParentField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { id: id } satisfies RestoreFolderFromTrashRequestBodyParentField; } @@ -363,8 +376,19 @@ export function serializeRestoreFolderFromTrashRequestBody( }; } export function deserializeRestoreFolderFromTrashRequestBody( - val: any + val: SerializedData ): RestoreFolderFromTrashRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RestoreFolderFromTrashRequestBody"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "RestoreFolderFromTrashRequestBody"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; const parent: undefined | RestoreFolderFromTrashRequestBodyParentField = val.parent == void 0 diff --git a/src/managers/trashedItems.generated.ts b/src/managers/trashedItems.generated.ts index 8c72a8a2..7f539361 100644 --- a/src/managers/trashedItems.generated.ts +++ b/src/managers/trashedItems.generated.ts @@ -119,7 +119,7 @@ export function serializeGetTrashedItemsQueryParamsDirectionField( return val; } export function deserializeGetTrashedItemsQueryParamsDirectionField( - val: any + val: SerializedData ): GetTrashedItemsQueryParamsDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -143,7 +143,7 @@ export function serializeGetTrashedItemsQueryParamsSortField( return val; } export function deserializeGetTrashedItemsQueryParamsSortField( - val: any + val: SerializedData ): GetTrashedItemsQueryParamsSortField { if (!sdIsString(val)) { throw new BoxSdkError({ diff --git a/src/managers/trashedWebLinks.generated.ts b/src/managers/trashedWebLinks.generated.ts index c0a0c35a..44a54d85 100644 --- a/src/managers/trashedWebLinks.generated.ts +++ b/src/managers/trashedWebLinks.generated.ts @@ -18,6 +18,7 @@ import { FetchOptions } from '../networking/fetch.js'; import { FetchResponse } from '../networking/fetch.js'; import { fetch } from '../networking/fetch.js'; import { SerializedData } from '../serialization/json.js'; +import { BoxSdkError } from '../box/errors.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; import { sdIsNumber } from '../serialization/json.js'; @@ -346,8 +347,20 @@ export function serializeRestoreWeblinkFromTrashRequestBodyParentField( return { ['id']: val.id == void 0 ? void 0 : val.id }; } export function deserializeRestoreWeblinkFromTrashRequestBodyParentField( - val: any + val: SerializedData ): RestoreWeblinkFromTrashRequestBodyParentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "RestoreWeblinkFromTrashRequestBodyParentField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "RestoreWeblinkFromTrashRequestBodyParentField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { id: id } satisfies RestoreWeblinkFromTrashRequestBodyParentField; } @@ -363,8 +376,19 @@ export function serializeRestoreWeblinkFromTrashRequestBody( }; } export function deserializeRestoreWeblinkFromTrashRequestBody( - val: any + val: SerializedData ): RestoreWeblinkFromTrashRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RestoreWeblinkFromTrashRequestBody"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "RestoreWeblinkFromTrashRequestBody"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; const parent: undefined | RestoreWeblinkFromTrashRequestBodyParentField = val.parent == void 0 diff --git a/src/managers/uploads.generated.ts b/src/managers/uploads.generated.ts index 4dfffb2a..9ddf0afe 100644 --- a/src/managers/uploads.generated.ts +++ b/src/managers/uploads.generated.ts @@ -25,6 +25,7 @@ import { FetchResponse } from '../networking/fetch.js'; import { fetch } from '../networking/fetch.js'; import { MultipartItem } from '../networking/fetch.js'; import { SerializedData } from '../serialization/json.js'; +import { BoxSdkError } from '../box/errors.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; import { sdIsNumber } from '../serialization/json.js'; @@ -401,9 +402,36 @@ export function serializeUploadFileVersionRequestBodyAttributesField( }; } export function deserializeUploadFileVersionRequestBodyAttributesField( - val: any + val: SerializedData ): UploadFileVersionRequestBodyAttributesField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UploadFileVersionRequestBodyAttributesField"', + }); + } + if (val.name == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "name" of type "UploadFileVersionRequestBodyAttributesField" to be defined', + }); + } + if (!sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "UploadFileVersionRequestBodyAttributesField"', + }); + } const name: string = val.name; + if ( + !(val.content_modified_at == void 0) && + !sdIsString(val.content_modified_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_modified_at" of type "UploadFileVersionRequestBodyAttributesField"', + }); + } const contentModifiedAt: undefined | DateTime = val.content_modified_at == void 0 ? void 0 @@ -419,8 +447,26 @@ export function serializeUploadFileRequestBodyAttributesParentField( return { ['id']: val.id }; } export function deserializeUploadFileRequestBodyAttributesParentField( - val: any + val: SerializedData ): UploadFileRequestBodyAttributesParentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UploadFileRequestBodyAttributesParentField"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "UploadFileRequestBodyAttributesParentField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "UploadFileRequestBodyAttributesParentField"', + }); + } const id: string = val.id; return { id: id } satisfies UploadFileRequestBodyAttributesParentField; } @@ -441,15 +487,56 @@ export function serializeUploadFileRequestBodyAttributesField( }; } export function deserializeUploadFileRequestBodyAttributesField( - val: any + val: SerializedData ): UploadFileRequestBodyAttributesField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UploadFileRequestBodyAttributesField"', + }); + } + if (val.name == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "name" of type "UploadFileRequestBodyAttributesField" to be defined', + }); + } + if (!sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "UploadFileRequestBodyAttributesField"', + }); + } const name: string = val.name; + if (val.parent == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "parent" of type "UploadFileRequestBodyAttributesField" to be defined', + }); + } const parent: UploadFileRequestBodyAttributesParentField = deserializeUploadFileRequestBodyAttributesParentField(val.parent); + if ( + !(val.content_created_at == void 0) && + !sdIsString(val.content_created_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_created_at" of type "UploadFileRequestBodyAttributesField"', + }); + } const contentCreatedAt: undefined | DateTime = val.content_created_at == void 0 ? void 0 : deserializeDateTime(val.content_created_at); + if ( + !(val.content_modified_at == void 0) && + !sdIsString(val.content_modified_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_modified_at" of type "UploadFileRequestBodyAttributesField"', + }); + } const contentModifiedAt: undefined | DateTime = val.content_modified_at == void 0 ? void 0 @@ -467,8 +554,20 @@ export function serializePreflightFileUploadCheckRequestBodyParentField( return { ['id']: val.id == void 0 ? void 0 : val.id }; } export function deserializePreflightFileUploadCheckRequestBodyParentField( - val: any + val: SerializedData ): PreflightFileUploadCheckRequestBodyParentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "PreflightFileUploadCheckRequestBodyParentField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "PreflightFileUploadCheckRequestBodyParentField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { id: id } satisfies PreflightFileUploadCheckRequestBodyParentField; } @@ -485,9 +584,26 @@ export function serializePreflightFileUploadCheckRequestBody( }; } export function deserializePreflightFileUploadCheckRequestBody( - val: any + val: SerializedData ): PreflightFileUploadCheckRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "PreflightFileUploadCheckRequestBody"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "PreflightFileUploadCheckRequestBody"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.size == void 0) && !sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: + 'Expecting number for "size" of type "PreflightFileUploadCheckRequestBody"', + }); + } const size: undefined | number = val.size == void 0 ? void 0 : val.size; const parent: undefined | PreflightFileUploadCheckRequestBodyParentField = val.parent == void 0 diff --git a/src/managers/userCollaborations.generated.ts b/src/managers/userCollaborations.generated.ts index 7f5cfa20..5a9e520d 100644 --- a/src/managers/userCollaborations.generated.ts +++ b/src/managers/userCollaborations.generated.ts @@ -460,7 +460,7 @@ export function serializeUpdateCollaborationByIdRequestBodyRoleField( return val; } export function deserializeUpdateCollaborationByIdRequestBodyRoleField( - val: any + val: SerializedData ): UpdateCollaborationByIdRequestBodyRoleField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -502,7 +502,7 @@ export function serializeUpdateCollaborationByIdRequestBodyStatusField( return val; } export function deserializeUpdateCollaborationByIdRequestBodyStatusField( - val: any + val: SerializedData ): UpdateCollaborationByIdRequestBodyStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -538,16 +538,39 @@ export function serializeUpdateCollaborationByIdRequestBody( }; } export function deserializeUpdateCollaborationByIdRequestBody( - val: any + val: SerializedData ): UpdateCollaborationByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateCollaborationByIdRequestBody"', + }); + } + if (val.role == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "role" of type "UpdateCollaborationByIdRequestBody" to be defined', + }); + } const role: UpdateCollaborationByIdRequestBodyRoleField = deserializeUpdateCollaborationByIdRequestBodyRoleField(val.role); const status: undefined | UpdateCollaborationByIdRequestBodyStatusField = val.status == void 0 ? void 0 : deserializeUpdateCollaborationByIdRequestBodyStatusField(val.status); + if (!(val.expires_at == void 0) && !sdIsString(val.expires_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "expires_at" of type "UpdateCollaborationByIdRequestBody"', + }); + } const expiresAt: undefined | DateTime = val.expires_at == void 0 ? void 0 : deserializeDateTime(val.expires_at); + if (!(val.can_view_path == void 0) && !sdIsBoolean(val.can_view_path)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_view_path" of type "UpdateCollaborationByIdRequestBody"', + }); + } const canViewPath: undefined | boolean = val.can_view_path == void 0 ? void 0 : val.can_view_path; return { @@ -563,7 +586,7 @@ export function serializeCreateCollaborationRequestBodyItemTypeField( return val; } export function deserializeCreateCollaborationRequestBodyItemTypeField( - val: any + val: SerializedData ): CreateCollaborationRequestBodyItemTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -593,12 +616,23 @@ export function serializeCreateCollaborationRequestBodyItemField( }; } export function deserializeCreateCollaborationRequestBodyItemField( - val: any + val: SerializedData ): CreateCollaborationRequestBodyItemField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateCollaborationRequestBodyItemField"', + }); + } const type: undefined | CreateCollaborationRequestBodyItemTypeField = val.type == void 0 ? void 0 : deserializeCreateCollaborationRequestBodyItemTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateCollaborationRequestBodyItemField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { type: type, @@ -611,7 +645,7 @@ export function serializeCreateCollaborationRequestBodyAccessibleByTypeField( return val; } export function deserializeCreateCollaborationRequestBodyAccessibleByTypeField( - val: any + val: SerializedData ): CreateCollaborationRequestBodyAccessibleByTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -641,11 +675,35 @@ export function serializeCreateCollaborationRequestBodyAccessibleByField( }; } export function deserializeCreateCollaborationRequestBodyAccessibleByField( - val: any + val: SerializedData ): CreateCollaborationRequestBodyAccessibleByField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CreateCollaborationRequestBodyAccessibleByField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CreateCollaborationRequestBodyAccessibleByField" to be defined', + }); + } const type: CreateCollaborationRequestBodyAccessibleByTypeField = deserializeCreateCollaborationRequestBodyAccessibleByTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateCollaborationRequestBodyAccessibleByField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (!(val.login == void 0) && !sdIsString(val.login)) { + throw new BoxSdkError({ + message: + 'Expecting string for "login" of type "CreateCollaborationRequestBodyAccessibleByField"', + }); + } const login: undefined | string = val.login == void 0 ? void 0 : val.login; return { type: type, @@ -659,7 +717,7 @@ export function serializeCreateCollaborationRequestBodyRoleField( return val; } export function deserializeCreateCollaborationRequestBodyRoleField( - val: any + val: SerializedData ): CreateCollaborationRequestBodyRoleField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -708,20 +766,61 @@ export function serializeCreateCollaborationRequestBody( }; } export function deserializeCreateCollaborationRequestBody( - val: any + val: SerializedData ): CreateCollaborationRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateCollaborationRequestBody"', + }); + } + if (val.item == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "item" of type "CreateCollaborationRequestBody" to be defined', + }); + } const item: CreateCollaborationRequestBodyItemField = deserializeCreateCollaborationRequestBodyItemField(val.item); + if (val.accessible_by == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "accessible_by" of type "CreateCollaborationRequestBody" to be defined', + }); + } const accessibleBy: CreateCollaborationRequestBodyAccessibleByField = deserializeCreateCollaborationRequestBodyAccessibleByField( val.accessible_by ); + if (val.role == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "role" of type "CreateCollaborationRequestBody" to be defined', + }); + } const role: CreateCollaborationRequestBodyRoleField = deserializeCreateCollaborationRequestBodyRoleField(val.role); + if (!(val.is_access_only == void 0) && !sdIsBoolean(val.is_access_only)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_access_only" of type "CreateCollaborationRequestBody"', + }); + } const isAccessOnly: undefined | boolean = val.is_access_only == void 0 ? void 0 : val.is_access_only; + if (!(val.can_view_path == void 0) && !sdIsBoolean(val.can_view_path)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_view_path" of type "CreateCollaborationRequestBody"', + }); + } const canViewPath: undefined | boolean = val.can_view_path == void 0 ? void 0 : val.can_view_path; + if (!(val.expires_at == void 0) && !sdIsString(val.expires_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "expires_at" of type "CreateCollaborationRequestBody"', + }); + } const expiresAt: undefined | DateTime = val.expires_at == void 0 ? void 0 : deserializeDateTime(val.expires_at); return { diff --git a/src/managers/users.generated.ts b/src/managers/users.generated.ts index 10087a1e..d6464c22 100644 --- a/src/managers/users.generated.ts +++ b/src/managers/users.generated.ts @@ -639,7 +639,7 @@ export function serializeGetUsersQueryParamsUserTypeField( return val; } export function deserializeGetUsersQueryParamsUserTypeField( - val: any + val: SerializedData ): GetUsersQueryParamsUserTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -665,7 +665,7 @@ export function serializeCreateUserRequestBodyRoleField( return val; } export function deserializeCreateUserRequestBodyRoleField( - val: any + val: SerializedData ): CreateUserRequestBodyRoleField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -688,7 +688,7 @@ export function serializeCreateUserRequestBodyStatusField( return val; } export function deserializeCreateUserRequestBodyStatusField( - val: any + val: SerializedData ): CreateUserRequestBodyStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -760,10 +760,39 @@ export function serializeCreateUserRequestBody( }; } export function deserializeCreateUserRequestBody( - val: any + val: SerializedData ): CreateUserRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateUserRequestBody"', + }); + } + if (val.name == void 0) { + throw new BoxSdkError({ + message: 'Expecting "name" of type "CreateUserRequestBody" to be defined', + }); + } + if (!sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "CreateUserRequestBody"', + }); + } const name: string = val.name; + if (!(val.login == void 0) && !sdIsString(val.login)) { + throw new BoxSdkError({ + message: 'Expecting string for "login" of type "CreateUserRequestBody"', + }); + } const login: undefined | string = val.login == void 0 ? void 0 : val.login; + if ( + !(val.is_platform_access_only == void 0) && + !sdIsBoolean(val.is_platform_access_only) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_platform_access_only" of type "CreateUserRequestBody"', + }); + } const isPlatformAccessOnly: undefined | boolean = val.is_platform_access_only == void 0 ? void 0 @@ -772,17 +801,57 @@ export function deserializeCreateUserRequestBody( val.role == void 0 ? void 0 : deserializeCreateUserRequestBodyRoleField(val.role); + if (!(val.language == void 0) && !sdIsString(val.language)) { + throw new BoxSdkError({ + message: + 'Expecting string for "language" of type "CreateUserRequestBody"', + }); + } const language: undefined | string = val.language == void 0 ? void 0 : val.language; + if (!(val.is_sync_enabled == void 0) && !sdIsBoolean(val.is_sync_enabled)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_sync_enabled" of type "CreateUserRequestBody"', + }); + } const isSyncEnabled: undefined | boolean = val.is_sync_enabled == void 0 ? void 0 : val.is_sync_enabled; + if (!(val.job_title == void 0) && !sdIsString(val.job_title)) { + throw new BoxSdkError({ + message: + 'Expecting string for "job_title" of type "CreateUserRequestBody"', + }); + } const jobTitle: undefined | string = val.job_title == void 0 ? void 0 : val.job_title; + if (!(val.phone == void 0) && !sdIsString(val.phone)) { + throw new BoxSdkError({ + message: 'Expecting string for "phone" of type "CreateUserRequestBody"', + }); + } const phone: undefined | string = val.phone == void 0 ? void 0 : val.phone; + if (!(val.address == void 0) && !sdIsString(val.address)) { + throw new BoxSdkError({ + message: 'Expecting string for "address" of type "CreateUserRequestBody"', + }); + } const address: undefined | string = val.address == void 0 ? void 0 : val.address; + if (!(val.space_amount == void 0) && !sdIsNumber(val.space_amount)) { + throw new BoxSdkError({ + message: + 'Expecting number for "space_amount" of type "CreateUserRequestBody"', + }); + } const spaceAmount: undefined | number = val.space_amount == void 0 ? void 0 : val.space_amount; + if (!(val.tracking_codes == void 0) && !sdIsList(val.tracking_codes)) { + throw new BoxSdkError({ + message: + 'Expecting array for "tracking_codes" of type "CreateUserRequestBody"', + }); + } const trackingCodes: undefined | readonly TrackingCode[] = val.tracking_codes == void 0 ? void 0 @@ -791,18 +860,60 @@ export function deserializeCreateUserRequestBody( return deserializeTrackingCode(itm); }) as readonly any[]) : []; + if ( + !(val.can_see_managed_users == void 0) && + !sdIsBoolean(val.can_see_managed_users) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_see_managed_users" of type "CreateUserRequestBody"', + }); + } const canSeeManagedUsers: undefined | boolean = val.can_see_managed_users == void 0 ? void 0 : val.can_see_managed_users; + if (!(val.timezone == void 0) && !sdIsString(val.timezone)) { + throw new BoxSdkError({ + message: + 'Expecting string for "timezone" of type "CreateUserRequestBody"', + }); + } const timezone: undefined | string = val.timezone == void 0 ? void 0 : val.timezone; + if ( + !(val.is_external_collab_restricted == void 0) && + !sdIsBoolean(val.is_external_collab_restricted) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_external_collab_restricted" of type "CreateUserRequestBody"', + }); + } const isExternalCollabRestricted: undefined | boolean = val.is_external_collab_restricted == void 0 ? void 0 : val.is_external_collab_restricted; + if ( + !(val.is_exempt_from_device_limits == void 0) && + !sdIsBoolean(val.is_exempt_from_device_limits) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_exempt_from_device_limits" of type "CreateUserRequestBody"', + }); + } const isExemptFromDeviceLimits: undefined | boolean = val.is_exempt_from_device_limits == void 0 ? void 0 : val.is_exempt_from_device_limits; + if ( + !(val.is_exempt_from_login_verification == void 0) && + !sdIsBoolean(val.is_exempt_from_login_verification) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_exempt_from_login_verification" of type "CreateUserRequestBody"', + }); + } const isExemptFromLoginVerification: undefined | boolean = val.is_exempt_from_login_verification == void 0 ? void 0 @@ -811,6 +922,15 @@ export function deserializeCreateUserRequestBody( val.status == void 0 ? void 0 : deserializeCreateUserRequestBodyStatusField(val.status); + if ( + !(val.external_app_user_id == void 0) && + !sdIsString(val.external_app_user_id) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "external_app_user_id" of type "CreateUserRequestBody"', + }); + } const externalAppUserId: undefined | string = val.external_app_user_id == void 0 ? void 0 : val.external_app_user_id; return { @@ -840,7 +960,7 @@ export function serializeUpdateUserByIdRequestBodyRoleField( return val; } export function deserializeUpdateUserByIdRequestBodyRoleField( - val: any + val: SerializedData ): UpdateUserByIdRequestBodyRoleField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -863,7 +983,7 @@ export function serializeUpdateUserByIdRequestBodyStatusField( return val; } export function deserializeUpdateUserByIdRequestBodyStatusField( - val: any + val: SerializedData ): UpdateUserByIdRequestBodyStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -892,8 +1012,20 @@ export function serializeUpdateUserByIdRequestBodyNotificationEmailField( return { ['email']: val.email == void 0 ? void 0 : val.email }; } export function deserializeUpdateUserByIdRequestBodyNotificationEmailField( - val: any + val: SerializedData ): UpdateUserByIdRequestBodyNotificationEmailField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateUserByIdRequestBodyNotificationEmailField"', + }); + } + if (!(val.email == void 0) && !sdIsString(val.email)) { + throw new BoxSdkError({ + message: + 'Expecting string for "email" of type "UpdateUserByIdRequestBodyNotificationEmailField"', + }); + } const email: undefined | string = val.email == void 0 ? void 0 : val.email; return { email: email, @@ -958,27 +1090,92 @@ export function serializeUpdateUserByIdRequestBody( }; } export function deserializeUpdateUserByIdRequestBody( - val: any + val: SerializedData ): UpdateUserByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateUserByIdRequestBody"', + }); + } + if (!(val.enterprise == void 0) && !sdIsString(val.enterprise)) { + throw new BoxSdkError({ + message: + 'Expecting string for "enterprise" of type "UpdateUserByIdRequestBody"', + }); + } const enterprise: undefined | string = val.enterprise == void 0 ? void 0 : val.enterprise; + if (!(val.notify == void 0) && !sdIsBoolean(val.notify)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "notify" of type "UpdateUserByIdRequestBody"', + }); + } const notify: undefined | boolean = val.notify == void 0 ? void 0 : val.notify; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "UpdateUserByIdRequestBody"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.login == void 0) && !sdIsString(val.login)) { + throw new BoxSdkError({ + message: + 'Expecting string for "login" of type "UpdateUserByIdRequestBody"', + }); + } const login: undefined | string = val.login == void 0 ? void 0 : val.login; const role: undefined | UpdateUserByIdRequestBodyRoleField = val.role == void 0 ? void 0 : deserializeUpdateUserByIdRequestBodyRoleField(val.role); + if (!(val.language == void 0) && !sdIsString(val.language)) { + throw new BoxSdkError({ + message: + 'Expecting string for "language" of type "UpdateUserByIdRequestBody"', + }); + } const language: undefined | string = val.language == void 0 ? void 0 : val.language; + if (!(val.is_sync_enabled == void 0) && !sdIsBoolean(val.is_sync_enabled)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_sync_enabled" of type "UpdateUserByIdRequestBody"', + }); + } const isSyncEnabled: undefined | boolean = val.is_sync_enabled == void 0 ? void 0 : val.is_sync_enabled; + if (!(val.job_title == void 0) && !sdIsString(val.job_title)) { + throw new BoxSdkError({ + message: + 'Expecting string for "job_title" of type "UpdateUserByIdRequestBody"', + }); + } const jobTitle: undefined | string = val.job_title == void 0 ? void 0 : val.job_title; + if (!(val.phone == void 0) && !sdIsString(val.phone)) { + throw new BoxSdkError({ + message: + 'Expecting string for "phone" of type "UpdateUserByIdRequestBody"', + }); + } const phone: undefined | string = val.phone == void 0 ? void 0 : val.phone; + if (!(val.address == void 0) && !sdIsString(val.address)) { + throw new BoxSdkError({ + message: + 'Expecting string for "address" of type "UpdateUserByIdRequestBody"', + }); + } const address: undefined | string = val.address == void 0 ? void 0 : val.address; + if (!(val.tracking_codes == void 0) && !sdIsList(val.tracking_codes)) { + throw new BoxSdkError({ + message: + 'Expecting array for "tracking_codes" of type "UpdateUserByIdRequestBody"', + }); + } const trackingCodes: undefined | readonly TrackingCode[] = val.tracking_codes == void 0 ? void 0 @@ -987,22 +1184,73 @@ export function deserializeUpdateUserByIdRequestBody( return deserializeTrackingCode(itm); }) as readonly any[]) : []; + if ( + !(val.can_see_managed_users == void 0) && + !sdIsBoolean(val.can_see_managed_users) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_see_managed_users" of type "UpdateUserByIdRequestBody"', + }); + } const canSeeManagedUsers: undefined | boolean = val.can_see_managed_users == void 0 ? void 0 : val.can_see_managed_users; + if (!(val.timezone == void 0) && !sdIsString(val.timezone)) { + throw new BoxSdkError({ + message: + 'Expecting string for "timezone" of type "UpdateUserByIdRequestBody"', + }); + } const timezone: undefined | string = val.timezone == void 0 ? void 0 : val.timezone; + if ( + !(val.is_external_collab_restricted == void 0) && + !sdIsBoolean(val.is_external_collab_restricted) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_external_collab_restricted" of type "UpdateUserByIdRequestBody"', + }); + } const isExternalCollabRestricted: undefined | boolean = val.is_external_collab_restricted == void 0 ? void 0 : val.is_external_collab_restricted; + if ( + !(val.is_exempt_from_device_limits == void 0) && + !sdIsBoolean(val.is_exempt_from_device_limits) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_exempt_from_device_limits" of type "UpdateUserByIdRequestBody"', + }); + } const isExemptFromDeviceLimits: undefined | boolean = val.is_exempt_from_device_limits == void 0 ? void 0 : val.is_exempt_from_device_limits; + if ( + !(val.is_exempt_from_login_verification == void 0) && + !sdIsBoolean(val.is_exempt_from_login_verification) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_exempt_from_login_verification" of type "UpdateUserByIdRequestBody"', + }); + } const isExemptFromLoginVerification: undefined | boolean = val.is_exempt_from_login_verification == void 0 ? void 0 : val.is_exempt_from_login_verification; + if ( + !(val.is_password_reset_required == void 0) && + !sdIsBoolean(val.is_password_reset_required) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_password_reset_required" of type "UpdateUserByIdRequestBody"', + }); + } const isPasswordResetRequired: undefined | boolean = val.is_password_reset_required == void 0 ? void 0 @@ -1011,6 +1259,12 @@ export function deserializeUpdateUserByIdRequestBody( val.status == void 0 ? void 0 : deserializeUpdateUserByIdRequestBodyStatusField(val.status); + if (!(val.space_amount == void 0) && !sdIsNumber(val.space_amount)) { + throw new BoxSdkError({ + message: + 'Expecting number for "space_amount" of type "UpdateUserByIdRequestBody"', + }); + } const spaceAmount: undefined | number = val.space_amount == void 0 ? void 0 : val.space_amount; const notificationEmail: @@ -1021,6 +1275,15 @@ export function deserializeUpdateUserByIdRequestBody( : deserializeUpdateUserByIdRequestBodyNotificationEmailField( val.notification_email ); + if ( + !(val.external_app_user_id == void 0) && + !sdIsString(val.external_app_user_id) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "external_app_user_id" of type "UpdateUserByIdRequestBody"', + }); + } const externalAppUserId: undefined | string = val.external_app_user_id == void 0 ? void 0 : val.external_app_user_id; return { diff --git a/src/managers/webLinks.generated.ts b/src/managers/webLinks.generated.ts index 6ae864aa..724e694d 100644 --- a/src/managers/webLinks.generated.ts +++ b/src/managers/webLinks.generated.ts @@ -388,8 +388,25 @@ export function serializeCreateWebLinkRequestBodyParentField( return { ['id']: val.id }; } export function deserializeCreateWebLinkRequestBodyParentField( - val: any + val: SerializedData ): CreateWebLinkRequestBodyParentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateWebLinkRequestBodyParentField"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CreateWebLinkRequestBodyParentField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateWebLinkRequestBodyParentField"', + }); + } const id: string = val.id; return { id: id } satisfies CreateWebLinkRequestBodyParentField; } @@ -404,12 +421,45 @@ export function serializeCreateWebLinkRequestBody( }; } export function deserializeCreateWebLinkRequestBody( - val: any + val: SerializedData ): CreateWebLinkRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateWebLinkRequestBody"', + }); + } + if (val.url == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "url" of type "CreateWebLinkRequestBody" to be defined', + }); + } + if (!sdIsString(val.url)) { + throw new BoxSdkError({ + message: 'Expecting string for "url" of type "CreateWebLinkRequestBody"', + }); + } const url: string = val.url; + if (val.parent == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "parent" of type "CreateWebLinkRequestBody" to be defined', + }); + } const parent: CreateWebLinkRequestBodyParentField = deserializeCreateWebLinkRequestBodyParentField(val.parent); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "CreateWebLinkRequestBody"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "CreateWebLinkRequestBody"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; return { @@ -425,8 +475,19 @@ export function serializeUpdateWebLinkByIdRequestBodyParentField( return { ['id']: val.id == void 0 ? void 0 : val.id }; } export function deserializeUpdateWebLinkByIdRequestBodyParentField( - val: any + val: SerializedData ): UpdateWebLinkByIdRequestBodyParentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateWebLinkByIdRequestBodyParentField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "UpdateWebLinkByIdRequestBodyParentField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { id: id } satisfies UpdateWebLinkByIdRequestBodyParentField; } @@ -436,7 +497,7 @@ export function serializeUpdateWebLinkByIdRequestBodySharedLinkAccessField( return val; } export function deserializeUpdateWebLinkByIdRequestBodySharedLinkAccessField( - val: any + val: SerializedData ): UpdateWebLinkByIdRequestBodySharedLinkAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -474,18 +535,42 @@ export function serializeUpdateWebLinkByIdRequestBodySharedLinkField( }; } export function deserializeUpdateWebLinkByIdRequestBodySharedLinkField( - val: any + val: SerializedData ): UpdateWebLinkByIdRequestBodySharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "UpdateWebLinkByIdRequestBodySharedLinkField"', + }); + } const access: undefined | UpdateWebLinkByIdRequestBodySharedLinkAccessField = val.access == void 0 ? void 0 : deserializeUpdateWebLinkByIdRequestBodySharedLinkAccessField( val.access ); + if (!(val.password == void 0) && !sdIsString(val.password)) { + throw new BoxSdkError({ + message: + 'Expecting string for "password" of type "UpdateWebLinkByIdRequestBodySharedLinkField"', + }); + } const password: undefined | string = val.password == void 0 ? void 0 : val.password; + if (!(val.vanity_name == void 0) && !sdIsString(val.vanity_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_name" of type "UpdateWebLinkByIdRequestBodySharedLinkField"', + }); + } const vanityName: undefined | string = val.vanity_name == void 0 ? void 0 : val.vanity_name; + if (!(val.unshared_at == void 0) && !sdIsString(val.unshared_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "unshared_at" of type "UpdateWebLinkByIdRequestBodySharedLinkField"', + }); + } const unsharedAt: undefined | DateTime = val.unshared_at == void 0 ? void 0 : deserializeDateTime(val.unshared_at); return { @@ -513,14 +598,37 @@ export function serializeUpdateWebLinkByIdRequestBody( }; } export function deserializeUpdateWebLinkByIdRequestBody( - val: any + val: SerializedData ): UpdateWebLinkByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateWebLinkByIdRequestBody"', + }); + } + if (!(val.url == void 0) && !sdIsString(val.url)) { + throw new BoxSdkError({ + message: + 'Expecting string for "url" of type "UpdateWebLinkByIdRequestBody"', + }); + } const url: undefined | string = val.url == void 0 ? void 0 : val.url; const parent: undefined | UpdateWebLinkByIdRequestBodyParentField = val.parent == void 0 ? void 0 : deserializeUpdateWebLinkByIdRequestBodyParentField(val.parent); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "UpdateWebLinkByIdRequestBody"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "UpdateWebLinkByIdRequestBody"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; const sharedLink: undefined | UpdateWebLinkByIdRequestBodySharedLinkField = diff --git a/src/managers/webhooks.generated.ts b/src/managers/webhooks.generated.ts index e7647730..2132b05c 100644 --- a/src/managers/webhooks.generated.ts +++ b/src/managers/webhooks.generated.ts @@ -509,7 +509,7 @@ export function serializeCreateWebhookRequestBodyTargetTypeField( return val; } export function deserializeCreateWebhookRequestBodyTargetTypeField( - val: any + val: SerializedData ): CreateWebhookRequestBodyTargetTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -539,8 +539,19 @@ export function serializeCreateWebhookRequestBodyTargetField( }; } export function deserializeCreateWebhookRequestBodyTargetField( - val: any + val: SerializedData ): CreateWebhookRequestBodyTargetField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateWebhookRequestBodyTargetField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CreateWebhookRequestBodyTargetField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | CreateWebhookRequestBodyTargetTypeField = val.type == void 0 @@ -554,7 +565,7 @@ export function serializeCreateWebhookRequestBodyTriggersField( return val; } export function deserializeCreateWebhookRequestBodyTriggersField( - val: any + val: SerializedData ): CreateWebhookRequestBodyTriggersField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -699,11 +710,46 @@ export function serializeCreateWebhookRequestBody( }; } export function deserializeCreateWebhookRequestBody( - val: any + val: SerializedData ): CreateWebhookRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CreateWebhookRequestBody"', + }); + } + if (val.target == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "target" of type "CreateWebhookRequestBody" to be defined', + }); + } const target: CreateWebhookRequestBodyTargetField = deserializeCreateWebhookRequestBodyTargetField(val.target); + if (val.address == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "address" of type "CreateWebhookRequestBody" to be defined', + }); + } + if (!sdIsString(val.address)) { + throw new BoxSdkError({ + message: + 'Expecting string for "address" of type "CreateWebhookRequestBody"', + }); + } const address: string = val.address; + if (val.triggers == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "triggers" of type "CreateWebhookRequestBody" to be defined', + }); + } + if (!sdIsList(val.triggers)) { + throw new BoxSdkError({ + message: + 'Expecting array for "triggers" of type "CreateWebhookRequestBody"', + }); + } const triggers: readonly CreateWebhookRequestBodyTriggersField[] = sdIsList( val.triggers ) @@ -725,7 +771,7 @@ export function serializeUpdateWebhookByIdRequestBodyTargetTypeField( return val; } export function deserializeUpdateWebhookByIdRequestBodyTargetTypeField( - val: any + val: SerializedData ): UpdateWebhookByIdRequestBodyTargetTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -755,8 +801,19 @@ export function serializeUpdateWebhookByIdRequestBodyTargetField( }; } export function deserializeUpdateWebhookByIdRequestBodyTargetField( - val: any + val: SerializedData ): UpdateWebhookByIdRequestBodyTargetField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateWebhookByIdRequestBodyTargetField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "UpdateWebhookByIdRequestBodyTargetField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | UpdateWebhookByIdRequestBodyTargetTypeField = val.type == void 0 @@ -773,7 +830,7 @@ export function serializeUpdateWebhookByIdRequestBodyTriggersField( return val; } export function deserializeUpdateWebhookByIdRequestBodyTriggersField( - val: any + val: SerializedData ): UpdateWebhookByIdRequestBodyTriggersField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -925,14 +982,31 @@ export function serializeUpdateWebhookByIdRequestBody( }; } export function deserializeUpdateWebhookByIdRequestBody( - val: any + val: SerializedData ): UpdateWebhookByIdRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UpdateWebhookByIdRequestBody"', + }); + } const target: undefined | UpdateWebhookByIdRequestBodyTargetField = val.target == void 0 ? void 0 : deserializeUpdateWebhookByIdRequestBodyTargetField(val.target); + if (!(val.address == void 0) && !sdIsString(val.address)) { + throw new BoxSdkError({ + message: + 'Expecting string for "address" of type "UpdateWebhookByIdRequestBody"', + }); + } const address: undefined | string = val.address == void 0 ? void 0 : val.address; + if (!(val.triggers == void 0) && !sdIsList(val.triggers)) { + throw new BoxSdkError({ + message: + 'Expecting array for "triggers" of type "UpdateWebhookByIdRequestBody"', + }); + } const triggers: | undefined | readonly UpdateWebhookByIdRequestBodyTriggersField[] = diff --git a/src/managers/workflows.generated.ts b/src/managers/workflows.generated.ts index 89c9bd59..64b17988 100644 --- a/src/managers/workflows.generated.ts +++ b/src/managers/workflows.generated.ts @@ -228,7 +228,7 @@ export function serializeStartWorkflowRequestBodyTypeField( return val; } export function deserializeStartWorkflowRequestBodyTypeField( - val: any + val: SerializedData ): StartWorkflowRequestBodyTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -251,9 +251,26 @@ export function serializeStartWorkflowRequestBodyFlowField( }; } export function deserializeStartWorkflowRequestBodyFlowField( - val: any + val: SerializedData ): StartWorkflowRequestBodyFlowField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StartWorkflowRequestBodyFlowField"', + }); + } + if (!(val.type == void 0) && !sdIsString(val.type)) { + throw new BoxSdkError({ + message: + 'Expecting string for "type" of type "StartWorkflowRequestBodyFlowField"', + }); + } const type: undefined | string = val.type == void 0 ? void 0 : val.type; + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "StartWorkflowRequestBodyFlowField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { type: type, id: id } satisfies StartWorkflowRequestBodyFlowField; } @@ -263,7 +280,7 @@ export function serializeStartWorkflowRequestBodyFilesTypeField( return val; } export function deserializeStartWorkflowRequestBodyFilesTypeField( - val: any + val: SerializedData ): StartWorkflowRequestBodyFilesTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -290,12 +307,23 @@ export function serializeStartWorkflowRequestBodyFilesField( }; } export function deserializeStartWorkflowRequestBodyFilesField( - val: any + val: SerializedData ): StartWorkflowRequestBodyFilesField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StartWorkflowRequestBodyFilesField"', + }); + } const type: undefined | StartWorkflowRequestBodyFilesTypeField = val.type == void 0 ? void 0 : deserializeStartWorkflowRequestBodyFilesTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "StartWorkflowRequestBodyFilesField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { type: type, id: id } satisfies StartWorkflowRequestBodyFilesField; } @@ -305,7 +333,7 @@ export function serializeStartWorkflowRequestBodyFolderTypeField( return val; } export function deserializeStartWorkflowRequestBodyFolderTypeField( - val: any + val: SerializedData ): StartWorkflowRequestBodyFolderTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -332,12 +360,23 @@ export function serializeStartWorkflowRequestBodyFolderField( }; } export function deserializeStartWorkflowRequestBodyFolderField( - val: any + val: SerializedData ): StartWorkflowRequestBodyFolderField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StartWorkflowRequestBodyFolderField"', + }); + } const type: undefined | StartWorkflowRequestBodyFolderTypeField = val.type == void 0 ? void 0 : deserializeStartWorkflowRequestBodyFolderTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "StartWorkflowRequestBodyFolderField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { type: type, id: id } satisfies StartWorkflowRequestBodyFolderField; } @@ -365,14 +404,36 @@ export function serializeStartWorkflowRequestBody( }; } export function deserializeStartWorkflowRequestBody( - val: any + val: SerializedData ): StartWorkflowRequestBody { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StartWorkflowRequestBody"', + }); + } const type: undefined | StartWorkflowRequestBodyTypeField = val.type == void 0 ? void 0 : deserializeStartWorkflowRequestBodyTypeField(val.type); + if (val.flow == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "flow" of type "StartWorkflowRequestBody" to be defined', + }); + } const flow: StartWorkflowRequestBodyFlowField = deserializeStartWorkflowRequestBodyFlowField(val.flow); + if (val.files == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "files" of type "StartWorkflowRequestBody" to be defined', + }); + } + if (!sdIsList(val.files)) { + throw new BoxSdkError({ + message: 'Expecting array for "files" of type "StartWorkflowRequestBody"', + }); + } const files: readonly StartWorkflowRequestBodyFilesField[] = sdIsList( val.files ) @@ -382,8 +443,20 @@ export function deserializeStartWorkflowRequestBody( return deserializeStartWorkflowRequestBodyFilesField(itm); }) as readonly any[]) : []; + if (val.folder == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "folder" of type "StartWorkflowRequestBody" to be defined', + }); + } const folder: StartWorkflowRequestBodyFolderField = deserializeStartWorkflowRequestBodyFolderField(val.folder); + if (!(val.outcomes == void 0) && !sdIsList(val.outcomes)) { + throw new BoxSdkError({ + message: + 'Expecting array for "outcomes" of type "StartWorkflowRequestBody"', + }); + } const outcomes: undefined | readonly Outcome[] = val.outcomes == void 0 ? void 0 diff --git a/src/networking/baseUrls.generated.ts b/src/networking/baseUrls.generated.ts index 33463df4..4e4ba558 100644 --- a/src/networking/baseUrls.generated.ts +++ b/src/networking/baseUrls.generated.ts @@ -1,3 +1,4 @@ +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -36,9 +37,42 @@ export function serializeBaseUrls(val: BaseUrls): SerializedData { ['oauth2_url']: val.oauth2Url, }; } -export function deserializeBaseUrls(val: any): BaseUrls { +export function deserializeBaseUrls(val: SerializedData): BaseUrls { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "BaseUrls"' }); + } + if (val.base_url == void 0) { + throw new BoxSdkError({ + message: 'Expecting "base_url" of type "BaseUrls" to be defined', + }); + } + if (!sdIsString(val.base_url)) { + throw new BoxSdkError({ + message: 'Expecting string for "base_url" of type "BaseUrls"', + }); + } const baseUrl: string = val.base_url; + if (val.upload_url == void 0) { + throw new BoxSdkError({ + message: 'Expecting "upload_url" of type "BaseUrls" to be defined', + }); + } + if (!sdIsString(val.upload_url)) { + throw new BoxSdkError({ + message: 'Expecting string for "upload_url" of type "BaseUrls"', + }); + } const uploadUrl: string = val.upload_url; + if (val.oauth2_url == void 0) { + throw new BoxSdkError({ + message: 'Expecting "oauth2_url" of type "BaseUrls" to be defined', + }); + } + if (!sdIsString(val.oauth2_url)) { + throw new BoxSdkError({ + message: 'Expecting string for "oauth2_url" of type "BaseUrls"', + }); + } const oauth2Url: string = val.oauth2_url; return { baseUrl: baseUrl, @@ -53,11 +87,29 @@ export function serializeBaseUrlsInput(val: BaseUrlsInput): SerializedData { ['oauth2Url']: val.oauth2Url == void 0 ? void 0 : val.oauth2Url, }; } -export function deserializeBaseUrlsInput(val: any): BaseUrlsInput { +export function deserializeBaseUrlsInput(val: SerializedData): BaseUrlsInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "BaseUrlsInput"' }); + } + if (!(val.baseUrl == void 0) && !sdIsString(val.baseUrl)) { + throw new BoxSdkError({ + message: 'Expecting string for "baseUrl" of type "BaseUrlsInput"', + }); + } const baseUrl: undefined | string = val.baseUrl == void 0 ? void 0 : val.baseUrl; + if (!(val.uploadUrl == void 0) && !sdIsString(val.uploadUrl)) { + throw new BoxSdkError({ + message: 'Expecting string for "uploadUrl" of type "BaseUrlsInput"', + }); + } const uploadUrl: undefined | string = val.uploadUrl == void 0 ? void 0 : val.uploadUrl; + if (!(val.oauth2Url == void 0) && !sdIsString(val.oauth2Url)) { + throw new BoxSdkError({ + message: 'Expecting string for "oauth2Url" of type "BaseUrlsInput"', + }); + } const oauth2Url: undefined | string = val.oauth2Url == void 0 ? void 0 : val.oauth2Url; return { diff --git a/src/schemas/accessToken.generated.ts b/src/schemas/accessToken.generated.ts index 8f1c2bfe..7c19e158 100644 --- a/src/schemas/accessToken.generated.ts +++ b/src/schemas/accessToken.generated.ts @@ -26,7 +26,7 @@ export function serializeAccessTokenTokenTypeField( return val; } export function deserializeAccessTokenTokenTypeField( - val: any + val: SerializedData ): AccessTokenTokenTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -46,7 +46,7 @@ export function serializeAccessTokenIssuedTokenTypeField( return val; } export function deserializeAccessTokenIssuedTokenTypeField( - val: any + val: SerializedData ): AccessTokenIssuedTokenTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -83,15 +83,33 @@ export function serializeAccessToken(val: AccessToken): SerializedData { : serializeAccessTokenIssuedTokenTypeField(val.issuedTokenType), }; } -export function deserializeAccessToken(val: any): AccessToken { +export function deserializeAccessToken(val: SerializedData): AccessToken { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "AccessToken"' }); + } + if (!(val.access_token == void 0) && !sdIsString(val.access_token)) { + throw new BoxSdkError({ + message: 'Expecting string for "access_token" of type "AccessToken"', + }); + } const accessToken: undefined | string = val.access_token == void 0 ? void 0 : val.access_token; + if (!(val.expires_in == void 0) && !sdIsNumber(val.expires_in)) { + throw new BoxSdkError({ + message: 'Expecting number for "expires_in" of type "AccessToken"', + }); + } const expiresIn: undefined | number = val.expires_in == void 0 ? void 0 : val.expires_in; const tokenType: undefined | AccessTokenTokenTypeField = val.token_type == void 0 ? void 0 : deserializeAccessTokenTokenTypeField(val.token_type); + if (!(val.restricted_to == void 0) && !sdIsList(val.restricted_to)) { + throw new BoxSdkError({ + message: 'Expecting array for "restricted_to" of type "AccessToken"', + }); + } const restrictedTo: undefined | readonly FileOrFolderScope[] = val.restricted_to == void 0 ? void 0 @@ -102,6 +120,11 @@ export function deserializeAccessToken(val: any): AccessToken { return deserializeFileOrFolderScope(itm); }) as readonly any[]) : []; + if (!(val.refresh_token == void 0) && !sdIsString(val.refresh_token)) { + throw new BoxSdkError({ + message: 'Expecting string for "refresh_token" of type "AccessToken"', + }); + } const refreshToken: undefined | string = val.refresh_token == void 0 ? void 0 : val.refresh_token; const issuedTokenType: undefined | AccessTokenIssuedTokenTypeField = diff --git a/src/schemas/aiAsk.generated.ts b/src/schemas/aiAsk.generated.ts index 29d84da0..2e1fea79 100644 --- a/src/schemas/aiAsk.generated.ts +++ b/src/schemas/aiAsk.generated.ts @@ -40,7 +40,7 @@ export interface AiAsk { export function serializeAiAskModeField(val: AiAskModeField): SerializedData { return val; } -export function deserializeAiAskModeField(val: any): AiAskModeField { +export function deserializeAiAskModeField(val: SerializedData): AiAskModeField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "AiAskModeField"', @@ -61,7 +61,9 @@ export function serializeAiAskItemsTypeField( ): SerializedData { return val; } -export function deserializeAiAskItemsTypeField(val: any): AiAskItemsTypeField { +export function deserializeAiAskItemsTypeField( + val: SerializedData +): AiAskItemsTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "AiAskItemsTypeField"', @@ -81,9 +83,34 @@ export function serializeAiAskItemsField(val: AiAskItemsField): SerializedData { ['content']: val.content == void 0 ? void 0 : val.content, }; } -export function deserializeAiAskItemsField(val: any): AiAskItemsField { +export function deserializeAiAskItemsField( + val: SerializedData +): AiAskItemsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "AiAskItemsField"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "AiAskItemsField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "AiAskItemsField"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "AiAskItemsField" to be defined', + }); + } const type: AiAskItemsTypeField = deserializeAiAskItemsTypeField(val.type); + if (!(val.content == void 0) && !sdIsString(val.content)) { + throw new BoxSdkError({ + message: 'Expecting string for "content" of type "AiAskItemsField"', + }); + } const content: undefined | string = val.content == void 0 ? void 0 : val.content; return { id: id, type: type, content: content } satisfies AiAskItemsField; @@ -99,11 +126,31 @@ export function serializeAiAskItemsFieldInput( }; } export function deserializeAiAskItemsFieldInput( - val: any + val: SerializedData ): AiAskItemsFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AiAskItemsFieldInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "AiAskItemsFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "AiAskItemsFieldInput"', + }); + } const id: string = val.id; const type: undefined | AiAskItemsTypeField = val.type == void 0 ? void 0 : deserializeAiAskItemsTypeField(val.type); + if (!(val.content == void 0) && !sdIsString(val.content)) { + throw new BoxSdkError({ + message: 'Expecting string for "content" of type "AiAskItemsFieldInput"', + }); + } const content: undefined | string = val.content == void 0 ? void 0 : val.content; return { @@ -121,9 +168,37 @@ export function serializeAiAsk(val: AiAsk): SerializedData { }) as readonly any[], }; } -export function deserializeAiAsk(val: any): AiAsk { +export function deserializeAiAsk(val: SerializedData): AiAsk { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "AiAsk"' }); + } + if (val.mode == void 0) { + throw new BoxSdkError({ + message: 'Expecting "mode" of type "AiAsk" to be defined', + }); + } const mode: AiAskModeField = deserializeAiAskModeField(val.mode); + if (val.prompt == void 0) { + throw new BoxSdkError({ + message: 'Expecting "prompt" of type "AiAsk" to be defined', + }); + } + if (!sdIsString(val.prompt)) { + throw new BoxSdkError({ + message: 'Expecting string for "prompt" of type "AiAsk"', + }); + } const prompt: string = val.prompt; + if (val.items == void 0) { + throw new BoxSdkError({ + message: 'Expecting "items" of type "AiAsk" to be defined', + }); + } + if (!sdIsList(val.items)) { + throw new BoxSdkError({ + message: 'Expecting array for "items" of type "AiAsk"', + }); + } const items: readonly AiAskItemsField[] = sdIsList(val.items) ? (val.items.map(function (itm: SerializedData): AiAskItemsField { return deserializeAiAskItemsField(itm); diff --git a/src/schemas/aiResponse.generated.ts b/src/schemas/aiResponse.generated.ts index d46dcbdd..bee35817 100644 --- a/src/schemas/aiResponse.generated.ts +++ b/src/schemas/aiResponse.generated.ts @@ -1,6 +1,7 @@ import { serializeDateTime } from '../internal/utils.js'; import { deserializeDateTime } from '../internal/utils.js'; import { DateTime } from '../internal/utils.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -21,9 +22,40 @@ export function serializeAiResponse(val: AiResponse): SerializedData { val.completionReason == void 0 ? void 0 : val.completionReason, }; } -export function deserializeAiResponse(val: any): AiResponse { +export function deserializeAiResponse(val: SerializedData): AiResponse { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "AiResponse"' }); + } + if (val.answer == void 0) { + throw new BoxSdkError({ + message: 'Expecting "answer" of type "AiResponse" to be defined', + }); + } + if (!sdIsString(val.answer)) { + throw new BoxSdkError({ + message: 'Expecting string for "answer" of type "AiResponse"', + }); + } const answer: string = val.answer; + if (val.created_at == void 0) { + throw new BoxSdkError({ + message: 'Expecting "created_at" of type "AiResponse" to be defined', + }); + } + if (!sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "AiResponse"', + }); + } const createdAt: DateTime = deserializeDateTime(val.created_at); + if ( + !(val.completion_reason == void 0) && + !sdIsString(val.completion_reason) + ) { + throw new BoxSdkError({ + message: 'Expecting string for "completion_reason" of type "AiResponse"', + }); + } const completionReason: undefined | string = val.completion_reason == void 0 ? void 0 : val.completion_reason; return { diff --git a/src/schemas/aiTextGen.generated.ts b/src/schemas/aiTextGen.generated.ts index 9a33013f..0158d002 100644 --- a/src/schemas/aiTextGen.generated.ts +++ b/src/schemas/aiTextGen.generated.ts @@ -31,7 +31,7 @@ export function serializeAiTextGenItemsTypeField( return val; } export function deserializeAiTextGenItemsTypeField( - val: any + val: SerializedData ): AiTextGenItemsTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -55,10 +55,27 @@ export function serializeAiTextGenItemsField( ['content']: val.content == void 0 ? void 0 : val.content, }; } -export function deserializeAiTextGenItemsField(val: any): AiTextGenItemsField { +export function deserializeAiTextGenItemsField( + val: SerializedData +): AiTextGenItemsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AiTextGenItemsField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "AiTextGenItemsField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | AiTextGenItemsTypeField = val.type == void 0 ? void 0 : deserializeAiTextGenItemsTypeField(val.type); + if (!(val.content == void 0) && !sdIsString(val.content)) { + throw new BoxSdkError({ + message: 'Expecting string for "content" of type "AiTextGenItemsField"', + }); + } const content: undefined | string = val.content == void 0 ? void 0 : val.content; return { id: id, type: type, content: content } satisfies AiTextGenItemsField; @@ -74,10 +91,33 @@ export function serializeAiTextGenDialogueHistoryField( }; } export function deserializeAiTextGenDialogueHistoryField( - val: any + val: SerializedData ): AiTextGenDialogueHistoryField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AiTextGenDialogueHistoryField"', + }); + } + if (!(val.prompt == void 0) && !sdIsString(val.prompt)) { + throw new BoxSdkError({ + message: + 'Expecting string for "prompt" of type "AiTextGenDialogueHistoryField"', + }); + } const prompt: undefined | string = val.prompt == void 0 ? void 0 : val.prompt; + if (!(val.answer == void 0) && !sdIsString(val.answer)) { + throw new BoxSdkError({ + message: + 'Expecting string for "answer" of type "AiTextGenDialogueHistoryField"', + }); + } const answer: undefined | string = val.answer == void 0 ? void 0 : val.answer; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "AiTextGenDialogueHistoryField"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); return { @@ -104,13 +144,41 @@ export function serializeAiTextGen(val: AiTextGen): SerializedData { }) as readonly any[]), }; } -export function deserializeAiTextGen(val: any): AiTextGen { +export function deserializeAiTextGen(val: SerializedData): AiTextGen { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "AiTextGen"' }); + } + if (val.prompt == void 0) { + throw new BoxSdkError({ + message: 'Expecting "prompt" of type "AiTextGen" to be defined', + }); + } + if (!sdIsString(val.prompt)) { + throw new BoxSdkError({ + message: 'Expecting string for "prompt" of type "AiTextGen"', + }); + } const prompt: string = val.prompt; + if (val.items == void 0) { + throw new BoxSdkError({ + message: 'Expecting "items" of type "AiTextGen" to be defined', + }); + } + if (!sdIsList(val.items)) { + throw new BoxSdkError({ + message: 'Expecting array for "items" of type "AiTextGen"', + }); + } const items: readonly AiTextGenItemsField[] = sdIsList(val.items) ? (val.items.map(function (itm: SerializedData): AiTextGenItemsField { return deserializeAiTextGenItemsField(itm); }) as readonly any[]) : []; + if (!(val.dialogue_history == void 0) && !sdIsList(val.dialogue_history)) { + throw new BoxSdkError({ + message: 'Expecting array for "dialogue_history" of type "AiTextGen"', + }); + } const dialogueHistory: undefined | readonly AiTextGenDialogueHistoryField[] = val.dialogue_history == void 0 ? void 0 diff --git a/src/schemas/classification.generated.ts b/src/schemas/classification.generated.ts index 61542fad..6f67cc9d 100644 --- a/src/schemas/classification.generated.ts +++ b/src/schemas/classification.generated.ts @@ -23,7 +23,7 @@ export function serializeClassificationTemplateField( return val; } export function deserializeClassificationTemplateField( - val: any + val: SerializedData ): ClassificationTemplateField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -55,23 +55,65 @@ export function serializeClassification(val: Classification): SerializedData { ['$canEdit']: val.canEdit == void 0 ? void 0 : val.canEdit, }; } -export function deserializeClassification(val: any): Classification { +export function deserializeClassification(val: SerializedData): Classification { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Classification"' }); + } + if ( + !(val.Box__Security__Classification__Key == void 0) && + !sdIsString(val.Box__Security__Classification__Key) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "Box__Security__Classification__Key" of type "Classification"', + }); + } const boxSecurityClassificationKey: undefined | string = val.Box__Security__Classification__Key == void 0 ? void 0 : val.Box__Security__Classification__Key; + if (!(val.$parent == void 0) && !sdIsString(val.$parent)) { + throw new BoxSdkError({ + message: 'Expecting string for "$parent" of type "Classification"', + }); + } const parent: undefined | string = val.$parent == void 0 ? void 0 : val.$parent; const template: undefined | ClassificationTemplateField = val.$template == void 0 ? void 0 : deserializeClassificationTemplateField(val.$template); + if (!(val.$scope == void 0) && !sdIsString(val.$scope)) { + throw new BoxSdkError({ + message: 'Expecting string for "$scope" of type "Classification"', + }); + } const scope: undefined | string = val.$scope == void 0 ? void 0 : val.$scope; + if (!(val.$version == void 0) && !sdIsNumber(val.$version)) { + throw new BoxSdkError({ + message: 'Expecting number for "$version" of type "Classification"', + }); + } const version: undefined | number = val.$version == void 0 ? void 0 : val.$version; + if (!(val.$type == void 0) && !sdIsString(val.$type)) { + throw new BoxSdkError({ + message: 'Expecting string for "$type" of type "Classification"', + }); + } const type: undefined | string = val.$type == void 0 ? void 0 : val.$type; + if (!(val.$typeVersion == void 0) && !sdIsNumber(val.$typeVersion)) { + throw new BoxSdkError({ + message: 'Expecting number for "$typeVersion" of type "Classification"', + }); + } const typeVersion: undefined | number = val.$typeVersion == void 0 ? void 0 : val.$typeVersion; + if (!(val.$canEdit == void 0) && !sdIsBoolean(val.$canEdit)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "$canEdit" of type "Classification"', + }); + } const canEdit: undefined | boolean = val.$canEdit == void 0 ? void 0 : val.$canEdit; return { diff --git a/src/schemas/classificationTemplate.generated.ts b/src/schemas/classificationTemplate.generated.ts index eb1c4a16..e2390274 100644 --- a/src/schemas/classificationTemplate.generated.ts +++ b/src/schemas/classificationTemplate.generated.ts @@ -136,7 +136,7 @@ export function serializeClassificationTemplateTypeField( return val; } export function deserializeClassificationTemplateTypeField( - val: any + val: SerializedData ): ClassificationTemplateTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -156,7 +156,7 @@ export function serializeClassificationTemplateTemplateKeyField( return val; } export function deserializeClassificationTemplateTemplateKeyField( - val: any + val: SerializedData ): ClassificationTemplateTemplateKeyField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -177,7 +177,7 @@ export function serializeClassificationTemplateDisplayNameField( return val; } export function deserializeClassificationTemplateDisplayNameField( - val: any + val: SerializedData ): ClassificationTemplateDisplayNameField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -198,7 +198,7 @@ export function serializeClassificationTemplateFieldsTypeField( return val; } export function deserializeClassificationTemplateFieldsTypeField( - val: any + val: SerializedData ): ClassificationTemplateFieldsTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -218,7 +218,7 @@ export function serializeClassificationTemplateFieldsKeyField( return val; } export function deserializeClassificationTemplateFieldsKeyField( - val: any + val: SerializedData ): ClassificationTemplateFieldsKeyField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -238,7 +238,7 @@ export function serializeClassificationTemplateFieldsDisplayNameField( return val; } export function deserializeClassificationTemplateFieldsDisplayNameField( - val: any + val: SerializedData ): ClassificationTemplateFieldsDisplayNameField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -265,12 +265,33 @@ export function serializeClassificationTemplateFieldsOptionsStaticConfigClassifi }; } export function deserializeClassificationTemplateFieldsOptionsStaticConfigClassificationField( - val: any + val: SerializedData ): ClassificationTemplateFieldsOptionsStaticConfigClassificationField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "ClassificationTemplateFieldsOptionsStaticConfigClassificationField"', + }); + } + if ( + !(val.classificationDefinition == void 0) && + !sdIsString(val.classificationDefinition) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "classificationDefinition" of type "ClassificationTemplateFieldsOptionsStaticConfigClassificationField"', + }); + } const classificationDefinition: undefined | string = val.classificationDefinition == void 0 ? void 0 : val.classificationDefinition; + if (!(val.colorID == void 0) && !sdIsNumber(val.colorID)) { + throw new BoxSdkError({ + message: + 'Expecting number for "colorID" of type "ClassificationTemplateFieldsOptionsStaticConfigClassificationField"', + }); + } const colorId: undefined | number = val.colorID == void 0 ? void 0 : val.colorID; return { @@ -291,8 +312,14 @@ export function serializeClassificationTemplateFieldsOptionsStaticConfigField( }; } export function deserializeClassificationTemplateFieldsOptionsStaticConfigField( - val: any + val: SerializedData ): ClassificationTemplateFieldsOptionsStaticConfigField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "ClassificationTemplateFieldsOptionsStaticConfigField"', + }); + } const classification: | undefined | ClassificationTemplateFieldsOptionsStaticConfigClassificationField = @@ -320,9 +347,38 @@ export function serializeClassificationTemplateFieldsOptionsField( }; } export function deserializeClassificationTemplateFieldsOptionsField( - val: any + val: SerializedData ): ClassificationTemplateFieldsOptionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ClassificationTemplateFieldsOptionsField"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "ClassificationTemplateFieldsOptionsField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ClassificationTemplateFieldsOptionsField"', + }); + } const id: string = val.id; + if (val.key == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "key" of type "ClassificationTemplateFieldsOptionsField" to be defined', + }); + } + if (!sdIsString(val.key)) { + throw new BoxSdkError({ + message: + 'Expecting string for "key" of type "ClassificationTemplateFieldsOptionsField"', + }); + } const key: string = val.key; const staticConfig: | undefined @@ -357,17 +413,70 @@ export function serializeClassificationTemplateFieldsField( }; } export function deserializeClassificationTemplateFieldsField( - val: any + val: SerializedData ): ClassificationTemplateFieldsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ClassificationTemplateFieldsField"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "ClassificationTemplateFieldsField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ClassificationTemplateFieldsField"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "ClassificationTemplateFieldsField" to be defined', + }); + } const type: ClassificationTemplateFieldsTypeField = deserializeClassificationTemplateFieldsTypeField(val.type); + if (val.key == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "key" of type "ClassificationTemplateFieldsField" to be defined', + }); + } const key: ClassificationTemplateFieldsKeyField = deserializeClassificationTemplateFieldsKeyField(val.key); + if (val.displayName == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "displayName" of type "ClassificationTemplateFieldsField" to be defined', + }); + } const displayName: ClassificationTemplateFieldsDisplayNameField = deserializeClassificationTemplateFieldsDisplayNameField(val.displayName); + if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "hidden" of type "ClassificationTemplateFieldsField"', + }); + } const hidden: undefined | boolean = val.hidden == void 0 ? void 0 : val.hidden; + if (val.options == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "options" of type "ClassificationTemplateFieldsField" to be defined', + }); + } + if (!sdIsList(val.options)) { + throw new BoxSdkError({ + message: + 'Expecting array for "options" of type "ClassificationTemplateFieldsField"', + }); + } const options: readonly ClassificationTemplateFieldsOptionsField[] = sdIsList( val.options ) @@ -414,8 +523,25 @@ export function serializeClassificationTemplateFieldsFieldInput( }; } export function deserializeClassificationTemplateFieldsFieldInput( - val: any + val: SerializedData ): ClassificationTemplateFieldsFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ClassificationTemplateFieldsFieldInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "ClassificationTemplateFieldsFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ClassificationTemplateFieldsFieldInput"', + }); + } const id: string = val.id; const type: undefined | ClassificationTemplateFieldsTypeField = val.type == void 0 @@ -431,8 +557,26 @@ export function deserializeClassificationTemplateFieldsFieldInput( : deserializeClassificationTemplateFieldsDisplayNameField( val.displayName ); + if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "hidden" of type "ClassificationTemplateFieldsFieldInput"', + }); + } const hidden: undefined | boolean = val.hidden == void 0 ? void 0 : val.hidden; + if (val.options == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "options" of type "ClassificationTemplateFieldsFieldInput" to be defined', + }); + } + if (!sdIsList(val.options)) { + throw new BoxSdkError({ + message: + 'Expecting array for "options" of type "ClassificationTemplateFieldsFieldInput"', + }); + } const options: readonly ClassificationTemplateFieldsOptionsField[] = sdIsList( val.options ) @@ -477,20 +621,90 @@ export function serializeClassificationTemplate( }; } export function deserializeClassificationTemplate( - val: any + val: SerializedData ): ClassificationTemplate { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ClassificationTemplate"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "ClassificationTemplate" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "ClassificationTemplate"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "ClassificationTemplate" to be defined', + }); + } const type: ClassificationTemplateTypeField = deserializeClassificationTemplateTypeField(val.type); + if (val.scope == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "scope" of type "ClassificationTemplate" to be defined', + }); + } + if (!sdIsString(val.scope)) { + throw new BoxSdkError({ + message: 'Expecting string for "scope" of type "ClassificationTemplate"', + }); + } const scope: string = val.scope; + if (val.templateKey == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "templateKey" of type "ClassificationTemplate" to be defined', + }); + } const templateKey: ClassificationTemplateTemplateKeyField = deserializeClassificationTemplateTemplateKeyField(val.templateKey); + if (val.displayName == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "displayName" of type "ClassificationTemplate" to be defined', + }); + } const displayName: ClassificationTemplateDisplayNameField = deserializeClassificationTemplateDisplayNameField(val.displayName); + if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "hidden" of type "ClassificationTemplate"', + }); + } const hidden: undefined | boolean = val.hidden == void 0 ? void 0 : val.hidden; + if ( + !(val.copyInstanceOnItemCopy == void 0) && + !sdIsBoolean(val.copyInstanceOnItemCopy) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "copyInstanceOnItemCopy" of type "ClassificationTemplate"', + }); + } const copyInstanceOnItemCopy: undefined | boolean = val.copyInstanceOnItemCopy == void 0 ? void 0 : val.copyInstanceOnItemCopy; + if (val.fields == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "fields" of type "ClassificationTemplate" to be defined', + }); + } + if (!sdIsList(val.fields)) { + throw new BoxSdkError({ + message: 'Expecting array for "fields" of type "ClassificationTemplate"', + }); + } const fields: readonly ClassificationTemplateFieldsField[] = sdIsList( val.fields ) @@ -542,13 +756,42 @@ export function serializeClassificationTemplateInput( }; } export function deserializeClassificationTemplateInput( - val: any + val: SerializedData ): ClassificationTemplateInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ClassificationTemplateInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "ClassificationTemplateInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ClassificationTemplateInput"', + }); + } const id: string = val.id; const type: undefined | ClassificationTemplateTypeField = val.type == void 0 ? void 0 : deserializeClassificationTemplateTypeField(val.type); + if (val.scope == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "scope" of type "ClassificationTemplateInput" to be defined', + }); + } + if (!sdIsString(val.scope)) { + throw new BoxSdkError({ + message: + 'Expecting string for "scope" of type "ClassificationTemplateInput"', + }); + } const scope: string = val.scope; const templateKey: undefined | ClassificationTemplateTemplateKeyField = val.templateKey == void 0 @@ -558,10 +801,37 @@ export function deserializeClassificationTemplateInput( val.displayName == void 0 ? void 0 : deserializeClassificationTemplateDisplayNameField(val.displayName); + if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "hidden" of type "ClassificationTemplateInput"', + }); + } const hidden: undefined | boolean = val.hidden == void 0 ? void 0 : val.hidden; + if ( + !(val.copyInstanceOnItemCopy == void 0) && + !sdIsBoolean(val.copyInstanceOnItemCopy) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "copyInstanceOnItemCopy" of type "ClassificationTemplateInput"', + }); + } const copyInstanceOnItemCopy: undefined | boolean = val.copyInstanceOnItemCopy == void 0 ? void 0 : val.copyInstanceOnItemCopy; + if (val.fields == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "fields" of type "ClassificationTemplateInput" to be defined', + }); + } + if (!sdIsList(val.fields)) { + throw new BoxSdkError({ + message: + 'Expecting array for "fields" of type "ClassificationTemplateInput"', + }); + } const fields: readonly ClassificationTemplateFieldsField[] = sdIsList( val.fields ) diff --git a/src/schemas/clientError.generated.ts b/src/schemas/clientError.generated.ts index 8fea2fb9..8c2e878e 100644 --- a/src/schemas/clientError.generated.ts +++ b/src/schemas/clientError.generated.ts @@ -43,7 +43,7 @@ export function serializeClientErrorTypeField( return val; } export function deserializeClientErrorTypeField( - val: any + val: SerializedData ): ClientErrorTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -63,7 +63,7 @@ export function serializeClientErrorCodeField( return val; } export function deserializeClientErrorCodeField( - val: any + val: SerializedData ): ClientErrorCodeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -131,8 +131,19 @@ export function serializeClientErrorContextInfoField( return { ['message']: val.message == void 0 ? void 0 : val.message }; } export function deserializeClientErrorContextInfoField( - val: any + val: SerializedData ): ClientErrorContextInfoField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ClientErrorContextInfoField"', + }); + } + if (!(val.message == void 0) && !sdIsString(val.message)) { + throw new BoxSdkError({ + message: + 'Expecting string for "message" of type "ClientErrorContextInfoField"', + }); + } const message: undefined | string = val.message == void 0 ? void 0 : val.message; return { message: message } satisfies ClientErrorContextInfoField; @@ -153,20 +164,43 @@ export function serializeClientError(val: ClientError): SerializedData { ['request_id']: val.requestId == void 0 ? void 0 : val.requestId, }; } -export function deserializeClientError(val: any): ClientError { +export function deserializeClientError(val: SerializedData): ClientError { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "ClientError"' }); + } const type: undefined | ClientErrorTypeField = val.type == void 0 ? void 0 : deserializeClientErrorTypeField(val.type); + if (!(val.status == void 0) && !sdIsNumber(val.status)) { + throw new BoxSdkError({ + message: 'Expecting number for "status" of type "ClientError"', + }); + } const status: undefined | number = val.status == void 0 ? void 0 : val.status; const code: undefined | ClientErrorCodeField = val.code == void 0 ? void 0 : deserializeClientErrorCodeField(val.code); + if (!(val.message == void 0) && !sdIsString(val.message)) { + throw new BoxSdkError({ + message: 'Expecting string for "message" of type "ClientError"', + }); + } const message: undefined | string = val.message == void 0 ? void 0 : val.message; const contextInfo: undefined | ClientErrorContextInfoField = val.context_info == void 0 ? void 0 : deserializeClientErrorContextInfoField(val.context_info); + if (!(val.help_url == void 0) && !sdIsString(val.help_url)) { + throw new BoxSdkError({ + message: 'Expecting string for "help_url" of type "ClientError"', + }); + } const helpUrl: undefined | string = val.help_url == void 0 ? void 0 : val.help_url; + if (!(val.request_id == void 0) && !sdIsString(val.request_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "request_id" of type "ClientError"', + }); + } const requestId: undefined | string = val.request_id == void 0 ? void 0 : val.request_id; return { diff --git a/src/schemas/collaboration.generated.ts b/src/schemas/collaboration.generated.ts index 2c812ed1..7c826cca 100644 --- a/src/schemas/collaboration.generated.ts +++ b/src/schemas/collaboration.generated.ts @@ -134,7 +134,7 @@ export function serializeCollaborationTypeField( return val; } export function deserializeCollaborationTypeField( - val: any + val: SerializedData ): CollaborationTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -154,7 +154,7 @@ export function serializeCollaborationRoleField( return val; } export function deserializeCollaborationRoleField( - val: any + val: SerializedData ): CollaborationRoleField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -195,7 +195,7 @@ export function serializeCollaborationStatusField( return val; } export function deserializeCollaborationStatusField( - val: any + val: SerializedData ): CollaborationStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -227,8 +227,20 @@ export function serializeCollaborationAcceptanceRequirementsStatusTermsOfService }; } export function deserializeCollaborationAcceptanceRequirementsStatusTermsOfServiceRequirementField( - val: any + val: SerializedData ): CollaborationAcceptanceRequirementsStatusTermsOfServiceRequirementField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CollaborationAcceptanceRequirementsStatusTermsOfServiceRequirementField"', + }); + } + if (!(val.is_accepted == void 0) && !sdIsBoolean(val.is_accepted)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_accepted" of type "CollaborationAcceptanceRequirementsStatusTermsOfServiceRequirementField"', + }); + } const isAccepted: undefined | boolean = val.is_accepted == void 0 ? void 0 : val.is_accepted; const termsOfService: undefined | TermsOfServiceBase = @@ -253,14 +265,40 @@ export function serializeCollaborationAcceptanceRequirementsStatusStrongPassword }; } export function deserializeCollaborationAcceptanceRequirementsStatusStrongPasswordRequirementField( - val: any + val: SerializedData ): CollaborationAcceptanceRequirementsStatusStrongPasswordRequirementField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CollaborationAcceptanceRequirementsStatusStrongPasswordRequirementField"', + }); + } + if ( + !( + val.enterprise_has_strong_password_required_for_external_users == void 0 + ) && + !sdIsBoolean(val.enterprise_has_strong_password_required_for_external_users) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "enterprise_has_strong_password_required_for_external_users" of type "CollaborationAcceptanceRequirementsStatusStrongPasswordRequirementField"', + }); + } const enterpriseHasStrongPasswordRequiredForExternalUsers: | undefined | boolean = val.enterprise_has_strong_password_required_for_external_users == void 0 ? void 0 : val.enterprise_has_strong_password_required_for_external_users; + if ( + !(val.user_has_strong_password == void 0) && + !sdIsBoolean(val.user_has_strong_password) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "user_has_strong_password" of type "CollaborationAcceptanceRequirementsStatusStrongPasswordRequirementField"', + }); + } const userHasStrongPassword: undefined | boolean = val.user_has_strong_password == void 0 ? void 0 @@ -286,12 +324,36 @@ export function serializeCollaborationAcceptanceRequirementsStatusTwoFactorAuthe }; } export function deserializeCollaborationAcceptanceRequirementsStatusTwoFactorAuthenticationRequirementField( - val: any + val: SerializedData ): CollaborationAcceptanceRequirementsStatusTwoFactorAuthenticationRequirementField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CollaborationAcceptanceRequirementsStatusTwoFactorAuthenticationRequirementField"', + }); + } + if ( + !(val.enterprise_has_two_factor_auth_enabled == void 0) && + !sdIsBoolean(val.enterprise_has_two_factor_auth_enabled) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "enterprise_has_two_factor_auth_enabled" of type "CollaborationAcceptanceRequirementsStatusTwoFactorAuthenticationRequirementField"', + }); + } const enterpriseHasTwoFactorAuthEnabled: undefined | boolean = val.enterprise_has_two_factor_auth_enabled == void 0 ? void 0 : val.enterprise_has_two_factor_auth_enabled; + if ( + !(val.user_has_two_factor_authentication_enabled == void 0) && + !sdIsBoolean(val.user_has_two_factor_authentication_enabled) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "user_has_two_factor_authentication_enabled" of type "CollaborationAcceptanceRequirementsStatusTwoFactorAuthenticationRequirementField"', + }); + } const userHasTwoFactorAuthenticationEnabled: undefined | boolean = val.user_has_two_factor_authentication_enabled == void 0 ? void 0 @@ -327,8 +389,14 @@ export function serializeCollaborationAcceptanceRequirementsStatusField( }; } export function deserializeCollaborationAcceptanceRequirementsStatusField( - val: any + val: SerializedData ): CollaborationAcceptanceRequirementsStatusField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CollaborationAcceptanceRequirementsStatusField"', + }); + } const termsOfServiceRequirement: | undefined | CollaborationAcceptanceRequirementsStatusTermsOfServiceRequirementField = @@ -399,8 +467,26 @@ export function serializeCollaboration(val: Collaboration): SerializedData { ), }; } -export function deserializeCollaboration(val: any): Collaboration { +export function deserializeCollaboration(val: SerializedData): Collaboration { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Collaboration"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "Collaboration" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "Collaboration"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "Collaboration" to be defined', + }); + } const type: CollaborationTypeField = deserializeCollaborationTypeField( val.type ); @@ -410,18 +496,38 @@ export function deserializeCollaboration(val: any): Collaboration { val.accessible_by == void 0 ? void 0 : deserializeGroupMiniOrUserCollaborations(val.accessible_by); + if (!(val.invite_email == void 0) && !sdIsString(val.invite_email)) { + throw new BoxSdkError({ + message: 'Expecting string for "invite_email" of type "Collaboration"', + }); + } const inviteEmail: undefined | string = val.invite_email == void 0 ? void 0 : val.invite_email; const role: undefined | CollaborationRoleField = val.role == void 0 ? void 0 : deserializeCollaborationRoleField(val.role); + if (!(val.expires_at == void 0) && !sdIsString(val.expires_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "expires_at" of type "Collaboration"', + }); + } const expiresAt: undefined | DateTime = val.expires_at == void 0 ? void 0 : deserializeDateTime(val.expires_at); + if (!(val.is_access_only == void 0) && !sdIsBoolean(val.is_access_only)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "is_access_only" of type "Collaboration"', + }); + } const isAccessOnly: undefined | boolean = val.is_access_only == void 0 ? void 0 : val.is_access_only; const status: undefined | CollaborationStatusField = val.status == void 0 ? void 0 : deserializeCollaborationStatusField(val.status); + if (!(val.acknowledged_at == void 0) && !sdIsString(val.acknowledged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "acknowledged_at" of type "Collaboration"', + }); + } const acknowledgedAt: undefined | DateTime = val.acknowledged_at == void 0 ? void 0 @@ -430,8 +536,18 @@ export function deserializeCollaboration(val: any): Collaboration { val.created_by == void 0 ? void 0 : deserializeUserCollaborations(val.created_by); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "Collaboration"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "Collaboration"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); const acceptanceRequirementsStatus: @@ -502,7 +618,24 @@ export function serializeCollaborationInput( ), }; } -export function deserializeCollaborationInput(val: any): CollaborationInput { +export function deserializeCollaborationInput( + val: SerializedData +): CollaborationInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CollaborationInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "CollaborationInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "CollaborationInput"', + }); + } const id: string = val.id; const type: undefined | CollaborationTypeField = val.type == void 0 ? void 0 : deserializeCollaborationTypeField(val.type); @@ -512,18 +645,41 @@ export function deserializeCollaborationInput(val: any): CollaborationInput { val.accessible_by == void 0 ? void 0 : deserializeGroupMiniOrUserCollaborations(val.accessible_by); + if (!(val.invite_email == void 0) && !sdIsString(val.invite_email)) { + throw new BoxSdkError({ + message: + 'Expecting string for "invite_email" of type "CollaborationInput"', + }); + } const inviteEmail: undefined | string = val.invite_email == void 0 ? void 0 : val.invite_email; const role: undefined | CollaborationRoleField = val.role == void 0 ? void 0 : deserializeCollaborationRoleField(val.role); + if (!(val.expires_at == void 0) && !sdIsString(val.expires_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "expires_at" of type "CollaborationInput"', + }); + } const expiresAt: undefined | DateTime = val.expires_at == void 0 ? void 0 : deserializeDateTime(val.expires_at); + if (!(val.is_access_only == void 0) && !sdIsBoolean(val.is_access_only)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_access_only" of type "CollaborationInput"', + }); + } const isAccessOnly: undefined | boolean = val.is_access_only == void 0 ? void 0 : val.is_access_only; const status: undefined | CollaborationStatusField = val.status == void 0 ? void 0 : deserializeCollaborationStatusField(val.status); + if (!(val.acknowledged_at == void 0) && !sdIsString(val.acknowledged_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "acknowledged_at" of type "CollaborationInput"', + }); + } const acknowledgedAt: undefined | DateTime = val.acknowledged_at == void 0 ? void 0 @@ -532,8 +688,19 @@ export function deserializeCollaborationInput(val: any): CollaborationInput { val.created_by == void 0 ? void 0 : deserializeUserCollaborations(val.created_by); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "CollaborationInput"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "modified_at" of type "CollaborationInput"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); const acceptanceRequirementsStatus: diff --git a/src/schemas/collaborationAllowlistEntries.generated.ts b/src/schemas/collaborationAllowlistEntries.generated.ts index 58613c73..8142361c 100644 --- a/src/schemas/collaborationAllowlistEntries.generated.ts +++ b/src/schemas/collaborationAllowlistEntries.generated.ts @@ -1,6 +1,7 @@ import { serializeCollaborationAllowlistEntry } from './collaborationAllowlistEntry.generated.js'; import { deserializeCollaborationAllowlistEntry } from './collaborationAllowlistEntry.generated.js'; import { CollaborationAllowlistEntry } from './collaborationAllowlistEntry.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -32,13 +33,42 @@ export function serializeCollaborationAllowlistEntries( }; } export function deserializeCollaborationAllowlistEntries( - val: any + val: SerializedData ): CollaborationAllowlistEntries { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CollaborationAllowlistEntries"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "CollaborationAllowlistEntries"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "CollaborationAllowlistEntries"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "prev_marker" of type "CollaborationAllowlistEntries"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "CollaborationAllowlistEntries"', + }); + } const entries: undefined | readonly CollaborationAllowlistEntry[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/collaborationAllowlistEntry.generated.ts b/src/schemas/collaborationAllowlistEntry.generated.ts index 360f738e..3cb47b72 100644 --- a/src/schemas/collaborationAllowlistEntry.generated.ts +++ b/src/schemas/collaborationAllowlistEntry.generated.ts @@ -35,7 +35,7 @@ export function serializeCollaborationAllowlistEntryTypeField( return val; } export function deserializeCollaborationAllowlistEntryTypeField( - val: any + val: SerializedData ): CollaborationAllowlistEntryTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -55,7 +55,7 @@ export function serializeCollaborationAllowlistEntryDirectionField( return val; } export function deserializeCollaborationAllowlistEntryDirectionField( - val: any + val: SerializedData ): CollaborationAllowlistEntryDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -82,7 +82,7 @@ export function serializeCollaborationAllowlistEntryEnterpriseTypeField( return val; } export function deserializeCollaborationAllowlistEntryEnterpriseTypeField( - val: any + val: SerializedData ): CollaborationAllowlistEntryEnterpriseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -110,13 +110,31 @@ export function serializeCollaborationAllowlistEntryEnterpriseField( }; } export function deserializeCollaborationAllowlistEntryEnterpriseField( - val: any + val: SerializedData ): CollaborationAllowlistEntryEnterpriseField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CollaborationAllowlistEntryEnterpriseField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CollaborationAllowlistEntryEnterpriseField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | CollaborationAllowlistEntryEnterpriseTypeField = val.type == void 0 ? void 0 : deserializeCollaborationAllowlistEntryEnterpriseTypeField(val.type); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "CollaborationAllowlistEntryEnterpriseField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; return { id: id, @@ -147,13 +165,30 @@ export function serializeCollaborationAllowlistEntry( }; } export function deserializeCollaborationAllowlistEntry( - val: any + val: SerializedData ): CollaborationAllowlistEntry { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CollaborationAllowlistEntry"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CollaborationAllowlistEntry"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | CollaborationAllowlistEntryTypeField = val.type == void 0 ? void 0 : deserializeCollaborationAllowlistEntryTypeField(val.type); + if (!(val.domain == void 0) && !sdIsString(val.domain)) { + throw new BoxSdkError({ + message: + 'Expecting string for "domain" of type "CollaborationAllowlistEntry"', + }); + } const domain: undefined | string = val.domain == void 0 ? void 0 : val.domain; const direction: undefined | CollaborationAllowlistEntryDirectionField = val.direction == void 0 @@ -163,6 +198,12 @@ export function deserializeCollaborationAllowlistEntry( val.enterprise == void 0 ? void 0 : deserializeCollaborationAllowlistEntryEnterpriseField(val.enterprise); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "CollaborationAllowlistEntry"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); return { diff --git a/src/schemas/collaborationAllowlistExemptTarget.generated.ts b/src/schemas/collaborationAllowlistExemptTarget.generated.ts index c3021c36..1aa7a2a2 100644 --- a/src/schemas/collaborationAllowlistExemptTarget.generated.ts +++ b/src/schemas/collaborationAllowlistExemptTarget.generated.ts @@ -35,7 +35,7 @@ export function serializeCollaborationAllowlistExemptTargetTypeField( return val; } export function deserializeCollaborationAllowlistExemptTargetTypeField( - val: any + val: SerializedData ): CollaborationAllowlistExemptTargetTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -56,7 +56,7 @@ export function serializeCollaborationAllowlistExemptTargetEnterpriseTypeField( return val; } export function deserializeCollaborationAllowlistExemptTargetEnterpriseTypeField( - val: any + val: SerializedData ): CollaborationAllowlistExemptTargetEnterpriseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -86,8 +86,20 @@ export function serializeCollaborationAllowlistExemptTargetEnterpriseField( }; } export function deserializeCollaborationAllowlistExemptTargetEnterpriseField( - val: any + val: SerializedData ): CollaborationAllowlistExemptTargetEnterpriseField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CollaborationAllowlistExemptTargetEnterpriseField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CollaborationAllowlistExemptTargetEnterpriseField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: | undefined @@ -97,6 +109,12 @@ export function deserializeCollaborationAllowlistExemptTargetEnterpriseField( : deserializeCollaborationAllowlistExemptTargetEnterpriseTypeField( val.type ); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "CollaborationAllowlistExemptTargetEnterpriseField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; return { id: id, @@ -127,8 +145,19 @@ export function serializeCollaborationAllowlistExemptTarget( }; } export function deserializeCollaborationAllowlistExemptTarget( - val: any + val: SerializedData ): CollaborationAllowlistExemptTarget { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CollaborationAllowlistExemptTarget"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CollaborationAllowlistExemptTarget"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | CollaborationAllowlistExemptTargetTypeField = val.type == void 0 @@ -144,8 +173,20 @@ export function deserializeCollaborationAllowlistExemptTarget( ); const user: undefined | UserMini = val.user == void 0 ? void 0 : deserializeUserMini(val.user); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "CollaborationAllowlistExemptTarget"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "modified_at" of type "CollaborationAllowlistExemptTarget"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); return { diff --git a/src/schemas/collaborationAllowlistExemptTargets.generated.ts b/src/schemas/collaborationAllowlistExemptTargets.generated.ts index 7c758c55..b77fdb2b 100644 --- a/src/schemas/collaborationAllowlistExemptTargets.generated.ts +++ b/src/schemas/collaborationAllowlistExemptTargets.generated.ts @@ -1,6 +1,7 @@ import { serializeCollaborationAllowlistExemptTarget } from './collaborationAllowlistExemptTarget.generated.js'; import { deserializeCollaborationAllowlistExemptTarget } from './collaborationAllowlistExemptTarget.generated.js'; import { CollaborationAllowlistExemptTarget } from './collaborationAllowlistExemptTarget.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -32,13 +33,42 @@ export function serializeCollaborationAllowlistExemptTargets( }; } export function deserializeCollaborationAllowlistExemptTargets( - val: any + val: SerializedData ): CollaborationAllowlistExemptTargets { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CollaborationAllowlistExemptTargets"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "CollaborationAllowlistExemptTargets"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "CollaborationAllowlistExemptTargets"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "prev_marker" of type "CollaborationAllowlistExemptTargets"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "CollaborationAllowlistExemptTargets"', + }); + } const entries: undefined | readonly CollaborationAllowlistExemptTarget[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/collaborations.generated.ts b/src/schemas/collaborations.generated.ts index eb7eef9a..16c48297 100644 --- a/src/schemas/collaborations.generated.ts +++ b/src/schemas/collaborations.generated.ts @@ -27,7 +27,7 @@ export function serializeCollaborationsOrderDirectionField( return val; } export function deserializeCollaborationsOrderDirectionField( - val: any + val: SerializedData ): CollaborationsOrderDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -56,8 +56,18 @@ export function serializeCollaborationsOrderField( }; } export function deserializeCollaborationsOrderField( - val: any + val: SerializedData ): CollaborationsOrderField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CollaborationsOrderField"', + }); + } + if (!(val.by == void 0) && !sdIsString(val.by)) { + throw new BoxSdkError({ + message: 'Expecting string for "by" of type "CollaborationsOrderField"', + }); + } const by: undefined | string = val.by == void 0 ? void 0 : val.by; const direction: undefined | CollaborationsOrderDirectionField = val.direction == void 0 @@ -86,11 +96,34 @@ export function serializeCollaborations(val: Collaborations): SerializedData { }) as readonly any[]), }; } -export function deserializeCollaborations(val: any): Collaborations { +export function deserializeCollaborations(val: SerializedData): Collaborations { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Collaborations"' }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "Collaborations"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "Collaborations"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: 'Expecting number for "offset" of type "Collaborations"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; + if (!(val.order == void 0) && !sdIsList(val.order)) { + throw new BoxSdkError({ + message: 'Expecting array for "order" of type "Collaborations"', + }); + } const order: undefined | readonly CollaborationsOrderField[] = val.order == void 0 ? void 0 @@ -101,6 +134,11 @@ export function deserializeCollaborations(val: any): Collaborations { return deserializeCollaborationsOrderField(itm); }) as readonly any[]) : []; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "Collaborations"', + }); + } const entries: undefined | readonly Collaboration[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/collaboratorVariable.generated.ts b/src/schemas/collaboratorVariable.generated.ts index 6e8ccb13..bf3e303b 100644 --- a/src/schemas/collaboratorVariable.generated.ts +++ b/src/schemas/collaboratorVariable.generated.ts @@ -61,7 +61,7 @@ export function serializeCollaboratorVariableTypeField( return val; } export function deserializeCollaboratorVariableTypeField( - val: any + val: SerializedData ): CollaboratorVariableTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -81,7 +81,7 @@ export function serializeCollaboratorVariableVariableTypeField( return val; } export function deserializeCollaboratorVariableVariableTypeField( - val: any + val: SerializedData ): CollaboratorVariableVariableTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -101,7 +101,7 @@ export function serializeCollaboratorVariableVariableValueTypeField( return val; } export function deserializeCollaboratorVariableVariableValueTypeField( - val: any + val: SerializedData ): CollaboratorVariableVariableValueTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -125,10 +125,33 @@ export function serializeCollaboratorVariableVariableValueField( }; } export function deserializeCollaboratorVariableVariableValueField( - val: any + val: SerializedData ): CollaboratorVariableVariableValueField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CollaboratorVariableVariableValueField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CollaboratorVariableVariableValueField" to be defined', + }); + } const type: CollaboratorVariableVariableValueTypeField = deserializeCollaboratorVariableVariableValueTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CollaboratorVariableVariableValueField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CollaboratorVariableVariableValueField"', + }); + } const id: string = val.id; return { type: type, @@ -147,12 +170,30 @@ export function serializeCollaboratorVariableVariableValueFieldInput( }; } export function deserializeCollaboratorVariableVariableValueFieldInput( - val: any + val: SerializedData ): CollaboratorVariableVariableValueFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "CollaboratorVariableVariableValueFieldInput"', + }); + } const type: undefined | CollaboratorVariableVariableValueTypeField = val.type == void 0 ? void 0 : deserializeCollaboratorVariableVariableValueTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "CollaboratorVariableVariableValueFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "CollaboratorVariableVariableValueFieldInput"', + }); + } const id: string = val.id; return { type: type, @@ -175,12 +216,40 @@ export function serializeCollaboratorVariable( }; } export function deserializeCollaboratorVariable( - val: any + val: SerializedData ): CollaboratorVariable { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CollaboratorVariable"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "CollaboratorVariable" to be defined', + }); + } const type: CollaboratorVariableTypeField = deserializeCollaboratorVariableTypeField(val.type); + if (val.variable_type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "variable_type" of type "CollaboratorVariable" to be defined', + }); + } const variableType: CollaboratorVariableVariableTypeField = deserializeCollaboratorVariableVariableTypeField(val.variable_type); + if (val.variable_value == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "variable_value" of type "CollaboratorVariable" to be defined', + }); + } + if (!sdIsList(val.variable_value)) { + throw new BoxSdkError({ + message: + 'Expecting array for "variable_value" of type "CollaboratorVariable"', + }); + } const variableValue: readonly CollaboratorVariableVariableValueField[] = sdIsList(val.variable_value) ? (val.variable_value.map(function ( @@ -215,8 +284,13 @@ export function serializeCollaboratorVariableInput( }; } export function deserializeCollaboratorVariableInput( - val: any + val: SerializedData ): CollaboratorVariableInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CollaboratorVariableInput"', + }); + } const type: undefined | CollaboratorVariableTypeField = val.type == void 0 ? void 0 @@ -225,6 +299,18 @@ export function deserializeCollaboratorVariableInput( val.variableType == void 0 ? void 0 : deserializeCollaboratorVariableVariableTypeField(val.variableType); + if (val.variable_value == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "variable_value" of type "CollaboratorVariableInput" to be defined', + }); + } + if (!sdIsList(val.variable_value)) { + throw new BoxSdkError({ + message: + 'Expecting array for "variable_value" of type "CollaboratorVariableInput"', + }); + } const variableValue: readonly CollaboratorVariableVariableValueField[] = sdIsList(val.variable_value) ? (val.variable_value.map(function ( diff --git a/src/schemas/collection.generated.ts b/src/schemas/collection.generated.ts index 1da860ef..92411512 100644 --- a/src/schemas/collection.generated.ts +++ b/src/schemas/collection.generated.ts @@ -20,7 +20,9 @@ export function serializeCollectionTypeField( ): SerializedData { return val; } -export function deserializeCollectionTypeField(val: any): CollectionTypeField { +export function deserializeCollectionTypeField( + val: SerializedData +): CollectionTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "CollectionTypeField"', @@ -38,7 +40,9 @@ export function serializeCollectionNameField( ): SerializedData { return val; } -export function deserializeCollectionNameField(val: any): CollectionNameField { +export function deserializeCollectionNameField( + val: SerializedData +): CollectionNameField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "CollectionNameField"', @@ -57,7 +61,7 @@ export function serializeCollectionCollectionTypeField( return val; } export function deserializeCollectionCollectionTypeField( - val: any + val: SerializedData ): CollectionCollectionTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -84,7 +88,15 @@ export function serializeCollection(val: Collection): SerializedData { : serializeCollectionCollectionTypeField(val.collectionType), }; } -export function deserializeCollection(val: any): Collection { +export function deserializeCollection(val: SerializedData): Collection { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Collection"' }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "Collection"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | CollectionTypeField = val.type == void 0 ? void 0 : deserializeCollectionTypeField(val.type); diff --git a/src/schemas/collections.generated.ts b/src/schemas/collections.generated.ts index c560df0b..5936d87a 100644 --- a/src/schemas/collections.generated.ts +++ b/src/schemas/collections.generated.ts @@ -27,7 +27,7 @@ export function serializeCollectionsOrderDirectionField( return val; } export function deserializeCollectionsOrderDirectionField( - val: any + val: SerializedData ): CollectionsOrderDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -56,8 +56,18 @@ export function serializeCollectionsOrderField( }; } export function deserializeCollectionsOrderField( - val: any + val: SerializedData ): CollectionsOrderField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CollectionsOrderField"', + }); + } + if (!(val.by == void 0) && !sdIsString(val.by)) { + throw new BoxSdkError({ + message: 'Expecting string for "by" of type "CollectionsOrderField"', + }); + } const by: undefined | string = val.by == void 0 ? void 0 : val.by; const direction: undefined | CollectionsOrderDirectionField = val.direction == void 0 @@ -86,11 +96,34 @@ export function serializeCollections(val: Collections): SerializedData { }) as readonly any[]), }; } -export function deserializeCollections(val: any): Collections { +export function deserializeCollections(val: SerializedData): Collections { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Collections"' }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "Collections"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "Collections"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: 'Expecting number for "offset" of type "Collections"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; + if (!(val.order == void 0) && !sdIsList(val.order)) { + throw new BoxSdkError({ + message: 'Expecting array for "order" of type "Collections"', + }); + } const order: undefined | readonly CollectionsOrderField[] = val.order == void 0 ? void 0 @@ -99,6 +132,11 @@ export function deserializeCollections(val: any): Collections { return deserializeCollectionsOrderField(itm); }) as readonly any[]) : []; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "Collections"', + }); + } const entries: undefined | readonly Collection[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/comment.generated.ts b/src/schemas/comment.generated.ts index 6abf0b00..a7924387 100644 --- a/src/schemas/comment.generated.ts +++ b/src/schemas/comment.generated.ts @@ -38,8 +38,25 @@ export function serializeCommentItemField( ['type']: val.type == void 0 ? void 0 : val.type, }; } -export function deserializeCommentItemField(val: any): CommentItemField { +export function deserializeCommentItemField( + val: SerializedData +): CommentItemField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CommentItemField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "CommentItemField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (!(val.type == void 0) && !sdIsString(val.type)) { + throw new BoxSdkError({ + message: 'Expecting string for "type" of type "CommentItemField"', + }); + } const type: undefined | string = val.type == void 0 ? void 0 : val.type; return { id: id, type: type } satisfies CommentItemField; } @@ -65,19 +82,47 @@ export function serializeComment(val: Comment): SerializedData { }, }; } -export function deserializeComment(val: any): Comment { +export function deserializeComment(val: SerializedData): Comment { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Comment"' }); + } + if (!(val.is_reply_comment == void 0) && !sdIsBoolean(val.is_reply_comment)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "is_reply_comment" of type "Comment"', + }); + } const isReplyComment: undefined | boolean = val.is_reply_comment == void 0 ? void 0 : val.is_reply_comment; + if (!(val.message == void 0) && !sdIsString(val.message)) { + throw new BoxSdkError({ + message: 'Expecting string for "message" of type "Comment"', + }); + } const message: undefined | string = val.message == void 0 ? void 0 : val.message; const createdBy: undefined | UserMini = val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "Comment"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "Comment"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); const item: undefined | CommentItemField = val.item == void 0 ? void 0 : deserializeCommentItemField(val.item); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "Comment"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | CommentBaseTypeField = val.type == void 0 ? void 0 : deserializeCommentBaseTypeField(val.type); diff --git a/src/schemas/commentBase.generated.ts b/src/schemas/commentBase.generated.ts index 1b9cbc13..d64e1c1e 100644 --- a/src/schemas/commentBase.generated.ts +++ b/src/schemas/commentBase.generated.ts @@ -17,7 +17,7 @@ export function serializeCommentBaseTypeField( return val; } export function deserializeCommentBaseTypeField( - val: any + val: SerializedData ): CommentBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -38,7 +38,15 @@ export function serializeCommentBase(val: CommentBase): SerializedData { val.type == void 0 ? void 0 : serializeCommentBaseTypeField(val.type), }; } -export function deserializeCommentBase(val: any): CommentBase { +export function deserializeCommentBase(val: SerializedData): CommentBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "CommentBase"' }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "CommentBase"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | CommentBaseTypeField = val.type == void 0 ? void 0 : deserializeCommentBaseTypeField(val.type); diff --git a/src/schemas/commentFull.generated.ts b/src/schemas/commentFull.generated.ts index 326e0ab4..36f1cac0 100644 --- a/src/schemas/commentFull.generated.ts +++ b/src/schemas/commentFull.generated.ts @@ -40,21 +40,54 @@ export function serializeCommentFull(val: CommentFull): SerializedData { }, }; } -export function deserializeCommentFull(val: any): CommentFull { +export function deserializeCommentFull(val: SerializedData): CommentFull { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "CommentFull"' }); + } + if (!(val.tagged_message == void 0) && !sdIsString(val.tagged_message)) { + throw new BoxSdkError({ + message: 'Expecting string for "tagged_message" of type "CommentFull"', + }); + } const taggedMessage: undefined | string = val.tagged_message == void 0 ? void 0 : val.tagged_message; + if (!(val.is_reply_comment == void 0) && !sdIsBoolean(val.is_reply_comment)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "is_reply_comment" of type "CommentFull"', + }); + } const isReplyComment: undefined | boolean = val.is_reply_comment == void 0 ? void 0 : val.is_reply_comment; + if (!(val.message == void 0) && !sdIsString(val.message)) { + throw new BoxSdkError({ + message: 'Expecting string for "message" of type "CommentFull"', + }); + } const message: undefined | string = val.message == void 0 ? void 0 : val.message; const createdBy: undefined | UserMini = val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "CommentFull"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "CommentFull"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); const item: undefined | CommentItemField = val.item == void 0 ? void 0 : deserializeCommentItemField(val.item); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "CommentFull"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | CommentBaseTypeField = val.type == void 0 ? void 0 : deserializeCommentBaseTypeField(val.type); diff --git a/src/schemas/comments.generated.ts b/src/schemas/comments.generated.ts index c859c80a..f6ef8172 100644 --- a/src/schemas/comments.generated.ts +++ b/src/schemas/comments.generated.ts @@ -27,7 +27,7 @@ export function serializeCommentsOrderDirectionField( return val; } export function deserializeCommentsOrderDirectionField( - val: any + val: SerializedData ): CommentsOrderDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -55,7 +55,19 @@ export function serializeCommentsOrderField( : serializeCommentsOrderDirectionField(val.direction), }; } -export function deserializeCommentsOrderField(val: any): CommentsOrderField { +export function deserializeCommentsOrderField( + val: SerializedData +): CommentsOrderField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CommentsOrderField"', + }); + } + if (!(val.by == void 0) && !sdIsString(val.by)) { + throw new BoxSdkError({ + message: 'Expecting string for "by" of type "CommentsOrderField"', + }); + } const by: undefined | string = val.by == void 0 ? void 0 : val.by; const direction: undefined | CommentsOrderDirectionField = val.direction == void 0 @@ -82,11 +94,34 @@ export function serializeComments(val: Comments): SerializedData { }) as readonly any[]), }; } -export function deserializeComments(val: any): Comments { +export function deserializeComments(val: SerializedData): Comments { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Comments"' }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "Comments"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "Comments"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: 'Expecting number for "offset" of type "Comments"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; + if (!(val.order == void 0) && !sdIsList(val.order)) { + throw new BoxSdkError({ + message: 'Expecting array for "order" of type "Comments"', + }); + } const order: undefined | readonly CommentsOrderField[] = val.order == void 0 ? void 0 @@ -95,6 +130,11 @@ export function deserializeComments(val: any): Comments { return deserializeCommentsOrderField(itm); }) as readonly any[]) : []; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "Comments"', + }); + } const entries: undefined | readonly CommentFull[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/completionRuleVariable.generated.ts b/src/schemas/completionRuleVariable.generated.ts index 64e2edde..61df1fd3 100644 --- a/src/schemas/completionRuleVariable.generated.ts +++ b/src/schemas/completionRuleVariable.generated.ts @@ -43,7 +43,7 @@ export function serializeCompletionRuleVariableTypeField( return val; } export function deserializeCompletionRuleVariableTypeField( - val: any + val: SerializedData ): CompletionRuleVariableTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -63,7 +63,7 @@ export function serializeCompletionRuleVariableVariableTypeField( return val; } export function deserializeCompletionRuleVariableVariableTypeField( - val: any + val: SerializedData ): CompletionRuleVariableVariableTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -84,7 +84,7 @@ export function serializeCompletionRuleVariableVariableValueField( return val; } export function deserializeCompletionRuleVariableVariableValueField( - val: any + val: SerializedData ): CompletionRuleVariableVariableValueField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -116,12 +116,35 @@ export function serializeCompletionRuleVariable( }; } export function deserializeCompletionRuleVariable( - val: any + val: SerializedData ): CompletionRuleVariable { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CompletionRuleVariable"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "CompletionRuleVariable" to be defined', + }); + } const type: CompletionRuleVariableTypeField = deserializeCompletionRuleVariableTypeField(val.type); + if (val.variable_type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "variable_type" of type "CompletionRuleVariable" to be defined', + }); + } const variableType: CompletionRuleVariableVariableTypeField = deserializeCompletionRuleVariableVariableTypeField(val.variable_type); + if (val.variable_value == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "variable_value" of type "CompletionRuleVariable" to be defined', + }); + } const variableValue: CompletionRuleVariableVariableValueField = deserializeCompletionRuleVariableVariableValueField(val.variable_value); return { @@ -148,8 +171,13 @@ export function serializeCompletionRuleVariableInput( }; } export function deserializeCompletionRuleVariableInput( - val: any + val: SerializedData ): CompletionRuleVariableInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "CompletionRuleVariableInput"', + }); + } const type: undefined | CompletionRuleVariableTypeField = val.type == void 0 ? void 0 @@ -158,6 +186,12 @@ export function deserializeCompletionRuleVariableInput( val.variableType == void 0 ? void 0 : deserializeCompletionRuleVariableVariableTypeField(val.variableType); + if (val.variable_value == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "variable_value" of type "CompletionRuleVariableInput" to be defined', + }); + } const variableValue: CompletionRuleVariableVariableValueField = deserializeCompletionRuleVariableVariableValueField(val.variable_value); return { diff --git a/src/schemas/conflictError.generated.ts b/src/schemas/conflictError.generated.ts index 40e21f94..6cb02165 100644 --- a/src/schemas/conflictError.generated.ts +++ b/src/schemas/conflictError.generated.ts @@ -38,8 +38,19 @@ export function serializeConflictErrorContextInfoField( }; } export function deserializeConflictErrorContextInfoField( - val: any + val: SerializedData ): ConflictErrorContextInfoField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ConflictErrorContextInfoField"', + }); + } + if (!(val.conflicts == void 0) && !sdIsList(val.conflicts)) { + throw new BoxSdkError({ + message: + 'Expecting array for "conflicts" of type "ConflictErrorContextInfoField"', + }); + } const conflicts: undefined | readonly FileConflict[] = val.conflicts == void 0 ? void 0 @@ -57,20 +68,43 @@ export function serializeConflictError(val: ConflictError): SerializedData { } return { ...base, ...{} }; } -export function deserializeConflictError(val: any): ConflictError { +export function deserializeConflictError(val: SerializedData): ConflictError { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "ConflictError"' }); + } const type: undefined | ClientErrorTypeField = val.type == void 0 ? void 0 : deserializeClientErrorTypeField(val.type); + if (!(val.status == void 0) && !sdIsNumber(val.status)) { + throw new BoxSdkError({ + message: 'Expecting number for "status" of type "ConflictError"', + }); + } const status: undefined | number = val.status == void 0 ? void 0 : val.status; const code: undefined | ClientErrorCodeField = val.code == void 0 ? void 0 : deserializeClientErrorCodeField(val.code); + if (!(val.message == void 0) && !sdIsString(val.message)) { + throw new BoxSdkError({ + message: 'Expecting string for "message" of type "ConflictError"', + }); + } const message: undefined | string = val.message == void 0 ? void 0 : val.message; const contextInfo: undefined | ClientErrorContextInfoField = val.context_info == void 0 ? void 0 : deserializeClientErrorContextInfoField(val.context_info); + if (!(val.help_url == void 0) && !sdIsString(val.help_url)) { + throw new BoxSdkError({ + message: 'Expecting string for "help_url" of type "ConflictError"', + }); + } const helpUrl: undefined | string = val.help_url == void 0 ? void 0 : val.help_url; + if (!(val.request_id == void 0) && !sdIsString(val.request_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "request_id" of type "ConflictError"', + }); + } const requestId: undefined | string = val.request_id == void 0 ? void 0 : val.request_id; return { diff --git a/src/schemas/devicePinner.generated.ts b/src/schemas/devicePinner.generated.ts index 92ce2c15..59e195af 100644 --- a/src/schemas/devicePinner.generated.ts +++ b/src/schemas/devicePinner.generated.ts @@ -22,7 +22,7 @@ export function serializeDevicePinnerTypeField( return val; } export function deserializeDevicePinnerTypeField( - val: any + val: SerializedData ): DevicePinnerTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -46,12 +46,25 @@ export function serializeDevicePinner(val: DevicePinner): SerializedData { ['product_name']: val.productName == void 0 ? void 0 : val.productName, }; } -export function deserializeDevicePinner(val: any): DevicePinner { +export function deserializeDevicePinner(val: SerializedData): DevicePinner { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "DevicePinner"' }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "DevicePinner"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | DevicePinnerTypeField = val.type == void 0 ? void 0 : deserializeDevicePinnerTypeField(val.type); const ownedBy: undefined | UserMini = val.owned_by == void 0 ? void 0 : deserializeUserMini(val.owned_by); + if (!(val.product_name == void 0) && !sdIsString(val.product_name)) { + throw new BoxSdkError({ + message: 'Expecting string for "product_name" of type "DevicePinner"', + }); + } const productName: undefined | string = val.product_name == void 0 ? void 0 : val.product_name; return { diff --git a/src/schemas/devicePinners.generated.ts b/src/schemas/devicePinners.generated.ts index e71cfd82..520da844 100644 --- a/src/schemas/devicePinners.generated.ts +++ b/src/schemas/devicePinners.generated.ts @@ -27,7 +27,7 @@ export function serializeDevicePinnersOrderByField( return val; } export function deserializeDevicePinnersOrderByField( - val: any + val: SerializedData ): DevicePinnersOrderByField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -47,7 +47,7 @@ export function serializeDevicePinnersOrderDirectionField( return val; } export function deserializeDevicePinnersOrderDirectionField( - val: any + val: SerializedData ): DevicePinnersOrderDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -77,8 +77,13 @@ export function serializeDevicePinnersOrderField( }; } export function deserializeDevicePinnersOrderField( - val: any + val: SerializedData ): DevicePinnersOrderField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "DevicePinnersOrderField"', + }); + } const by: undefined | DevicePinnersOrderByField = val.by == void 0 ? void 0 : deserializeDevicePinnersOrderByField(val.by); const direction: undefined | DevicePinnersOrderDirectionField = @@ -107,7 +112,15 @@ export function serializeDevicePinners(val: DevicePinners): SerializedData { }) as readonly any[]), }; } -export function deserializeDevicePinners(val: any): DevicePinners { +export function deserializeDevicePinners(val: SerializedData): DevicePinners { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "DevicePinners"' }); + } + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "DevicePinners"', + }); + } const entries: undefined | readonly DevicePinner[] = val.entries == void 0 ? void 0 @@ -116,9 +129,24 @@ export function deserializeDevicePinners(val: any): DevicePinners { return deserializeDevicePinner(itm); }) as readonly any[]) : []; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "DevicePinners"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsNumber(val.next_marker)) { + throw new BoxSdkError({ + message: 'Expecting number for "next_marker" of type "DevicePinners"', + }); + } const nextMarker: undefined | number = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.order == void 0) && !sdIsList(val.order)) { + throw new BoxSdkError({ + message: 'Expecting array for "order" of type "DevicePinners"', + }); + } const order: undefined | readonly DevicePinnersOrderField[] = val.order == void 0 ? void 0 diff --git a/src/schemas/emailAlias.generated.ts b/src/schemas/emailAlias.generated.ts index c00f9327..71c435e1 100644 --- a/src/schemas/emailAlias.generated.ts +++ b/src/schemas/emailAlias.generated.ts @@ -18,7 +18,9 @@ export function serializeEmailAliasTypeField( ): SerializedData { return val; } -export function deserializeEmailAliasTypeField(val: any): EmailAliasTypeField { +export function deserializeEmailAliasTypeField( + val: SerializedData +): EmailAliasTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "EmailAliasTypeField"', @@ -40,11 +42,29 @@ export function serializeEmailAlias(val: EmailAlias): SerializedData { ['is_confirmed']: val.isConfirmed == void 0 ? void 0 : val.isConfirmed, }; } -export function deserializeEmailAlias(val: any): EmailAlias { +export function deserializeEmailAlias(val: SerializedData): EmailAlias { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "EmailAlias"' }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "EmailAlias"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | EmailAliasTypeField = val.type == void 0 ? void 0 : deserializeEmailAliasTypeField(val.type); + if (!(val.email == void 0) && !sdIsString(val.email)) { + throw new BoxSdkError({ + message: 'Expecting string for "email" of type "EmailAlias"', + }); + } const email: undefined | string = val.email == void 0 ? void 0 : val.email; + if (!(val.is_confirmed == void 0) && !sdIsBoolean(val.is_confirmed)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "is_confirmed" of type "EmailAlias"', + }); + } const isConfirmed: undefined | boolean = val.is_confirmed == void 0 ? void 0 : val.is_confirmed; return { diff --git a/src/schemas/emailAliases.generated.ts b/src/schemas/emailAliases.generated.ts index 26fb2e3b..08b47f91 100644 --- a/src/schemas/emailAliases.generated.ts +++ b/src/schemas/emailAliases.generated.ts @@ -1,6 +1,7 @@ import { serializeEmailAlias } from './emailAlias.generated.js'; import { deserializeEmailAlias } from './emailAlias.generated.js'; import { EmailAlias } from './emailAlias.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -23,9 +24,22 @@ export function serializeEmailAliases(val: EmailAliases): SerializedData { }) as readonly any[]), }; } -export function deserializeEmailAliases(val: any): EmailAliases { +export function deserializeEmailAliases(val: SerializedData): EmailAliases { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "EmailAliases"' }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "EmailAliases"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "EmailAliases"', + }); + } const entries: undefined | readonly EmailAlias[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/enterpriseBase.generated.ts b/src/schemas/enterpriseBase.generated.ts index c7b2c28a..14465238 100644 --- a/src/schemas/enterpriseBase.generated.ts +++ b/src/schemas/enterpriseBase.generated.ts @@ -17,7 +17,7 @@ export function serializeEnterpriseBaseTypeField( return val; } export function deserializeEnterpriseBaseTypeField( - val: any + val: SerializedData ): EnterpriseBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -38,7 +38,15 @@ export function serializeEnterpriseBase(val: EnterpriseBase): SerializedData { val.type == void 0 ? void 0 : serializeEnterpriseBaseTypeField(val.type), }; } -export function deserializeEnterpriseBase(val: any): EnterpriseBase { +export function deserializeEnterpriseBase(val: SerializedData): EnterpriseBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "EnterpriseBase"' }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "EnterpriseBase"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | EnterpriseBaseTypeField = val.type == void 0 ? void 0 : deserializeEnterpriseBaseTypeField(val.type); diff --git a/src/schemas/event.generated.ts b/src/schemas/event.generated.ts index c3548e2c..ccb5e540 100644 --- a/src/schemas/event.generated.ts +++ b/src/schemas/event.generated.ts @@ -168,7 +168,9 @@ export function serializeEventEventTypeField( ): SerializedData { return val; } -export function deserializeEventEventTypeField(val: any): EventEventTypeField { +export function deserializeEventEventTypeField( + val: SerializedData +): EventEventTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "EventEventTypeField"', @@ -589,8 +591,13 @@ export function serializeEventAdditionalDetailsField( return {}; } export function deserializeEventAdditionalDetailsField( - val: any + val: SerializedData ): EventAdditionalDetailsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "EventAdditionalDetailsField"', + }); + } return {} satisfies EventAdditionalDetailsField; } export function serializeEvent(val: Event): SerializedData { @@ -618,12 +625,35 @@ export function serializeEvent(val: Event): SerializedData { : serializeEventAdditionalDetailsField(val.additionalDetails), }; } -export function deserializeEvent(val: any): Event { +export function deserializeEvent(val: SerializedData): Event { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Event"' }); + } + if (!(val.type == void 0) && !sdIsString(val.type)) { + throw new BoxSdkError({ + message: 'Expecting string for "type" of type "Event"', + }); + } const type: undefined | string = val.type == void 0 ? void 0 : val.type; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "Event"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.recorded_at == void 0) && !sdIsString(val.recorded_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "recorded_at" of type "Event"', + }); + } const recordedAt: undefined | DateTime = val.recorded_at == void 0 ? void 0 : deserializeDateTime(val.recorded_at); + if (!(val.event_id == void 0) && !sdIsString(val.event_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "event_id" of type "Event"', + }); + } const eventId: undefined | string = val.event_id == void 0 ? void 0 : val.event_id; const createdBy: undefined | UserMini = @@ -632,6 +662,11 @@ export function deserializeEvent(val: any): Event { val.event_type == void 0 ? void 0 : deserializeEventEventTypeField(val.event_type); + if (!(val.session_id == void 0) && !sdIsString(val.session_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "session_id" of type "Event"', + }); + } const sessionId: undefined | string = val.session_id == void 0 ? void 0 : val.session_id; const source: undefined | EventSourceOrFileOrFolderOrGenericSourceOrUser = diff --git a/src/schemas/eventSource.generated.ts b/src/schemas/eventSource.generated.ts index 40e3e543..edbafb5f 100644 --- a/src/schemas/eventSource.generated.ts +++ b/src/schemas/eventSource.generated.ts @@ -30,7 +30,7 @@ export function serializeEventSourceItemTypeField( return val; } export function deserializeEventSourceItemTypeField( - val: any + val: SerializedData ): EventSourceItemTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -53,8 +53,19 @@ export function serializeEventSourceClassificationField( return { ['name']: val.name == void 0 ? void 0 : val.name }; } export function deserializeEventSourceClassificationField( - val: any + val: SerializedData ): EventSourceClassificationField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "EventSourceClassificationField"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "EventSourceClassificationField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; return { name: name } satisfies EventSourceClassificationField; } @@ -72,10 +83,38 @@ export function serializeEventSource(val: EventSource): SerializedData { val.ownedBy == void 0 ? void 0 : serializeUserMini(val.ownedBy), }; } -export function deserializeEventSource(val: any): EventSource { +export function deserializeEventSource(val: SerializedData): EventSource { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "EventSource"' }); + } + if (val.item_type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "item_type" of type "EventSource" to be defined', + }); + } const itemType: EventSourceItemTypeField = deserializeEventSourceItemTypeField(val.item_type); + if (val.item_id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "item_id" of type "EventSource" to be defined', + }); + } + if (!sdIsString(val.item_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "item_id" of type "EventSource"', + }); + } const itemId: string = val.item_id; + if (val.item_name == void 0) { + throw new BoxSdkError({ + message: 'Expecting "item_name" of type "EventSource" to be defined', + }); + } + if (!sdIsString(val.item_name)) { + throw new BoxSdkError({ + message: 'Expecting string for "item_name" of type "EventSource"', + }); + } const itemName: string = val.item_name; const classification: undefined | EventSourceClassificationField = val.classification == void 0 diff --git a/src/schemas/eventSourceOrFileOrFolderOrGenericSourceOrUser.generated.ts b/src/schemas/eventSourceOrFileOrFolderOrGenericSourceOrUser.generated.ts index 156f9862..1209fba9 100644 --- a/src/schemas/eventSourceOrFileOrFolderOrGenericSourceOrUser.generated.ts +++ b/src/schemas/eventSourceOrFileOrFolderOrGenericSourceOrUser.generated.ts @@ -48,7 +48,7 @@ export function serializeEventSourceOrFileOrFolderOrGenericSourceOrUser( return serializeGenericSource(val); } export function deserializeEventSourceOrFileOrFolderOrGenericSourceOrUser( - val: any + val: SerializedData ): EventSourceOrFileOrFolderOrGenericSourceOrUser { if (!sdIsMap(val)) { throw new BoxSdkError({ diff --git a/src/schemas/events.generated.ts b/src/schemas/events.generated.ts index c602845e..b55b9139 100644 --- a/src/schemas/events.generated.ts +++ b/src/schemas/events.generated.ts @@ -1,6 +1,7 @@ import { serializeEvent } from './event.generated.js'; import { deserializeEvent } from './event.generated.js'; import { Event } from './event.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -26,11 +27,32 @@ export function serializeEvents(val: Events): SerializedData { }) as readonly any[]), }; } -export function deserializeEvents(val: any): Events { +export function deserializeEvents(val: SerializedData): Events { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Events"' }); + } + if (!(val.chunk_size == void 0) && !sdIsNumber(val.chunk_size)) { + throw new BoxSdkError({ + message: 'Expecting number for "chunk_size" of type "Events"', + }); + } const chunkSize: undefined | number = val.chunk_size == void 0 ? void 0 : val.chunk_size; + if ( + !(val.next_stream_position == void 0) && + !sdIsString(val.next_stream_position) + ) { + throw new BoxSdkError({ + message: 'Expecting string for "next_stream_position" of type "Events"', + }); + } const nextStreamPosition: undefined | string = val.next_stream_position == void 0 ? void 0 : val.next_stream_position; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "Events"', + }); + } const entries: undefined | readonly Event[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/file.generated.ts b/src/schemas/file.generated.ts index 596538fe..5f32da79 100644 --- a/src/schemas/file.generated.ts +++ b/src/schemas/file.generated.ts @@ -92,9 +92,38 @@ export function serializeFilePathCollectionField( }; } export function deserializeFilePathCollectionField( - val: any + val: SerializedData ): FilePathCollectionField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FilePathCollectionField"', + }); + } + if (val.total_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "total_count" of type "FilePathCollectionField" to be defined', + }); + } + if (!sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "total_count" of type "FilePathCollectionField"', + }); + } const totalCount: number = val.total_count; + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "FilePathCollectionField" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "FilePathCollectionField"', + }); + } const entries: readonly FolderMini[] = sdIsList(val.entries) ? (val.entries.map(function (itm: SerializedData): FolderMini { return deserializeFolderMini(itm); @@ -111,7 +140,7 @@ export function serializeFileSharedLinkAccessField( return val; } export function deserializeFileSharedLinkAccessField( - val: any + val: SerializedData ): FileSharedLinkAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -137,7 +166,7 @@ export function serializeFileSharedLinkEffectiveAccessField( return val; } export function deserializeFileSharedLinkEffectiveAccessField( - val: any + val: SerializedData ): FileSharedLinkEffectiveAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -163,7 +192,7 @@ export function serializeFileSharedLinkEffectivePermissionField( return val; } export function deserializeFileSharedLinkEffectivePermissionField( - val: any + val: SerializedData ): FileSharedLinkEffectivePermissionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -197,10 +226,51 @@ export function serializeFileSharedLinkPermissionsField( }; } export function deserializeFileSharedLinkPermissionsField( - val: any + val: SerializedData ): FileSharedLinkPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileSharedLinkPermissionsField"', + }); + } + if (val.can_download == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_download" of type "FileSharedLinkPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_download)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_download" of type "FileSharedLinkPermissionsField"', + }); + } const canDownload: boolean = val.can_download; + if (val.can_preview == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_preview" of type "FileSharedLinkPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_preview)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_preview" of type "FileSharedLinkPermissionsField"', + }); + } const canPreview: boolean = val.can_preview; + if (val.can_edit == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_edit" of type "FileSharedLinkPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_edit)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_edit" of type "FileSharedLinkPermissionsField"', + }); + } const canEdit: boolean = val.can_edit; return { canDownload: canDownload, @@ -237,30 +307,119 @@ export function serializeFileSharedLinkField( ['preview_count']: val.previewCount, }; } -export function deserializeFileSharedLinkField(val: any): FileSharedLinkField { +export function deserializeFileSharedLinkField( + val: SerializedData +): FileSharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileSharedLinkField"', + }); + } + if (val.url == void 0) { + throw new BoxSdkError({ + message: 'Expecting "url" of type "FileSharedLinkField" to be defined', + }); + } + if (!sdIsString(val.url)) { + throw new BoxSdkError({ + message: 'Expecting string for "url" of type "FileSharedLinkField"', + }); + } const url: string = val.url; + if (!(val.download_url == void 0) && !sdIsString(val.download_url)) { + throw new BoxSdkError({ + message: + 'Expecting string for "download_url" of type "FileSharedLinkField"', + }); + } const downloadUrl: undefined | string = val.download_url == void 0 ? void 0 : val.download_url; + if (!(val.vanity_url == void 0) && !sdIsString(val.vanity_url)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_url" of type "FileSharedLinkField"', + }); + } const vanityUrl: undefined | string = val.vanity_url == void 0 ? void 0 : val.vanity_url; + if (!(val.vanity_name == void 0) && !sdIsString(val.vanity_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_name" of type "FileSharedLinkField"', + }); + } const vanityName: undefined | string = val.vanity_name == void 0 ? void 0 : val.vanity_name; const access: undefined | FileSharedLinkAccessField = val.access == void 0 ? void 0 : deserializeFileSharedLinkAccessField(val.access); + if (val.effective_access == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "effective_access" of type "FileSharedLinkField" to be defined', + }); + } const effectiveAccess: FileSharedLinkEffectiveAccessField = deserializeFileSharedLinkEffectiveAccessField(val.effective_access); + if (val.effective_permission == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "effective_permission" of type "FileSharedLinkField" to be defined', + }); + } const effectivePermission: FileSharedLinkEffectivePermissionField = deserializeFileSharedLinkEffectivePermissionField(val.effective_permission); + if (!(val.unshared_at == void 0) && !sdIsString(val.unshared_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "unshared_at" of type "FileSharedLinkField"', + }); + } const unsharedAt: undefined | DateTime = val.unshared_at == void 0 ? void 0 : deserializeDateTime(val.unshared_at); + if (val.is_password_enabled == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "is_password_enabled" of type "FileSharedLinkField" to be defined', + }); + } + if (!sdIsBoolean(val.is_password_enabled)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_password_enabled" of type "FileSharedLinkField"', + }); + } const isPasswordEnabled: boolean = val.is_password_enabled; const permissions: undefined | FileSharedLinkPermissionsField = val.permissions == void 0 ? void 0 : deserializeFileSharedLinkPermissionsField(val.permissions); + if (val.download_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "download_count" of type "FileSharedLinkField" to be defined', + }); + } + if (!sdIsNumber(val.download_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "download_count" of type "FileSharedLinkField"', + }); + } const downloadCount: number = val.download_count; + if (val.preview_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "preview_count" of type "FileSharedLinkField" to be defined', + }); + } + if (!sdIsNumber(val.preview_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "preview_count" of type "FileSharedLinkField"', + }); + } const previewCount: number = val.preview_count; return { url: url, @@ -282,7 +441,9 @@ export function serializeFileItemStatusField( ): SerializedData { return val; } -export function deserializeFileItemStatusField(val: any): FileItemStatusField { +export function deserializeFileItemStatusField( + val: SerializedData +): FileItemStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "FileItemStatusField"', @@ -350,26 +511,75 @@ export function serializeFile(val: File): SerializedData { }, }; } -export function deserializeFile(val: any): File { +export function deserializeFile(val: SerializedData): File { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "File"' }); + } + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "File"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if (!(val.size == void 0) && !sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "File"', + }); + } const size: undefined | number = val.size == void 0 ? void 0 : val.size; const pathCollection: undefined | FilePathCollectionField = val.path_collection == void 0 ? void 0 : deserializeFilePathCollectionField(val.path_collection); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "File"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "File"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "trashed_at" of type "File"', + }); + } const trashedAt: undefined | DateTime = val.trashed_at == void 0 ? void 0 : deserializeDateTime(val.trashed_at); + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "purged_at" of type "File"', + }); + } const purgedAt: undefined | DateTime = val.purged_at == void 0 ? void 0 : deserializeDateTime(val.purged_at); + if ( + !(val.content_created_at == void 0) && + !sdIsString(val.content_created_at) + ) { + throw new BoxSdkError({ + message: 'Expecting string for "content_created_at" of type "File"', + }); + } const contentCreatedAt: undefined | DateTime = val.content_created_at == void 0 ? void 0 : deserializeDateTime(val.content_created_at); + if ( + !(val.content_modified_at == void 0) && + !sdIsString(val.content_modified_at) + ) { + throw new BoxSdkError({ + message: 'Expecting string for "content_modified_at" of type "File"', + }); + } const contentModifiedAt: undefined | DateTime = val.content_modified_at == void 0 ? void 0 @@ -390,16 +600,51 @@ export function deserializeFile(val: any): File { val.item_status == void 0 ? void 0 : deserializeFileItemStatusField(val.item_status); + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "File"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "File"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.sha1 == void 0) && !sdIsString(val.sha1)) { + throw new BoxSdkError({ + message: 'Expecting string for "sha1" of type "File"', + }); + } const sha1: undefined | string = val.sha1 == void 0 ? void 0 : val.sha1; const fileVersion: undefined | FileVersionMini = val.file_version == void 0 ? void 0 : deserializeFileVersionMini(val.file_version); + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "File" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "File"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "File"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "File" to be defined', + }); + } const type: FileBaseTypeField = deserializeFileBaseTypeField(val.type); return { description: description, diff --git a/src/schemas/fileBase.generated.ts b/src/schemas/fileBase.generated.ts index 7d7f8636..59d8bbcd 100644 --- a/src/schemas/fileBase.generated.ts +++ b/src/schemas/fileBase.generated.ts @@ -35,7 +35,9 @@ export function serializeFileBaseTypeField( ): SerializedData { return val; } -export function deserializeFileBaseTypeField(val: any): FileBaseTypeField { +export function deserializeFileBaseTypeField( + val: SerializedData +): FileBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "FileBaseTypeField"', @@ -55,9 +57,32 @@ export function serializeFileBase(val: FileBase): SerializedData { ['type']: serializeFileBaseTypeField(val.type), }; } -export function deserializeFileBase(val: any): FileBase { +export function deserializeFileBase(val: SerializedData): FileBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FileBase"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FileBase" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileBase"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "FileBase"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "FileBase" to be defined', + }); + } const type: FileBaseTypeField = deserializeFileBaseTypeField(val.type); return { id: id, etag: etag, type: type } satisfies FileBase; } @@ -69,8 +94,26 @@ export function serializeFileBaseInput(val: FileBaseInput): SerializedData { val.type == void 0 ? void 0 : serializeFileBaseTypeField(val.type), }; } -export function deserializeFileBaseInput(val: any): FileBaseInput { +export function deserializeFileBaseInput(val: SerializedData): FileBaseInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FileBaseInput"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FileBaseInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileBaseInput"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "FileBaseInput"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; const type: undefined | FileBaseTypeField = val.type == void 0 ? void 0 : deserializeFileBaseTypeField(val.type); diff --git a/src/schemas/fileConflict.generated.ts b/src/schemas/fileConflict.generated.ts index b5c4d829..9e19d2f6 100644 --- a/src/schemas/fileConflict.generated.ts +++ b/src/schemas/fileConflict.generated.ts @@ -30,17 +30,55 @@ export function serializeFileConflict(val: FileConflict): SerializedData { } return { ...base, ...{} }; } -export function deserializeFileConflict(val: any): FileConflict { +export function deserializeFileConflict(val: SerializedData): FileConflict { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FileConflict"' }); + } + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "FileConflict"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "FileConflict"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.sha1 == void 0) && !sdIsString(val.sha1)) { + throw new BoxSdkError({ + message: 'Expecting string for "sha1" of type "FileConflict"', + }); + } const sha1: undefined | string = val.sha1 == void 0 ? void 0 : val.sha1; const fileVersion: undefined | FileVersionMini = val.file_version == void 0 ? void 0 : deserializeFileVersionMini(val.file_version); + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FileConflict" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileConflict"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "FileConflict"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "FileConflict" to be defined', + }); + } const type: FileBaseTypeField = deserializeFileBaseTypeField(val.type); return { sequenceId: sequenceId, diff --git a/src/schemas/fileFull.generated.ts b/src/schemas/fileFull.generated.ts index 411eaba4..75fa888c 100644 --- a/src/schemas/fileFull.generated.ts +++ b/src/schemas/fileFull.generated.ts @@ -186,26 +186,145 @@ export function serializeFileFullPermissionsField( }; } export function deserializeFileFullPermissionsField( - val: any + val: SerializedData ): FileFullPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileFullPermissionsField"', + }); + } + if (val.can_delete == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_delete" of type "FileFullPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_delete)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_delete" of type "FileFullPermissionsField"', + }); + } const canDelete: boolean = val.can_delete; + if (val.can_download == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_download" of type "FileFullPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_download)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_download" of type "FileFullPermissionsField"', + }); + } const canDownload: boolean = val.can_download; + if (val.can_invite_collaborator == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_invite_collaborator" of type "FileFullPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_invite_collaborator)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_invite_collaborator" of type "FileFullPermissionsField"', + }); + } const canInviteCollaborator: boolean = val.can_invite_collaborator; + if (val.can_rename == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_rename" of type "FileFullPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_rename)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_rename" of type "FileFullPermissionsField"', + }); + } const canRename: boolean = val.can_rename; + if (val.can_set_share_access == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_set_share_access" of type "FileFullPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_set_share_access)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_set_share_access" of type "FileFullPermissionsField"', + }); + } const canSetShareAccess: boolean = val.can_set_share_access; + if (val.can_share == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_share" of type "FileFullPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_share)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_share" of type "FileFullPermissionsField"', + }); + } const canShare: boolean = val.can_share; + if (!(val.can_annotate == void 0) && !sdIsBoolean(val.can_annotate)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_annotate" of type "FileFullPermissionsField"', + }); + } const canAnnotate: undefined | boolean = val.can_annotate == void 0 ? void 0 : val.can_annotate; + if (!(val.can_comment == void 0) && !sdIsBoolean(val.can_comment)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_comment" of type "FileFullPermissionsField"', + }); + } const canComment: undefined | boolean = val.can_comment == void 0 ? void 0 : val.can_comment; + if (!(val.can_preview == void 0) && !sdIsBoolean(val.can_preview)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_preview" of type "FileFullPermissionsField"', + }); + } const canPreview: undefined | boolean = val.can_preview == void 0 ? void 0 : val.can_preview; + if (!(val.can_upload == void 0) && !sdIsBoolean(val.can_upload)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_upload" of type "FileFullPermissionsField"', + }); + } const canUpload: undefined | boolean = val.can_upload == void 0 ? void 0 : val.can_upload; + if ( + !(val.can_view_annotations_all == void 0) && + !sdIsBoolean(val.can_view_annotations_all) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_view_annotations_all" of type "FileFullPermissionsField"', + }); + } const canViewAnnotationsAll: undefined | boolean = val.can_view_annotations_all == void 0 ? void 0 : val.can_view_annotations_all; + if ( + !(val.can_view_annotations_self == void 0) && + !sdIsBoolean(val.can_view_annotations_self) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_view_annotations_self" of type "FileFullPermissionsField"', + }); + } const canViewAnnotationsSelf: undefined | boolean = val.can_view_annotations_self == void 0 ? void 0 @@ -231,7 +350,7 @@ export function serializeFileFullLockTypeField( return val; } export function deserializeFileFullLockTypeField( - val: any + val: SerializedData ): FileFullLockTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -251,7 +370,7 @@ export function serializeFileFullLockAppTypeField( return val; } export function deserializeFileFullLockAppTypeField( - val: any + val: SerializedData ): FileFullLockAppTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -295,16 +414,47 @@ export function serializeFileFullLockField( : serializeFileFullLockAppTypeField(val.appType), }; } -export function deserializeFileFullLockField(val: any): FileFullLockField { +export function deserializeFileFullLockField( + val: SerializedData +): FileFullLockField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileFullLockField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileFullLockField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | FileFullLockTypeField = val.type == void 0 ? void 0 : deserializeFileFullLockTypeField(val.type); const createdBy: undefined | UserMini = val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "FileFullLockField"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.expired_at == void 0) && !sdIsString(val.expired_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "expired_at" of type "FileFullLockField"', + }); + } const expiredAt: undefined | DateTime = val.expired_at == void 0 ? void 0 : deserializeDateTime(val.expired_at); + if ( + !(val.is_download_prevented == void 0) && + !sdIsBoolean(val.is_download_prevented) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_download_prevented" of type "FileFullLockField"', + }); + } const isDownloadPrevented: undefined | boolean = val.is_download_prevented == void 0 ? void 0 : val.is_download_prevented; const appType: undefined | FileFullLockAppTypeField = @@ -327,7 +477,7 @@ export function serializeFileFullExpiringEmbedLinkTokenTypeField( return val; } export function deserializeFileFullExpiringEmbedLinkTokenTypeField( - val: any + val: SerializedData ): FileFullExpiringEmbedLinkTokenTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -364,16 +514,39 @@ export function serializeFileFullExpiringEmbedLinkField( }; } export function deserializeFileFullExpiringEmbedLinkField( - val: any + val: SerializedData ): FileFullExpiringEmbedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileFullExpiringEmbedLinkField"', + }); + } + if (!(val.access_token == void 0) && !sdIsString(val.access_token)) { + throw new BoxSdkError({ + message: + 'Expecting string for "access_token" of type "FileFullExpiringEmbedLinkField"', + }); + } const accessToken: undefined | string = val.access_token == void 0 ? void 0 : val.access_token; + if (!(val.expires_in == void 0) && !sdIsNumber(val.expires_in)) { + throw new BoxSdkError({ + message: + 'Expecting number for "expires_in" of type "FileFullExpiringEmbedLinkField"', + }); + } const expiresIn: undefined | number = val.expires_in == void 0 ? void 0 : val.expires_in; const tokenType: undefined | FileFullExpiringEmbedLinkTokenTypeField = val.token_type == void 0 ? void 0 : deserializeFileFullExpiringEmbedLinkTokenTypeField(val.token_type); + if (!(val.restricted_to == void 0) && !sdIsList(val.restricted_to)) { + throw new BoxSdkError({ + message: + 'Expecting array for "restricted_to" of type "FileFullExpiringEmbedLinkField"', + }); + } const restrictedTo: undefined | readonly FileOrFolderScope[] = val.restricted_to == void 0 ? void 0 @@ -384,6 +557,12 @@ export function deserializeFileFullExpiringEmbedLinkField( return deserializeFileOrFolderScope(itm); }) as readonly any[]) : []; + if (!(val.url == void 0) && !sdIsString(val.url)) { + throw new BoxSdkError({ + message: + 'Expecting string for "url" of type "FileFullExpiringEmbedLinkField"', + }); + } const url: undefined | string = val.url == void 0 ? void 0 : val.url; return { accessToken: accessToken, @@ -402,8 +581,19 @@ export function serializeFileFullWatermarkInfoField( }; } export function deserializeFileFullWatermarkInfoField( - val: any + val: SerializedData ): FileFullWatermarkInfoField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileFullWatermarkInfoField"', + }); + } + if (!(val.is_watermarked == void 0) && !sdIsBoolean(val.is_watermarked)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_watermarked" of type "FileFullWatermarkInfoField"', + }); + } const isWatermarked: undefined | boolean = val.is_watermarked == void 0 ? void 0 : val.is_watermarked; return { isWatermarked: isWatermarked } satisfies FileFullWatermarkInfoField; @@ -414,7 +604,7 @@ export function serializeFileFullAllowedInviteeRolesField( return val; } export function deserializeFileFullAllowedInviteeRolesField( - val: any + val: SerializedData ): FileFullAllowedInviteeRolesField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -452,15 +642,49 @@ export function serializeFileFullMetadataField( return { ...{}, ...val.extraData }; } export function deserializeFileFullMetadataField( - val: any + val: SerializedData ): FileFullMetadataField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileFullMetadataField"', + }); + } + if (!(val == void 0) && !sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting object for "extraData" of type "FileFullMetadataField"', + }); + } const extraData: | undefined | { readonly [key: string]: { readonly [key: string]: Metadata; }; - } = val == void 0 ? void 0 : val; + } = + val == void 0 + ? void 0 + : sdIsMap(val) + ? (Object.fromEntries( + Object.entries(val).map(([k, v]: [string, any]) => [ + k, + (function (v: any): any { + return sdIsMap(v) + ? (Object.fromEntries( + Object.entries(v).map(([k, v]: [string, any]) => [ + k, + deserializeMetadata(v), + ]) + ) as { + readonly [key: string]: any; + }) + : {}; + })(v), + ]) + ) as { + readonly [key: string]: any; + }) + : {}; return { extraData: extraData } satisfies FileFullMetadataField; } export function serializeFileFullRepresentationsEntriesContentField( @@ -471,8 +695,20 @@ export function serializeFileFullRepresentationsEntriesContentField( }; } export function deserializeFileFullRepresentationsEntriesContentField( - val: any + val: SerializedData ): FileFullRepresentationsEntriesContentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "FileFullRepresentationsEntriesContentField"', + }); + } + if (!(val.url_template == void 0) && !sdIsString(val.url_template)) { + throw new BoxSdkError({ + message: + 'Expecting string for "url_template" of type "FileFullRepresentationsEntriesContentField"', + }); + } const urlTemplate: undefined | string = val.url_template == void 0 ? void 0 : val.url_template; return { @@ -485,8 +721,19 @@ export function serializeFileFullRepresentationsEntriesInfoField( return { ['url']: val.url == void 0 ? void 0 : val.url }; } export function deserializeFileFullRepresentationsEntriesInfoField( - val: any + val: SerializedData ): FileFullRepresentationsEntriesInfoField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileFullRepresentationsEntriesInfoField"', + }); + } + if (!(val.url == void 0) && !sdIsString(val.url)) { + throw new BoxSdkError({ + message: + 'Expecting string for "url" of type "FileFullRepresentationsEntriesInfoField"', + }); + } const url: undefined | string = val.url == void 0 ? void 0 : val.url; return { url: url } satisfies FileFullRepresentationsEntriesInfoField; } @@ -500,11 +747,35 @@ export function serializeFileFullRepresentationsEntriesPropertiesField( }; } export function deserializeFileFullRepresentationsEntriesPropertiesField( - val: any + val: SerializedData ): FileFullRepresentationsEntriesPropertiesField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "FileFullRepresentationsEntriesPropertiesField"', + }); + } + if (!(val.dimensions == void 0) && !sdIsString(val.dimensions)) { + throw new BoxSdkError({ + message: + 'Expecting string for "dimensions" of type "FileFullRepresentationsEntriesPropertiesField"', + }); + } const dimensions: undefined | string = val.dimensions == void 0 ? void 0 : val.dimensions; + if (!(val.paged == void 0) && !sdIsBoolean(val.paged)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "paged" of type "FileFullRepresentationsEntriesPropertiesField"', + }); + } const paged: undefined | boolean = val.paged == void 0 ? void 0 : val.paged; + if (!(val.thumb == void 0) && !sdIsBoolean(val.thumb)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "thumb" of type "FileFullRepresentationsEntriesPropertiesField"', + }); + } const thumb: undefined | boolean = val.thumb == void 0 ? void 0 : val.thumb; return { dimensions: dimensions, @@ -518,7 +789,7 @@ export function serializeFileFullRepresentationsEntriesStatusStateField( return val; } export function deserializeFileFullRepresentationsEntriesStatusStateField( - val: any + val: SerializedData ): FileFullRepresentationsEntriesStatusStateField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -553,8 +824,14 @@ export function serializeFileFullRepresentationsEntriesStatusField( }; } export function deserializeFileFullRepresentationsEntriesStatusField( - val: any + val: SerializedData ): FileFullRepresentationsEntriesStatusField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "FileFullRepresentationsEntriesStatusField"', + }); + } const state: undefined | FileFullRepresentationsEntriesStatusStateField = val.state == void 0 ? void 0 @@ -588,8 +865,13 @@ export function serializeFileFullRepresentationsEntriesField( }; } export function deserializeFileFullRepresentationsEntriesField( - val: any + val: SerializedData ): FileFullRepresentationsEntriesField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileFullRepresentationsEntriesField"', + }); + } const content: undefined | FileFullRepresentationsEntriesContentField = val.content == void 0 ? void 0 @@ -604,6 +886,12 @@ export function deserializeFileFullRepresentationsEntriesField( : deserializeFileFullRepresentationsEntriesPropertiesField( val.properties ); + if (!(val.representation == void 0) && !sdIsString(val.representation)) { + throw new BoxSdkError({ + message: + 'Expecting string for "representation" of type "FileFullRepresentationsEntriesField"', + }); + } const representation: undefined | string = val.representation == void 0 ? void 0 : val.representation; const status: undefined | FileFullRepresentationsEntriesStatusField = @@ -633,8 +921,19 @@ export function serializeFileFullRepresentationsField( }; } export function deserializeFileFullRepresentationsField( - val: any + val: SerializedData ): FileFullRepresentationsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileFullRepresentationsField"', + }); + } + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "FileFullRepresentationsField"', + }); + } const entries: undefined | readonly FileFullRepresentationsEntriesField[] = val.entries == void 0 ? void 0 @@ -657,11 +956,34 @@ export function serializeFileFullClassificationField( }; } export function deserializeFileFullClassificationField( - val: any + val: SerializedData ): FileFullClassificationField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileFullClassificationField"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "FileFullClassificationField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.definition == void 0) && !sdIsString(val.definition)) { + throw new BoxSdkError({ + message: + 'Expecting string for "definition" of type "FileFullClassificationField"', + }); + } const definition: undefined | string = val.definition == void 0 ? void 0 : val.definition; + if (!(val.color == void 0) && !sdIsString(val.color)) { + throw new BoxSdkError({ + message: + 'Expecting string for "color" of type "FileFullClassificationField"', + }); + } const color: undefined | string = val.color == void 0 ? void 0 : val.color; return { name: name, @@ -675,7 +997,7 @@ export function serializeFileFullSharedLinkPermissionOptionsField( return val; } export function deserializeFileFullSharedLinkPermissionOptionsField( - val: any + val: SerializedData ): FileFullSharedLinkPermissionOptionsField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -776,21 +1098,60 @@ export function serializeFileFull(val: FileFull): SerializedData { }, }; } -export function deserializeFileFull(val: any): FileFull { +export function deserializeFileFull(val: SerializedData): FileFull { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FileFull"' }); + } + if (!(val.version_number == void 0) && !sdIsString(val.version_number)) { + throw new BoxSdkError({ + message: 'Expecting string for "version_number" of type "FileFull"', + }); + } const versionNumber: undefined | string = val.version_number == void 0 ? void 0 : val.version_number; + if (!(val.comment_count == void 0) && !sdIsNumber(val.comment_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "comment_count" of type "FileFull"', + }); + } const commentCount: undefined | number = val.comment_count == void 0 ? void 0 : val.comment_count; const permissions: undefined | FileFullPermissionsField = val.permissions == void 0 ? void 0 : deserializeFileFullPermissionsField(val.permissions); + if (!(val.tags == void 0) && !sdIsList(val.tags)) { + throw new BoxSdkError({ + message: 'Expecting array for "tags" of type "FileFull"', + }); + } const tags: undefined | readonly string[] = - val.tags == void 0 ? void 0 : sdIsList(val.tags) ? val.tags : []; + val.tags == void 0 + ? void 0 + : sdIsList(val.tags) + ? (val.tags.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: 'Expecting string for "FileFull"', + }); + } + return itm; + }) as readonly any[]) + : []; const lock: undefined | FileFullLockField = val.lock == void 0 ? void 0 : deserializeFileFullLockField(val.lock); + if (!(val.extension == void 0) && !sdIsString(val.extension)) { + throw new BoxSdkError({ + message: 'Expecting string for "extension" of type "FileFull"', + }); + } const extension: undefined | string = val.extension == void 0 ? void 0 : val.extension; + if (!(val.is_package == void 0) && !sdIsBoolean(val.is_package)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "is_package" of type "FileFull"', + }); + } const isPackage: undefined | boolean = val.is_package == void 0 ? void 0 : val.is_package; const expiringEmbedLink: undefined | FileFullExpiringEmbedLinkField = @@ -801,10 +1162,27 @@ export function deserializeFileFull(val: any): FileFull { val.watermark_info == void 0 ? void 0 : deserializeFileFullWatermarkInfoField(val.watermark_info); + if ( + !(val.is_accessible_via_shared_link == void 0) && + !sdIsBoolean(val.is_accessible_via_shared_link) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_accessible_via_shared_link" of type "FileFull"', + }); + } const isAccessibleViaSharedLink: undefined | boolean = val.is_accessible_via_shared_link == void 0 ? void 0 : val.is_accessible_via_shared_link; + if ( + !(val.allowed_invitee_roles == void 0) && + !sdIsList(val.allowed_invitee_roles) + ) { + throw new BoxSdkError({ + message: 'Expecting array for "allowed_invitee_roles" of type "FileFull"', + }); + } const allowedInviteeRoles: | undefined | readonly FileFullAllowedInviteeRolesField[] = @@ -817,14 +1195,35 @@ export function deserializeFileFull(val: any): FileFull { return deserializeFileFullAllowedInviteeRolesField(itm); }) as readonly any[]) : []; + if ( + !(val.is_externally_owned == void 0) && + !sdIsBoolean(val.is_externally_owned) + ) { + throw new BoxSdkError({ + message: 'Expecting boolean for "is_externally_owned" of type "FileFull"', + }); + } const isExternallyOwned: undefined | boolean = val.is_externally_owned == void 0 ? void 0 : val.is_externally_owned; + if ( + !(val.has_collaborations == void 0) && + !sdIsBoolean(val.has_collaborations) + ) { + throw new BoxSdkError({ + message: 'Expecting boolean for "has_collaborations" of type "FileFull"', + }); + } const hasCollaborations: undefined | boolean = val.has_collaborations == void 0 ? void 0 : val.has_collaborations; const metadata: undefined | FileFullMetadataField = val.metadata == void 0 ? void 0 : deserializeFileFullMetadataField(val.metadata); + if (!(val.expires_at == void 0) && !sdIsString(val.expires_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "expires_at" of type "FileFull"', + }); + } const expiresAt: undefined | DateTime = val.expires_at == void 0 ? void 0 : deserializeDateTime(val.expires_at); const representations: undefined | FileFullRepresentationsField = @@ -835,12 +1234,35 @@ export function deserializeFileFull(val: any): FileFull { val.classification == void 0 ? void 0 : deserializeFileFullClassificationField(val.classification); + if ( + !(val.uploader_display_name == void 0) && + !sdIsString(val.uploader_display_name) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "uploader_display_name" of type "FileFull"', + }); + } const uploaderDisplayName: undefined | string = val.uploader_display_name == void 0 ? void 0 : val.uploader_display_name; + if (!(val.disposition_at == void 0) && !sdIsString(val.disposition_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "disposition_at" of type "FileFull"', + }); + } const dispositionAt: undefined | DateTime = val.disposition_at == void 0 ? void 0 : deserializeDateTime(val.disposition_at); + if ( + !(val.shared_link_permission_options == void 0) && + !sdIsList(val.shared_link_permission_options) + ) { + throw new BoxSdkError({ + message: + 'Expecting array for "shared_link_permission_options" of type "FileFull"', + }); + } const sharedLinkPermissionOptions: | undefined | readonly FileFullSharedLinkPermissionOptionsField[] = @@ -853,25 +1275,71 @@ export function deserializeFileFull(val: any): FileFull { return deserializeFileFullSharedLinkPermissionOptionsField(itm); }) as readonly any[]) : []; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "FileFull"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if (!(val.size == void 0) && !sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "FileFull"', + }); + } const size: undefined | number = val.size == void 0 ? void 0 : val.size; const pathCollection: undefined | FilePathCollectionField = val.path_collection == void 0 ? void 0 : deserializeFilePathCollectionField(val.path_collection); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "FileFull"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "FileFull"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "trashed_at" of type "FileFull"', + }); + } const trashedAt: undefined | DateTime = val.trashed_at == void 0 ? void 0 : deserializeDateTime(val.trashed_at); + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "purged_at" of type "FileFull"', + }); + } const purgedAt: undefined | DateTime = val.purged_at == void 0 ? void 0 : deserializeDateTime(val.purged_at); + if ( + !(val.content_created_at == void 0) && + !sdIsString(val.content_created_at) + ) { + throw new BoxSdkError({ + message: 'Expecting string for "content_created_at" of type "FileFull"', + }); + } const contentCreatedAt: undefined | DateTime = val.content_created_at == void 0 ? void 0 : deserializeDateTime(val.content_created_at); + if ( + !(val.content_modified_at == void 0) && + !sdIsString(val.content_modified_at) + ) { + throw new BoxSdkError({ + message: 'Expecting string for "content_modified_at" of type "FileFull"', + }); + } const contentModifiedAt: undefined | DateTime = val.content_modified_at == void 0 ? void 0 @@ -892,16 +1360,51 @@ export function deserializeFileFull(val: any): FileFull { val.item_status == void 0 ? void 0 : deserializeFileItemStatusField(val.item_status); + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "FileFull"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "FileFull"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.sha1 == void 0) && !sdIsString(val.sha1)) { + throw new BoxSdkError({ + message: 'Expecting string for "sha1" of type "FileFull"', + }); + } const sha1: undefined | string = val.sha1 == void 0 ? void 0 : val.sha1; const fileVersion: undefined | FileVersionMini = val.file_version == void 0 ? void 0 : deserializeFileVersionMini(val.file_version); + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FileFull" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileFull"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "FileFull"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "FileFull" to be defined', + }); + } const type: FileBaseTypeField = deserializeFileBaseTypeField(val.type); return { versionNumber: versionNumber, diff --git a/src/schemas/fileFullOrFolderFullOrWebLink.generated.ts b/src/schemas/fileFullOrFolderFullOrWebLink.generated.ts index 608569f8..7c1e6cbe 100644 --- a/src/schemas/fileFullOrFolderFullOrWebLink.generated.ts +++ b/src/schemas/fileFullOrFolderFullOrWebLink.generated.ts @@ -31,7 +31,7 @@ export function serializeFileFullOrFolderFullOrWebLink( throw new BoxSdkError({ message: 'unknown type' }); } export function deserializeFileFullOrFolderFullOrWebLink( - val: any + val: SerializedData ): FileFullOrFolderFullOrWebLink { if (!sdIsMap(val)) { throw new BoxSdkError({ diff --git a/src/schemas/fileFullOrFolderMiniOrWebLink.generated.ts b/src/schemas/fileFullOrFolderMiniOrWebLink.generated.ts index 8d8db930..2cc6b6d7 100644 --- a/src/schemas/fileFullOrFolderMiniOrWebLink.generated.ts +++ b/src/schemas/fileFullOrFolderMiniOrWebLink.generated.ts @@ -31,7 +31,7 @@ export function serializeFileFullOrFolderMiniOrWebLink( throw new BoxSdkError({ message: 'unknown type' }); } export function deserializeFileFullOrFolderMiniOrWebLink( - val: any + val: SerializedData ): FileFullOrFolderMiniOrWebLink { if (!sdIsMap(val)) { throw new BoxSdkError({ diff --git a/src/schemas/fileMini.generated.ts b/src/schemas/fileMini.generated.ts index 013e3316..c9c27ff7 100644 --- a/src/schemas/fileMini.generated.ts +++ b/src/schemas/fileMini.generated.ts @@ -42,17 +42,55 @@ export function serializeFileMini(val: FileMini): SerializedData { }, }; } -export function deserializeFileMini(val: any): FileMini { +export function deserializeFileMini(val: SerializedData): FileMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FileMini"' }); + } + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "FileMini"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "FileMini"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.sha1 == void 0) && !sdIsString(val.sha1)) { + throw new BoxSdkError({ + message: 'Expecting string for "sha1" of type "FileMini"', + }); + } const sha1: undefined | string = val.sha1 == void 0 ? void 0 : val.sha1; const fileVersion: undefined | FileVersionMini = val.file_version == void 0 ? void 0 : deserializeFileVersionMini(val.file_version); + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FileMini" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileMini"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "FileMini"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "FileMini" to be defined', + }); + } const type: FileBaseTypeField = deserializeFileBaseTypeField(val.type); return { sequenceId: sequenceId, diff --git a/src/schemas/fileMiniOrFolderMini.generated.ts b/src/schemas/fileMiniOrFolderMini.generated.ts index e9eb1d37..9ccfbd50 100644 --- a/src/schemas/fileMiniOrFolderMini.generated.ts +++ b/src/schemas/fileMiniOrFolderMini.generated.ts @@ -23,7 +23,7 @@ export function serializeFileMiniOrFolderMini(val: any): SerializedData { throw new BoxSdkError({ message: 'unknown type' }); } export function deserializeFileMiniOrFolderMini( - val: any + val: SerializedData ): FileMiniOrFolderMini { if (!sdIsMap(val)) { throw new BoxSdkError({ diff --git a/src/schemas/fileOrFolder.generated.ts b/src/schemas/fileOrFolder.generated.ts index e1bde7f3..82b33e69 100644 --- a/src/schemas/fileOrFolder.generated.ts +++ b/src/schemas/fileOrFolder.generated.ts @@ -22,7 +22,7 @@ export function serializeFileOrFolder(val: any): SerializedData { } throw new BoxSdkError({ message: 'unknown type' }); } -export function deserializeFileOrFolder(val: any): FileOrFolder { +export function deserializeFileOrFolder(val: SerializedData): FileOrFolder { if (!sdIsMap(val)) { throw new BoxSdkError({ message: 'Expecting a map for "FileOrFolder"' }); } diff --git a/src/schemas/fileOrFolderOrWebLink.generated.ts b/src/schemas/fileOrFolderOrWebLink.generated.ts index 4ffeec38..3bcc2b6d 100644 --- a/src/schemas/fileOrFolderOrWebLink.generated.ts +++ b/src/schemas/fileOrFolderOrWebLink.generated.ts @@ -29,7 +29,7 @@ export function serializeFileOrFolderOrWebLink(val: any): SerializedData { throw new BoxSdkError({ message: 'unknown type' }); } export function deserializeFileOrFolderOrWebLink( - val: any + val: SerializedData ): FileOrFolderOrWebLink { if (!sdIsMap(val)) { throw new BoxSdkError({ diff --git a/src/schemas/fileOrFolderScope.generated.ts b/src/schemas/fileOrFolderScope.generated.ts index c4e069ec..9a80ff8b 100644 --- a/src/schemas/fileOrFolderScope.generated.ts +++ b/src/schemas/fileOrFolderScope.generated.ts @@ -32,7 +32,7 @@ export function serializeFileOrFolderScopeScopeField( return val; } export function deserializeFileOrFolderScopeScopeField( - val: any + val: SerializedData ): FileOrFolderScopeScopeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -91,7 +91,14 @@ export function serializeFileOrFolderScope( val.object == void 0 ? void 0 : serializeFileMiniOrFolderMini(val.object), }; } -export function deserializeFileOrFolderScope(val: any): FileOrFolderScope { +export function deserializeFileOrFolderScope( + val: SerializedData +): FileOrFolderScope { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileOrFolderScope"', + }); + } const scope: undefined | FileOrFolderScopeScopeField = val.scope == void 0 ? void 0 diff --git a/src/schemas/fileRequest.generated.ts b/src/schemas/fileRequest.generated.ts index 1cec180c..7e4cc959 100644 --- a/src/schemas/fileRequest.generated.ts +++ b/src/schemas/fileRequest.generated.ts @@ -106,7 +106,7 @@ export function serializeFileRequestTypeField( return val; } export function deserializeFileRequestTypeField( - val: any + val: SerializedData ): FileRequestTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -126,7 +126,7 @@ export function serializeFileRequestStatusField( return val; } export function deserializeFileRequestStatusField( - val: any + val: SerializedData ): FileRequestStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -170,32 +170,118 @@ export function serializeFileRequest(val: FileRequest): SerializedData { ['updated_at']: serializeDateTime(val.updatedAt), }; } -export function deserializeFileRequest(val: any): FileRequest { +export function deserializeFileRequest(val: SerializedData): FileRequest { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FileRequest"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FileRequest" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileRequest"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "FileRequest" to be defined', + }); + } const type: FileRequestTypeField = deserializeFileRequestTypeField(val.type); + if (!(val.title == void 0) && !sdIsString(val.title)) { + throw new BoxSdkError({ + message: 'Expecting string for "title" of type "FileRequest"', + }); + } const title: undefined | string = 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 "FileRequest"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; const status: undefined | FileRequestStatusField = val.status == void 0 ? void 0 : deserializeFileRequestStatusField(val.status); + if ( + !(val.is_email_required == void 0) && + !sdIsBoolean(val.is_email_required) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_email_required" of type "FileRequest"', + }); + } const isEmailRequired: undefined | boolean = val.is_email_required == void 0 ? void 0 : val.is_email_required; + if ( + !(val.is_description_required == void 0) && + !sdIsBoolean(val.is_description_required) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_description_required" of type "FileRequest"', + }); + } const isDescriptionRequired: undefined | boolean = val.is_description_required == void 0 ? void 0 : val.is_description_required; + if (!(val.expires_at == void 0) && !sdIsString(val.expires_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "expires_at" of type "FileRequest"', + }); + } const expiresAt: undefined | DateTime = val.expires_at == void 0 ? void 0 : deserializeDateTime(val.expires_at); + if (val.folder == void 0) { + throw new BoxSdkError({ + message: 'Expecting "folder" of type "FileRequest" to be defined', + }); + } const folder: FolderMini = deserializeFolderMini(val.folder); + if (!(val.url == void 0) && !sdIsString(val.url)) { + throw new BoxSdkError({ + message: 'Expecting string for "url" of type "FileRequest"', + }); + } const url: undefined | string = val.url == void 0 ? void 0 : val.url; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "FileRequest"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; const createdBy: undefined | UserMini = val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); + if (val.created_at == void 0) { + throw new BoxSdkError({ + message: 'Expecting "created_at" of type "FileRequest" to be defined', + }); + } + if (!sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "FileRequest"', + }); + } const createdAt: DateTime = deserializeDateTime(val.created_at); const updatedBy: undefined | UserMini = val.updated_by == void 0 ? void 0 : deserializeUserMini(val.updated_by); + if (val.updated_at == void 0) { + throw new BoxSdkError({ + message: 'Expecting "updated_at" of type "FileRequest" to be defined', + }); + } + if (!sdIsString(val.updated_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "updated_at" of type "FileRequest"', + }); + } const updatedAt: DateTime = deserializeDateTime(val.updated_at); return { id: id, @@ -245,33 +331,120 @@ export function serializeFileRequestInput( ['updated_at']: serializeDateTime(val.updatedAt), }; } -export function deserializeFileRequestInput(val: any): FileRequestInput { +export function deserializeFileRequestInput( + val: SerializedData +): FileRequestInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileRequestInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FileRequestInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileRequestInput"', + }); + } const id: string = val.id; const type: undefined | FileRequestTypeField = val.type == void 0 ? void 0 : deserializeFileRequestTypeField(val.type); + if (!(val.title == void 0) && !sdIsString(val.title)) { + throw new BoxSdkError({ + message: 'Expecting string for "title" of type "FileRequestInput"', + }); + } const title: undefined | string = 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 "FileRequestInput"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; const status: undefined | FileRequestStatusField = val.status == void 0 ? void 0 : deserializeFileRequestStatusField(val.status); + if ( + !(val.is_email_required == void 0) && + !sdIsBoolean(val.is_email_required) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_email_required" of type "FileRequestInput"', + }); + } const isEmailRequired: undefined | boolean = val.is_email_required == void 0 ? void 0 : val.is_email_required; + if ( + !(val.is_description_required == void 0) && + !sdIsBoolean(val.is_description_required) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_description_required" of type "FileRequestInput"', + }); + } const isDescriptionRequired: undefined | boolean = val.is_description_required == void 0 ? void 0 : val.is_description_required; + if (!(val.expires_at == void 0) && !sdIsString(val.expires_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "expires_at" of type "FileRequestInput"', + }); + } const expiresAt: undefined | DateTime = val.expires_at == void 0 ? void 0 : deserializeDateTime(val.expires_at); + if (val.folder == void 0) { + throw new BoxSdkError({ + message: 'Expecting "folder" of type "FileRequestInput" to be defined', + }); + } const folder: FolderMini = deserializeFolderMini(val.folder); + if (!(val.url == void 0) && !sdIsString(val.url)) { + throw new BoxSdkError({ + message: 'Expecting string for "url" of type "FileRequestInput"', + }); + } const url: undefined | string = val.url == void 0 ? void 0 : val.url; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "FileRequestInput"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; const createdBy: undefined | UserMini = val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); + if (val.created_at == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "created_at" of type "FileRequestInput" to be defined', + }); + } + if (!sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "FileRequestInput"', + }); + } const createdAt: DateTime = deserializeDateTime(val.created_at); const updatedBy: undefined | UserMini = val.updated_by == void 0 ? void 0 : deserializeUserMini(val.updated_by); + if (val.updated_at == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "updated_at" of type "FileRequestInput" to be defined', + }); + } + if (!sdIsString(val.updated_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "updated_at" of type "FileRequestInput"', + }); + } const updatedAt: DateTime = deserializeDateTime(val.updated_at); return { id: id, diff --git a/src/schemas/fileRequestCopyRequest.generated.ts b/src/schemas/fileRequestCopyRequest.generated.ts index 4756be15..2c449d2e 100644 --- a/src/schemas/fileRequestCopyRequest.generated.ts +++ b/src/schemas/fileRequestCopyRequest.generated.ts @@ -29,7 +29,7 @@ export function serializeFileRequestCopyRequestFolderTypeField( return val; } export function deserializeFileRequestCopyRequestFolderTypeField( - val: any + val: SerializedData ): FileRequestCopyRequestFolderTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -55,12 +55,29 @@ export function serializeFileRequestCopyRequestFolderField( }; } export function deserializeFileRequestCopyRequestFolderField( - val: any + val: SerializedData ): FileRequestCopyRequestFolderField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileRequestCopyRequestFolderField"', + }); + } const type: undefined | FileRequestCopyRequestFolderTypeField = val.type == void 0 ? void 0 : deserializeFileRequestCopyRequestFolderTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "FileRequestCopyRequestFolderField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "FileRequestCopyRequestFolderField"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies FileRequestCopyRequestFolderField; } @@ -79,23 +96,69 @@ export function serializeFileRequestCopyRequest( }; } export function deserializeFileRequestCopyRequest( - val: any + val: SerializedData ): FileRequestCopyRequest { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileRequestCopyRequest"', + }); + } + if (val.folder == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "folder" of type "FileRequestCopyRequest" to be defined', + }); + } const folder: FileRequestCopyRequestFolderField = deserializeFileRequestCopyRequestFolderField(val.folder); + if (!(val.title == void 0) && !sdIsString(val.title)) { + throw new BoxSdkError({ + message: 'Expecting string for "title" of type "FileRequestCopyRequest"', + }); + } const title: undefined | string = 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 "FileRequestCopyRequest"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; const status: undefined | FileRequestUpdateRequestStatusField = val.status == void 0 ? void 0 : deserializeFileRequestUpdateRequestStatusField(val.status); + if ( + !(val.is_email_required == void 0) && + !sdIsBoolean(val.is_email_required) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_email_required" of type "FileRequestCopyRequest"', + }); + } const isEmailRequired: undefined | boolean = val.is_email_required == void 0 ? void 0 : val.is_email_required; + if ( + !(val.is_description_required == void 0) && + !sdIsBoolean(val.is_description_required) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_description_required" of type "FileRequestCopyRequest"', + }); + } const isDescriptionRequired: undefined | boolean = val.is_description_required == void 0 ? void 0 : val.is_description_required; + if (!(val.expires_at == void 0) && !sdIsString(val.expires_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "expires_at" of type "FileRequestCopyRequest"', + }); + } const expiresAt: undefined | DateTime = val.expires_at == void 0 ? void 0 : deserializeDateTime(val.expires_at); return { diff --git a/src/schemas/fileRequestUpdateRequest.generated.ts b/src/schemas/fileRequestUpdateRequest.generated.ts index 6bb4ec65..dff7e871 100644 --- a/src/schemas/fileRequestUpdateRequest.generated.ts +++ b/src/schemas/fileRequestUpdateRequest.generated.ts @@ -24,7 +24,7 @@ export function serializeFileRequestUpdateRequestStatusField( return val; } export function deserializeFileRequestUpdateRequestStatusField( - val: any + val: SerializedData ): FileRequestUpdateRequestStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -60,21 +60,62 @@ export function serializeFileRequestUpdateRequest( }; } export function deserializeFileRequestUpdateRequest( - val: any + val: SerializedData ): FileRequestUpdateRequest { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileRequestUpdateRequest"', + }); + } + if (!(val.title == void 0) && !sdIsString(val.title)) { + throw new BoxSdkError({ + message: + 'Expecting string for "title" of type "FileRequestUpdateRequest"', + }); + } const title: undefined | string = 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 "FileRequestUpdateRequest"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; const status: undefined | FileRequestUpdateRequestStatusField = val.status == void 0 ? void 0 : deserializeFileRequestUpdateRequestStatusField(val.status); + if ( + !(val.is_email_required == void 0) && + !sdIsBoolean(val.is_email_required) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_email_required" of type "FileRequestUpdateRequest"', + }); + } const isEmailRequired: undefined | boolean = val.is_email_required == void 0 ? void 0 : val.is_email_required; + if ( + !(val.is_description_required == void 0) && + !sdIsBoolean(val.is_description_required) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_description_required" of type "FileRequestUpdateRequest"', + }); + } const isDescriptionRequired: undefined | boolean = val.is_description_required == void 0 ? void 0 : val.is_description_required; + if (!(val.expires_at == void 0) && !sdIsString(val.expires_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "expires_at" of type "FileRequestUpdateRequest"', + }); + } const expiresAt: undefined | DateTime = val.expires_at == void 0 ? void 0 : deserializeDateTime(val.expires_at); return { diff --git a/src/schemas/fileVersion.generated.ts b/src/schemas/fileVersion.generated.ts index 87a1a85a..613109bf 100644 --- a/src/schemas/fileVersion.generated.ts +++ b/src/schemas/fileVersion.generated.ts @@ -68,29 +68,96 @@ export function serializeFileVersion(val: FileVersion): SerializedData { }, }; } -export function deserializeFileVersion(val: any): FileVersion { +export function deserializeFileVersion(val: SerializedData): FileVersion { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FileVersion"' }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "FileVersion"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.size == void 0) && !sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "FileVersion"', + }); + } const size: undefined | number = val.size == void 0 ? void 0 : val.size; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "FileVersion"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "FileVersion"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); const modifiedBy: undefined | UserMini = val.modified_by == void 0 ? void 0 : deserializeUserMini(val.modified_by); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "trashed_at" of type "FileVersion"', + }); + } const trashedAt: undefined | DateTime = val.trashed_at == void 0 ? void 0 : deserializeDateTime(val.trashed_at); const trashedBy: undefined | UserMini = val.trashed_by == void 0 ? void 0 : deserializeUserMini(val.trashed_by); + if (!(val.restored_at == void 0) && !sdIsString(val.restored_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "restored_at" of type "FileVersion"', + }); + } const restoredAt: undefined | DateTime = val.restored_at == void 0 ? void 0 : deserializeDateTime(val.restored_at); const restoredBy: undefined | UserMini = val.restored_by == void 0 ? void 0 : deserializeUserMini(val.restored_by); + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "purged_at" of type "FileVersion"', + }); + } const purgedAt: undefined | DateTime = val.purged_at == void 0 ? void 0 : deserializeDateTime(val.purged_at); + if ( + !(val.uploader_display_name == void 0) && + !sdIsString(val.uploader_display_name) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "uploader_display_name" of type "FileVersion"', + }); + } const uploaderDisplayName: undefined | string = val.uploader_display_name == void 0 ? void 0 : val.uploader_display_name; + if (!(val.sha1 == void 0) && !sdIsString(val.sha1)) { + throw new BoxSdkError({ + message: 'Expecting string for "sha1" of type "FileVersion"', + }); + } const sha1: undefined | string = val.sha1 == void 0 ? void 0 : val.sha1; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FileVersion" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileVersion"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "FileVersion" to be defined', + }); + } const type: FileVersionBaseTypeField = deserializeFileVersionBaseTypeField( val.type ); diff --git a/src/schemas/fileVersionBase.generated.ts b/src/schemas/fileVersionBase.generated.ts index fe4da0bd..8d799b3d 100644 --- a/src/schemas/fileVersionBase.generated.ts +++ b/src/schemas/fileVersionBase.generated.ts @@ -33,7 +33,7 @@ export function serializeFileVersionBaseTypeField( return val; } export function deserializeFileVersionBaseTypeField( - val: any + val: SerializedData ): FileVersionBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -53,8 +53,28 @@ export function serializeFileVersionBase(val: FileVersionBase): SerializedData { ['type']: serializeFileVersionBaseTypeField(val.type), }; } -export function deserializeFileVersionBase(val: any): FileVersionBase { +export function deserializeFileVersionBase( + val: SerializedData +): FileVersionBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FileVersionBase"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FileVersionBase" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileVersionBase"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "FileVersionBase" to be defined', + }); + } const type: FileVersionBaseTypeField = deserializeFileVersionBaseTypeField( val.type ); @@ -70,8 +90,23 @@ export function serializeFileVersionBaseInput( }; } export function deserializeFileVersionBaseInput( - val: any + val: SerializedData ): FileVersionBaseInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileVersionBaseInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FileVersionBaseInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileVersionBaseInput"', + }); + } const id: string = val.id; const type: undefined | FileVersionBaseTypeField = val.type == void 0 ? void 0 : deserializeFileVersionBaseTypeField(val.type); diff --git a/src/schemas/fileVersionFull.generated.ts b/src/schemas/fileVersionFull.generated.ts index 5aa09cf0..f14c2d84 100644 --- a/src/schemas/fileVersionFull.generated.ts +++ b/src/schemas/fileVersionFull.generated.ts @@ -43,31 +43,106 @@ export function serializeFileVersionFull(val: FileVersionFull): SerializedData { }, }; } -export function deserializeFileVersionFull(val: any): FileVersionFull { +export function deserializeFileVersionFull( + val: SerializedData +): FileVersionFull { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FileVersionFull"' }); + } + if (!(val.version_number == void 0) && !sdIsString(val.version_number)) { + throw new BoxSdkError({ + message: + 'Expecting string for "version_number" of type "FileVersionFull"', + }); + } const versionNumber: undefined | string = val.version_number == void 0 ? void 0 : val.version_number; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "FileVersionFull"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.size == void 0) && !sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "FileVersionFull"', + }); + } const size: undefined | number = val.size == void 0 ? void 0 : val.size; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "FileVersionFull"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "FileVersionFull"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); const modifiedBy: undefined | UserMini = val.modified_by == void 0 ? void 0 : deserializeUserMini(val.modified_by); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "trashed_at" of type "FileVersionFull"', + }); + } const trashedAt: undefined | DateTime = val.trashed_at == void 0 ? void 0 : deserializeDateTime(val.trashed_at); const trashedBy: undefined | UserMini = val.trashed_by == void 0 ? void 0 : deserializeUserMini(val.trashed_by); + if (!(val.restored_at == void 0) && !sdIsString(val.restored_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "restored_at" of type "FileVersionFull"', + }); + } const restoredAt: undefined | DateTime = val.restored_at == void 0 ? void 0 : deserializeDateTime(val.restored_at); const restoredBy: undefined | UserMini = val.restored_by == void 0 ? void 0 : deserializeUserMini(val.restored_by); + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "purged_at" of type "FileVersionFull"', + }); + } const purgedAt: undefined | DateTime = val.purged_at == void 0 ? void 0 : deserializeDateTime(val.purged_at); + if ( + !(val.uploader_display_name == void 0) && + !sdIsString(val.uploader_display_name) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "uploader_display_name" of type "FileVersionFull"', + }); + } const uploaderDisplayName: undefined | string = val.uploader_display_name == void 0 ? void 0 : val.uploader_display_name; + if (!(val.sha1 == void 0) && !sdIsString(val.sha1)) { + throw new BoxSdkError({ + message: 'Expecting string for "sha1" of type "FileVersionFull"', + }); + } const sha1: undefined | string = val.sha1 == void 0 ? void 0 : val.sha1; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FileVersionFull" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileVersionFull"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "FileVersionFull" to be defined', + }); + } const type: FileVersionBaseTypeField = deserializeFileVersionBaseTypeField( val.type ); diff --git a/src/schemas/fileVersionLegalHold.generated.ts b/src/schemas/fileVersionLegalHold.generated.ts index 9ca14533..e7383c84 100644 --- a/src/schemas/fileVersionLegalHold.generated.ts +++ b/src/schemas/fileVersionLegalHold.generated.ts @@ -33,7 +33,7 @@ export function serializeFileVersionLegalHoldTypeField( return val; } export function deserializeFileVersionLegalHoldTypeField( - val: any + val: SerializedData ): FileVersionLegalHoldTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -74,8 +74,18 @@ export function serializeFileVersionLegalHold( }; } export function deserializeFileVersionLegalHold( - val: any + val: SerializedData ): FileVersionLegalHold { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileVersionLegalHold"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileVersionLegalHold"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | FileVersionLegalHoldTypeField = val.type == void 0 @@ -87,6 +97,15 @@ export function deserializeFileVersionLegalHold( : deserializeFileVersionMini(val.file_version); const file: undefined | FileMini = val.file == void 0 ? void 0 : deserializeFileMini(val.file); + if ( + !(val.legal_hold_policy_assignments == void 0) && + !sdIsList(val.legal_hold_policy_assignments) + ) { + throw new BoxSdkError({ + message: + 'Expecting array for "legal_hold_policy_assignments" of type "FileVersionLegalHold"', + }); + } const legalHoldPolicyAssignments: | undefined | readonly LegalHoldPolicyAssignment[] = @@ -99,6 +118,12 @@ export function deserializeFileVersionLegalHold( return deserializeLegalHoldPolicyAssignment(itm); }) as readonly any[]) : []; + if (!(val.deleted_at == void 0) && !sdIsString(val.deleted_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "deleted_at" of type "FileVersionLegalHold"', + }); + } const deletedAt: undefined | DateTime = val.deleted_at == void 0 ? void 0 : deserializeDateTime(val.deleted_at); return { diff --git a/src/schemas/fileVersionLegalHolds.generated.ts b/src/schemas/fileVersionLegalHolds.generated.ts index 9c3a921e..01047d16 100644 --- a/src/schemas/fileVersionLegalHolds.generated.ts +++ b/src/schemas/fileVersionLegalHolds.generated.ts @@ -1,6 +1,7 @@ import { serializeFileVersionLegalHold } from './fileVersionLegalHold.generated.js'; import { deserializeFileVersionLegalHold } from './fileVersionLegalHold.generated.js'; import { FileVersionLegalHold } from './fileVersionLegalHold.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -32,13 +33,40 @@ export function serializeFileVersionLegalHolds( }; } export function deserializeFileVersionLegalHolds( - val: any + val: SerializedData ): FileVersionLegalHolds { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileVersionLegalHolds"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "FileVersionLegalHolds"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "FileVersionLegalHolds"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "prev_marker" of type "FileVersionLegalHolds"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "FileVersionLegalHolds"', + }); + } const entries: undefined | readonly FileVersionLegalHold[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/fileVersionMini.generated.ts b/src/schemas/fileVersionMini.generated.ts index 19a00c8e..f3459edb 100644 --- a/src/schemas/fileVersionMini.generated.ts +++ b/src/schemas/fileVersionMini.generated.ts @@ -25,9 +25,34 @@ export function serializeFileVersionMini(val: FileVersionMini): SerializedData { } return { ...base, ...{ ['sha1']: val.sha1 == void 0 ? void 0 : val.sha1 } }; } -export function deserializeFileVersionMini(val: any): FileVersionMini { +export function deserializeFileVersionMini( + val: SerializedData +): FileVersionMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FileVersionMini"' }); + } + if (!(val.sha1 == void 0) && !sdIsString(val.sha1)) { + throw new BoxSdkError({ + message: 'Expecting string for "sha1" of type "FileVersionMini"', + }); + } const sha1: undefined | string = val.sha1 == void 0 ? void 0 : val.sha1; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FileVersionMini" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileVersionMini"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "FileVersionMini" to be defined', + }); + } const type: FileVersionBaseTypeField = deserializeFileVersionBaseTypeField( val.type ); diff --git a/src/schemas/fileVersionRetention.generated.ts b/src/schemas/fileVersionRetention.generated.ts index d7293864..b4dd3e30 100644 --- a/src/schemas/fileVersionRetention.generated.ts +++ b/src/schemas/fileVersionRetention.generated.ts @@ -34,7 +34,7 @@ export function serializeFileVersionRetentionTypeField( return val; } export function deserializeFileVersionRetentionTypeField( - val: any + val: SerializedData ): FileVersionRetentionTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -75,8 +75,18 @@ export function serializeFileVersionRetention( }; } export function deserializeFileVersionRetention( - val: any + val: SerializedData ): FileVersionRetention { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileVersionRetention"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileVersionRetention"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | FileVersionRetentionTypeField = val.type == void 0 @@ -88,8 +98,20 @@ export function deserializeFileVersionRetention( : deserializeFileVersionMini(val.file_version); const file: undefined | FileMini = val.file == void 0 ? void 0 : deserializeFileMini(val.file); + if (!(val.applied_at == void 0) && !sdIsString(val.applied_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "applied_at" of type "FileVersionRetention"', + }); + } const appliedAt: undefined | DateTime = val.applied_at == void 0 ? void 0 : deserializeDateTime(val.applied_at); + if (!(val.disposition_at == void 0) && !sdIsString(val.disposition_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "disposition_at" of type "FileVersionRetention"', + }); + } const dispositionAt: undefined | DateTime = val.disposition_at == void 0 ? void 0 diff --git a/src/schemas/fileVersionRetentions.generated.ts b/src/schemas/fileVersionRetentions.generated.ts index 0538ea6d..9d9f0c32 100644 --- a/src/schemas/fileVersionRetentions.generated.ts +++ b/src/schemas/fileVersionRetentions.generated.ts @@ -1,6 +1,7 @@ import { serializeFileVersionRetention } from './fileVersionRetention.generated.js'; import { deserializeFileVersionRetention } from './fileVersionRetention.generated.js'; import { FileVersionRetention } from './fileVersionRetention.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -32,13 +33,40 @@ export function serializeFileVersionRetentions( }; } export function deserializeFileVersionRetentions( - val: any + val: SerializedData ): FileVersionRetentions { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileVersionRetentions"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "FileVersionRetentions"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "FileVersionRetentions"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "prev_marker" of type "FileVersionRetentions"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "FileVersionRetentions"', + }); + } const entries: undefined | readonly FileVersionRetention[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/fileVersions.generated.ts b/src/schemas/fileVersions.generated.ts index c7d268fe..5c7dc850 100644 --- a/src/schemas/fileVersions.generated.ts +++ b/src/schemas/fileVersions.generated.ts @@ -27,7 +27,7 @@ export function serializeFileVersionsOrderDirectionField( return val; } export function deserializeFileVersionsOrderDirectionField( - val: any + val: SerializedData ): FileVersionsOrderDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -56,8 +56,18 @@ export function serializeFileVersionsOrderField( }; } export function deserializeFileVersionsOrderField( - val: any + val: SerializedData ): FileVersionsOrderField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileVersionsOrderField"', + }); + } + if (!(val.by == void 0) && !sdIsString(val.by)) { + throw new BoxSdkError({ + message: 'Expecting string for "by" of type "FileVersionsOrderField"', + }); + } const by: undefined | string = val.by == void 0 ? void 0 : val.by; const direction: undefined | FileVersionsOrderDirectionField = val.direction == void 0 @@ -86,11 +96,34 @@ export function serializeFileVersions(val: FileVersions): SerializedData { }) as readonly any[]), }; } -export function deserializeFileVersions(val: any): FileVersions { +export function deserializeFileVersions(val: SerializedData): FileVersions { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FileVersions"' }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "FileVersions"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "FileVersions"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: 'Expecting number for "offset" of type "FileVersions"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; + if (!(val.order == void 0) && !sdIsList(val.order)) { + throw new BoxSdkError({ + message: 'Expecting array for "order" of type "FileVersions"', + }); + } const order: undefined | readonly FileVersionsOrderField[] = val.order == void 0 ? void 0 @@ -99,6 +132,11 @@ export function deserializeFileVersions(val: any): FileVersions { return deserializeFileVersionsOrderField(itm); }) as readonly any[]) : []; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "FileVersions"', + }); + } const entries: undefined | readonly FileVersionFull[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/files.generated.ts b/src/schemas/files.generated.ts index 07eb367c..b436aa10 100644 --- a/src/schemas/files.generated.ts +++ b/src/schemas/files.generated.ts @@ -1,6 +1,7 @@ import { serializeFileFull } from './fileFull.generated.js'; import { deserializeFileFull } from './fileFull.generated.js'; import { FileFull } from './fileFull.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -23,9 +24,22 @@ export function serializeFiles(val: Files): SerializedData { }) as readonly any[]), }; } -export function deserializeFiles(val: any): Files { +export function deserializeFiles(val: SerializedData): Files { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Files"' }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "Files"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "Files"', + }); + } const entries: undefined | readonly FileFull[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/filesUnderRetention.generated.ts b/src/schemas/filesUnderRetention.generated.ts index 8e2bf691..a5811fef 100644 --- a/src/schemas/filesUnderRetention.generated.ts +++ b/src/schemas/filesUnderRetention.generated.ts @@ -1,6 +1,7 @@ import { serializeFileMini } from './fileMini.generated.js'; import { deserializeFileMini } from './fileMini.generated.js'; import { FileMini } from './fileMini.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -29,12 +30,41 @@ export function serializeFilesUnderRetention( }) as readonly any[]), }; } -export function deserializeFilesUnderRetention(val: any): FilesUnderRetention { +export function deserializeFilesUnderRetention( + val: SerializedData +): FilesUnderRetention { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FilesUnderRetention"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "FilesUnderRetention"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "FilesUnderRetention"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "prev_marker" of type "FilesUnderRetention"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "FilesUnderRetention"', + }); + } const entries: undefined | readonly FileMini[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/folder.generated.ts b/src/schemas/folder.generated.ts index f20a0e99..92a8195f 100644 --- a/src/schemas/folder.generated.ts +++ b/src/schemas/folder.generated.ts @@ -96,9 +96,38 @@ export function serializeFolderPathCollectionField( }; } export function deserializeFolderPathCollectionField( - val: any + val: SerializedData ): FolderPathCollectionField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FolderPathCollectionField"', + }); + } + if (val.total_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "total_count" of type "FolderPathCollectionField" to be defined', + }); + } + if (!sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "total_count" of type "FolderPathCollectionField"', + }); + } const totalCount: number = val.total_count; + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "FolderPathCollectionField" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "FolderPathCollectionField"', + }); + } const entries: readonly FolderMini[] = sdIsList(val.entries) ? (val.entries.map(function (itm: SerializedData): FolderMini { return deserializeFolderMini(itm); @@ -115,7 +144,7 @@ export function serializeFolderSharedLinkAccessField( return val; } export function deserializeFolderSharedLinkAccessField( - val: any + val: SerializedData ): FolderSharedLinkAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -141,7 +170,7 @@ export function serializeFolderSharedLinkEffectiveAccessField( return val; } export function deserializeFolderSharedLinkEffectiveAccessField( - val: any + val: SerializedData ): FolderSharedLinkEffectiveAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -167,7 +196,7 @@ export function serializeFolderSharedLinkEffectivePermissionField( return val; } export function deserializeFolderSharedLinkEffectivePermissionField( - val: any + val: SerializedData ): FolderSharedLinkEffectivePermissionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -201,10 +230,51 @@ export function serializeFolderSharedLinkPermissionsField( }; } export function deserializeFolderSharedLinkPermissionsField( - val: any + val: SerializedData ): FolderSharedLinkPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FolderSharedLinkPermissionsField"', + }); + } + if (val.can_download == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_download" of type "FolderSharedLinkPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_download)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_download" of type "FolderSharedLinkPermissionsField"', + }); + } const canDownload: boolean = val.can_download; + if (val.can_preview == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_preview" of type "FolderSharedLinkPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_preview)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_preview" of type "FolderSharedLinkPermissionsField"', + }); + } const canPreview: boolean = val.can_preview; + if (val.can_edit == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_edit" of type "FolderSharedLinkPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_edit)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_edit" of type "FolderSharedLinkPermissionsField"', + }); + } const canEdit: boolean = val.can_edit; return { canDownload: canDownload, @@ -242,33 +312,120 @@ export function serializeFolderSharedLinkField( }; } export function deserializeFolderSharedLinkField( - val: any + val: SerializedData ): FolderSharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FolderSharedLinkField"', + }); + } + if (val.url == void 0) { + throw new BoxSdkError({ + message: 'Expecting "url" of type "FolderSharedLinkField" to be defined', + }); + } + if (!sdIsString(val.url)) { + throw new BoxSdkError({ + message: 'Expecting string for "url" of type "FolderSharedLinkField"', + }); + } const url: string = val.url; + if (!(val.download_url == void 0) && !sdIsString(val.download_url)) { + throw new BoxSdkError({ + message: + 'Expecting string for "download_url" of type "FolderSharedLinkField"', + }); + } const downloadUrl: undefined | string = val.download_url == void 0 ? void 0 : val.download_url; + if (!(val.vanity_url == void 0) && !sdIsString(val.vanity_url)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_url" of type "FolderSharedLinkField"', + }); + } const vanityUrl: undefined | string = val.vanity_url == void 0 ? void 0 : val.vanity_url; + if (!(val.vanity_name == void 0) && !sdIsString(val.vanity_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_name" of type "FolderSharedLinkField"', + }); + } const vanityName: undefined | string = val.vanity_name == void 0 ? void 0 : val.vanity_name; const access: undefined | FolderSharedLinkAccessField = val.access == void 0 ? void 0 : deserializeFolderSharedLinkAccessField(val.access); + if (val.effective_access == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "effective_access" of type "FolderSharedLinkField" to be defined', + }); + } const effectiveAccess: FolderSharedLinkEffectiveAccessField = deserializeFolderSharedLinkEffectiveAccessField(val.effective_access); + if (val.effective_permission == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "effective_permission" of type "FolderSharedLinkField" to be defined', + }); + } const effectivePermission: FolderSharedLinkEffectivePermissionField = deserializeFolderSharedLinkEffectivePermissionField( val.effective_permission ); + if (!(val.unshared_at == void 0) && !sdIsString(val.unshared_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "unshared_at" of type "FolderSharedLinkField"', + }); + } const unsharedAt: undefined | DateTime = val.unshared_at == void 0 ? void 0 : deserializeDateTime(val.unshared_at); + if (val.is_password_enabled == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "is_password_enabled" of type "FolderSharedLinkField" to be defined', + }); + } + if (!sdIsBoolean(val.is_password_enabled)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_password_enabled" of type "FolderSharedLinkField"', + }); + } const isPasswordEnabled: boolean = val.is_password_enabled; const permissions: undefined | FolderSharedLinkPermissionsField = val.permissions == void 0 ? void 0 : deserializeFolderSharedLinkPermissionsField(val.permissions); + if (val.download_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "download_count" of type "FolderSharedLinkField" to be defined', + }); + } + if (!sdIsNumber(val.download_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "download_count" of type "FolderSharedLinkField"', + }); + } const downloadCount: number = val.download_count; + if (val.preview_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "preview_count" of type "FolderSharedLinkField" to be defined', + }); + } + if (!sdIsNumber(val.preview_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "preview_count" of type "FolderSharedLinkField"', + }); + } const previewCount: number = val.preview_count; return { url: url, @@ -291,7 +448,7 @@ export function serializeFolderFolderUploadEmailAccessField( return val; } export function deserializeFolderFolderUploadEmailAccessField( - val: any + val: SerializedData ): FolderFolderUploadEmailAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -320,12 +477,23 @@ export function serializeFolderFolderUploadEmailField( }; } export function deserializeFolderFolderUploadEmailField( - val: any + val: SerializedData ): FolderFolderUploadEmailField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FolderFolderUploadEmailField"', + }); + } const access: undefined | FolderFolderUploadEmailAccessField = val.access == void 0 ? void 0 : deserializeFolderFolderUploadEmailAccessField(val.access); + if (!(val.email == void 0) && !sdIsString(val.email)) { + throw new BoxSdkError({ + message: + 'Expecting string for "email" of type "FolderFolderUploadEmailField"', + }); + } const email: undefined | string = val.email == void 0 ? void 0 : val.email; return { access: access, @@ -338,7 +506,7 @@ export function serializeFolderItemStatusField( return val; } export function deserializeFolderItemStatusField( - val: any + val: SerializedData ): FolderItemStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -415,13 +583,36 @@ export function serializeFolder(val: Folder): SerializedData { }, }; } -export function deserializeFolder(val: any): Folder { +export function deserializeFolder(val: SerializedData): Folder { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Folder"' }); + } + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "Folder"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "Folder"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "Folder"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if (!(val.size == void 0) && !sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "Folder"', + }); + } const size: undefined | number = val.size == void 0 ? void 0 : val.size; const pathCollection: undefined | FolderPathCollectionField = val.path_collection == void 0 @@ -431,14 +622,40 @@ export function deserializeFolder(val: any): Folder { val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); const modifiedBy: undefined | UserMini = val.modified_by == void 0 ? void 0 : deserializeUserMini(val.modified_by); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "trashed_at" of type "Folder"', + }); + } const trashedAt: undefined | DateTime = val.trashed_at == void 0 ? void 0 : deserializeDateTime(val.trashed_at); + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "purged_at" of type "Folder"', + }); + } const purgedAt: undefined | DateTime = val.purged_at == void 0 ? void 0 : deserializeDateTime(val.purged_at); + if ( + !(val.content_created_at == void 0) && + !sdIsString(val.content_created_at) + ) { + throw new BoxSdkError({ + message: 'Expecting string for "content_created_at" of type "Folder"', + }); + } const contentCreatedAt: undefined | DateTime = val.content_created_at == void 0 ? void 0 : deserializeDateTime(val.content_created_at); + if ( + !(val.content_modified_at == void 0) && + !sdIsString(val.content_modified_at) + ) { + throw new BoxSdkError({ + message: 'Expecting string for "content_modified_at" of type "Folder"', + }); + } const contentModifiedAt: undefined | DateTime = val.content_modified_at == void 0 ? void 0 @@ -463,11 +680,41 @@ export function deserializeFolder(val: any): Folder { val.item_collection == void 0 ? void 0 : deserializeItems(val.item_collection); + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "Folder"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "Folder"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "Folder" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "Folder"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "Folder"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "Folder" to be defined', + }); + } const type: FolderBaseTypeField = deserializeFolderBaseTypeField(val.type); return { createdAt: createdAt, diff --git a/src/schemas/folderBase.generated.ts b/src/schemas/folderBase.generated.ts index 644ccac3..d0de8ab1 100644 --- a/src/schemas/folderBase.generated.ts +++ b/src/schemas/folderBase.generated.ts @@ -35,7 +35,9 @@ export function serializeFolderBaseTypeField( ): SerializedData { return val; } -export function deserializeFolderBaseTypeField(val: any): FolderBaseTypeField { +export function deserializeFolderBaseTypeField( + val: SerializedData +): FolderBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "FolderBaseTypeField"', @@ -55,9 +57,32 @@ export function serializeFolderBase(val: FolderBase): SerializedData { ['type']: serializeFolderBaseTypeField(val.type), }; } -export function deserializeFolderBase(val: any): FolderBase { +export function deserializeFolderBase(val: SerializedData): FolderBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FolderBase"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FolderBase" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FolderBase"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "FolderBase"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "FolderBase" to be defined', + }); + } const type: FolderBaseTypeField = deserializeFolderBaseTypeField(val.type); return { id: id, etag: etag, type: type } satisfies FolderBase; } @@ -69,8 +94,28 @@ export function serializeFolderBaseInput(val: FolderBaseInput): SerializedData { val.type == void 0 ? void 0 : serializeFolderBaseTypeField(val.type), }; } -export function deserializeFolderBaseInput(val: any): FolderBaseInput { +export function deserializeFolderBaseInput( + val: SerializedData +): FolderBaseInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FolderBaseInput"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FolderBaseInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FolderBaseInput"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "FolderBaseInput"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; const type: undefined | FolderBaseTypeField = val.type == void 0 ? void 0 : deserializeFolderBaseTypeField(val.type); diff --git a/src/schemas/folderFull.generated.ts b/src/schemas/folderFull.generated.ts index 3ef32a72..b5814f44 100644 --- a/src/schemas/folderFull.generated.ts +++ b/src/schemas/folderFull.generated.ts @@ -107,7 +107,7 @@ export function serializeFolderFullSyncStateField( return val; } export function deserializeFolderFullSyncStateField( - val: any + val: SerializedData ): FolderFullSyncStateField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -141,14 +141,97 @@ export function serializeFolderFullPermissionsField( }; } export function deserializeFolderFullPermissionsField( - val: any + val: SerializedData ): FolderFullPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FolderFullPermissionsField"', + }); + } + if (val.can_delete == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_delete" of type "FolderFullPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_delete)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_delete" of type "FolderFullPermissionsField"', + }); + } const canDelete: boolean = val.can_delete; + if (val.can_download == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_download" of type "FolderFullPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_download)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_download" of type "FolderFullPermissionsField"', + }); + } const canDownload: boolean = val.can_download; + if (val.can_invite_collaborator == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_invite_collaborator" of type "FolderFullPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_invite_collaborator)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_invite_collaborator" of type "FolderFullPermissionsField"', + }); + } const canInviteCollaborator: boolean = val.can_invite_collaborator; + if (val.can_rename == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_rename" of type "FolderFullPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_rename)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_rename" of type "FolderFullPermissionsField"', + }); + } const canRename: boolean = val.can_rename; + if (val.can_set_share_access == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_set_share_access" of type "FolderFullPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_set_share_access)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_set_share_access" of type "FolderFullPermissionsField"', + }); + } const canSetShareAccess: boolean = val.can_set_share_access; + if (val.can_share == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_share" of type "FolderFullPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_share)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_share" of type "FolderFullPermissionsField"', + }); + } const canShare: boolean = val.can_share; + if (!(val.can_upload == void 0) && !sdIsBoolean(val.can_upload)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_upload" of type "FolderFullPermissionsField"', + }); + } const canUpload: undefined | boolean = val.can_upload == void 0 ? void 0 : val.can_upload; return { @@ -167,15 +250,49 @@ export function serializeFolderFullMetadataField( return { ...{}, ...val.extraData }; } export function deserializeFolderFullMetadataField( - val: any + val: SerializedData ): FolderFullMetadataField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FolderFullMetadataField"', + }); + } + if (!(val == void 0) && !sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting object for "extraData" of type "FolderFullMetadataField"', + }); + } const extraData: | undefined | { readonly [key: string]: { readonly [key: string]: Metadata; }; - } = val == void 0 ? void 0 : val; + } = + val == void 0 + ? void 0 + : sdIsMap(val) + ? (Object.fromEntries( + Object.entries(val).map(([k, v]: [string, any]) => [ + k, + (function (v: any): any { + return sdIsMap(v) + ? (Object.fromEntries( + Object.entries(v).map(([k, v]: [string, any]) => [ + k, + deserializeMetadata(v), + ]) + ) as { + readonly [key: string]: any; + }) + : {}; + })(v), + ]) + ) as { + readonly [key: string]: any; + }) + : {}; return { extraData: extraData } satisfies FolderFullMetadataField; } export function serializeFolderFullAllowedSharedLinkAccessLevelsField( @@ -184,7 +301,7 @@ export function serializeFolderFullAllowedSharedLinkAccessLevelsField( return val; } export function deserializeFolderFullAllowedSharedLinkAccessLevelsField( - val: any + val: SerializedData ): FolderFullAllowedSharedLinkAccessLevelsField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -211,7 +328,7 @@ export function serializeFolderFullAllowedInviteeRolesField( return val; } export function deserializeFolderFullAllowedInviteeRolesField( - val: any + val: SerializedData ): FolderFullAllowedInviteeRolesField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -252,8 +369,19 @@ export function serializeFolderFullWatermarkInfoField( }; } export function deserializeFolderFullWatermarkInfoField( - val: any + val: SerializedData ): FolderFullWatermarkInfoField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FolderFullWatermarkInfoField"', + }); + } + if (!(val.is_watermarked == void 0) && !sdIsBoolean(val.is_watermarked)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_watermarked" of type "FolderFullWatermarkInfoField"', + }); + } const isWatermarked: undefined | boolean = val.is_watermarked == void 0 ? void 0 : val.is_watermarked; return { @@ -270,11 +398,34 @@ export function serializeFolderFullClassificationField( }; } export function deserializeFolderFullClassificationField( - val: any + val: SerializedData ): FolderFullClassificationField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FolderFullClassificationField"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "FolderFullClassificationField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.definition == void 0) && !sdIsString(val.definition)) { + throw new BoxSdkError({ + message: + 'Expecting string for "definition" of type "FolderFullClassificationField"', + }); + } const definition: undefined | string = val.definition == void 0 ? void 0 : val.definition; + if (!(val.color == void 0) && !sdIsString(val.color)) { + throw new BoxSdkError({ + message: + 'Expecting string for "color" of type "FolderFullClassificationField"', + }); + } const color: undefined | string = val.color == void 0 ? void 0 : val.color; return { name: name, @@ -355,31 +506,95 @@ export function serializeFolderFull(val: FolderFull): SerializedData { }, }; } -export function deserializeFolderFull(val: any): FolderFull { +export function deserializeFolderFull(val: SerializedData): FolderFull { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FolderFull"' }); + } const syncState: undefined | FolderFullSyncStateField = val.sync_state == void 0 ? void 0 : deserializeFolderFullSyncStateField(val.sync_state); + if ( + !(val.has_collaborations == void 0) && + !sdIsBoolean(val.has_collaborations) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "has_collaborations" of type "FolderFull"', + }); + } const hasCollaborations: undefined | boolean = val.has_collaborations == void 0 ? void 0 : val.has_collaborations; const permissions: undefined | FolderFullPermissionsField = val.permissions == void 0 ? void 0 : deserializeFolderFullPermissionsField(val.permissions); + if (!(val.tags == void 0) && !sdIsList(val.tags)) { + throw new BoxSdkError({ + message: 'Expecting array for "tags" of type "FolderFull"', + }); + } const tags: undefined | readonly string[] = - val.tags == void 0 ? void 0 : sdIsList(val.tags) ? val.tags : []; + val.tags == void 0 + ? void 0 + : sdIsList(val.tags) + ? (val.tags.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: 'Expecting string for "FolderFull"', + }); + } + return itm; + }) as readonly any[]) + : []; + 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 "FolderFull"', + }); + } const canNonOwnersInvite: undefined | boolean = val.can_non_owners_invite == void 0 ? void 0 : val.can_non_owners_invite; + if ( + !(val.is_externally_owned == void 0) && + !sdIsBoolean(val.is_externally_owned) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_externally_owned" of type "FolderFull"', + }); + } const isExternallyOwned: undefined | boolean = val.is_externally_owned == void 0 ? void 0 : val.is_externally_owned; const metadata: undefined | FolderFullMetadataField = val.metadata == void 0 ? void 0 : deserializeFolderFullMetadataField(val.metadata); + 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 "FolderFull"', + }); + } const isCollaborationRestrictedToEnterprise: undefined | boolean = val.is_collaboration_restricted_to_enterprise == void 0 ? void 0 : val.is_collaboration_restricted_to_enterprise; + if ( + !(val.allowed_shared_link_access_levels == void 0) && + !sdIsList(val.allowed_shared_link_access_levels) + ) { + throw new BoxSdkError({ + message: + 'Expecting array for "allowed_shared_link_access_levels" of type "FolderFull"', + }); + } const allowedSharedLinkAccessLevels: | undefined | readonly FolderFullAllowedSharedLinkAccessLevelsField[] = @@ -392,6 +607,15 @@ export function deserializeFolderFull(val: any): FolderFull { return deserializeFolderFullAllowedSharedLinkAccessLevelsField(itm); }) as readonly any[]) : []; + if ( + !(val.allowed_invitee_roles == void 0) && + !sdIsList(val.allowed_invitee_roles) + ) { + throw new BoxSdkError({ + message: + 'Expecting array for "allowed_invitee_roles" of type "FolderFull"', + }); + } const allowedInviteeRoles: | undefined | readonly FolderFullAllowedInviteeRolesField[] = @@ -408,10 +632,28 @@ export function deserializeFolderFull(val: any): FolderFull { val.watermark_info == void 0 ? void 0 : deserializeFolderFullWatermarkInfoField(val.watermark_info); + if ( + !(val.is_accessible_via_shared_link == void 0) && + !sdIsBoolean(val.is_accessible_via_shared_link) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_accessible_via_shared_link" of type "FolderFull"', + }); + } const isAccessibleViaSharedLink: undefined | boolean = val.is_accessible_via_shared_link == void 0 ? void 0 : val.is_accessible_via_shared_link; + if ( + !(val.can_non_owners_view_collaborators == void 0) && + !sdIsBoolean(val.can_non_owners_view_collaborators) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_non_owners_view_collaborators" of type "FolderFull"', + }); + } const canNonOwnersViewCollaborators: undefined | boolean = val.can_non_owners_view_collaborators == void 0 ? void 0 @@ -420,12 +662,32 @@ export function deserializeFolderFull(val: any): FolderFull { val.classification == void 0 ? void 0 : deserializeFolderFullClassificationField(val.classification); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "FolderFull"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "FolderFull"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "FolderFull"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if (!(val.size == void 0) && !sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "FolderFull"', + }); + } const size: undefined | number = val.size == void 0 ? void 0 : val.size; const pathCollection: undefined | FolderPathCollectionField = val.path_collection == void 0 @@ -435,14 +697,41 @@ export function deserializeFolderFull(val: any): FolderFull { val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); const modifiedBy: undefined | UserMini = val.modified_by == void 0 ? void 0 : deserializeUserMini(val.modified_by); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "trashed_at" of type "FolderFull"', + }); + } const trashedAt: undefined | DateTime = val.trashed_at == void 0 ? void 0 : deserializeDateTime(val.trashed_at); + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "purged_at" of type "FolderFull"', + }); + } const purgedAt: undefined | DateTime = val.purged_at == void 0 ? void 0 : deserializeDateTime(val.purged_at); + if ( + !(val.content_created_at == void 0) && + !sdIsString(val.content_created_at) + ) { + throw new BoxSdkError({ + message: 'Expecting string for "content_created_at" of type "FolderFull"', + }); + } const contentCreatedAt: undefined | DateTime = val.content_created_at == void 0 ? void 0 : deserializeDateTime(val.content_created_at); + if ( + !(val.content_modified_at == void 0) && + !sdIsString(val.content_modified_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_modified_at" of type "FolderFull"', + }); + } const contentModifiedAt: undefined | DateTime = val.content_modified_at == void 0 ? void 0 @@ -467,11 +756,41 @@ export function deserializeFolderFull(val: any): FolderFull { val.item_collection == void 0 ? void 0 : deserializeItems(val.item_collection); + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "FolderFull"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "FolderFull"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FolderFull" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FolderFull"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "FolderFull"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "FolderFull" to be defined', + }); + } const type: FolderBaseTypeField = deserializeFolderBaseTypeField(val.type); return { syncState: syncState, diff --git a/src/schemas/folderLock.generated.ts b/src/schemas/folderLock.generated.ts index e0dccd40..6c284831 100644 --- a/src/schemas/folderLock.generated.ts +++ b/src/schemas/folderLock.generated.ts @@ -7,6 +7,7 @@ import { deserializeDateTime } from '../internal/utils.js'; import { FolderMini } from './folderMini.generated.js'; import { UserBase } from './userBase.generated.js'; import { DateTime } from '../internal/utils.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -33,9 +34,38 @@ export function serializeFolderLockLockedOperationsField( return { ['move']: val.move, ['delete']: val.delete }; } export function deserializeFolderLockLockedOperationsField( - val: any + val: SerializedData ): FolderLockLockedOperationsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FolderLockLockedOperationsField"', + }); + } + if (val.move == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "move" of type "FolderLockLockedOperationsField" to be defined', + }); + } + if (!sdIsBoolean(val.move)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "move" of type "FolderLockLockedOperationsField"', + }); + } const move: boolean = val.move; + if (val.delete == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "delete" of type "FolderLockLockedOperationsField" to be defined', + }); + } + if (!sdIsBoolean(val.delete)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "delete" of type "FolderLockLockedOperationsField"', + }); + } const _delete: boolean = val.delete; return { move: move, @@ -58,19 +88,42 @@ export function serializeFolderLock(val: FolderLock): SerializedData { ['lock_type']: val.lockType == void 0 ? void 0 : val.lockType, }; } -export function deserializeFolderLock(val: any): FolderLock { +export function deserializeFolderLock(val: SerializedData): FolderLock { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FolderLock"' }); + } const folder: undefined | FolderMini = val.folder == void 0 ? void 0 : deserializeFolderMini(val.folder); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FolderLock"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (!(val.type == void 0) && !sdIsString(val.type)) { + throw new BoxSdkError({ + message: 'Expecting string for "type" of type "FolderLock"', + }); + } const type: undefined | string = val.type == void 0 ? void 0 : val.type; const createdBy: undefined | UserBase = val.created_by == void 0 ? void 0 : deserializeUserBase(val.created_by); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "FolderLock"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); const lockedOperations: undefined | FolderLockLockedOperationsField = val.locked_operations == void 0 ? void 0 : deserializeFolderLockLockedOperationsField(val.locked_operations); + if (!(val.lock_type == void 0) && !sdIsString(val.lock_type)) { + throw new BoxSdkError({ + message: 'Expecting string for "lock_type" of type "FolderLock"', + }); + } const lockType: undefined | string = val.lock_type == void 0 ? void 0 : val.lock_type; return { diff --git a/src/schemas/folderLocks.generated.ts b/src/schemas/folderLocks.generated.ts index 6cb79c8a..2aaa1799 100644 --- a/src/schemas/folderLocks.generated.ts +++ b/src/schemas/folderLocks.generated.ts @@ -1,6 +1,7 @@ import { serializeFolderLock } from './folderLock.generated.js'; import { deserializeFolderLock } from './folderLock.generated.js'; import { FolderLock } from './folderLock.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -25,7 +26,15 @@ export function serializeFolderLocks(val: FolderLocks): SerializedData { ['next_marker']: val.nextMarker == void 0 ? void 0 : val.nextMarker, }; } -export function deserializeFolderLocks(val: any): FolderLocks { +export function deserializeFolderLocks(val: SerializedData): FolderLocks { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FolderLocks"' }); + } + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "FolderLocks"', + }); + } const entries: undefined | readonly FolderLock[] = val.entries == void 0 ? void 0 @@ -34,7 +43,17 @@ export function deserializeFolderLocks(val: any): FolderLocks { return deserializeFolderLock(itm); }) as readonly any[]) : []; + if (!(val.limit == void 0) && !sdIsString(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting string for "limit" of type "FolderLocks"', + }); + } const limit: undefined | string = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "next_marker" of type "FolderLocks"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; return { diff --git a/src/schemas/folderMini.generated.ts b/src/schemas/folderMini.generated.ts index cc95d506..d7e763ae 100644 --- a/src/schemas/folderMini.generated.ts +++ b/src/schemas/folderMini.generated.ts @@ -34,12 +34,45 @@ export function serializeFolderMini(val: FolderMini): SerializedData { }, }; } -export function deserializeFolderMini(val: any): FolderMini { +export function deserializeFolderMini(val: SerializedData): FolderMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "FolderMini"' }); + } + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "FolderMini"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "FolderMini"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FolderMini" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FolderMini"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "FolderMini"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "FolderMini" to be defined', + }); + } const type: FolderBaseTypeField = deserializeFolderBaseTypeField(val.type); return { sequenceId: sequenceId, diff --git a/src/schemas/genericSource.generated.ts b/src/schemas/genericSource.generated.ts index 1b5c4575..23a19058 100644 --- a/src/schemas/genericSource.generated.ts +++ b/src/schemas/genericSource.generated.ts @@ -20,6 +20,17 @@ export function serializeGenericSource(val: GenericSource): SerializedData { readonly [key: string]: any; }; } -export function deserializeGenericSource(val: any): GenericSource { - return val; +export function deserializeGenericSource(val: SerializedData): GenericSource { + return sdIsMap(val) + ? (Object.fromEntries( + Object.entries(val).map(([k, v]: [string, any]) => [ + k, + (function (v: any): any { + return v; + })(v), + ]) + ) as { + readonly [key: string]: any; + }) + : {}; } diff --git a/src/schemas/group.generated.ts b/src/schemas/group.generated.ts index 4d8ea015..b0cd2fa8 100644 --- a/src/schemas/group.generated.ts +++ b/src/schemas/group.generated.ts @@ -43,17 +43,50 @@ export function serializeGroup(val: Group): SerializedData { }, }; } -export function deserializeGroup(val: any): Group { +export function deserializeGroup(val: SerializedData): Group { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Group"' }); + } + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "Group"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "Group"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "Group"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; const groupType: undefined | GroupMiniGroupTypeField = val.group_type == void 0 ? void 0 : deserializeGroupMiniGroupTypeField(val.group_type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "Group" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "Group"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "Group" to be defined', + }); + } const type: GroupBaseTypeField = deserializeGroupBaseTypeField(val.type); return { createdAt: createdAt, diff --git a/src/schemas/groupBase.generated.ts b/src/schemas/groupBase.generated.ts index 85cb3489..a908eeaf 100644 --- a/src/schemas/groupBase.generated.ts +++ b/src/schemas/groupBase.generated.ts @@ -30,7 +30,9 @@ export function serializeGroupBaseTypeField( ): SerializedData { return val; } -export function deserializeGroupBaseTypeField(val: any): GroupBaseTypeField { +export function deserializeGroupBaseTypeField( + val: SerializedData +): GroupBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "GroupBaseTypeField"', @@ -46,8 +48,26 @@ export function deserializeGroupBaseTypeField(val: any): GroupBaseTypeField { export function serializeGroupBase(val: GroupBase): SerializedData { return { ['id']: val.id, ['type']: serializeGroupBaseTypeField(val.type) }; } -export function deserializeGroupBase(val: any): GroupBase { +export function deserializeGroupBase(val: SerializedData): GroupBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "GroupBase"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "GroupBase" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "GroupBase"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "GroupBase" to be defined', + }); + } const type: GroupBaseTypeField = deserializeGroupBaseTypeField(val.type); return { id: id, type: type } satisfies GroupBase; } @@ -58,7 +78,20 @@ export function serializeGroupBaseInput(val: GroupBaseInput): SerializedData { val.type == void 0 ? void 0 : serializeGroupBaseTypeField(val.type), }; } -export function deserializeGroupBaseInput(val: any): GroupBaseInput { +export function deserializeGroupBaseInput(val: SerializedData): GroupBaseInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "GroupBaseInput"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "GroupBaseInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "GroupBaseInput"', + }); + } const id: string = val.id; const type: undefined | GroupBaseTypeField = val.type == void 0 ? void 0 : deserializeGroupBaseTypeField(val.type); diff --git a/src/schemas/groupFull.generated.ts b/src/schemas/groupFull.generated.ts index e1114e56..253a317c 100644 --- a/src/schemas/groupFull.generated.ts +++ b/src/schemas/groupFull.generated.ts @@ -52,7 +52,7 @@ export function serializeGroupFullInvitabilityLevelField( return val; } export function deserializeGroupFullInvitabilityLevelField( - val: any + val: SerializedData ): GroupFullInvitabilityLevelField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -78,7 +78,7 @@ export function serializeGroupFullMemberViewabilityLevelField( return val; } export function deserializeGroupFullMemberViewabilityLevelField( - val: any + val: SerializedData ): GroupFullMemberViewabilityLevelField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -109,8 +109,22 @@ export function serializeGroupFullPermissionsField( }; } export function deserializeGroupFullPermissionsField( - val: any + val: SerializedData ): GroupFullPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "GroupFullPermissionsField"', + }); + } + if ( + !(val.can_invite_as_collaborator == void 0) && + !sdIsBoolean(val.can_invite_as_collaborator) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_invite_as_collaborator" of type "GroupFullPermissionsField"', + }); + } const canInviteAsCollaborator: undefined | boolean = val.can_invite_as_collaborator == void 0 ? void 0 @@ -150,13 +164,35 @@ export function serializeGroupFull(val: GroupFull): SerializedData { }, }; } -export function deserializeGroupFull(val: any): GroupFull { +export function deserializeGroupFull(val: SerializedData): GroupFull { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "GroupFull"' }); + } + if (!(val.provenance == void 0) && !sdIsString(val.provenance)) { + throw new BoxSdkError({ + message: 'Expecting string for "provenance" of type "GroupFull"', + }); + } const provenance: undefined | string = val.provenance == void 0 ? void 0 : val.provenance; + if ( + !(val.external_sync_identifier == void 0) && + !sdIsString(val.external_sync_identifier) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "external_sync_identifier" of type "GroupFull"', + }); + } const externalSyncIdentifier: undefined | string = val.external_sync_identifier == void 0 ? void 0 : val.external_sync_identifier; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "GroupFull"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; const invitabilityLevel: undefined | GroupFullInvitabilityLevelField = @@ -175,16 +211,46 @@ export function deserializeGroupFull(val: any): GroupFull { val.permissions == void 0 ? void 0 : deserializeGroupFullPermissionsField(val.permissions); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "GroupFull"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "GroupFull"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "GroupFull"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; const groupType: undefined | GroupMiniGroupTypeField = val.group_type == void 0 ? void 0 : deserializeGroupMiniGroupTypeField(val.group_type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "GroupFull" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "GroupFull"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "GroupFull" to be defined', + }); + } const type: GroupBaseTypeField = deserializeGroupBaseTypeField(val.type); return { provenance: provenance, diff --git a/src/schemas/groupMembership.generated.ts b/src/schemas/groupMembership.generated.ts index 59b0322f..50c43ff3 100644 --- a/src/schemas/groupMembership.generated.ts +++ b/src/schemas/groupMembership.generated.ts @@ -32,7 +32,7 @@ export function serializeGroupMembershipTypeField( return val; } export function deserializeGroupMembershipTypeField( - val: any + val: SerializedData ): GroupMembershipTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -52,7 +52,7 @@ export function serializeGroupMembershipRoleField( return val; } export function deserializeGroupMembershipRoleField( - val: any + val: SerializedData ): GroupMembershipRoleField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -84,7 +84,17 @@ export function serializeGroupMembership(val: GroupMembership): SerializedData { val.modifiedAt == void 0 ? void 0 : serializeDateTime(val.modifiedAt), }; } -export function deserializeGroupMembership(val: any): GroupMembership { +export function deserializeGroupMembership( + val: SerializedData +): GroupMembership { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "GroupMembership"' }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "GroupMembership"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | GroupMembershipTypeField = val.type == void 0 ? void 0 : deserializeGroupMembershipTypeField(val.type); @@ -94,8 +104,18 @@ export function deserializeGroupMembership(val: any): GroupMembership { val.group == void 0 ? void 0 : deserializeGroupMini(val.group); const role: undefined | GroupMembershipRoleField = val.role == void 0 ? void 0 : deserializeGroupMembershipRoleField(val.role); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "GroupMembership"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "GroupMembership"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); return { diff --git a/src/schemas/groupMemberships.generated.ts b/src/schemas/groupMemberships.generated.ts index 7f7a2460..577e3033 100644 --- a/src/schemas/groupMemberships.generated.ts +++ b/src/schemas/groupMemberships.generated.ts @@ -27,7 +27,7 @@ export function serializeGroupMembershipsOrderDirectionField( return val; } export function deserializeGroupMembershipsOrderDirectionField( - val: any + val: SerializedData ): GroupMembershipsOrderDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -56,8 +56,18 @@ export function serializeGroupMembershipsOrderField( }; } export function deserializeGroupMembershipsOrderField( - val: any + val: SerializedData ): GroupMembershipsOrderField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "GroupMembershipsOrderField"', + }); + } + if (!(val.by == void 0) && !sdIsString(val.by)) { + throw new BoxSdkError({ + message: 'Expecting string for "by" of type "GroupMembershipsOrderField"', + }); + } const by: undefined | string = val.by == void 0 ? void 0 : val.by; const direction: undefined | GroupMembershipsOrderDirectionField = val.direction == void 0 @@ -88,11 +98,38 @@ export function serializeGroupMemberships( }) as readonly any[]), }; } -export function deserializeGroupMemberships(val: any): GroupMemberships { +export function deserializeGroupMemberships( + val: SerializedData +): GroupMemberships { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "GroupMemberships"', + }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "GroupMemberships"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "GroupMemberships"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: 'Expecting number for "offset" of type "GroupMemberships"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; + if (!(val.order == void 0) && !sdIsList(val.order)) { + throw new BoxSdkError({ + message: 'Expecting array for "order" of type "GroupMemberships"', + }); + } const order: undefined | readonly GroupMembershipsOrderField[] = val.order == void 0 ? void 0 @@ -103,6 +140,11 @@ export function deserializeGroupMemberships(val: any): GroupMemberships { return deserializeGroupMembershipsOrderField(itm); }) as readonly any[]) : []; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "GroupMemberships"', + }); + } const entries: undefined | readonly GroupMembership[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/groupMini.generated.ts b/src/schemas/groupMini.generated.ts index 410c9ad0..24d09e5a 100644 --- a/src/schemas/groupMini.generated.ts +++ b/src/schemas/groupMini.generated.ts @@ -26,7 +26,7 @@ export function serializeGroupMiniGroupTypeField( return val; } export function deserializeGroupMiniGroupTypeField( - val: any + val: SerializedData ): GroupMiniGroupTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -59,13 +59,36 @@ export function serializeGroupMini(val: GroupMini): SerializedData { }, }; } -export function deserializeGroupMini(val: any): GroupMini { +export function deserializeGroupMini(val: SerializedData): GroupMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "GroupMini"' }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "GroupMini"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; const groupType: undefined | GroupMiniGroupTypeField = val.group_type == void 0 ? void 0 : deserializeGroupMiniGroupTypeField(val.group_type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "GroupMini" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "GroupMini"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "GroupMini" to be defined', + }); + } const type: GroupBaseTypeField = deserializeGroupBaseTypeField(val.type); return { name: name, diff --git a/src/schemas/groupMiniOrUserCollaborations.generated.ts b/src/schemas/groupMiniOrUserCollaborations.generated.ts index daecfd3c..e9592187 100644 --- a/src/schemas/groupMiniOrUserCollaborations.generated.ts +++ b/src/schemas/groupMiniOrUserCollaborations.generated.ts @@ -25,7 +25,7 @@ export function serializeGroupMiniOrUserCollaborations( throw new BoxSdkError({ message: 'unknown type' }); } export function deserializeGroupMiniOrUserCollaborations( - val: any + val: SerializedData ): GroupMiniOrUserCollaborations { if (!sdIsMap(val)) { throw new BoxSdkError({ diff --git a/src/schemas/groups.generated.ts b/src/schemas/groups.generated.ts index 9bd5daec..73537353 100644 --- a/src/schemas/groups.generated.ts +++ b/src/schemas/groups.generated.ts @@ -27,7 +27,7 @@ export function serializeGroupsOrderDirectionField( return val; } export function deserializeGroupsOrderDirectionField( - val: any + val: SerializedData ): GroupsOrderDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -55,7 +55,19 @@ export function serializeGroupsOrderField( : serializeGroupsOrderDirectionField(val.direction), }; } -export function deserializeGroupsOrderField(val: any): GroupsOrderField { +export function deserializeGroupsOrderField( + val: SerializedData +): GroupsOrderField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "GroupsOrderField"', + }); + } + if (!(val.by == void 0) && !sdIsString(val.by)) { + throw new BoxSdkError({ + message: 'Expecting string for "by" of type "GroupsOrderField"', + }); + } const by: undefined | string = val.by == void 0 ? void 0 : val.by; const direction: undefined | GroupsOrderDirectionField = val.direction == void 0 @@ -82,11 +94,34 @@ export function serializeGroups(val: Groups): SerializedData { }) as readonly any[]), }; } -export function deserializeGroups(val: any): Groups { +export function deserializeGroups(val: SerializedData): Groups { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Groups"' }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "Groups"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "Groups"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: 'Expecting number for "offset" of type "Groups"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; + if (!(val.order == void 0) && !sdIsList(val.order)) { + throw new BoxSdkError({ + message: 'Expecting array for "order" of type "Groups"', + }); + } const order: undefined | readonly GroupsOrderField[] = val.order == void 0 ? void 0 @@ -95,6 +130,11 @@ export function deserializeGroups(val: any): Groups { return deserializeGroupsOrderField(itm); }) as readonly any[]) : []; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "Groups"', + }); + } const entries: undefined | readonly GroupFull[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/integrationMapping.generated.ts b/src/schemas/integrationMapping.generated.ts index b39e7876..7bf9008f 100644 --- a/src/schemas/integrationMapping.generated.ts +++ b/src/schemas/integrationMapping.generated.ts @@ -86,7 +86,7 @@ export function serializeIntegrationMappingTypeField( return val; } export function deserializeIntegrationMappingTypeField( - val: any + val: SerializedData ): IntegrationMappingTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -138,12 +138,45 @@ export function serializeIntegrationMapping( }, }; } -export function deserializeIntegrationMapping(val: any): IntegrationMapping { +export function deserializeIntegrationMapping( + val: SerializedData +): IntegrationMapping { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "IntegrationMapping"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "IntegrationMapping" to be defined', + }); + } const type: IntegrationMappingTypeField = deserializeIntegrationMappingTypeField(val.type); + if (val.partner_item == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "partner_item" of type "IntegrationMapping" to be defined', + }); + } const partnerItem: IntegrationMappingPartnerItemSlack = deserializeIntegrationMappingPartnerItemSlack(val.partner_item); + if (val.box_item == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "box_item" of type "IntegrationMapping" to be defined', + }); + } const boxItem: FolderMini = deserializeFolderMini(val.box_item); + if ( + !(val.is_manually_created == void 0) && + !sdIsBoolean(val.is_manually_created) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_manually_created" of type "IntegrationMapping"', + }); + } const isManuallyCreated: undefined | boolean = val.is_manually_created == void 0 ? void 0 : val.is_manually_created; const options: undefined | IntegrationMappingSlackOptions = @@ -158,10 +191,26 @@ export function deserializeIntegrationMapping(val: any): IntegrationMapping { val.modified_by == void 0 ? void 0 : deserializeUserIntegrationMappings(val.modified_by); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "IntegrationMapping"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "modified_at" of type "IntegrationMapping"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "IntegrationMapping"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const integrationType: | undefined diff --git a/src/schemas/integrationMappingBase.generated.ts b/src/schemas/integrationMappingBase.generated.ts index 34e00830..685ac85a 100644 --- a/src/schemas/integrationMappingBase.generated.ts +++ b/src/schemas/integrationMappingBase.generated.ts @@ -17,7 +17,7 @@ export function serializeIntegrationMappingBaseIntegrationTypeField( return val; } export function deserializeIntegrationMappingBaseIntegrationTypeField( - val: any + val: SerializedData ): IntegrationMappingBaseIntegrationTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -46,8 +46,18 @@ export function serializeIntegrationMappingBase( }; } export function deserializeIntegrationMappingBase( - val: any + val: SerializedData ): IntegrationMappingBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "IntegrationMappingBase"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "IntegrationMappingBase"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const integrationType: | undefined diff --git a/src/schemas/integrationMappingBoxItemSlack.generated.ts b/src/schemas/integrationMappingBoxItemSlack.generated.ts index aff49012..361149f9 100644 --- a/src/schemas/integrationMappingBoxItemSlack.generated.ts +++ b/src/schemas/integrationMappingBoxItemSlack.generated.ts @@ -33,7 +33,7 @@ export function serializeIntegrationMappingBoxItemSlackTypeField( return val; } export function deserializeIntegrationMappingBoxItemSlackTypeField( - val: any + val: SerializedData ): IntegrationMappingBoxItemSlackTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -57,10 +57,33 @@ export function serializeIntegrationMappingBoxItemSlack( }; } export function deserializeIntegrationMappingBoxItemSlack( - val: any + val: SerializedData ): IntegrationMappingBoxItemSlack { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "IntegrationMappingBoxItemSlack"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "IntegrationMappingBoxItemSlack" to be defined', + }); + } const type: IntegrationMappingBoxItemSlackTypeField = deserializeIntegrationMappingBoxItemSlackTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "IntegrationMappingBoxItemSlack" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "IntegrationMappingBoxItemSlack"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies IntegrationMappingBoxItemSlack; } @@ -76,12 +99,29 @@ export function serializeIntegrationMappingBoxItemSlackInput( }; } export function deserializeIntegrationMappingBoxItemSlackInput( - val: any + val: SerializedData ): IntegrationMappingBoxItemSlackInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "IntegrationMappingBoxItemSlackInput"', + }); + } const type: undefined | IntegrationMappingBoxItemSlackTypeField = val.type == void 0 ? void 0 : deserializeIntegrationMappingBoxItemSlackTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "IntegrationMappingBoxItemSlackInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "IntegrationMappingBoxItemSlackInput"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies IntegrationMappingBoxItemSlackInput; } diff --git a/src/schemas/integrationMappingMini.generated.ts b/src/schemas/integrationMappingMini.generated.ts index 2a6f19be..f9c51aa1 100644 --- a/src/schemas/integrationMappingMini.generated.ts +++ b/src/schemas/integrationMappingMini.generated.ts @@ -26,7 +26,7 @@ export function serializeIntegrationMappingMiniPartnerItemTypeField( return val; } export function deserializeIntegrationMappingMiniPartnerItemTypeField( - val: any + val: SerializedData ): IntegrationMappingMiniPartnerItemTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -47,7 +47,7 @@ export function serializeIntegrationMappingMiniBoxItemTypeField( return val; } export function deserializeIntegrationMappingMiniBoxItemTypeField( - val: any + val: SerializedData ): IntegrationMappingMiniBoxItemTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -91,8 +91,19 @@ export function serializeIntegrationMappingMini( }; } export function deserializeIntegrationMappingMini( - val: any + val: SerializedData ): IntegrationMappingMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "IntegrationMappingMini"', + }); + } + if (!(val.partner_item_id == void 0) && !sdIsString(val.partner_item_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "partner_item_id" of type "IntegrationMappingMini"', + }); + } const partnerItemId: undefined | string = val.partner_item_id == void 0 ? void 0 : val.partner_item_id; const partnerItemType: @@ -103,12 +114,23 @@ export function deserializeIntegrationMappingMini( : deserializeIntegrationMappingMiniPartnerItemTypeField( val.partner_item_type ); + if (!(val.box_item_id == void 0) && !sdIsString(val.box_item_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "box_item_id" of type "IntegrationMappingMini"', + }); + } const boxItemId: undefined | string = val.box_item_id == void 0 ? void 0 : val.box_item_id; const boxItemType: undefined | IntegrationMappingMiniBoxItemTypeField = val.box_item_type == void 0 ? void 0 : deserializeIntegrationMappingMiniBoxItemTypeField(val.box_item_type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "IntegrationMappingMini"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const integrationType: | undefined diff --git a/src/schemas/integrationMappingPartnerItemSlack.generated.ts b/src/schemas/integrationMappingPartnerItemSlack.generated.ts index c8b1a1b6..a68a1430 100644 --- a/src/schemas/integrationMappingPartnerItemSlack.generated.ts +++ b/src/schemas/integrationMappingPartnerItemSlack.generated.ts @@ -43,7 +43,7 @@ export function serializeIntegrationMappingPartnerItemSlackTypeField( return val; } export function deserializeIntegrationMappingPartnerItemSlackTypeField( - val: any + val: SerializedData ): IntegrationMappingPartnerItemSlackTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -70,13 +70,51 @@ export function serializeIntegrationMappingPartnerItemSlack( }; } export function deserializeIntegrationMappingPartnerItemSlack( - val: any + val: SerializedData ): IntegrationMappingPartnerItemSlack { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "IntegrationMappingPartnerItemSlack"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "IntegrationMappingPartnerItemSlack" to be defined', + }); + } const type: IntegrationMappingPartnerItemSlackTypeField = deserializeIntegrationMappingPartnerItemSlackTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "IntegrationMappingPartnerItemSlack" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "IntegrationMappingPartnerItemSlack"', + }); + } const id: string = val.id; + if ( + !(val.slack_workspace_id == void 0) && + !sdIsString(val.slack_workspace_id) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "slack_workspace_id" of type "IntegrationMappingPartnerItemSlack"', + }); + } const slackWorkspaceId: undefined | string = val.slack_workspace_id == void 0 ? void 0 : val.slack_workspace_id; + if (!(val.slack_org_id == void 0) && !sdIsString(val.slack_org_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "slack_org_id" of type "IntegrationMappingPartnerItemSlack"', + }); + } const slackOrgId: undefined | string = val.slack_org_id == void 0 ? void 0 : val.slack_org_id; return { @@ -101,15 +139,47 @@ export function serializeIntegrationMappingPartnerItemSlackInput( }; } export function deserializeIntegrationMappingPartnerItemSlackInput( - val: any + val: SerializedData ): IntegrationMappingPartnerItemSlackInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "IntegrationMappingPartnerItemSlackInput"', + }); + } const type: undefined | IntegrationMappingPartnerItemSlackTypeField = val.type == void 0 ? void 0 : deserializeIntegrationMappingPartnerItemSlackTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "IntegrationMappingPartnerItemSlackInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "IntegrationMappingPartnerItemSlackInput"', + }); + } const id: string = val.id; + if ( + !(val.slack_workspace_id == void 0) && + !sdIsString(val.slack_workspace_id) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "slack_workspace_id" of type "IntegrationMappingPartnerItemSlackInput"', + }); + } const slackWorkspaceId: undefined | string = val.slack_workspace_id == void 0 ? void 0 : val.slack_workspace_id; + if (!(val.slack_org_id == void 0) && !sdIsString(val.slack_org_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "slack_org_id" of type "IntegrationMappingPartnerItemSlackInput"', + }); + } const slackOrgId: undefined | string = val.slack_org_id == void 0 ? void 0 : val.slack_org_id; return { diff --git a/src/schemas/integrationMappingSlackCreateRequest.generated.ts b/src/schemas/integrationMappingSlackCreateRequest.generated.ts index 4a7bacc1..637d24da 100644 --- a/src/schemas/integrationMappingSlackCreateRequest.generated.ts +++ b/src/schemas/integrationMappingSlackCreateRequest.generated.ts @@ -7,6 +7,7 @@ import { deserializeIntegrationMappingSlackOptions } from './integrationMappingS import { IntegrationMappingPartnerItemSlack } from './integrationMappingPartnerItemSlack.generated.js'; import { IntegrationMappingBoxItemSlack } from './integrationMappingBoxItemSlack.generated.js'; import { IntegrationMappingSlackOptions } from './integrationMappingSlackOptions.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -34,10 +35,27 @@ export function serializeIntegrationMappingSlackCreateRequest( }; } export function deserializeIntegrationMappingSlackCreateRequest( - val: any + val: SerializedData ): IntegrationMappingSlackCreateRequest { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "IntegrationMappingSlackCreateRequest"', + }); + } + if (val.partner_item == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "partner_item" of type "IntegrationMappingSlackCreateRequest" to be defined', + }); + } const partnerItem: IntegrationMappingPartnerItemSlack = deserializeIntegrationMappingPartnerItemSlack(val.partner_item); + if (val.box_item == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "box_item" of type "IntegrationMappingSlackCreateRequest" to be defined', + }); + } const boxItem: IntegrationMappingBoxItemSlack = deserializeIntegrationMappingBoxItemSlack(val.box_item); const options: undefined | IntegrationMappingSlackOptions = diff --git a/src/schemas/integrationMappingSlackOptions.generated.ts b/src/schemas/integrationMappingSlackOptions.generated.ts index 16a69dab..da4b1882 100644 --- a/src/schemas/integrationMappingSlackOptions.generated.ts +++ b/src/schemas/integrationMappingSlackOptions.generated.ts @@ -1,3 +1,4 @@ +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -19,8 +20,22 @@ export function serializeIntegrationMappingSlackOptions( }; } export function deserializeIntegrationMappingSlackOptions( - val: any + val: SerializedData ): IntegrationMappingSlackOptions { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "IntegrationMappingSlackOptions"', + }); + } + if ( + !(val.is_access_management_disabled == void 0) && + !sdIsBoolean(val.is_access_management_disabled) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_access_management_disabled" of type "IntegrationMappingSlackOptions"', + }); + } const isAccessManagementDisabled: undefined | boolean = val.is_access_management_disabled == void 0 ? void 0 diff --git a/src/schemas/integrationMappings.generated.ts b/src/schemas/integrationMappings.generated.ts index a6f80add..d728d77f 100644 --- a/src/schemas/integrationMappings.generated.ts +++ b/src/schemas/integrationMappings.generated.ts @@ -1,6 +1,7 @@ import { serializeIntegrationMapping } from './integrationMapping.generated.js'; import { deserializeIntegrationMapping } from './integrationMapping.generated.js'; import { IntegrationMapping } from './integrationMapping.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -27,10 +28,33 @@ export function serializeIntegrationMappings( }) as readonly any[]), }; } -export function deserializeIntegrationMappings(val: any): IntegrationMappings { +export function deserializeIntegrationMappings( + val: SerializedData +): IntegrationMappings { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "IntegrationMappings"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "IntegrationMappings"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "IntegrationMappings"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "IntegrationMappings"', + }); + } const entries: undefined | readonly IntegrationMapping[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/invite.generated.ts b/src/schemas/invite.generated.ts index 84c90fdb..7ede5b11 100644 --- a/src/schemas/invite.generated.ts +++ b/src/schemas/invite.generated.ts @@ -68,7 +68,9 @@ export interface InviteInput { export function serializeInviteTypeField(val: InviteTypeField): SerializedData { return val; } -export function deserializeInviteTypeField(val: any): InviteTypeField { +export function deserializeInviteTypeField( + val: SerializedData +): InviteTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "InviteTypeField"', @@ -87,7 +89,7 @@ export function serializeInviteInvitedToTypeField( return val; } export function deserializeInviteInvitedToTypeField( - val: any + val: SerializedData ): InviteInvitedToTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -112,11 +114,26 @@ export function serializeInviteInvitedToField( }; } export function deserializeInviteInvitedToField( - val: any + val: SerializedData ): InviteInvitedToField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "InviteInvitedToField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "InviteInvitedToField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | InviteInvitedToTypeField = val.type == void 0 ? void 0 : deserializeInviteInvitedToTypeField(val.type); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "InviteInvitedToField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; return { id: id, type: type, name: name } satisfies InviteInvitedToField; } @@ -139,8 +156,26 @@ export function serializeInvite(val: Invite): SerializedData { val.modifiedAt == void 0 ? void 0 : serializeDateTime(val.modifiedAt), }; } -export function deserializeInvite(val: any): Invite { +export function deserializeInvite(val: SerializedData): Invite { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Invite"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "Invite" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "Invite"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "Invite" to be defined', + }); + } const type: InviteTypeField = deserializeInviteTypeField(val.type); const invitedTo: undefined | InviteInvitedToField = val.invited_to == void 0 @@ -152,9 +187,24 @@ export function deserializeInvite(val: any): Invite { : deserializeUserMini(val.actionable_by); const invitedBy: undefined | UserMini = val.invited_by == void 0 ? void 0 : deserializeUserMini(val.invited_by); + if (!(val.status == void 0) && !sdIsString(val.status)) { + throw new BoxSdkError({ + message: 'Expecting string for "status" of type "Invite"', + }); + } const status: undefined | string = val.status == void 0 ? void 0 : val.status; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "Invite"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "Invite"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); return { @@ -187,7 +237,20 @@ export function serializeInviteInput(val: InviteInput): SerializedData { val.modifiedAt == void 0 ? void 0 : serializeDateTime(val.modifiedAt), }; } -export function deserializeInviteInput(val: any): InviteInput { +export function deserializeInviteInput(val: SerializedData): InviteInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "InviteInput"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "InviteInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "InviteInput"', + }); + } const id: string = val.id; const type: undefined | InviteTypeField = val.type == void 0 ? void 0 : deserializeInviteTypeField(val.type); @@ -201,9 +264,24 @@ export function deserializeInviteInput(val: any): InviteInput { : deserializeUserMini(val.actionable_by); const invitedBy: undefined | UserMini = val.invited_by == void 0 ? void 0 : deserializeUserMini(val.invited_by); + if (!(val.status == void 0) && !sdIsString(val.status)) { + throw new BoxSdkError({ + message: 'Expecting string for "status" of type "InviteInput"', + }); + } const status: undefined | string = val.status == void 0 ? void 0 : val.status; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "InviteInput"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "InviteInput"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); return { diff --git a/src/schemas/items.generated.ts b/src/schemas/items.generated.ts index 8b2b4cd9..ac893938 100644 --- a/src/schemas/items.generated.ts +++ b/src/schemas/items.generated.ts @@ -27,7 +27,7 @@ export function serializeItemsOrderDirectionField( return val; } export function deserializeItemsOrderDirectionField( - val: any + val: SerializedData ): ItemsOrderDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -53,7 +53,17 @@ export function serializeItemsOrderField(val: ItemsOrderField): SerializedData { : serializeItemsOrderDirectionField(val.direction), }; } -export function deserializeItemsOrderField(val: any): ItemsOrderField { +export function deserializeItemsOrderField( + val: SerializedData +): ItemsOrderField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "ItemsOrderField"' }); + } + if (!(val.by == void 0) && !sdIsString(val.by)) { + throw new BoxSdkError({ + message: 'Expecting string for "by" of type "ItemsOrderField"', + }); + } const by: undefined | string = val.by == void 0 ? void 0 : val.by; const direction: undefined | ItemsOrderDirectionField = val.direction == void 0 @@ -82,11 +92,34 @@ export function serializeItems(val: Items): SerializedData { }) as readonly any[]), }; } -export function deserializeItems(val: any): Items { +export function deserializeItems(val: SerializedData): Items { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Items"' }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "Items"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "Items"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: 'Expecting number for "offset" of type "Items"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; + if (!(val.order == void 0) && !sdIsList(val.order)) { + throw new BoxSdkError({ + message: 'Expecting array for "order" of type "Items"', + }); + } const order: undefined | readonly ItemsOrderField[] = val.order == void 0 ? void 0 @@ -95,6 +128,11 @@ export function deserializeItems(val: any): Items { return deserializeItemsOrderField(itm); }) as readonly any[]) : []; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "Items"', + }); + } const entries: undefined | readonly FileFullOrFolderMiniOrWebLink[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/keywordSkillCard.generated.ts b/src/schemas/keywordSkillCard.generated.ts index 4d548236..f1f23813 100644 --- a/src/schemas/keywordSkillCard.generated.ts +++ b/src/schemas/keywordSkillCard.generated.ts @@ -112,7 +112,7 @@ export function serializeKeywordSkillCardTypeField( return val; } export function deserializeKeywordSkillCardTypeField( - val: any + val: SerializedData ): KeywordSkillCardTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -132,7 +132,7 @@ export function serializeKeywordSkillCardSkillCardTypeField( return val; } export function deserializeKeywordSkillCardSkillCardTypeField( - val: any + val: SerializedData ): KeywordSkillCardSkillCardTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -155,9 +155,32 @@ export function serializeKeywordSkillCardSkillCardTitleField( }; } export function deserializeKeywordSkillCardSkillCardTitleField( - val: any + val: SerializedData ): KeywordSkillCardSkillCardTitleField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "KeywordSkillCardSkillCardTitleField"', + }); + } + if (!(val.code == void 0) && !sdIsString(val.code)) { + throw new BoxSdkError({ + message: + 'Expecting string for "code" of type "KeywordSkillCardSkillCardTitleField"', + }); + } const code: undefined | string = val.code == void 0 ? void 0 : val.code; + if (val.message == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "message" of type "KeywordSkillCardSkillCardTitleField" to be defined', + }); + } + if (!sdIsString(val.message)) { + throw new BoxSdkError({ + message: + 'Expecting string for "message" of type "KeywordSkillCardSkillCardTitleField"', + }); + } const message: string = val.message; return { code: code, @@ -170,7 +193,7 @@ export function serializeKeywordSkillCardSkillTypeField( return val; } export function deserializeKeywordSkillCardSkillTypeField( - val: any + val: SerializedData ): KeywordSkillCardSkillTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -193,10 +216,32 @@ export function serializeKeywordSkillCardSkillField( }; } export function deserializeKeywordSkillCardSkillField( - val: any + val: SerializedData ): KeywordSkillCardSkillField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "KeywordSkillCardSkillField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "KeywordSkillCardSkillField" to be defined', + }); + } const type: KeywordSkillCardSkillTypeField = deserializeKeywordSkillCardSkillTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "KeywordSkillCardSkillField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "KeywordSkillCardSkillField"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies KeywordSkillCardSkillField; } @@ -212,12 +257,29 @@ export function serializeKeywordSkillCardSkillFieldInput( }; } export function deserializeKeywordSkillCardSkillFieldInput( - val: any + val: SerializedData ): KeywordSkillCardSkillFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "KeywordSkillCardSkillFieldInput"', + }); + } const type: undefined | KeywordSkillCardSkillTypeField = val.type == void 0 ? void 0 : deserializeKeywordSkillCardSkillTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "KeywordSkillCardSkillFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "KeywordSkillCardSkillFieldInput"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies KeywordSkillCardSkillFieldInput; } @@ -227,7 +289,7 @@ export function serializeKeywordSkillCardInvocationTypeField( return val; } export function deserializeKeywordSkillCardInvocationTypeField( - val: any + val: SerializedData ): KeywordSkillCardInvocationTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -250,10 +312,33 @@ export function serializeKeywordSkillCardInvocationField( }; } export function deserializeKeywordSkillCardInvocationField( - val: any + val: SerializedData ): KeywordSkillCardInvocationField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "KeywordSkillCardInvocationField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "KeywordSkillCardInvocationField" to be defined', + }); + } const type: KeywordSkillCardInvocationTypeField = deserializeKeywordSkillCardInvocationTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "KeywordSkillCardInvocationField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "KeywordSkillCardInvocationField"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies KeywordSkillCardInvocationField; } @@ -269,12 +354,29 @@ export function serializeKeywordSkillCardInvocationFieldInput( }; } export function deserializeKeywordSkillCardInvocationFieldInput( - val: any + val: SerializedData ): KeywordSkillCardInvocationFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "KeywordSkillCardInvocationFieldInput"', + }); + } const type: undefined | KeywordSkillCardInvocationTypeField = val.type == void 0 ? void 0 : deserializeKeywordSkillCardInvocationTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "KeywordSkillCardInvocationFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "KeywordSkillCardInvocationFieldInput"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies KeywordSkillCardInvocationFieldInput; } @@ -284,8 +386,19 @@ export function serializeKeywordSkillCardEntriesField( return { ['text']: val.text == void 0 ? void 0 : val.text }; } export function deserializeKeywordSkillCardEntriesField( - val: any + val: SerializedData ): KeywordSkillCardEntriesField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "KeywordSkillCardEntriesField"', + }); + } + if (!(val.text == void 0) && !sdIsString(val.text)) { + throw new BoxSdkError({ + message: + 'Expecting string for "text" of type "KeywordSkillCardEntriesField"', + }); + } const text: undefined | string = val.text == void 0 ? void 0 : val.text; return { text: text } satisfies KeywordSkillCardEntriesField; } @@ -312,22 +425,66 @@ export function serializeKeywordSkillCard( }) as readonly any[], }; } -export function deserializeKeywordSkillCard(val: any): KeywordSkillCard { +export function deserializeKeywordSkillCard( + val: SerializedData +): KeywordSkillCard { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "KeywordSkillCard"', + }); + } + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "KeywordSkillCard"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "KeywordSkillCard" to be defined', + }); + } const type: KeywordSkillCardTypeField = deserializeKeywordSkillCardTypeField( val.type ); + if (val.skill_card_type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "skill_card_type" of type "KeywordSkillCard" to be defined', + }); + } const skillCardType: KeywordSkillCardSkillCardTypeField = deserializeKeywordSkillCardSkillCardTypeField(val.skill_card_type); const skillCardTitle: undefined | KeywordSkillCardSkillCardTitleField = val.skill_card_title == void 0 ? void 0 : deserializeKeywordSkillCardSkillCardTitleField(val.skill_card_title); + if (val.skill == void 0) { + throw new BoxSdkError({ + message: 'Expecting "skill" of type "KeywordSkillCard" to be defined', + }); + } const skill: KeywordSkillCardSkillField = deserializeKeywordSkillCardSkillField(val.skill); + if (val.invocation == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "invocation" of type "KeywordSkillCard" to be defined', + }); + } const invocation: KeywordSkillCardInvocationField = deserializeKeywordSkillCardInvocationField(val.invocation); + if (val.entries == void 0) { + throw new BoxSdkError({ + message: 'Expecting "entries" of type "KeywordSkillCard" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "KeywordSkillCard"', + }); + } const entries: readonly KeywordSkillCardEntriesField[] = sdIsList(val.entries) ? (val.entries.map(function ( itm: SerializedData @@ -373,8 +530,19 @@ export function serializeKeywordSkillCardInput( }; } export function deserializeKeywordSkillCardInput( - val: any + val: SerializedData ): KeywordSkillCardInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "KeywordSkillCardInput"', + }); + } + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "KeywordSkillCardInput"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); const type: undefined | KeywordSkillCardTypeField = @@ -389,10 +557,33 @@ export function deserializeKeywordSkillCardInput( val.skill_card_title == void 0 ? void 0 : deserializeKeywordSkillCardSkillCardTitleField(val.skill_card_title); + if (val.skill == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "skill" of type "KeywordSkillCardInput" to be defined', + }); + } const skill: KeywordSkillCardSkillField = deserializeKeywordSkillCardSkillField(val.skill); + if (val.invocation == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "invocation" of type "KeywordSkillCardInput" to be defined', + }); + } const invocation: KeywordSkillCardInvocationField = deserializeKeywordSkillCardInvocationField(val.invocation); + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "KeywordSkillCardInput" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "KeywordSkillCardInput"', + }); + } const entries: readonly KeywordSkillCardEntriesField[] = sdIsList(val.entries) ? (val.entries.map(function ( itm: SerializedData diff --git a/src/schemas/keywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard.generated.ts b/src/schemas/keywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard.generated.ts index 4ad7633f..da31191f 100644 --- a/src/schemas/keywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard.generated.ts +++ b/src/schemas/keywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard.generated.ts @@ -38,7 +38,7 @@ export function serializeKeywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrT throw new BoxSdkError({ message: 'unknown type' }); } export function deserializeKeywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard( - val: any + val: SerializedData ): KeywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard { if (!sdIsMap(val)) { throw new BoxSdkError({ diff --git a/src/schemas/legalHoldPolicies.generated.ts b/src/schemas/legalHoldPolicies.generated.ts index c0ce13e3..78ffb813 100644 --- a/src/schemas/legalHoldPolicies.generated.ts +++ b/src/schemas/legalHoldPolicies.generated.ts @@ -1,6 +1,7 @@ import { serializeLegalHoldPolicy } from './legalHoldPolicy.generated.js'; import { deserializeLegalHoldPolicy } from './legalHoldPolicy.generated.js'; import { LegalHoldPolicy } from './legalHoldPolicy.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -29,12 +30,39 @@ export function serializeLegalHoldPolicies( }) as readonly any[]), }; } -export function deserializeLegalHoldPolicies(val: any): LegalHoldPolicies { +export function deserializeLegalHoldPolicies( + val: SerializedData +): LegalHoldPolicies { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "LegalHoldPolicies"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "LegalHoldPolicies"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "next_marker" of type "LegalHoldPolicies"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "prev_marker" of type "LegalHoldPolicies"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "LegalHoldPolicies"', + }); + } const entries: undefined | readonly LegalHoldPolicy[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/legalHoldPolicy.generated.ts b/src/schemas/legalHoldPolicy.generated.ts index 867b1697..12f29021 100644 --- a/src/schemas/legalHoldPolicy.generated.ts +++ b/src/schemas/legalHoldPolicy.generated.ts @@ -51,7 +51,7 @@ export function serializeLegalHoldPolicyStatusField( return val; } export function deserializeLegalHoldPolicyStatusField( - val: any + val: SerializedData ): LegalHoldPolicyStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -85,11 +85,40 @@ export function serializeLegalHoldPolicyAssignmentCountsField( }; } export function deserializeLegalHoldPolicyAssignmentCountsField( - val: any + val: SerializedData ): LegalHoldPolicyAssignmentCountsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "LegalHoldPolicyAssignmentCountsField"', + }); + } + if (!(val.user == void 0) && !sdIsNumber(val.user)) { + throw new BoxSdkError({ + message: + 'Expecting number for "user" of type "LegalHoldPolicyAssignmentCountsField"', + }); + } const user: undefined | number = val.user == void 0 ? void 0 : val.user; + if (!(val.folder == void 0) && !sdIsNumber(val.folder)) { + throw new BoxSdkError({ + message: + 'Expecting number for "folder" of type "LegalHoldPolicyAssignmentCountsField"', + }); + } const folder: undefined | number = val.folder == void 0 ? void 0 : val.folder; + if (!(val.file == void 0) && !sdIsNumber(val.file)) { + throw new BoxSdkError({ + message: + 'Expecting number for "file" of type "LegalHoldPolicyAssignmentCountsField"', + }); + } const file: undefined | number = val.file == void 0 ? void 0 : val.file; + if (!(val.file_version == void 0) && !sdIsNumber(val.file_version)) { + throw new BoxSdkError({ + message: + 'Expecting number for "file_version" of type "LegalHoldPolicyAssignmentCountsField"', + }); + } const fileVersion: undefined | number = val.file_version == void 0 ? void 0 : val.file_version; return { @@ -137,9 +166,24 @@ export function serializeLegalHoldPolicy(val: LegalHoldPolicy): SerializedData { }, }; } -export function deserializeLegalHoldPolicy(val: any): LegalHoldPolicy { +export function deserializeLegalHoldPolicy( + val: SerializedData +): LegalHoldPolicy { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "LegalHoldPolicy"' }); + } + if (!(val.policy_name == void 0) && !sdIsString(val.policy_name)) { + throw new BoxSdkError({ + message: 'Expecting string for "policy_name" of type "LegalHoldPolicy"', + }); + } const policyName: undefined | string = val.policy_name == void 0 ? void 0 : val.policy_name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "LegalHoldPolicy"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; const status: undefined | LegalHoldPolicyStatusField = @@ -152,23 +196,73 @@ export function deserializeLegalHoldPolicy(val: any): LegalHoldPolicy { : deserializeLegalHoldPolicyAssignmentCountsField(val.assignment_counts); const createdBy: undefined | UserMini = val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "LegalHoldPolicy"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "LegalHoldPolicy"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (!(val.deleted_at == void 0) && !sdIsString(val.deleted_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "deleted_at" of type "LegalHoldPolicy"', + }); + } const deletedAt: undefined | DateTime = val.deleted_at == void 0 ? void 0 : deserializeDateTime(val.deleted_at); + if ( + !(val.filter_started_at == void 0) && + !sdIsString(val.filter_started_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "filter_started_at" of type "LegalHoldPolicy"', + }); + } const filterStartedAt: undefined | DateTime = val.filter_started_at == void 0 ? void 0 : deserializeDateTime(val.filter_started_at); + if (!(val.filter_ended_at == void 0) && !sdIsString(val.filter_ended_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "filter_ended_at" of type "LegalHoldPolicy"', + }); + } const filterEndedAt: undefined | DateTime = val.filter_ended_at == void 0 ? void 0 : deserializeDateTime(val.filter_ended_at); + if (!(val.release_notes == void 0) && !sdIsString(val.release_notes)) { + throw new BoxSdkError({ + message: 'Expecting string for "release_notes" of type "LegalHoldPolicy"', + }); + } const releaseNotes: undefined | string = val.release_notes == void 0 ? void 0 : val.release_notes; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "LegalHoldPolicy" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "LegalHoldPolicy"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "LegalHoldPolicy" to be defined', + }); + } const type: LegalHoldPolicyMiniTypeField = deserializeLegalHoldPolicyMiniTypeField(val.type); return { diff --git a/src/schemas/legalHoldPolicyAssignment.generated.ts b/src/schemas/legalHoldPolicyAssignment.generated.ts index 0066d0e4..1795c7b1 100644 --- a/src/schemas/legalHoldPolicyAssignment.generated.ts +++ b/src/schemas/legalHoldPolicyAssignment.generated.ts @@ -61,8 +61,13 @@ export function serializeLegalHoldPolicyAssignment( }; } export function deserializeLegalHoldPolicyAssignment( - val: any + val: SerializedData ): LegalHoldPolicyAssignment { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "LegalHoldPolicyAssignment"', + }); + } const legalHoldPolicy: undefined | LegalHoldPolicyMini = val.legal_hold_policy == void 0 ? void 0 @@ -73,10 +78,27 @@ export function deserializeLegalHoldPolicyAssignment( : deserializeFileOrFolderOrWebLink(val.assigned_to); const assignedBy: undefined | UserMini = val.assigned_by == void 0 ? void 0 : deserializeUserMini(val.assigned_by); + if (!(val.assigned_at == void 0) && !sdIsString(val.assigned_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "assigned_at" of type "LegalHoldPolicyAssignment"', + }); + } const assignedAt: undefined | DateTime = val.assigned_at == void 0 ? void 0 : deserializeDateTime(val.assigned_at); + if (!(val.deleted_at == void 0) && !sdIsString(val.deleted_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "deleted_at" of type "LegalHoldPolicyAssignment"', + }); + } const deletedAt: undefined | DateTime = val.deleted_at == void 0 ? void 0 : deserializeDateTime(val.deleted_at); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "LegalHoldPolicyAssignment"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | LegalHoldPolicyAssignmentBaseTypeField = val.type == void 0 diff --git a/src/schemas/legalHoldPolicyAssignmentBase.generated.ts b/src/schemas/legalHoldPolicyAssignmentBase.generated.ts index ad4796c8..6565903c 100644 --- a/src/schemas/legalHoldPolicyAssignmentBase.generated.ts +++ b/src/schemas/legalHoldPolicyAssignmentBase.generated.ts @@ -18,7 +18,7 @@ export function serializeLegalHoldPolicyAssignmentBaseTypeField( return val; } export function deserializeLegalHoldPolicyAssignmentBaseTypeField( - val: any + val: SerializedData ): LegalHoldPolicyAssignmentBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -45,8 +45,19 @@ export function serializeLegalHoldPolicyAssignmentBase( }; } export function deserializeLegalHoldPolicyAssignmentBase( - val: any + val: SerializedData ): LegalHoldPolicyAssignmentBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "LegalHoldPolicyAssignmentBase"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "LegalHoldPolicyAssignmentBase"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | LegalHoldPolicyAssignmentBaseTypeField = val.type == void 0 diff --git a/src/schemas/legalHoldPolicyAssignments.generated.ts b/src/schemas/legalHoldPolicyAssignments.generated.ts index e8c01e64..102e5e54 100644 --- a/src/schemas/legalHoldPolicyAssignments.generated.ts +++ b/src/schemas/legalHoldPolicyAssignments.generated.ts @@ -1,6 +1,7 @@ import { serializeLegalHoldPolicyAssignment } from './legalHoldPolicyAssignment.generated.js'; import { deserializeLegalHoldPolicyAssignment } from './legalHoldPolicyAssignment.generated.js'; import { LegalHoldPolicyAssignment } from './legalHoldPolicyAssignment.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -32,13 +33,42 @@ export function serializeLegalHoldPolicyAssignments( }; } export function deserializeLegalHoldPolicyAssignments( - val: any + val: SerializedData ): LegalHoldPolicyAssignments { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "LegalHoldPolicyAssignments"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "LegalHoldPolicyAssignments"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "LegalHoldPolicyAssignments"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "prev_marker" of type "LegalHoldPolicyAssignments"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "LegalHoldPolicyAssignments"', + }); + } const entries: undefined | readonly LegalHoldPolicyAssignment[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/legalHoldPolicyMini.generated.ts b/src/schemas/legalHoldPolicyMini.generated.ts index 4a8bf6d4..b9ed4b5b 100644 --- a/src/schemas/legalHoldPolicyMini.generated.ts +++ b/src/schemas/legalHoldPolicyMini.generated.ts @@ -33,7 +33,7 @@ export function serializeLegalHoldPolicyMiniTypeField( return val; } export function deserializeLegalHoldPolicyMiniTypeField( - val: any + val: SerializedData ): LegalHoldPolicyMiniTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -55,8 +55,30 @@ export function serializeLegalHoldPolicyMini( ['type']: serializeLegalHoldPolicyMiniTypeField(val.type), }; } -export function deserializeLegalHoldPolicyMini(val: any): LegalHoldPolicyMini { +export function deserializeLegalHoldPolicyMini( + val: SerializedData +): LegalHoldPolicyMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "LegalHoldPolicyMini"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "LegalHoldPolicyMini" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "LegalHoldPolicyMini"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "LegalHoldPolicyMini" to be defined', + }); + } const type: LegalHoldPolicyMiniTypeField = deserializeLegalHoldPolicyMiniTypeField(val.type); return { id: id, type: type } satisfies LegalHoldPolicyMini; @@ -73,8 +95,24 @@ export function serializeLegalHoldPolicyMiniInput( }; } export function deserializeLegalHoldPolicyMiniInput( - val: any + val: SerializedData ): LegalHoldPolicyMiniInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "LegalHoldPolicyMiniInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "LegalHoldPolicyMiniInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "LegalHoldPolicyMiniInput"', + }); + } const id: string = val.id; const type: undefined | LegalHoldPolicyMiniTypeField = val.type == void 0 diff --git a/src/schemas/metadata.generated.ts b/src/schemas/metadata.generated.ts index 4265e439..34e143da 100644 --- a/src/schemas/metadata.generated.ts +++ b/src/schemas/metadata.generated.ts @@ -12,6 +12,6 @@ export type Metadata = MetadataBase; export function serializeMetadata(val: Metadata): SerializedData { return serializeMetadataBase(val); } -export function deserializeMetadata(val: any): Metadata { +export function deserializeMetadata(val: SerializedData): Metadata { return deserializeMetadataBase(val); } diff --git a/src/schemas/metadataBase.generated.ts b/src/schemas/metadataBase.generated.ts index b56b11cf..80ce9cc1 100644 --- a/src/schemas/metadataBase.generated.ts +++ b/src/schemas/metadataBase.generated.ts @@ -1,3 +1,4 @@ +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -19,12 +20,35 @@ export function serializeMetadataBase(val: MetadataBase): SerializedData { ['$version']: val.version == void 0 ? void 0 : val.version, }; } -export function deserializeMetadataBase(val: any): MetadataBase { +export function deserializeMetadataBase(val: SerializedData): MetadataBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "MetadataBase"' }); + } + if (!(val.$parent == void 0) && !sdIsString(val.$parent)) { + throw new BoxSdkError({ + message: 'Expecting string for "$parent" of type "MetadataBase"', + }); + } const parent: undefined | string = val.$parent == void 0 ? void 0 : val.$parent; + if (!(val.$template == void 0) && !sdIsString(val.$template)) { + throw new BoxSdkError({ + message: 'Expecting string for "$template" of type "MetadataBase"', + }); + } const template: undefined | string = val.$template == void 0 ? void 0 : val.$template; + if (!(val.$scope == void 0) && !sdIsString(val.$scope)) { + throw new BoxSdkError({ + message: 'Expecting string for "$scope" of type "MetadataBase"', + }); + } const scope: undefined | string = val.$scope == void 0 ? void 0 : val.$scope; + if (!(val.$version == void 0) && !sdIsNumber(val.$version)) { + throw new BoxSdkError({ + message: 'Expecting number for "$version" of type "MetadataBase"', + }); + } const version: undefined | number = val.$version == void 0 ? void 0 : val.$version; return { diff --git a/src/schemas/metadataCascadePolicies.generated.ts b/src/schemas/metadataCascadePolicies.generated.ts index 2d53c744..a33f2767 100644 --- a/src/schemas/metadataCascadePolicies.generated.ts +++ b/src/schemas/metadataCascadePolicies.generated.ts @@ -1,6 +1,7 @@ import { serializeMetadataCascadePolicy } from './metadataCascadePolicy.generated.js'; import { deserializeMetadataCascadePolicy } from './metadataCascadePolicy.generated.js'; import { MetadataCascadePolicy } from './metadataCascadePolicy.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -32,13 +33,41 @@ export function serializeMetadataCascadePolicies( }; } export function deserializeMetadataCascadePolicies( - val: any + val: SerializedData ): MetadataCascadePolicies { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataCascadePolicies"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "MetadataCascadePolicies"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "MetadataCascadePolicies"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "prev_marker" of type "MetadataCascadePolicies"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "MetadataCascadePolicies"', + }); + } const entries: undefined | readonly MetadataCascadePolicy[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/metadataCascadePolicy.generated.ts b/src/schemas/metadataCascadePolicy.generated.ts index 5eb01a12..d63545e0 100644 --- a/src/schemas/metadataCascadePolicy.generated.ts +++ b/src/schemas/metadataCascadePolicy.generated.ts @@ -63,7 +63,7 @@ export function serializeMetadataCascadePolicyTypeField( return val; } export function deserializeMetadataCascadePolicyTypeField( - val: any + val: SerializedData ): MetadataCascadePolicyTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -83,7 +83,7 @@ export function serializeMetadataCascadePolicyOwnerEnterpriseTypeField( return val; } export function deserializeMetadataCascadePolicyOwnerEnterpriseTypeField( - val: any + val: SerializedData ): MetadataCascadePolicyOwnerEnterpriseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -110,12 +110,24 @@ export function serializeMetadataCascadePolicyOwnerEnterpriseField( }; } export function deserializeMetadataCascadePolicyOwnerEnterpriseField( - val: any + val: SerializedData ): MetadataCascadePolicyOwnerEnterpriseField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "MetadataCascadePolicyOwnerEnterpriseField"', + }); + } const type: undefined | MetadataCascadePolicyOwnerEnterpriseTypeField = val.type == void 0 ? void 0 : deserializeMetadataCascadePolicyOwnerEnterpriseTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "MetadataCascadePolicyOwnerEnterpriseField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { type: type, @@ -128,7 +140,7 @@ export function serializeMetadataCascadePolicyParentTypeField( return val; } export function deserializeMetadataCascadePolicyParentTypeField( - val: any + val: SerializedData ): MetadataCascadePolicyParentTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -154,12 +166,23 @@ export function serializeMetadataCascadePolicyParentField( }; } export function deserializeMetadataCascadePolicyParentField( - val: any + val: SerializedData ): MetadataCascadePolicyParentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataCascadePolicyParentField"', + }); + } const type: undefined | MetadataCascadePolicyParentTypeField = val.type == void 0 ? void 0 : deserializeMetadataCascadePolicyParentTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "MetadataCascadePolicyParentField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { type: type, id: id } satisfies MetadataCascadePolicyParentField; } @@ -184,9 +207,29 @@ export function serializeMetadataCascadePolicy( }; } export function deserializeMetadataCascadePolicy( - val: any + val: SerializedData ): MetadataCascadePolicy { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataCascadePolicy"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "MetadataCascadePolicy" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "MetadataCascadePolicy"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "MetadataCascadePolicy" to be defined', + }); + } const type: MetadataCascadePolicyTypeField = deserializeMetadataCascadePolicyTypeField(val.type); const ownerEnterprise: undefined | MetadataCascadePolicyOwnerEnterpriseField = @@ -199,7 +242,18 @@ export function deserializeMetadataCascadePolicy( val.parent == void 0 ? void 0 : deserializeMetadataCascadePolicyParentField(val.parent); + if (!(val.scope == void 0) && !sdIsString(val.scope)) { + throw new BoxSdkError({ + message: 'Expecting string for "scope" of type "MetadataCascadePolicy"', + }); + } const scope: undefined | string = val.scope == void 0 ? void 0 : val.scope; + if (!(val.templateKey == void 0) && !sdIsString(val.templateKey)) { + throw new BoxSdkError({ + message: + 'Expecting string for "templateKey" of type "MetadataCascadePolicy"', + }); + } const templateKey: undefined | string = val.templateKey == void 0 ? void 0 : val.templateKey; return { @@ -235,8 +289,24 @@ export function serializeMetadataCascadePolicyInput( }; } export function deserializeMetadataCascadePolicyInput( - val: any + val: SerializedData ): MetadataCascadePolicyInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataCascadePolicyInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "MetadataCascadePolicyInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "MetadataCascadePolicyInput"', + }); + } const id: string = val.id; const type: undefined | MetadataCascadePolicyTypeField = val.type == void 0 @@ -252,7 +322,19 @@ export function deserializeMetadataCascadePolicyInput( val.parent == void 0 ? void 0 : deserializeMetadataCascadePolicyParentField(val.parent); + if (!(val.scope == void 0) && !sdIsString(val.scope)) { + throw new BoxSdkError({ + message: + 'Expecting string for "scope" of type "MetadataCascadePolicyInput"', + }); + } const scope: undefined | string = val.scope == void 0 ? void 0 : val.scope; + if (!(val.templateKey == void 0) && !sdIsString(val.templateKey)) { + throw new BoxSdkError({ + message: + 'Expecting string for "templateKey" of type "MetadataCascadePolicyInput"', + }); + } const templateKey: undefined | string = val.templateKey == void 0 ? void 0 : val.templateKey; return { diff --git a/src/schemas/metadataFieldFilterDateRange.generated.ts b/src/schemas/metadataFieldFilterDateRange.generated.ts index a1b76a8a..0dc5e7bf 100644 --- a/src/schemas/metadataFieldFilterDateRange.generated.ts +++ b/src/schemas/metadataFieldFilterDateRange.generated.ts @@ -1,6 +1,7 @@ import { serializeDateTime } from '../internal/utils.js'; import { deserializeDateTime } from '../internal/utils.js'; import { DateTime } from '../internal/utils.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -21,10 +22,27 @@ export function serializeMetadataFieldFilterDateRange( }; } export function deserializeMetadataFieldFilterDateRange( - val: any + val: SerializedData ): MetadataFieldFilterDateRange { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataFieldFilterDateRange"', + }); + } + if (!(val.lt == void 0) && !sdIsString(val.lt)) { + throw new BoxSdkError({ + message: + 'Expecting string for "lt" of type "MetadataFieldFilterDateRange"', + }); + } const lt: undefined | DateTime = val.lt == void 0 ? void 0 : deserializeDateTime(val.lt); + if (!(val.gt == void 0) && !sdIsString(val.gt)) { + throw new BoxSdkError({ + message: + 'Expecting string for "gt" of type "MetadataFieldFilterDateRange"', + }); + } const gt: undefined | DateTime = val.gt == void 0 ? void 0 : deserializeDateTime(val.gt); return { lt: lt, gt: gt } satisfies MetadataFieldFilterDateRange; diff --git a/src/schemas/metadataFieldFilterDateRangeOrMetadataFieldFilterFloatRangeOrArrayOfStringOrNumberOrString.generated.ts b/src/schemas/metadataFieldFilterDateRangeOrMetadataFieldFilterFloatRangeOrArrayOfStringOrNumberOrString.generated.ts index 13e11af4..cdda0298 100644 --- a/src/schemas/metadataFieldFilterDateRangeOrMetadataFieldFilterFloatRangeOrArrayOfStringOrNumberOrString.generated.ts +++ b/src/schemas/metadataFieldFilterDateRangeOrMetadataFieldFilterFloatRangeOrArrayOfStringOrNumberOrString.generated.ts @@ -49,7 +49,7 @@ export function serializeMetadataFieldFilterDateRangeOrMetadataFieldFilterFloatR }); } export function deserializeMetadataFieldFilterDateRangeOrMetadataFieldFilterFloatRangeOrArrayOfStringOrNumberOrString( - val: any + val: SerializedData ): MetadataFieldFilterDateRangeOrMetadataFieldFilterFloatRangeOrArrayOfStringOrNumberOrString { if (sdIsString(val)) { return val; diff --git a/src/schemas/metadataFieldFilterFloatRange.generated.ts b/src/schemas/metadataFieldFilterFloatRange.generated.ts index 631c732a..d7210706 100644 --- a/src/schemas/metadataFieldFilterFloatRange.generated.ts +++ b/src/schemas/metadataFieldFilterFloatRange.generated.ts @@ -1,3 +1,4 @@ +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -18,9 +19,26 @@ export function serializeMetadataFieldFilterFloatRange( }; } export function deserializeMetadataFieldFilterFloatRange( - val: any + val: SerializedData ): MetadataFieldFilterFloatRange { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataFieldFilterFloatRange"', + }); + } + if (!(val.lt == void 0) && !sdIsNumber(val.lt)) { + throw new BoxSdkError({ + message: + 'Expecting number for "lt" of type "MetadataFieldFilterFloatRange"', + }); + } const lt: undefined | number = val.lt == void 0 ? void 0 : val.lt; + if (!(val.gt == void 0) && !sdIsNumber(val.gt)) { + throw new BoxSdkError({ + message: + 'Expecting number for "gt" of type "MetadataFieldFilterFloatRange"', + }); + } const gt: undefined | number = val.gt == void 0 ? void 0 : val.gt; return { lt: lt, gt: gt } satisfies MetadataFieldFilterFloatRange; } diff --git a/src/schemas/metadataFilter.generated.ts b/src/schemas/metadataFilter.generated.ts index aaaace79..fb133fc5 100644 --- a/src/schemas/metadataFilter.generated.ts +++ b/src/schemas/metadataFilter.generated.ts @@ -28,7 +28,7 @@ export function serializeMetadataFilterScopeField( return val; } export function deserializeMetadataFilterScopeField( - val: any + val: SerializedData ): MetadataFilterScopeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -70,20 +70,47 @@ export function serializeMetadataFilter(val: MetadataFilter): SerializedData { }), }; } -export function deserializeMetadataFilter(val: any): MetadataFilter { +export function deserializeMetadataFilter(val: SerializedData): MetadataFilter { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "MetadataFilter"' }); + } const scope: undefined | MetadataFilterScopeField = val.scope == void 0 ? void 0 : deserializeMetadataFilterScopeField(val.scope); + if (!(val.templateKey == void 0) && !sdIsString(val.templateKey)) { + throw new BoxSdkError({ + message: 'Expecting string for "templateKey" of type "MetadataFilter"', + }); + } const templateKey: undefined | string = val.templateKey == void 0 ? void 0 : val.templateKey; + if (!(val.filters == void 0) && !sdIsMap(val.filters)) { + throw new BoxSdkError({ + message: 'Expecting object for "filters" of type "MetadataFilter"', + }); + } const filters: | undefined | { readonly [ key: string ]: MetadataFieldFilterDateRangeOrMetadataFieldFilterFloatRangeOrArrayOfStringOrNumberOrString; - } = val.filters == void 0 ? void 0 : val.filters; + } = + val.filters == void 0 + ? void 0 + : sdIsMap(val.filters) + ? (Object.fromEntries( + Object.entries(val.filters).map(([k, v]: [string, any]) => [ + k, + deserializeMetadataFieldFilterDateRangeOrMetadataFieldFilterFloatRangeOrArrayOfStringOrNumberOrString( + v + ), + ]) + ) as { + readonly [key: string]: any; + }) + : {}; return { scope: scope, templateKey: templateKey, diff --git a/src/schemas/metadataFull.generated.ts b/src/schemas/metadataFull.generated.ts index 4f8ebe51..24ccd352 100644 --- a/src/schemas/metadataFull.generated.ts +++ b/src/schemas/metadataFull.generated.ts @@ -39,23 +39,85 @@ export function serializeMetadataFull(val: MetadataFull): SerializedData { }, }; } -export function deserializeMetadataFull(val: any): MetadataFull { +export function deserializeMetadataFull(val: SerializedData): MetadataFull { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "MetadataFull"' }); + } + if (!(val.$canEdit == void 0) && !sdIsBoolean(val.$canEdit)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "$canEdit" of type "MetadataFull"', + }); + } const canEdit: undefined | boolean = val.$canEdit == void 0 ? void 0 : val.$canEdit; + if (!(val.$id == void 0) && !sdIsString(val.$id)) { + throw new BoxSdkError({ + message: 'Expecting string for "$id" of type "MetadataFull"', + }); + } const id: undefined | string = val.$id == void 0 ? void 0 : val.$id; + if (!(val.$type == void 0) && !sdIsString(val.$type)) { + throw new BoxSdkError({ + message: 'Expecting string for "$type" of type "MetadataFull"', + }); + } const type: undefined | string = val.$type == void 0 ? void 0 : val.$type; + if (!(val.$typeVersion == void 0) && !sdIsNumber(val.$typeVersion)) { + throw new BoxSdkError({ + message: 'Expecting number for "$typeVersion" of type "MetadataFull"', + }); + } const typeVersion: undefined | number = val.$typeVersion == void 0 ? void 0 : val.$typeVersion; + if (!(val == void 0) && !sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting object for "extraData" of type "MetadataFull"', + }); + } const extraData: | undefined | { readonly [key: string]: any; - } = val == void 0 ? void 0 : val; + } = + val == void 0 + ? void 0 + : sdIsMap(val) + ? (Object.fromEntries( + Object.entries(val).map(([k, v]: [string, any]) => [ + k, + (function (v: any): any { + return v; + })(v), + ]) + ) as { + readonly [key: string]: any; + }) + : {}; + if (!(val.$parent == void 0) && !sdIsString(val.$parent)) { + throw new BoxSdkError({ + message: 'Expecting string for "$parent" of type "MetadataFull"', + }); + } const parent: undefined | string = val.$parent == void 0 ? void 0 : val.$parent; + if (!(val.$template == void 0) && !sdIsString(val.$template)) { + throw new BoxSdkError({ + message: 'Expecting string for "$template" of type "MetadataFull"', + }); + } const template: undefined | string = val.$template == void 0 ? void 0 : val.$template; + if (!(val.$scope == void 0) && !sdIsString(val.$scope)) { + throw new BoxSdkError({ + message: 'Expecting string for "$scope" of type "MetadataFull"', + }); + } const scope: undefined | string = val.$scope == void 0 ? void 0 : val.$scope; + if (!(val.$version == void 0) && !sdIsNumber(val.$version)) { + throw new BoxSdkError({ + message: 'Expecting number for "$version" of type "MetadataFull"', + }); + } const version: undefined | number = val.$version == void 0 ? void 0 : val.$version; return { diff --git a/src/schemas/metadataQuery.generated.ts b/src/schemas/metadataQuery.generated.ts index 7bc9e6e2..012ca8c1 100644 --- a/src/schemas/metadataQuery.generated.ts +++ b/src/schemas/metadataQuery.generated.ts @@ -29,7 +29,7 @@ export function serializeMetadataQueryOrderByDirectionField( return val; } export function deserializeMetadataQueryOrderByDirectionField( - val: any + val: SerializedData ): MetadataQueryOrderByDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -58,8 +58,19 @@ export function serializeMetadataQueryOrderByField( }; } export function deserializeMetadataQueryOrderByField( - val: any + val: SerializedData ): MetadataQueryOrderByField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataQueryOrderByField"', + }); + } + if (!(val.field_key == void 0) && !sdIsString(val.field_key)) { + throw new BoxSdkError({ + message: + 'Expecting string for "field_key" of type "MetadataQueryOrderByField"', + }); + } const fieldKey: undefined | string = val.field_key == void 0 ? void 0 : val.field_key; const direction: undefined | MetadataQueryOrderByDirectionField = @@ -95,15 +106,74 @@ export function serializeMetadataQuery(val: MetadataQuery): SerializedData { }) as readonly any[]), }; } -export function deserializeMetadataQuery(val: any): MetadataQuery { +export function deserializeMetadataQuery(val: SerializedData): MetadataQuery { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "MetadataQuery"' }); + } + if (val.from == void 0) { + throw new BoxSdkError({ + message: 'Expecting "from" of type "MetadataQuery" to be defined', + }); + } + if (!sdIsString(val.from)) { + throw new BoxSdkError({ + message: 'Expecting string for "from" of type "MetadataQuery"', + }); + } const from: string = val.from; + if (!(val.query == void 0) && !sdIsString(val.query)) { + throw new BoxSdkError({ + message: 'Expecting string for "query" of type "MetadataQuery"', + }); + } const query: undefined | string = val.query == void 0 ? void 0 : val.query; + if (!(val.query_params == void 0) && !sdIsMap(val.query_params)) { + throw new BoxSdkError({ + message: 'Expecting object for "query_params" of type "MetadataQuery"', + }); + } const queryParams: | undefined | { readonly [key: string]: string; - } = val.query_params == void 0 ? void 0 : val.query_params; + } = + val.query_params == void 0 + ? void 0 + : sdIsMap(val.query_params) + ? (Object.fromEntries( + Object.entries(val.query_params).map(([k, v]: [string, any]) => [ + k, + (function (v: any): any { + if (!sdIsString(v)) { + throw new BoxSdkError({ + message: 'Expecting string for "MetadataQuery"', + }); + } + return v; + })(v), + ]) + ) as { + readonly [key: string]: any; + }) + : {}; + if (val.ancestor_folder_id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "ancestor_folder_id" of type "MetadataQuery" to be defined', + }); + } + if (!sdIsString(val.ancestor_folder_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "ancestor_folder_id" of type "MetadataQuery"', + }); + } const ancestorFolderId: string = val.ancestor_folder_id; + if (!(val.order_by == void 0) && !sdIsList(val.order_by)) { + throw new BoxSdkError({ + message: 'Expecting array for "order_by" of type "MetadataQuery"', + }); + } const orderBy: undefined | readonly MetadataQueryOrderByField[] = val.order_by == void 0 ? void 0 @@ -114,10 +184,36 @@ export function deserializeMetadataQuery(val: any): MetadataQuery { return deserializeMetadataQueryOrderByField(itm); }) as readonly any[]) : []; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "MetadataQuery"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.marker == void 0) && !sdIsString(val.marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "marker" of type "MetadataQuery"', + }); + } const marker: undefined | string = val.marker == void 0 ? void 0 : val.marker; + if (!(val.fields == void 0) && !sdIsList(val.fields)) { + throw new BoxSdkError({ + message: 'Expecting array for "fields" of type "MetadataQuery"', + }); + } const fields: undefined | readonly string[] = - val.fields == void 0 ? void 0 : sdIsList(val.fields) ? val.fields : []; + val.fields == void 0 + ? void 0 + : sdIsList(val.fields) + ? (val.fields.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: 'Expecting string for "MetadataQuery"', + }); + } + return itm; + }) as readonly any[]) + : []; return { from: from, query: query, diff --git a/src/schemas/metadataQueryIndex.generated.ts b/src/schemas/metadataQueryIndex.generated.ts index cc5e1a08..fc66b19d 100644 --- a/src/schemas/metadataQueryIndex.generated.ts +++ b/src/schemas/metadataQueryIndex.generated.ts @@ -24,7 +24,7 @@ export function serializeMetadataQueryIndexStatusField( return val; } export function deserializeMetadataQueryIndexStatusField( - val: any + val: SerializedData ): MetadataQueryIndexStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -50,7 +50,7 @@ export function serializeMetadataQueryIndexFieldsSortDirectionField( return val; } export function deserializeMetadataQueryIndexFieldsSortDirectionField( - val: any + val: SerializedData ): MetadataQueryIndexFieldsSortDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -82,8 +82,19 @@ export function serializeMetadataQueryIndexFieldsField( }; } export function deserializeMetadataQueryIndexFieldsField( - val: any + val: SerializedData ): MetadataQueryIndexFieldsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataQueryIndexFieldsField"', + }); + } + if (!(val.key == void 0) && !sdIsString(val.key)) { + throw new BoxSdkError({ + message: + 'Expecting string for "key" of type "MetadataQueryIndexFieldsField"', + }); + } const key: undefined | string = val.key == void 0 ? void 0 : val.key; const sortDirection: undefined | MetadataQueryIndexFieldsSortDirectionField = val.sort_direction == void 0 @@ -113,11 +124,43 @@ export function serializeMetadataQueryIndex( }) as readonly any[]), }; } -export function deserializeMetadataQueryIndex(val: any): MetadataQueryIndex { +export function deserializeMetadataQueryIndex( + val: SerializedData +): MetadataQueryIndex { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataQueryIndex"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "MetadataQueryIndex"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "MetadataQueryIndex" to be defined', + }); + } + if (!sdIsString(val.type)) { + throw new BoxSdkError({ + message: 'Expecting string for "type" of type "MetadataQueryIndex"', + }); + } const type: string = val.type; + if (val.status == void 0) { + throw new BoxSdkError({ + message: 'Expecting "status" of type "MetadataQueryIndex" to be defined', + }); + } const status: MetadataQueryIndexStatusField = deserializeMetadataQueryIndexStatusField(val.status); + if (!(val.fields == void 0) && !sdIsList(val.fields)) { + throw new BoxSdkError({ + message: 'Expecting array for "fields" of type "MetadataQueryIndex"', + }); + } const fields: undefined | readonly MetadataQueryIndexFieldsField[] = val.fields == void 0 ? void 0 diff --git a/src/schemas/metadataQueryResults.generated.ts b/src/schemas/metadataQueryResults.generated.ts index ed71629b..dd3bbb24 100644 --- a/src/schemas/metadataQueryResults.generated.ts +++ b/src/schemas/metadataQueryResults.generated.ts @@ -1,6 +1,7 @@ import { serializeFileOrFolder } from './fileOrFolder.generated.js'; import { deserializeFileOrFolder } from './fileOrFolder.generated.js'; import { FileOrFolder } from './fileOrFolder.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -28,8 +29,18 @@ export function serializeMetadataQueryResults( }; } export function deserializeMetadataQueryResults( - val: any + val: SerializedData ): MetadataQueryResults { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataQueryResults"', + }); + } + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "MetadataQueryResults"', + }); + } const entries: undefined | readonly FileOrFolder[] = val.entries == void 0 ? void 0 @@ -38,7 +49,18 @@ export function deserializeMetadataQueryResults( return deserializeFileOrFolder(itm); }) as readonly any[]) : []; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "MetadataQueryResults"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "MetadataQueryResults"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; return { diff --git a/src/schemas/metadataTemplate.generated.ts b/src/schemas/metadataTemplate.generated.ts index 32aafc85..43147420 100644 --- a/src/schemas/metadataTemplate.generated.ts +++ b/src/schemas/metadataTemplate.generated.ts @@ -83,7 +83,7 @@ export function serializeMetadataTemplateTypeField( return val; } export function deserializeMetadataTemplateTypeField( - val: any + val: SerializedData ): MetadataTemplateTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -103,7 +103,7 @@ export function serializeMetadataTemplateFieldsTypeField( return val; } export function deserializeMetadataTemplateFieldsTypeField( - val: any + val: SerializedData ): MetadataTemplateFieldsTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -138,9 +138,32 @@ export function serializeMetadataTemplateFieldsOptionsField( return { ['key']: val.key, ['id']: val.id == void 0 ? void 0 : val.id }; } export function deserializeMetadataTemplateFieldsOptionsField( - val: any + val: SerializedData ): MetadataTemplateFieldsOptionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataTemplateFieldsOptionsField"', + }); + } + if (val.key == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "key" of type "MetadataTemplateFieldsOptionsField" to be defined', + }); + } + if (!sdIsString(val.key)) { + throw new BoxSdkError({ + message: + 'Expecting string for "key" of type "MetadataTemplateFieldsOptionsField"', + }); + } const key: string = val.key; + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "MetadataTemplateFieldsOptionsField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { key: key, id: id } satisfies MetadataTemplateFieldsOptionsField; } @@ -165,16 +188,69 @@ export function serializeMetadataTemplateFieldsField( }; } export function deserializeMetadataTemplateFieldsField( - val: any + val: SerializedData ): MetadataTemplateFieldsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataTemplateFieldsField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "MetadataTemplateFieldsField" to be defined', + }); + } const type: MetadataTemplateFieldsTypeField = deserializeMetadataTemplateFieldsTypeField(val.type); + if (val.key == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "key" of type "MetadataTemplateFieldsField" to be defined', + }); + } + if (!sdIsString(val.key)) { + throw new BoxSdkError({ + message: + 'Expecting string for "key" of type "MetadataTemplateFieldsField"', + }); + } const key: string = val.key; + if (val.displayName == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "displayName" of type "MetadataTemplateFieldsField" to be defined', + }); + } + if (!sdIsString(val.displayName)) { + throw new BoxSdkError({ + message: + 'Expecting string for "displayName" of type "MetadataTemplateFieldsField"', + }); + } const displayName: string = val.displayName; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "MetadataTemplateFieldsField"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "hidden" of type "MetadataTemplateFieldsField"', + }); + } const hidden: undefined | boolean = val.hidden == void 0 ? void 0 : val.hidden; + if (!(val.options == void 0) && !sdIsList(val.options)) { + throw new BoxSdkError({ + message: + 'Expecting array for "options" of type "MetadataTemplateFieldsField"', + }); + } const options: undefined | readonly MetadataTemplateFieldsOptionsField[] = val.options == void 0 ? void 0 @@ -185,6 +261,12 @@ export function deserializeMetadataTemplateFieldsField( return deserializeMetadataTemplateFieldsOptionsField(itm); }) as readonly any[]) : []; + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "MetadataTemplateFieldsField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { type: type, @@ -220,18 +302,65 @@ export function serializeMetadataTemplate( : val.copyInstanceOnItemCopy, }; } -export function deserializeMetadataTemplate(val: any): MetadataTemplate { +export function deserializeMetadataTemplate( + val: SerializedData +): MetadataTemplate { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataTemplate"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "MetadataTemplate" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "MetadataTemplate"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "MetadataTemplate" to be defined', + }); + } const type: MetadataTemplateTypeField = deserializeMetadataTemplateTypeField( val.type ); + if (!(val.scope == void 0) && !sdIsString(val.scope)) { + throw new BoxSdkError({ + message: 'Expecting string for "scope" of type "MetadataTemplate"', + }); + } const scope: undefined | string = val.scope == void 0 ? void 0 : val.scope; + if (!(val.templateKey == void 0) && !sdIsString(val.templateKey)) { + throw new BoxSdkError({ + message: 'Expecting string for "templateKey" of type "MetadataTemplate"', + }); + } const templateKey: undefined | string = val.templateKey == void 0 ? void 0 : val.templateKey; + if (!(val.displayName == void 0) && !sdIsString(val.displayName)) { + throw new BoxSdkError({ + message: 'Expecting string for "displayName" of type "MetadataTemplate"', + }); + } const displayName: undefined | string = val.displayName == void 0 ? void 0 : val.displayName; + if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "hidden" of type "MetadataTemplate"', + }); + } const hidden: undefined | boolean = val.hidden == void 0 ? void 0 : val.hidden; + if (!(val.fields == void 0) && !sdIsList(val.fields)) { + throw new BoxSdkError({ + message: 'Expecting array for "fields" of type "MetadataTemplate"', + }); + } const fields: undefined | readonly MetadataTemplateFieldsField[] = val.fields == void 0 ? void 0 @@ -242,6 +371,15 @@ export function deserializeMetadataTemplate(val: any): MetadataTemplate { return deserializeMetadataTemplateFieldsField(itm); }) as readonly any[]) : []; + if ( + !(val.copyInstanceOnItemCopy == void 0) && + !sdIsBoolean(val.copyInstanceOnItemCopy) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "copyInstanceOnItemCopy" of type "MetadataTemplate"', + }); + } const copyInstanceOnItemCopy: undefined | boolean = val.copyInstanceOnItemCopy == void 0 ? void 0 : val.copyInstanceOnItemCopy; return { @@ -283,20 +421,62 @@ export function serializeMetadataTemplateInput( }; } export function deserializeMetadataTemplateInput( - val: any + val: SerializedData ): MetadataTemplateInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataTemplateInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "MetadataTemplateInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "MetadataTemplateInput"', + }); + } const id: string = val.id; const type: undefined | MetadataTemplateTypeField = val.type == void 0 ? void 0 : deserializeMetadataTemplateTypeField(val.type); + if (!(val.scope == void 0) && !sdIsString(val.scope)) { + throw new BoxSdkError({ + message: 'Expecting string for "scope" of type "MetadataTemplateInput"', + }); + } const scope: undefined | string = val.scope == void 0 ? void 0 : val.scope; + if (!(val.templateKey == void 0) && !sdIsString(val.templateKey)) { + throw new BoxSdkError({ + message: + 'Expecting string for "templateKey" of type "MetadataTemplateInput"', + }); + } const templateKey: undefined | string = val.templateKey == void 0 ? void 0 : val.templateKey; + if (!(val.displayName == void 0) && !sdIsString(val.displayName)) { + throw new BoxSdkError({ + message: + 'Expecting string for "displayName" of type "MetadataTemplateInput"', + }); + } const displayName: undefined | string = val.displayName == void 0 ? void 0 : val.displayName; + if (!(val.hidden == void 0) && !sdIsBoolean(val.hidden)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "hidden" of type "MetadataTemplateInput"', + }); + } const hidden: undefined | boolean = val.hidden == void 0 ? void 0 : val.hidden; + if (!(val.fields == void 0) && !sdIsList(val.fields)) { + throw new BoxSdkError({ + message: 'Expecting array for "fields" of type "MetadataTemplateInput"', + }); + } const fields: undefined | readonly MetadataTemplateFieldsField[] = val.fields == void 0 ? void 0 @@ -307,6 +487,15 @@ export function deserializeMetadataTemplateInput( return deserializeMetadataTemplateFieldsField(itm); }) as readonly any[]) : []; + if ( + !(val.copyInstanceOnItemCopy == void 0) && + !sdIsBoolean(val.copyInstanceOnItemCopy) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "copyInstanceOnItemCopy" of type "MetadataTemplateInput"', + }); + } const copyInstanceOnItemCopy: undefined | boolean = val.copyInstanceOnItemCopy == void 0 ? void 0 : val.copyInstanceOnItemCopy; return { diff --git a/src/schemas/metadataTemplates.generated.ts b/src/schemas/metadataTemplates.generated.ts index b448d93d..5f09e139 100644 --- a/src/schemas/metadataTemplates.generated.ts +++ b/src/schemas/metadataTemplates.generated.ts @@ -1,6 +1,7 @@ import { serializeMetadataTemplate } from './metadataTemplate.generated.js'; import { deserializeMetadataTemplate } from './metadataTemplate.generated.js'; import { MetadataTemplate } from './metadataTemplate.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -29,12 +30,39 @@ export function serializeMetadataTemplates( }) as readonly any[]), }; } -export function deserializeMetadataTemplates(val: any): MetadataTemplates { +export function deserializeMetadataTemplates( + val: SerializedData +): MetadataTemplates { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "MetadataTemplates"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "MetadataTemplates"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "next_marker" of type "MetadataTemplates"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "prev_marker" of type "MetadataTemplates"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "MetadataTemplates"', + }); + } const entries: undefined | readonly MetadataTemplate[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/metadatas.generated.ts b/src/schemas/metadatas.generated.ts index 955f74d3..a982052d 100644 --- a/src/schemas/metadatas.generated.ts +++ b/src/schemas/metadatas.generated.ts @@ -1,6 +1,7 @@ import { serializeMetadata } from './metadata.generated.js'; import { deserializeMetadata } from './metadata.generated.js'; import { Metadata } from './metadata.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -23,7 +24,15 @@ export function serializeMetadatas(val: Metadatas): SerializedData { ['limit']: val.limit == void 0 ? void 0 : val.limit, }; } -export function deserializeMetadatas(val: any): Metadatas { +export function deserializeMetadatas(val: SerializedData): Metadatas { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Metadatas"' }); + } + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "Metadatas"', + }); + } const entries: undefined | readonly Metadata[] = val.entries == void 0 ? void 0 @@ -32,6 +41,11 @@ export function deserializeMetadatas(val: any): Metadatas { return deserializeMetadata(itm); }) as readonly any[]) : []; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "Metadatas"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; return { entries: entries, limit: limit } satisfies Metadatas; } diff --git a/src/schemas/oAuth2Error.generated.ts b/src/schemas/oAuth2Error.generated.ts index 44f1563c..4041ced3 100644 --- a/src/schemas/oAuth2Error.generated.ts +++ b/src/schemas/oAuth2Error.generated.ts @@ -1,3 +1,4 @@ +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -16,8 +17,24 @@ export function serializeOAuth2Error(val: OAuth2Error): SerializedData { val.errorDescription == void 0 ? void 0 : val.errorDescription, }; } -export function deserializeOAuth2Error(val: any): OAuth2Error { +export function deserializeOAuth2Error(val: SerializedData): OAuth2Error { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "OAuth2Error"' }); + } + if (!(val.error == void 0) && !sdIsString(val.error)) { + throw new BoxSdkError({ + message: 'Expecting string for "error" of type "OAuth2Error"', + }); + } const error: undefined | string = val.error == void 0 ? void 0 : val.error; + if ( + !(val.error_description == void 0) && + !sdIsString(val.error_description) + ) { + throw new BoxSdkError({ + message: 'Expecting string for "error_description" of type "OAuth2Error"', + }); + } const errorDescription: undefined | string = val.error_description == void 0 ? void 0 : val.error_description; return { diff --git a/src/schemas/outcome.generated.ts b/src/schemas/outcome.generated.ts index e6b61923..7e3652ad 100644 --- a/src/schemas/outcome.generated.ts +++ b/src/schemas/outcome.generated.ts @@ -7,6 +7,7 @@ import { deserializeRoleVariable } from './roleVariable.generated.js'; import { CollaboratorVariable } from './collaboratorVariable.generated.js'; import { CompletionRuleVariable } from './completionRuleVariable.generated.js'; import { RoleVariable } from './roleVariable.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -44,7 +45,20 @@ export function serializeOutcome(val: Outcome): SerializedData { ['role']: val.role == void 0 ? void 0 : serializeRoleVariable(val.role), }; } -export function deserializeOutcome(val: any): Outcome { +export function deserializeOutcome(val: SerializedData): Outcome { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Outcome"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "Outcome" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "Outcome"', + }); + } const id: string = val.id; const collaborators: undefined | CollaboratorVariable = val.collaborators == void 0 diff --git a/src/schemas/postOAuth2Revoke.generated.ts b/src/schemas/postOAuth2Revoke.generated.ts index fb4a31ca..f5d57c56 100644 --- a/src/schemas/postOAuth2Revoke.generated.ts +++ b/src/schemas/postOAuth2Revoke.generated.ts @@ -1,3 +1,4 @@ +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -19,11 +20,34 @@ export function serializePostOAuth2Revoke( ['token']: val.token == void 0 ? void 0 : val.token, }; } -export function deserializePostOAuth2Revoke(val: any): PostOAuth2Revoke { +export function deserializePostOAuth2Revoke( + val: SerializedData +): PostOAuth2Revoke { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "PostOAuth2Revoke"', + }); + } + if (!(val.client_id == void 0) && !sdIsString(val.client_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "client_id" of type "PostOAuth2Revoke"', + }); + } const clientId: undefined | string = val.client_id == void 0 ? void 0 : val.client_id; + if (!(val.client_secret == void 0) && !sdIsString(val.client_secret)) { + throw new BoxSdkError({ + message: + 'Expecting string for "client_secret" of type "PostOAuth2Revoke"', + }); + } const clientSecret: undefined | string = val.client_secret == void 0 ? void 0 : val.client_secret; + if (!(val.token == void 0) && !sdIsString(val.token)) { + throw new BoxSdkError({ + message: 'Expecting string for "token" of type "PostOAuth2Revoke"', + }); + } const token: undefined | string = val.token == void 0 ? void 0 : val.token; return { clientId: clientId, diff --git a/src/schemas/postOAuth2Token.generated.ts b/src/schemas/postOAuth2Token.generated.ts index 1762df5a..8b1e175a 100644 --- a/src/schemas/postOAuth2Token.generated.ts +++ b/src/schemas/postOAuth2Token.generated.ts @@ -40,7 +40,7 @@ export function serializePostOAuth2TokenGrantTypeField( return val; } export function deserializePostOAuth2TokenGrantTypeField( - val: any + val: SerializedData ): PostOAuth2TokenGrantTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -72,7 +72,7 @@ export function serializePostOAuth2TokenSubjectTokenTypeField( return val; } export function deserializePostOAuth2TokenSubjectTokenTypeField( - val: any + val: SerializedData ): PostOAuth2TokenSubjectTokenTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -92,7 +92,7 @@ export function serializePostOAuth2TokenActorTokenTypeField( return val; } export function deserializePostOAuth2TokenActorTokenTypeField( - val: any + val: SerializedData ): PostOAuth2TokenActorTokenTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -112,7 +112,7 @@ export function serializePostOAuth2TokenBoxSubjectTypeField( return val; } export function deserializePostOAuth2TokenBoxSubjectTypeField( - val: any + val: SerializedData ): PostOAuth2TokenBoxSubjectTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -158,39 +158,106 @@ export function serializePostOAuth2Token(val: PostOAuth2Token): SerializedData { val.boxSharedLink == void 0 ? void 0 : val.boxSharedLink, }; } -export function deserializePostOAuth2Token(val: any): PostOAuth2Token { +export function deserializePostOAuth2Token( + val: SerializedData +): PostOAuth2Token { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "PostOAuth2Token"' }); + } + if (val.grant_type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "grant_type" of type "PostOAuth2Token" to be defined', + }); + } const grantType: PostOAuth2TokenGrantTypeField = deserializePostOAuth2TokenGrantTypeField(val.grant_type); + if (!(val.client_id == void 0) && !sdIsString(val.client_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "client_id" of type "PostOAuth2Token"', + }); + } const clientId: undefined | string = val.client_id == void 0 ? void 0 : val.client_id; + if (!(val.client_secret == void 0) && !sdIsString(val.client_secret)) { + throw new BoxSdkError({ + message: 'Expecting string for "client_secret" of type "PostOAuth2Token"', + }); + } const clientSecret: undefined | string = val.client_secret == void 0 ? void 0 : val.client_secret; + if (!(val.code == void 0) && !sdIsString(val.code)) { + throw new BoxSdkError({ + message: 'Expecting string for "code" of type "PostOAuth2Token"', + }); + } const code: undefined | string = val.code == void 0 ? void 0 : val.code; + if (!(val.refresh_token == void 0) && !sdIsString(val.refresh_token)) { + throw new BoxSdkError({ + message: 'Expecting string for "refresh_token" of type "PostOAuth2Token"', + }); + } const refreshToken: undefined | string = val.refresh_token == void 0 ? void 0 : val.refresh_token; + if (!(val.assertion == void 0) && !sdIsString(val.assertion)) { + throw new BoxSdkError({ + message: 'Expecting string for "assertion" of type "PostOAuth2Token"', + }); + } const assertion: undefined | string = val.assertion == void 0 ? void 0 : val.assertion; + if (!(val.subject_token == void 0) && !sdIsString(val.subject_token)) { + throw new BoxSdkError({ + message: 'Expecting string for "subject_token" of type "PostOAuth2Token"', + }); + } const subjectToken: undefined | string = val.subject_token == void 0 ? void 0 : val.subject_token; const subjectTokenType: undefined | PostOAuth2TokenSubjectTokenTypeField = val.subject_token_type == void 0 ? void 0 : deserializePostOAuth2TokenSubjectTokenTypeField(val.subject_token_type); + if (!(val.actor_token == void 0) && !sdIsString(val.actor_token)) { + throw new BoxSdkError({ + message: 'Expecting string for "actor_token" of type "PostOAuth2Token"', + }); + } const actorToken: undefined | string = val.actor_token == void 0 ? void 0 : val.actor_token; const actorTokenType: undefined | PostOAuth2TokenActorTokenTypeField = val.actor_token_type == void 0 ? void 0 : deserializePostOAuth2TokenActorTokenTypeField(val.actor_token_type); + if (!(val.scope == void 0) && !sdIsString(val.scope)) { + throw new BoxSdkError({ + message: 'Expecting string for "scope" of type "PostOAuth2Token"', + }); + } const scope: undefined | string = val.scope == void 0 ? void 0 : val.scope; + if (!(val.resource == void 0) && !sdIsString(val.resource)) { + throw new BoxSdkError({ + message: 'Expecting string for "resource" of type "PostOAuth2Token"', + }); + } const resource: undefined | string = val.resource == void 0 ? void 0 : val.resource; const boxSubjectType: undefined | PostOAuth2TokenBoxSubjectTypeField = val.box_subject_type == void 0 ? void 0 : deserializePostOAuth2TokenBoxSubjectTypeField(val.box_subject_type); + if (!(val.box_subject_id == void 0) && !sdIsString(val.box_subject_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "box_subject_id" of type "PostOAuth2Token"', + }); + } const boxSubjectId: undefined | string = val.box_subject_id == void 0 ? void 0 : val.box_subject_id; + if (!(val.box_shared_link == void 0) && !sdIsString(val.box_shared_link)) { + throw new BoxSdkError({ + message: + 'Expecting string for "box_shared_link" of type "PostOAuth2Token"', + }); + } const boxSharedLink: undefined | string = val.box_shared_link == void 0 ? void 0 : val.box_shared_link; return { diff --git a/src/schemas/postOAuth2TokenRefreshAccessToken.generated.ts b/src/schemas/postOAuth2TokenRefreshAccessToken.generated.ts index 9cc08e75..c0b861c3 100644 --- a/src/schemas/postOAuth2TokenRefreshAccessToken.generated.ts +++ b/src/schemas/postOAuth2TokenRefreshAccessToken.generated.ts @@ -43,7 +43,7 @@ export function serializePostOAuth2TokenRefreshAccessTokenGrantTypeField( return val; } export function deserializePostOAuth2TokenRefreshAccessTokenGrantTypeField( - val: any + val: SerializedData ): PostOAuth2TokenRefreshAccessTokenGrantTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -71,12 +71,59 @@ export function serializePostOAuth2TokenRefreshAccessToken( }; } export function deserializePostOAuth2TokenRefreshAccessToken( - val: any + val: SerializedData ): PostOAuth2TokenRefreshAccessToken { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "PostOAuth2TokenRefreshAccessToken"', + }); + } + if (val.grant_type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "grant_type" of type "PostOAuth2TokenRefreshAccessToken" to be defined', + }); + } const grantType: PostOAuth2TokenRefreshAccessTokenGrantTypeField = deserializePostOAuth2TokenRefreshAccessTokenGrantTypeField(val.grant_type); + if (val.client_id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "client_id" of type "PostOAuth2TokenRefreshAccessToken" to be defined', + }); + } + if (!sdIsString(val.client_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "client_id" of type "PostOAuth2TokenRefreshAccessToken"', + }); + } const clientId: string = val.client_id; + if (val.client_secret == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "client_secret" of type "PostOAuth2TokenRefreshAccessToken" to be defined', + }); + } + if (!sdIsString(val.client_secret)) { + throw new BoxSdkError({ + message: + 'Expecting string for "client_secret" of type "PostOAuth2TokenRefreshAccessToken"', + }); + } const clientSecret: string = val.client_secret; + if (val.refresh_token == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "refresh_token" of type "PostOAuth2TokenRefreshAccessToken" to be defined', + }); + } + if (!sdIsString(val.refresh_token)) { + throw new BoxSdkError({ + message: + 'Expecting string for "refresh_token" of type "PostOAuth2TokenRefreshAccessToken"', + }); + } const refreshToken: string = val.refresh_token; return { grantType: grantType, @@ -101,16 +148,57 @@ export function serializePostOAuth2TokenRefreshAccessTokenInput( }; } export function deserializePostOAuth2TokenRefreshAccessTokenInput( - val: any + val: SerializedData ): PostOAuth2TokenRefreshAccessTokenInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "PostOAuth2TokenRefreshAccessTokenInput"', + }); + } const grantType: undefined | PostOAuth2TokenRefreshAccessTokenGrantTypeField = val.grantType == void 0 ? void 0 : deserializePostOAuth2TokenRefreshAccessTokenGrantTypeField( val.grantType ); + if (val.client_id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "client_id" of type "PostOAuth2TokenRefreshAccessTokenInput" to be defined', + }); + } + if (!sdIsString(val.client_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "client_id" of type "PostOAuth2TokenRefreshAccessTokenInput"', + }); + } const clientId: string = val.client_id; + if (val.client_secret == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "client_secret" of type "PostOAuth2TokenRefreshAccessTokenInput" to be defined', + }); + } + if (!sdIsString(val.client_secret)) { + throw new BoxSdkError({ + message: + 'Expecting string for "client_secret" of type "PostOAuth2TokenRefreshAccessTokenInput"', + }); + } const clientSecret: string = val.client_secret; + if (val.refresh_token == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "refresh_token" of type "PostOAuth2TokenRefreshAccessTokenInput" to be defined', + }); + } + if (!sdIsString(val.refresh_token)) { + throw new BoxSdkError({ + message: + 'Expecting string for "refresh_token" of type "PostOAuth2TokenRefreshAccessTokenInput"', + }); + } const refreshToken: string = val.refresh_token; return { grantType: grantType, diff --git a/src/schemas/realtimeServer.generated.ts b/src/schemas/realtimeServer.generated.ts index 0970a19a..f044de6e 100644 --- a/src/schemas/realtimeServer.generated.ts +++ b/src/schemas/realtimeServer.generated.ts @@ -1,3 +1,4 @@ +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -21,12 +22,40 @@ export function serializeRealtimeServer(val: RealtimeServer): SerializedData { ['retry_timeout']: val.retryTimeout == void 0 ? void 0 : val.retryTimeout, }; } -export function deserializeRealtimeServer(val: any): RealtimeServer { +export function deserializeRealtimeServer(val: SerializedData): RealtimeServer { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "RealtimeServer"' }); + } + if (!(val.type == void 0) && !sdIsString(val.type)) { + throw new BoxSdkError({ + message: 'Expecting string for "type" of type "RealtimeServer"', + }); + } const type: undefined | string = val.type == void 0 ? void 0 : val.type; + if (!(val.url == void 0) && !sdIsString(val.url)) { + throw new BoxSdkError({ + message: 'Expecting string for "url" of type "RealtimeServer"', + }); + } const url: undefined | string = val.url == void 0 ? void 0 : val.url; + if (!(val.ttl == void 0) && !sdIsNumber(val.ttl)) { + throw new BoxSdkError({ + message: 'Expecting number for "ttl" of type "RealtimeServer"', + }); + } const ttl: undefined | number = val.ttl == void 0 ? void 0 : val.ttl; + if (!(val.max_retries == void 0) && !sdIsNumber(val.max_retries)) { + throw new BoxSdkError({ + message: 'Expecting number for "max_retries" of type "RealtimeServer"', + }); + } const maxRetries: undefined | number = val.max_retries == void 0 ? void 0 : val.max_retries; + if (!(val.retry_timeout == void 0) && !sdIsNumber(val.retry_timeout)) { + throw new BoxSdkError({ + message: 'Expecting number for "retry_timeout" of type "RealtimeServer"', + }); + } const retryTimeout: undefined | number = val.retry_timeout == void 0 ? void 0 : val.retry_timeout; return { diff --git a/src/schemas/realtimeServers.generated.ts b/src/schemas/realtimeServers.generated.ts index 14e68311..ce18f63d 100644 --- a/src/schemas/realtimeServers.generated.ts +++ b/src/schemas/realtimeServers.generated.ts @@ -1,6 +1,7 @@ import { serializeRealtimeServer } from './realtimeServer.generated.js'; import { deserializeRealtimeServer } from './realtimeServer.generated.js'; import { RealtimeServer } from './realtimeServer.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -23,9 +24,24 @@ export function serializeRealtimeServers(val: RealtimeServers): SerializedData { }) as readonly any[]), }; } -export function deserializeRealtimeServers(val: any): RealtimeServers { +export function deserializeRealtimeServers( + val: SerializedData +): RealtimeServers { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "RealtimeServers"' }); + } + if (!(val.chunk_size == void 0) && !sdIsNumber(val.chunk_size)) { + throw new BoxSdkError({ + message: 'Expecting number for "chunk_size" of type "RealtimeServers"', + }); + } const chunkSize: undefined | number = val.chunk_size == void 0 ? void 0 : val.chunk_size; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "RealtimeServers"', + }); + } const entries: undefined | readonly RealtimeServer[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/recentItem.generated.ts b/src/schemas/recentItem.generated.ts index aae1a40e..bd9c0d58 100644 --- a/src/schemas/recentItem.generated.ts +++ b/src/schemas/recentItem.generated.ts @@ -31,7 +31,7 @@ export function serializeRecentItemInteractionTypeField( return val; } export function deserializeRecentItemInteractionTypeField( - val: any + val: SerializedData ): RecentItemInteractionTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -74,7 +74,15 @@ export function serializeRecentItem(val: RecentItem): SerializedData { val.interactionSharedLink == void 0 ? void 0 : val.interactionSharedLink, }; } -export function deserializeRecentItem(val: any): RecentItem { +export function deserializeRecentItem(val: SerializedData): RecentItem { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "RecentItem"' }); + } + if (!(val.type == void 0) && !sdIsString(val.type)) { + throw new BoxSdkError({ + message: 'Expecting string for "type" of type "RecentItem"', + }); + } const type: undefined | string = val.type == void 0 ? void 0 : val.type; const item: undefined | FileFullOrFolderFullOrWebLink = val.item == void 0 @@ -84,10 +92,24 @@ export function deserializeRecentItem(val: any): RecentItem { val.interaction_type == void 0 ? void 0 : deserializeRecentItemInteractionTypeField(val.interaction_type); + if (!(val.interacted_at == void 0) && !sdIsString(val.interacted_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "interacted_at" of type "RecentItem"', + }); + } const interactedAt: undefined | DateTime = val.interacted_at == void 0 ? void 0 : deserializeDateTime(val.interacted_at); + if ( + !(val.interaction_shared_link == void 0) && + !sdIsString(val.interaction_shared_link) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "interaction_shared_link" of type "RecentItem"', + }); + } const interactionSharedLink: undefined | string = val.interaction_shared_link == void 0 ? void 0 diff --git a/src/schemas/recentItems.generated.ts b/src/schemas/recentItems.generated.ts index 3df6beb6..10ad4316 100644 --- a/src/schemas/recentItems.generated.ts +++ b/src/schemas/recentItems.generated.ts @@ -1,6 +1,7 @@ import { serializeRecentItem } from './recentItem.generated.js'; import { deserializeRecentItem } from './recentItem.generated.js'; import { RecentItem } from './recentItem.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -27,12 +28,35 @@ export function serializeRecentItems(val: RecentItems): SerializedData { }) as readonly any[]), }; } -export function deserializeRecentItems(val: any): RecentItems { +export function deserializeRecentItems(val: SerializedData): RecentItems { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "RecentItems"' }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "RecentItems"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "next_marker" of type "RecentItems"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "prev_marker" of type "RecentItems"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "RecentItems"', + }); + } const entries: undefined | readonly RecentItem[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/retentionPolicies.generated.ts b/src/schemas/retentionPolicies.generated.ts index 1beb001e..c66d6eef 100644 --- a/src/schemas/retentionPolicies.generated.ts +++ b/src/schemas/retentionPolicies.generated.ts @@ -1,6 +1,7 @@ import { serializeRetentionPolicy } from './retentionPolicy.generated.js'; import { deserializeRetentionPolicy } from './retentionPolicy.generated.js'; import { RetentionPolicy } from './retentionPolicy.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -27,7 +28,19 @@ export function serializeRetentionPolicies( ['next_marker']: val.nextMarker == void 0 ? void 0 : val.nextMarker, }; } -export function deserializeRetentionPolicies(val: any): RetentionPolicies { +export function deserializeRetentionPolicies( + val: SerializedData +): RetentionPolicies { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RetentionPolicies"', + }); + } + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "RetentionPolicies"', + }); + } const entries: undefined | readonly RetentionPolicy[] = val.entries == void 0 ? void 0 @@ -36,7 +49,17 @@ export function deserializeRetentionPolicies(val: any): RetentionPolicies { return deserializeRetentionPolicy(itm); }) as readonly any[]) : []; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "RetentionPolicies"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "next_marker" of type "RetentionPolicies"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; return { diff --git a/src/schemas/retentionPolicy.generated.ts b/src/schemas/retentionPolicy.generated.ts index 1713867e..f830da38 100644 --- a/src/schemas/retentionPolicy.generated.ts +++ b/src/schemas/retentionPolicy.generated.ts @@ -54,7 +54,7 @@ export function serializeRetentionPolicyPolicyTypeField( return val; } export function deserializeRetentionPolicyPolicyTypeField( - val: any + val: SerializedData ): RetentionPolicyPolicyTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -77,7 +77,7 @@ export function serializeRetentionPolicyRetentionTypeField( return val; } export function deserializeRetentionPolicyRetentionTypeField( - val: any + val: SerializedData ): RetentionPolicyRetentionTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -100,7 +100,7 @@ export function serializeRetentionPolicyStatusField( return val; } export function deserializeRetentionPolicyStatusField( - val: any + val: SerializedData ): RetentionPolicyStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -128,11 +128,37 @@ export function serializeRetentionPolicyAssignmentCountsField( }; } export function deserializeRetentionPolicyAssignmentCountsField( - val: any + val: SerializedData ): RetentionPolicyAssignmentCountsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RetentionPolicyAssignmentCountsField"', + }); + } + if (!(val.enterprise == void 0) && !sdIsNumber(val.enterprise)) { + throw new BoxSdkError({ + message: + 'Expecting number for "enterprise" of type "RetentionPolicyAssignmentCountsField"', + }); + } const enterprise: undefined | number = val.enterprise == void 0 ? void 0 : val.enterprise; + if (!(val.folder == void 0) && !sdIsNumber(val.folder)) { + throw new BoxSdkError({ + message: + 'Expecting number for "folder" of type "RetentionPolicyAssignmentCountsField"', + }); + } const folder: undefined | number = val.folder == void 0 ? void 0 : val.folder; + if ( + !(val.metadata_template == void 0) && + !sdIsNumber(val.metadata_template) + ) { + throw new BoxSdkError({ + message: + 'Expecting number for "metadata_template" of type "RetentionPolicyAssignmentCountsField"', + }); + } const metadataTemplate: undefined | number = val.metadata_template == void 0 ? void 0 : val.metadata_template; return { @@ -189,7 +215,17 @@ export function serializeRetentionPolicy(val: RetentionPolicy): SerializedData { }, }; } -export function deserializeRetentionPolicy(val: any): RetentionPolicy { +export function deserializeRetentionPolicy( + val: SerializedData +): RetentionPolicy { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "RetentionPolicy"' }); + } + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "RetentionPolicy"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; const policyType: undefined | RetentionPolicyPolicyTypeField = @@ -206,16 +242,53 @@ export function deserializeRetentionPolicy(val: any): RetentionPolicy { : deserializeRetentionPolicyStatusField(val.status); const createdBy: undefined | UserMini = val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "RetentionPolicy"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "RetentionPolicy"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if ( + !(val.can_owner_extend_retention == void 0) && + !sdIsBoolean(val.can_owner_extend_retention) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_owner_extend_retention" of type "RetentionPolicy"', + }); + } const canOwnerExtendRetention: undefined | boolean = val.can_owner_extend_retention == void 0 ? void 0 : val.can_owner_extend_retention; + if ( + !(val.are_owners_notified == void 0) && + !sdIsBoolean(val.are_owners_notified) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "are_owners_notified" of type "RetentionPolicy"', + }); + } const areOwnersNotified: undefined | boolean = val.are_owners_notified == void 0 ? void 0 : val.are_owners_notified; + if ( + !(val.custom_notification_recipients == void 0) && + !sdIsList(val.custom_notification_recipients) + ) { + throw new BoxSdkError({ + message: + 'Expecting array for "custom_notification_recipients" of type "RetentionPolicy"', + }); + } const customNotificationRecipients: undefined | readonly UserMini[] = val.custom_notification_recipients == void 0 ? void 0 @@ -230,8 +303,19 @@ export function deserializeRetentionPolicy(val: any): RetentionPolicy { val.assignment_counts == void 0 ? void 0 : deserializeRetentionPolicyAssignmentCountsField(val.assignment_counts); + if (!(val.policy_name == void 0) && !sdIsString(val.policy_name)) { + throw new BoxSdkError({ + message: 'Expecting string for "policy_name" of type "RetentionPolicy"', + }); + } const policyName: undefined | string = val.policy_name == void 0 ? void 0 : val.policy_name; + if (!(val.retention_length == void 0) && !sdIsString(val.retention_length)) { + throw new BoxSdkError({ + message: + 'Expecting string for "retention_length" of type "RetentionPolicy"', + }); + } const retentionLength: undefined | string = val.retention_length == void 0 ? void 0 : val.retention_length; const dispositionAction: @@ -242,7 +326,22 @@ export function deserializeRetentionPolicy(val: any): RetentionPolicy { : deserializeRetentionPolicyMiniDispositionActionField( val.disposition_action ); + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "RetentionPolicy" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "RetentionPolicy"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "RetentionPolicy" to be defined', + }); + } const type: RetentionPolicyBaseTypeField = deserializeRetentionPolicyBaseTypeField(val.type); return { diff --git a/src/schemas/retentionPolicyAssignment.generated.ts b/src/schemas/retentionPolicyAssignment.generated.ts index 878020b1..e2e71779 100644 --- a/src/schemas/retentionPolicyAssignment.generated.ts +++ b/src/schemas/retentionPolicyAssignment.generated.ts @@ -84,7 +84,7 @@ export function serializeRetentionPolicyAssignmentTypeField( return val; } export function deserializeRetentionPolicyAssignmentTypeField( - val: any + val: SerializedData ): RetentionPolicyAssignmentTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -104,7 +104,7 @@ export function serializeRetentionPolicyAssignmentAssignedToTypeField( return val; } export function deserializeRetentionPolicyAssignmentAssignedToTypeField( - val: any + val: SerializedData ): RetentionPolicyAssignmentAssignedToTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -137,8 +137,19 @@ export function serializeRetentionPolicyAssignmentAssignedToField( }; } export function deserializeRetentionPolicyAssignmentAssignedToField( - val: any + val: SerializedData ): RetentionPolicyAssignmentAssignedToField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RetentionPolicyAssignmentAssignedToField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "RetentionPolicyAssignmentAssignedToField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | RetentionPolicyAssignmentAssignedToTypeField = val.type == void 0 @@ -158,9 +169,27 @@ export function serializeRetentionPolicyAssignmentFilterFieldsField( }; } export function deserializeRetentionPolicyAssignmentFilterFieldsField( - val: any + val: SerializedData ): RetentionPolicyAssignmentFilterFieldsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "RetentionPolicyAssignmentFilterFieldsField"', + }); + } + if (!(val.field == void 0) && !sdIsString(val.field)) { + throw new BoxSdkError({ + message: + 'Expecting string for "field" of type "RetentionPolicyAssignmentFilterFieldsField"', + }); + } const field: undefined | string = val.field == void 0 ? void 0 : val.field; + if (!(val.value == void 0) && !sdIsString(val.value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "value" of type "RetentionPolicyAssignmentFilterFieldsField"', + }); + } const value: undefined | string = val.value == void 0 ? void 0 : val.value; return { field: field, @@ -198,9 +227,31 @@ export function serializeRetentionPolicyAssignment( }; } export function deserializeRetentionPolicyAssignment( - val: any + val: SerializedData ): RetentionPolicyAssignment { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RetentionPolicyAssignment"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "RetentionPolicyAssignment" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "RetentionPolicyAssignment"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "RetentionPolicyAssignment" to be defined', + }); + } const type: RetentionPolicyAssignmentTypeField = deserializeRetentionPolicyAssignmentTypeField(val.type); const retentionPolicy: undefined | RetentionPolicyMini = @@ -211,6 +262,12 @@ export function deserializeRetentionPolicyAssignment( val.assigned_to == void 0 ? void 0 : deserializeRetentionPolicyAssignmentAssignedToField(val.assigned_to); + if (!(val.filter_fields == void 0) && !sdIsList(val.filter_fields)) { + throw new BoxSdkError({ + message: + 'Expecting array for "filter_fields" of type "RetentionPolicyAssignment"', + }); + } const filterFields: | undefined | readonly RetentionPolicyAssignmentFilterFieldsField[] = @@ -225,8 +282,20 @@ export function deserializeRetentionPolicyAssignment( : []; const assignedBy: undefined | UserMini = val.assigned_by == void 0 ? void 0 : deserializeUserMini(val.assigned_by); + if (!(val.assigned_at == void 0) && !sdIsString(val.assigned_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "assigned_at" of type "RetentionPolicyAssignment"', + }); + } const assignedAt: undefined | DateTime = val.assigned_at == void 0 ? void 0 : deserializeDateTime(val.assigned_at); + if (!(val.start_date_field == void 0) && !sdIsString(val.start_date_field)) { + throw new BoxSdkError({ + message: + 'Expecting string for "start_date_field" of type "RetentionPolicyAssignment"', + }); + } const startDateField: undefined | string = val.start_date_field == void 0 ? void 0 : val.start_date_field; return { @@ -274,8 +343,25 @@ export function serializeRetentionPolicyAssignmentInput( }; } export function deserializeRetentionPolicyAssignmentInput( - val: any + val: SerializedData ): RetentionPolicyAssignmentInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RetentionPolicyAssignmentInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "RetentionPolicyAssignmentInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "RetentionPolicyAssignmentInput"', + }); + } const id: string = val.id; const type: undefined | RetentionPolicyAssignmentTypeField = val.type == void 0 @@ -289,6 +375,12 @@ export function deserializeRetentionPolicyAssignmentInput( val.assigned_to == void 0 ? void 0 : deserializeRetentionPolicyAssignmentAssignedToField(val.assigned_to); + if (!(val.filter_fields == void 0) && !sdIsList(val.filter_fields)) { + throw new BoxSdkError({ + message: + 'Expecting array for "filter_fields" of type "RetentionPolicyAssignmentInput"', + }); + } const filterFields: | undefined | readonly RetentionPolicyAssignmentFilterFieldsField[] = @@ -303,8 +395,20 @@ export function deserializeRetentionPolicyAssignmentInput( : []; const assignedBy: undefined | UserMini = val.assigned_by == void 0 ? void 0 : deserializeUserMini(val.assigned_by); + if (!(val.assigned_at == void 0) && !sdIsString(val.assigned_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "assigned_at" of type "RetentionPolicyAssignmentInput"', + }); + } const assignedAt: undefined | DateTime = val.assigned_at == void 0 ? void 0 : deserializeDateTime(val.assigned_at); + if (!(val.start_date_field == void 0) && !sdIsString(val.start_date_field)) { + throw new BoxSdkError({ + message: + 'Expecting string for "start_date_field" of type "RetentionPolicyAssignmentInput"', + }); + } const startDateField: undefined | string = val.start_date_field == void 0 ? void 0 : val.start_date_field; return { diff --git a/src/schemas/retentionPolicyAssignmentBase.generated.ts b/src/schemas/retentionPolicyAssignmentBase.generated.ts index a46d29e3..99b05960 100644 --- a/src/schemas/retentionPolicyAssignmentBase.generated.ts +++ b/src/schemas/retentionPolicyAssignmentBase.generated.ts @@ -34,7 +34,7 @@ export function serializeRetentionPolicyAssignmentBaseTypeField( return val; } export function deserializeRetentionPolicyAssignmentBaseTypeField( - val: any + val: SerializedData ): RetentionPolicyAssignmentBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -58,9 +58,32 @@ export function serializeRetentionPolicyAssignmentBase( }; } export function deserializeRetentionPolicyAssignmentBase( - val: any + val: SerializedData ): RetentionPolicyAssignmentBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RetentionPolicyAssignmentBase"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "RetentionPolicyAssignmentBase" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "RetentionPolicyAssignmentBase"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "RetentionPolicyAssignmentBase" to be defined', + }); + } const type: RetentionPolicyAssignmentBaseTypeField = deserializeRetentionPolicyAssignmentBaseTypeField(val.type); return { id: id, type: type } satisfies RetentionPolicyAssignmentBase; @@ -77,8 +100,25 @@ export function serializeRetentionPolicyAssignmentBaseInput( }; } export function deserializeRetentionPolicyAssignmentBaseInput( - val: any + val: SerializedData ): RetentionPolicyAssignmentBaseInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RetentionPolicyAssignmentBaseInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "RetentionPolicyAssignmentBaseInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "RetentionPolicyAssignmentBaseInput"', + }); + } const id: string = val.id; const type: undefined | RetentionPolicyAssignmentBaseTypeField = val.type == void 0 diff --git a/src/schemas/retentionPolicyAssignments.generated.ts b/src/schemas/retentionPolicyAssignments.generated.ts index 32e510d6..a1fe7a75 100644 --- a/src/schemas/retentionPolicyAssignments.generated.ts +++ b/src/schemas/retentionPolicyAssignments.generated.ts @@ -1,6 +1,7 @@ import { serializeRetentionPolicyAssignment } from './retentionPolicyAssignment.generated.js'; import { deserializeRetentionPolicyAssignment } from './retentionPolicyAssignment.generated.js'; import { RetentionPolicyAssignment } from './retentionPolicyAssignment.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -30,8 +31,19 @@ export function serializeRetentionPolicyAssignments( }; } export function deserializeRetentionPolicyAssignments( - val: any + val: SerializedData ): RetentionPolicyAssignments { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RetentionPolicyAssignments"', + }); + } + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "RetentionPolicyAssignments"', + }); + } const entries: undefined | readonly RetentionPolicyAssignment[] = val.entries == void 0 ? void 0 @@ -42,7 +54,19 @@ export function deserializeRetentionPolicyAssignments( return deserializeRetentionPolicyAssignment(itm); }) as readonly any[]) : []; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "RetentionPolicyAssignments"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "RetentionPolicyAssignments"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; return { diff --git a/src/schemas/retentionPolicyBase.generated.ts b/src/schemas/retentionPolicyBase.generated.ts index cd5c0f12..9fb3ab23 100644 --- a/src/schemas/retentionPolicyBase.generated.ts +++ b/src/schemas/retentionPolicyBase.generated.ts @@ -33,7 +33,7 @@ export function serializeRetentionPolicyBaseTypeField( return val; } export function deserializeRetentionPolicyBaseTypeField( - val: any + val: SerializedData ): RetentionPolicyBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -55,8 +55,30 @@ export function serializeRetentionPolicyBase( ['type']: serializeRetentionPolicyBaseTypeField(val.type), }; } -export function deserializeRetentionPolicyBase(val: any): RetentionPolicyBase { +export function deserializeRetentionPolicyBase( + val: SerializedData +): RetentionPolicyBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RetentionPolicyBase"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "RetentionPolicyBase" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "RetentionPolicyBase"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "RetentionPolicyBase" to be defined', + }); + } const type: RetentionPolicyBaseTypeField = deserializeRetentionPolicyBaseTypeField(val.type); return { id: id, type: type } satisfies RetentionPolicyBase; @@ -73,8 +95,24 @@ export function serializeRetentionPolicyBaseInput( }; } export function deserializeRetentionPolicyBaseInput( - val: any + val: SerializedData ): RetentionPolicyBaseInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RetentionPolicyBaseInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "RetentionPolicyBaseInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "RetentionPolicyBaseInput"', + }); + } const id: string = val.id; const type: undefined | RetentionPolicyBaseTypeField = val.type == void 0 diff --git a/src/schemas/retentionPolicyMini.generated.ts b/src/schemas/retentionPolicyMini.generated.ts index b6eee038..14956841 100644 --- a/src/schemas/retentionPolicyMini.generated.ts +++ b/src/schemas/retentionPolicyMini.generated.ts @@ -29,7 +29,7 @@ export function serializeRetentionPolicyMiniDispositionActionField( return val; } export function deserializeRetentionPolicyMiniDispositionActionField( - val: any + val: SerializedData ): RetentionPolicyMiniDispositionActionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -71,9 +71,28 @@ export function serializeRetentionPolicyMini( }, }; } -export function deserializeRetentionPolicyMini(val: any): RetentionPolicyMini { +export function deserializeRetentionPolicyMini( + val: SerializedData +): RetentionPolicyMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RetentionPolicyMini"', + }); + } + if (!(val.policy_name == void 0) && !sdIsString(val.policy_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "policy_name" of type "RetentionPolicyMini"', + }); + } const policyName: undefined | string = val.policy_name == void 0 ? void 0 : val.policy_name; + if (!(val.retention_length == void 0) && !sdIsString(val.retention_length)) { + throw new BoxSdkError({ + message: + 'Expecting string for "retention_length" of type "RetentionPolicyMini"', + }); + } const retentionLength: undefined | string = val.retention_length == void 0 ? void 0 : val.retention_length; const dispositionAction: @@ -84,7 +103,22 @@ export function deserializeRetentionPolicyMini(val: any): RetentionPolicyMini { : deserializeRetentionPolicyMiniDispositionActionField( val.disposition_action ); + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "RetentionPolicyMini" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "RetentionPolicyMini"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "RetentionPolicyMini" to be defined', + }); + } const type: RetentionPolicyBaseTypeField = deserializeRetentionPolicyBaseTypeField(val.type); return { diff --git a/src/schemas/roleVariable.generated.ts b/src/schemas/roleVariable.generated.ts index ea49df73..9223070c 100644 --- a/src/schemas/roleVariable.generated.ts +++ b/src/schemas/roleVariable.generated.ts @@ -47,7 +47,7 @@ export function serializeRoleVariableTypeField( return val; } export function deserializeRoleVariableTypeField( - val: any + val: SerializedData ): RoleVariableTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -67,7 +67,7 @@ export function serializeRoleVariableVariableTypeField( return val; } export function deserializeRoleVariableVariableTypeField( - val: any + val: SerializedData ): RoleVariableVariableTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -87,7 +87,7 @@ export function serializeRoleVariableVariableValueField( return val; } export function deserializeRoleVariableVariableValueField( - val: any + val: SerializedData ): RoleVariableVariableValueField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -128,12 +128,31 @@ export function serializeRoleVariable(val: RoleVariable): SerializedData { ), }; } -export function deserializeRoleVariable(val: any): RoleVariable { +export function deserializeRoleVariable(val: SerializedData): RoleVariable { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "RoleVariable"' }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "RoleVariable" to be defined', + }); + } const type: RoleVariableTypeField = deserializeRoleVariableTypeField( val.type ); + if (val.variable_type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "variable_type" of type "RoleVariable" to be defined', + }); + } const variableType: RoleVariableVariableTypeField = deserializeRoleVariableVariableTypeField(val.variable_type); + if (val.variable_value == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "variable_value" of type "RoleVariable" to be defined', + }); + } const variableValue: RoleVariableVariableValueField = deserializeRoleVariableVariableValueField(val.variable_value); return { @@ -157,13 +176,26 @@ export function serializeRoleVariableInput( ), }; } -export function deserializeRoleVariableInput(val: any): RoleVariableInput { +export function deserializeRoleVariableInput( + val: SerializedData +): RoleVariableInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "RoleVariableInput"', + }); + } const type: undefined | RoleVariableTypeField = val.type == void 0 ? void 0 : deserializeRoleVariableTypeField(val.type); const variableType: undefined | RoleVariableVariableTypeField = val.variableType == void 0 ? void 0 : deserializeRoleVariableVariableTypeField(val.variableType); + if (val.variable_value == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "variable_value" of type "RoleVariableInput" to be defined', + }); + } const variableValue: RoleVariableVariableValueField = deserializeRoleVariableVariableValueField(val.variable_value); return { diff --git a/src/schemas/searchResultWithSharedLink.generated.ts b/src/schemas/searchResultWithSharedLink.generated.ts index 243adcbf..0b13cf6f 100644 --- a/src/schemas/searchResultWithSharedLink.generated.ts +++ b/src/schemas/searchResultWithSharedLink.generated.ts @@ -1,6 +1,7 @@ import { serializeFileFullOrFolderFullOrWebLink } from './fileFullOrFolderFullOrWebLink.generated.js'; import { deserializeFileFullOrFolderFullOrWebLink } from './fileFullOrFolderFullOrWebLink.generated.js'; import { FileFullOrFolderFullOrWebLink } from './fileFullOrFolderFullOrWebLink.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -29,8 +30,22 @@ export function serializeSearchResultWithSharedLink( }; } export function deserializeSearchResultWithSharedLink( - val: any + val: SerializedData ): SearchResultWithSharedLink { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SearchResultWithSharedLink"', + }); + } + if ( + !(val.accessible_via_shared_link == void 0) && + !sdIsString(val.accessible_via_shared_link) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "accessible_via_shared_link" of type "SearchResultWithSharedLink"', + }); + } const accessibleViaSharedLink: undefined | string = val.accessible_via_shared_link == void 0 ? void 0 @@ -39,6 +54,12 @@ export function deserializeSearchResultWithSharedLink( val.item == void 0 ? void 0 : deserializeFileFullOrFolderFullOrWebLink(val.item); + if (!(val.type == void 0) && !sdIsString(val.type)) { + throw new BoxSdkError({ + message: + 'Expecting string for "type" of type "SearchResultWithSharedLink"', + }); + } const type: undefined | string = val.type == void 0 ? void 0 : val.type; return { accessibleViaSharedLink: accessibleViaSharedLink, diff --git a/src/schemas/searchResults.generated.ts b/src/schemas/searchResults.generated.ts index 86ea2496..11a1c674 100644 --- a/src/schemas/searchResults.generated.ts +++ b/src/schemas/searchResults.generated.ts @@ -50,7 +50,7 @@ export function serializeSearchResultsTypeField( return val; } export function deserializeSearchResultsTypeField( - val: any + val: SerializedData ): SearchResultsTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -80,14 +80,42 @@ export function serializeSearchResults(val: SearchResults): SerializedData { }) as readonly any[]), }; } -export function deserializeSearchResults(val: any): SearchResults { +export function deserializeSearchResults(val: SerializedData): SearchResults { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "SearchResults"' }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "SearchResults"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "SearchResults"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: 'Expecting number for "offset" of type "SearchResults"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "SearchResults" to be defined', + }); + } const type: SearchResultsTypeField = deserializeSearchResultsTypeField( val.type ); + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "SearchResults"', + }); + } const entries: undefined | readonly FileFullOrFolderFullOrWebLink[] = val.entries == void 0 ? void 0 @@ -125,13 +153,41 @@ export function serializeSearchResultsInput( }) as readonly any[]), }; } -export function deserializeSearchResultsInput(val: any): SearchResultsInput { +export function deserializeSearchResultsInput( + val: SerializedData +): SearchResultsInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SearchResultsInput"', + }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "total_count" of type "SearchResultsInput"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "SearchResultsInput"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: 'Expecting number for "offset" of type "SearchResultsInput"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; const type: undefined | SearchResultsTypeField = val.type == void 0 ? void 0 : deserializeSearchResultsTypeField(val.type); + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "SearchResultsInput"', + }); + } const entries: undefined | readonly FileFullOrFolderFullOrWebLink[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/searchResultsOrSearchResultsWithSharedLinks.generated.ts b/src/schemas/searchResultsOrSearchResultsWithSharedLinks.generated.ts index 82bf783a..97996861 100644 --- a/src/schemas/searchResultsOrSearchResultsWithSharedLinks.generated.ts +++ b/src/schemas/searchResultsOrSearchResultsWithSharedLinks.generated.ts @@ -27,7 +27,7 @@ export function serializeSearchResultsOrSearchResultsWithSharedLinks( throw new BoxSdkError({ message: 'unknown type' }); } export function deserializeSearchResultsOrSearchResultsWithSharedLinks( - val: any + val: SerializedData ): SearchResultsOrSearchResultsWithSharedLinks { if (!sdIsMap(val)) { throw new BoxSdkError({ diff --git a/src/schemas/searchResultsWithSharedLinks.generated.ts b/src/schemas/searchResultsWithSharedLinks.generated.ts index e79ed548..c021747d 100644 --- a/src/schemas/searchResultsWithSharedLinks.generated.ts +++ b/src/schemas/searchResultsWithSharedLinks.generated.ts @@ -52,7 +52,7 @@ export function serializeSearchResultsWithSharedLinksTypeField( return val; } export function deserializeSearchResultsWithSharedLinksTypeField( - val: any + val: SerializedData ): SearchResultsWithSharedLinksTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -85,14 +85,49 @@ export function serializeSearchResultsWithSharedLinks( }; } export function deserializeSearchResultsWithSharedLinks( - val: any + val: SerializedData ): SearchResultsWithSharedLinks { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SearchResultsWithSharedLinks"', + }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "total_count" of type "SearchResultsWithSharedLinks"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "SearchResultsWithSharedLinks"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: + 'Expecting number for "offset" of type "SearchResultsWithSharedLinks"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "SearchResultsWithSharedLinks" to be defined', + }); + } const type: SearchResultsWithSharedLinksTypeField = deserializeSearchResultsWithSharedLinksTypeField(val.type); + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "SearchResultsWithSharedLinks"', + }); + } const entries: undefined | readonly SearchResultWithSharedLink[] = val.entries == void 0 ? void 0 @@ -133,16 +168,45 @@ export function serializeSearchResultsWithSharedLinksInput( }; } export function deserializeSearchResultsWithSharedLinksInput( - val: any + val: SerializedData ): SearchResultsWithSharedLinksInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SearchResultsWithSharedLinksInput"', + }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "total_count" of type "SearchResultsWithSharedLinksInput"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "SearchResultsWithSharedLinksInput"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: + 'Expecting number for "offset" of type "SearchResultsWithSharedLinksInput"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; const type: undefined | SearchResultsWithSharedLinksTypeField = val.type == void 0 ? void 0 : deserializeSearchResultsWithSharedLinksTypeField(val.type); + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "SearchResultsWithSharedLinksInput"', + }); + } const entries: undefined | readonly SearchResultWithSharedLink[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/sessionTerminationMessage.generated.ts b/src/schemas/sessionTerminationMessage.generated.ts index 73dacc48..302bb573 100644 --- a/src/schemas/sessionTerminationMessage.generated.ts +++ b/src/schemas/sessionTerminationMessage.generated.ts @@ -1,3 +1,4 @@ +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -14,8 +15,19 @@ export function serializeSessionTerminationMessage( return { ['message']: val.message == void 0 ? void 0 : val.message }; } export function deserializeSessionTerminationMessage( - val: any + val: SerializedData ): SessionTerminationMessage { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SessionTerminationMessage"', + }); + } + if (!(val.message == void 0) && !sdIsString(val.message)) { + throw new BoxSdkError({ + message: + 'Expecting string for "message" of type "SessionTerminationMessage"', + }); + } const message: undefined | string = val.message == void 0 ? void 0 : val.message; return { message: message } satisfies SessionTerminationMessage; diff --git a/src/schemas/shieldInformationBarrier.generated.ts b/src/schemas/shieldInformationBarrier.generated.ts index e19374df..96f3c5f5 100644 --- a/src/schemas/shieldInformationBarrier.generated.ts +++ b/src/schemas/shieldInformationBarrier.generated.ts @@ -40,7 +40,7 @@ export function serializeShieldInformationBarrierTypeField( return val; } export function deserializeShieldInformationBarrierTypeField( - val: any + val: SerializedData ): ShieldInformationBarrierTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -60,7 +60,7 @@ export function serializeShieldInformationBarrierStatusField( return val; } export function deserializeShieldInformationBarrierStatusField( - val: any + val: SerializedData ): ShieldInformationBarrierStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -118,8 +118,18 @@ export function serializeShieldInformationBarrier( }; } export function deserializeShieldInformationBarrier( - val: any + val: SerializedData ): ShieldInformationBarrier { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ShieldInformationBarrier"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "ShieldInformationBarrier"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | ShieldInformationBarrierTypeField = val.type == void 0 @@ -133,14 +143,32 @@ export function deserializeShieldInformationBarrier( val.status == void 0 ? void 0 : deserializeShieldInformationBarrierStatusField(val.status); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "ShieldInformationBarrier"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); const createdBy: undefined | UserBase = val.created_by == void 0 ? void 0 : deserializeUserBase(val.created_by); + if (!(val.updated_at == void 0) && !sdIsString(val.updated_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "updated_at" of type "ShieldInformationBarrier"', + }); + } const updatedAt: undefined | DateTime = val.updated_at == void 0 ? void 0 : deserializeDateTime(val.updated_at); const updatedBy: undefined | UserBase = val.updated_by == void 0 ? void 0 : deserializeUserBase(val.updated_by); + if (!(val.enabled_at == void 0) && !sdIsString(val.enabled_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "enabled_at" of type "ShieldInformationBarrier"', + }); + } const enabledAt: undefined | DateTime = val.enabled_at == void 0 ? void 0 : deserializeDateTime(val.enabled_at); const enabledBy: undefined | UserBase = diff --git a/src/schemas/shieldInformationBarrierBase.generated.ts b/src/schemas/shieldInformationBarrierBase.generated.ts index 7db67206..796428e2 100644 --- a/src/schemas/shieldInformationBarrierBase.generated.ts +++ b/src/schemas/shieldInformationBarrierBase.generated.ts @@ -18,7 +18,7 @@ export function serializeShieldInformationBarrierBaseTypeField( return val; } export function deserializeShieldInformationBarrierBaseTypeField( - val: any + val: SerializedData ): ShieldInformationBarrierBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -44,8 +44,19 @@ export function serializeShieldInformationBarrierBase( }; } export function deserializeShieldInformationBarrierBase( - val: any + val: SerializedData ): ShieldInformationBarrierBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ShieldInformationBarrierBase"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ShieldInformationBarrierBase"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | ShieldInformationBarrierBaseTypeField = val.type == void 0 diff --git a/src/schemas/shieldInformationBarrierReference.generated.ts b/src/schemas/shieldInformationBarrierReference.generated.ts index 5be15605..1f94bda4 100644 --- a/src/schemas/shieldInformationBarrierReference.generated.ts +++ b/src/schemas/shieldInformationBarrierReference.generated.ts @@ -1,6 +1,7 @@ import { serializeShieldInformationBarrierBase } from './shieldInformationBarrierBase.generated.js'; import { deserializeShieldInformationBarrierBase } from './shieldInformationBarrierBase.generated.js'; import { ShieldInformationBarrierBase } from './shieldInformationBarrierBase.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -22,8 +23,13 @@ export function serializeShieldInformationBarrierReference( }; } export function deserializeShieldInformationBarrierReference( - val: any + val: SerializedData ): ShieldInformationBarrierReference { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ShieldInformationBarrierReference"', + }); + } const shieldInformationBarrier: undefined | ShieldInformationBarrierBase = val.shield_information_barrier == void 0 ? void 0 diff --git a/src/schemas/shieldInformationBarrierReport.generated.ts b/src/schemas/shieldInformationBarrierReport.generated.ts index 2a0b54ca..a1ed7f51 100644 --- a/src/schemas/shieldInformationBarrierReport.generated.ts +++ b/src/schemas/shieldInformationBarrierReport.generated.ts @@ -44,7 +44,7 @@ export function serializeShieldInformationBarrierReportStatusField( return val; } export function deserializeShieldInformationBarrierReportStatusField( - val: any + val: SerializedData ): ShieldInformationBarrierReportStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -104,8 +104,13 @@ export function serializeShieldInformationBarrierReport( }; } export function deserializeShieldInformationBarrierReport( - val: any + val: SerializedData ): ShieldInformationBarrierReport { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ShieldInformationBarrierReport"', + }); + } const shieldInformationBarrier: | undefined | ShieldInformationBarrierReference = @@ -122,12 +127,30 @@ export function deserializeShieldInformationBarrierReport( val.details == void 0 ? void 0 : deserializeShieldInformationBarrierReportDetails(val.details); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "ShieldInformationBarrierReport"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); const createdBy: undefined | UserBase = val.created_by == void 0 ? void 0 : deserializeUserBase(val.created_by); + if (!(val.updated_at == void 0) && !sdIsString(val.updated_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "updated_at" of type "ShieldInformationBarrierReport"', + }); + } const updatedAt: undefined | DateTime = val.updated_at == void 0 ? void 0 : deserializeDateTime(val.updated_at); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ShieldInformationBarrierReport"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | ShieldInformationBarrierReportBaseTypeField = val.type == void 0 diff --git a/src/schemas/shieldInformationBarrierReportBase.generated.ts b/src/schemas/shieldInformationBarrierReportBase.generated.ts index 9da87e03..f3a8d8ff 100644 --- a/src/schemas/shieldInformationBarrierReportBase.generated.ts +++ b/src/schemas/shieldInformationBarrierReportBase.generated.ts @@ -18,7 +18,7 @@ export function serializeShieldInformationBarrierReportBaseTypeField( return val; } export function deserializeShieldInformationBarrierReportBaseTypeField( - val: any + val: SerializedData ): ShieldInformationBarrierReportBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -45,8 +45,19 @@ export function serializeShieldInformationBarrierReportBase( }; } export function deserializeShieldInformationBarrierReportBase( - val: any + val: SerializedData ): ShieldInformationBarrierReportBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ShieldInformationBarrierReportBase"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ShieldInformationBarrierReportBase"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | ShieldInformationBarrierReportBaseTypeField = val.type == void 0 diff --git a/src/schemas/shieldInformationBarrierReportDetails.generated.ts b/src/schemas/shieldInformationBarrierReportDetails.generated.ts index b1b4b043..e8e3c0b8 100644 --- a/src/schemas/shieldInformationBarrierReportDetails.generated.ts +++ b/src/schemas/shieldInformationBarrierReportDetails.generated.ts @@ -1,3 +1,4 @@ +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -17,8 +18,20 @@ export function serializeShieldInformationBarrierReportDetailsDetailsField( return { ['folder_id']: val.folderId == void 0 ? void 0 : val.folderId }; } export function deserializeShieldInformationBarrierReportDetailsDetailsField( - val: any + val: SerializedData ): ShieldInformationBarrierReportDetailsDetailsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "ShieldInformationBarrierReportDetailsDetailsField"', + }); + } + if (!(val.folder_id == void 0) && !sdIsString(val.folder_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "folder_id" of type "ShieldInformationBarrierReportDetailsDetailsField"', + }); + } const folderId: undefined | string = val.folder_id == void 0 ? void 0 : val.folder_id; return { @@ -38,8 +51,13 @@ export function serializeShieldInformationBarrierReportDetails( }; } export function deserializeShieldInformationBarrierReportDetails( - val: any + val: SerializedData ): ShieldInformationBarrierReportDetails { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ShieldInformationBarrierReportDetails"', + }); + } const details: undefined | ShieldInformationBarrierReportDetailsDetailsField = val.details == void 0 ? void 0 diff --git a/src/schemas/shieldInformationBarrierReports.generated.ts b/src/schemas/shieldInformationBarrierReports.generated.ts index 2c19a6ee..d35ab21a 100644 --- a/src/schemas/shieldInformationBarrierReports.generated.ts +++ b/src/schemas/shieldInformationBarrierReports.generated.ts @@ -1,6 +1,7 @@ import { serializeShieldInformationBarrierReport } from './shieldInformationBarrierReport.generated.js'; import { deserializeShieldInformationBarrierReport } from './shieldInformationBarrierReport.generated.js'; import { ShieldInformationBarrierReport } from './shieldInformationBarrierReport.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -30,11 +31,34 @@ export function serializeShieldInformationBarrierReports( }; } export function deserializeShieldInformationBarrierReports( - val: any + val: SerializedData ): ShieldInformationBarrierReports { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ShieldInformationBarrierReports"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "ShieldInformationBarrierReports"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "ShieldInformationBarrierReports"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "ShieldInformationBarrierReports"', + }); + } const entries: undefined | readonly ShieldInformationBarrierReport[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/shieldInformationBarrierSegment.generated.ts b/src/schemas/shieldInformationBarrierSegment.generated.ts index 23c0f21f..d0c01f2c 100644 --- a/src/schemas/shieldInformationBarrierSegment.generated.ts +++ b/src/schemas/shieldInformationBarrierSegment.generated.ts @@ -34,7 +34,7 @@ export function serializeShieldInformationBarrierSegmentTypeField( return val; } export function deserializeShieldInformationBarrierSegmentTypeField( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -75,8 +75,19 @@ export function serializeShieldInformationBarrierSegment( }; } export function deserializeShieldInformationBarrierSegment( - val: any + val: SerializedData ): ShieldInformationBarrierSegment { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ShieldInformationBarrierSegment"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ShieldInformationBarrierSegment"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | ShieldInformationBarrierSegmentTypeField = val.type == void 0 @@ -86,13 +97,37 @@ export function deserializeShieldInformationBarrierSegment( val.shield_information_barrier == void 0 ? void 0 : deserializeShieldInformationBarrierBase(val.shield_information_barrier); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "ShieldInformationBarrierSegment"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "ShieldInformationBarrierSegment"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "ShieldInformationBarrierSegment"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); const createdBy: undefined | UserBase = val.created_by == void 0 ? void 0 : deserializeUserBase(val.created_by); + if (!(val.updated_at == void 0) && !sdIsString(val.updated_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "updated_at" of type "ShieldInformationBarrierSegment"', + }); + } const updatedAt: undefined | DateTime = val.updated_at == void 0 ? void 0 : deserializeDateTime(val.updated_at); const updatedBy: undefined | UserBase = diff --git a/src/schemas/shieldInformationBarrierSegmentMember.generated.ts b/src/schemas/shieldInformationBarrierSegmentMember.generated.ts index 979be45e..fd11e6f2 100644 --- a/src/schemas/shieldInformationBarrierSegmentMember.generated.ts +++ b/src/schemas/shieldInformationBarrierSegmentMember.generated.ts @@ -45,7 +45,7 @@ export function serializeShieldInformationBarrierSegmentMemberShieldInformationB return val; } export function deserializeShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -74,8 +74,20 @@ export function serializeShieldInformationBarrierSegmentMemberShieldInformationB }; } export function deserializeShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentField( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: | undefined @@ -124,8 +136,13 @@ export function serializeShieldInformationBarrierSegmentMember( }; } export function deserializeShieldInformationBarrierSegmentMember( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentMember { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ShieldInformationBarrierSegmentMember"', + }); + } const shieldInformationBarrier: undefined | ShieldInformationBarrierBase = val.shield_information_barrier == void 0 ? void 0 @@ -138,16 +155,34 @@ export function deserializeShieldInformationBarrierSegmentMember( : deserializeShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentField( val.shield_information_barrier_segment ); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "ShieldInformationBarrierSegmentMember"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); const createdBy: undefined | UserBase = val.created_by == void 0 ? void 0 : deserializeUserBase(val.created_by); + if (!(val.updated_at == void 0) && !sdIsString(val.updated_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "updated_at" of type "ShieldInformationBarrierSegmentMember"', + }); + } const updatedAt: undefined | DateTime = val.updated_at == void 0 ? void 0 : deserializeDateTime(val.updated_at); const updatedBy: undefined | UserBase = val.updated_by == void 0 ? void 0 : deserializeUserBase(val.updated_by); const user: undefined | UserBase = val.user == void 0 ? void 0 : deserializeUserBase(val.user); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ShieldInformationBarrierSegmentMember"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | ShieldInformationBarrierSegmentMemberBaseTypeField = val.type == void 0 diff --git a/src/schemas/shieldInformationBarrierSegmentMemberBase.generated.ts b/src/schemas/shieldInformationBarrierSegmentMemberBase.generated.ts index b8cd4bc0..5b7a3fc8 100644 --- a/src/schemas/shieldInformationBarrierSegmentMemberBase.generated.ts +++ b/src/schemas/shieldInformationBarrierSegmentMemberBase.generated.ts @@ -18,7 +18,7 @@ export function serializeShieldInformationBarrierSegmentMemberBaseTypeField( return val; } export function deserializeShieldInformationBarrierSegmentMemberBaseTypeField( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentMemberBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -45,8 +45,20 @@ export function serializeShieldInformationBarrierSegmentMemberBase( }; } export function deserializeShieldInformationBarrierSegmentMemberBase( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentMemberBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "ShieldInformationBarrierSegmentMemberBase"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ShieldInformationBarrierSegmentMemberBase"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | ShieldInformationBarrierSegmentMemberBaseTypeField = val.type == void 0 diff --git a/src/schemas/shieldInformationBarrierSegmentMemberMini.generated.ts b/src/schemas/shieldInformationBarrierSegmentMemberMini.generated.ts index 0393fbe6..75b3d496 100644 --- a/src/schemas/shieldInformationBarrierSegmentMemberMini.generated.ts +++ b/src/schemas/shieldInformationBarrierSegmentMemberMini.generated.ts @@ -35,10 +35,22 @@ export function serializeShieldInformationBarrierSegmentMemberMini( }; } export function deserializeShieldInformationBarrierSegmentMemberMini( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentMemberMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "ShieldInformationBarrierSegmentMemberMini"', + }); + } const user: undefined | UserBase = val.user == void 0 ? void 0 : deserializeUserBase(val.user); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ShieldInformationBarrierSegmentMemberMini"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | ShieldInformationBarrierSegmentMemberBaseTypeField = val.type == void 0 diff --git a/src/schemas/shieldInformationBarrierSegmentMembers.generated.ts b/src/schemas/shieldInformationBarrierSegmentMembers.generated.ts index 8fd23e84..c1f114f9 100644 --- a/src/schemas/shieldInformationBarrierSegmentMembers.generated.ts +++ b/src/schemas/shieldInformationBarrierSegmentMembers.generated.ts @@ -1,6 +1,7 @@ import { serializeShieldInformationBarrierSegmentMember } from './shieldInformationBarrierSegmentMember.generated.js'; import { deserializeShieldInformationBarrierSegmentMember } from './shieldInformationBarrierSegmentMember.generated.js'; import { ShieldInformationBarrierSegmentMember } from './shieldInformationBarrierSegmentMember.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -30,11 +31,34 @@ export function serializeShieldInformationBarrierSegmentMembers( }; } export function deserializeShieldInformationBarrierSegmentMembers( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentMembers { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ShieldInformationBarrierSegmentMembers"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "ShieldInformationBarrierSegmentMembers"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "ShieldInformationBarrierSegmentMembers"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "ShieldInformationBarrierSegmentMembers"', + }); + } const entries: undefined | readonly ShieldInformationBarrierSegmentMember[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/shieldInformationBarrierSegmentRestriction.generated.ts b/src/schemas/shieldInformationBarrierSegmentRestriction.generated.ts index 1bdd8c9a..a5929d71 100644 --- a/src/schemas/shieldInformationBarrierSegmentRestriction.generated.ts +++ b/src/schemas/shieldInformationBarrierSegmentRestriction.generated.ts @@ -68,24 +68,54 @@ export function serializeShieldInformationBarrierSegmentRestriction( }; } export function deserializeShieldInformationBarrierSegmentRestriction( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentRestriction { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "ShieldInformationBarrierSegmentRestriction"', + }); + } const shieldInformationBarrier: undefined | ShieldInformationBarrierBase = val.shield_information_barrier == void 0 ? void 0 : deserializeShieldInformationBarrierBase(val.shield_information_barrier); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "ShieldInformationBarrierSegmentRestriction"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); const createdBy: undefined | UserBase = val.created_by == void 0 ? void 0 : deserializeUserBase(val.created_by); + if (!(val.updated_at == void 0) && !sdIsString(val.updated_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "updated_at" of type "ShieldInformationBarrierSegmentRestriction"', + }); + } const updatedAt: undefined | DateTime = val.updated_at == void 0 ? void 0 : deserializeDateTime(val.updated_at); const updatedBy: undefined | UserBase = val.updated_by == void 0 ? void 0 : deserializeUserBase(val.updated_by); + if (val.shield_information_barrier_segment == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "shield_information_barrier_segment" of type "ShieldInformationBarrierSegmentRestriction" to be defined', + }); + } const shieldInformationBarrierSegment: ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField = deserializeShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField( val.shield_information_barrier_segment ); + if (val.restricted_segment == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "restricted_segment" of type "ShieldInformationBarrierSegmentRestriction" to be defined', + }); + } const restrictedSegment: ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField = deserializeShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField( val.restricted_segment @@ -98,6 +128,12 @@ export function deserializeShieldInformationBarrierSegmentRestriction( : deserializeShieldInformationBarrierSegmentRestrictionBaseTypeField( val.type ); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ShieldInformationBarrierSegmentRestriction"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { shieldInformationBarrier: shieldInformationBarrier, diff --git a/src/schemas/shieldInformationBarrierSegmentRestrictionBase.generated.ts b/src/schemas/shieldInformationBarrierSegmentRestrictionBase.generated.ts index b58afd99..709cf6bc 100644 --- a/src/schemas/shieldInformationBarrierSegmentRestrictionBase.generated.ts +++ b/src/schemas/shieldInformationBarrierSegmentRestrictionBase.generated.ts @@ -18,7 +18,7 @@ export function serializeShieldInformationBarrierSegmentRestrictionBaseTypeField return val; } export function deserializeShieldInformationBarrierSegmentRestrictionBaseTypeField( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentRestrictionBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -47,8 +47,14 @@ export function serializeShieldInformationBarrierSegmentRestrictionBase( }; } export function deserializeShieldInformationBarrierSegmentRestrictionBase( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentRestrictionBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "ShieldInformationBarrierSegmentRestrictionBase"', + }); + } const type: | undefined | ShieldInformationBarrierSegmentRestrictionBaseTypeField = @@ -57,6 +63,12 @@ export function deserializeShieldInformationBarrierSegmentRestrictionBase( : deserializeShieldInformationBarrierSegmentRestrictionBaseTypeField( val.type ); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ShieldInformationBarrierSegmentRestrictionBase"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { type: type, diff --git a/src/schemas/shieldInformationBarrierSegmentRestrictionMini.generated.ts b/src/schemas/shieldInformationBarrierSegmentRestrictionMini.generated.ts index 6d38632e..17fb6de2 100644 --- a/src/schemas/shieldInformationBarrierSegmentRestrictionMini.generated.ts +++ b/src/schemas/shieldInformationBarrierSegmentRestrictionMini.generated.ts @@ -35,7 +35,7 @@ export function serializeShieldInformationBarrierSegmentRestrictionMiniShieldInf return val; } export function deserializeShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentTypeField( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -64,8 +64,20 @@ export function serializeShieldInformationBarrierSegmentRestrictionMiniShieldInf }; } export function deserializeShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: | undefined @@ -86,7 +98,7 @@ export function serializeShieldInformationBarrierSegmentRestrictionMiniRestricte return val; } export function deserializeShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentTypeField( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -115,8 +127,20 @@ export function serializeShieldInformationBarrierSegmentRestrictionMiniRestricte }; } export function deserializeShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: | undefined @@ -157,12 +181,30 @@ export function serializeShieldInformationBarrierSegmentRestrictionMini( }; } export function deserializeShieldInformationBarrierSegmentRestrictionMini( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentRestrictionMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "ShieldInformationBarrierSegmentRestrictionMini"', + }); + } + if (val.shield_information_barrier_segment == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "shield_information_barrier_segment" of type "ShieldInformationBarrierSegmentRestrictionMini" to be defined', + }); + } const shieldInformationBarrierSegment: ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField = deserializeShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField( val.shield_information_barrier_segment ); + if (val.restricted_segment == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "restricted_segment" of type "ShieldInformationBarrierSegmentRestrictionMini" to be defined', + }); + } const restrictedSegment: ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField = deserializeShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField( val.restricted_segment @@ -175,6 +217,12 @@ export function deserializeShieldInformationBarrierSegmentRestrictionMini( : deserializeShieldInformationBarrierSegmentRestrictionBaseTypeField( val.type ); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ShieldInformationBarrierSegmentRestrictionMini"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { shieldInformationBarrierSegment: shieldInformationBarrierSegment, diff --git a/src/schemas/shieldInformationBarrierSegmentRestrictions.generated.ts b/src/schemas/shieldInformationBarrierSegmentRestrictions.generated.ts index 1cc303fd..e2884af6 100644 --- a/src/schemas/shieldInformationBarrierSegmentRestrictions.generated.ts +++ b/src/schemas/shieldInformationBarrierSegmentRestrictions.generated.ts @@ -1,6 +1,7 @@ import { serializeShieldInformationBarrierSegmentRestriction } from './shieldInformationBarrierSegmentRestriction.generated.js'; import { deserializeShieldInformationBarrierSegmentRestriction } from './shieldInformationBarrierSegmentRestriction.generated.js'; import { ShieldInformationBarrierSegmentRestriction } from './shieldInformationBarrierSegmentRestriction.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -30,11 +31,35 @@ export function serializeShieldInformationBarrierSegmentRestrictions( }; } export function deserializeShieldInformationBarrierSegmentRestrictions( - val: any + val: SerializedData ): ShieldInformationBarrierSegmentRestrictions { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "ShieldInformationBarrierSegmentRestrictions"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "ShieldInformationBarrierSegmentRestrictions"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "ShieldInformationBarrierSegmentRestrictions"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "ShieldInformationBarrierSegmentRestrictions"', + }); + } const entries: | undefined | readonly ShieldInformationBarrierSegmentRestriction[] = diff --git a/src/schemas/shieldInformationBarrierSegments.generated.ts b/src/schemas/shieldInformationBarrierSegments.generated.ts index c6c201c4..cdf61d11 100644 --- a/src/schemas/shieldInformationBarrierSegments.generated.ts +++ b/src/schemas/shieldInformationBarrierSegments.generated.ts @@ -1,6 +1,7 @@ import { serializeShieldInformationBarrierSegment } from './shieldInformationBarrierSegment.generated.js'; import { deserializeShieldInformationBarrierSegment } from './shieldInformationBarrierSegment.generated.js'; import { ShieldInformationBarrierSegment } from './shieldInformationBarrierSegment.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -30,11 +31,34 @@ export function serializeShieldInformationBarrierSegments( }; } export function deserializeShieldInformationBarrierSegments( - val: any + val: SerializedData ): ShieldInformationBarrierSegments { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ShieldInformationBarrierSegments"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "ShieldInformationBarrierSegments"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "ShieldInformationBarrierSegments"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "ShieldInformationBarrierSegments"', + }); + } const entries: undefined | readonly ShieldInformationBarrierSegment[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/shieldInformationBarriers.generated.ts b/src/schemas/shieldInformationBarriers.generated.ts index e298c254..46632b62 100644 --- a/src/schemas/shieldInformationBarriers.generated.ts +++ b/src/schemas/shieldInformationBarriers.generated.ts @@ -1,6 +1,7 @@ import { serializeShieldInformationBarrier } from './shieldInformationBarrier.generated.js'; import { deserializeShieldInformationBarrier } from './shieldInformationBarrier.generated.js'; import { ShieldInformationBarrier } from './shieldInformationBarrier.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -30,11 +31,34 @@ export function serializeShieldInformationBarriers( }; } export function deserializeShieldInformationBarriers( - val: any + val: SerializedData ): ShieldInformationBarriers { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ShieldInformationBarriers"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "ShieldInformationBarriers"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "ShieldInformationBarriers"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "ShieldInformationBarriers"', + }); + } const entries: undefined | readonly ShieldInformationBarrier[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/signRequest.generated.ts b/src/schemas/signRequest.generated.ts index 0a7858ef..6ee3eeb4 100644 --- a/src/schemas/signRequest.generated.ts +++ b/src/schemas/signRequest.generated.ts @@ -64,7 +64,7 @@ export function serializeSignRequestTypeField( return val; } export function deserializeSignRequestTypeField( - val: any + val: SerializedData ): SignRequestTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -84,7 +84,7 @@ export function serializeSignRequestStatusField( return val; } export function deserializeSignRequestStatusField( - val: any + val: SerializedData ): SignRequestStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -146,8 +146,19 @@ export function serializeSignRequestSignFilesField( }; } export function deserializeSignRequestSignFilesField( - val: any + val: SerializedData ): SignRequestSignFilesField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SignRequestSignFilesField"', + }); + } + if (!(val.files == void 0) && !sdIsList(val.files)) { + throw new BoxSdkError({ + message: + 'Expecting array for "files" of type "SignRequestSignFilesField"', + }); + } const files: undefined | readonly FileMini[] = val.files == void 0 ? void 0 @@ -156,6 +167,15 @@ export function deserializeSignRequestSignFilesField( return deserializeFileMini(itm); }) as readonly any[]) : []; + if ( + !(val.is_ready_for_download == void 0) && + !sdIsBoolean(val.is_ready_for_download) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_ready_for_download" of type "SignRequestSignFilesField"', + }); + } const isReadyForDownload: undefined | boolean = val.is_ready_for_download == void 0 ? void 0 : val.is_ready_for_download; return { @@ -212,9 +232,17 @@ export function serializeSignRequest(val: SignRequest): SerializedData { }, }; } -export function deserializeSignRequest(val: any): SignRequest { +export function deserializeSignRequest(val: SerializedData): SignRequest { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "SignRequest"' }); + } const type: undefined | SignRequestTypeField = val.type == void 0 ? void 0 : deserializeSignRequestTypeField(val.type); + if (!(val.source_files == void 0) && !sdIsList(val.source_files)) { + throw new BoxSdkError({ + message: 'Expecting array for "source_files" of type "SignRequest"', + }); + } const sourceFiles: undefined | readonly FileBase[] = val.source_files == void 0 ? void 0 @@ -223,6 +251,11 @@ export function deserializeSignRequest(val: any): SignRequest { return deserializeFileBase(itm); }) as readonly any[]) : []; + if (!(val.signers == void 0) && !sdIsList(val.signers)) { + throw new BoxSdkError({ + message: 'Expecting array for "signers" of type "SignRequest"', + }); + } const signers: undefined | readonly SignRequestSigner[] = val.signers == void 0 ? void 0 @@ -231,9 +264,24 @@ export function deserializeSignRequest(val: any): SignRequest { return deserializeSignRequestSigner(itm); }) as readonly any[]) : []; + if (!(val.signature_color == void 0) && !sdIsString(val.signature_color)) { + throw new BoxSdkError({ + message: 'Expecting string for "signature_color" of type "SignRequest"', + }); + } const signatureColor: undefined | string = val.signature_color == void 0 ? void 0 : val.signature_color; + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "SignRequest"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (!(val.prepare_url == void 0) && !sdIsString(val.prepare_url)) { + throw new BoxSdkError({ + message: 'Expecting string for "prepare_url" of type "SignRequest"', + }); + } const prepareUrl: undefined | string = val.prepare_url == void 0 ? void 0 : val.prepare_url; const signingLog: undefined | FileMini = @@ -246,6 +294,11 @@ export function deserializeSignRequest(val: any): SignRequest { val.sign_files == void 0 ? void 0 : deserializeSignRequestSignFilesField(val.sign_files); + if (!(val.auto_expire_at == void 0) && !sdIsString(val.auto_expire_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "auto_expire_at" of type "SignRequest"', + }); + } const autoExpireAt: undefined | DateTime = val.auto_expire_at == void 0 ? void 0 @@ -254,25 +307,86 @@ export function deserializeSignRequest(val: any): SignRequest { val.parent_folder == void 0 ? void 0 : deserializeFolderMini(val.parent_folder); + if ( + !(val.is_document_preparation_needed == void 0) && + !sdIsBoolean(val.is_document_preparation_needed) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_document_preparation_needed" of type "SignRequest"', + }); + } const isDocumentPreparationNeeded: undefined | boolean = val.is_document_preparation_needed == void 0 ? void 0 : val.is_document_preparation_needed; + if (!(val.redirect_url == void 0) && !sdIsString(val.redirect_url)) { + throw new BoxSdkError({ + message: 'Expecting string for "redirect_url" of type "SignRequest"', + }); + } const redirectUrl: undefined | string = val.redirect_url == void 0 ? void 0 : val.redirect_url; + if ( + !(val.declined_redirect_url == void 0) && + !sdIsString(val.declined_redirect_url) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "declined_redirect_url" of type "SignRequest"', + }); + } const declinedRedirectUrl: undefined | string = val.declined_redirect_url == void 0 ? void 0 : val.declined_redirect_url; + if ( + !(val.are_text_signatures_enabled == void 0) && + !sdIsBoolean(val.are_text_signatures_enabled) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "are_text_signatures_enabled" of type "SignRequest"', + }); + } const areTextSignaturesEnabled: undefined | boolean = val.are_text_signatures_enabled == void 0 ? void 0 : val.are_text_signatures_enabled; + if (!(val.email_subject == void 0) && !sdIsString(val.email_subject)) { + throw new BoxSdkError({ + message: 'Expecting string for "email_subject" of type "SignRequest"', + }); + } const emailSubject: undefined | string = val.email_subject == void 0 ? void 0 : val.email_subject; + if (!(val.email_message == void 0) && !sdIsString(val.email_message)) { + throw new BoxSdkError({ + message: 'Expecting string for "email_message" of type "SignRequest"', + }); + } const emailMessage: undefined | string = val.email_message == void 0 ? void 0 : val.email_message; + if ( + !(val.are_reminders_enabled == void 0) && + !sdIsBoolean(val.are_reminders_enabled) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "are_reminders_enabled" of type "SignRequest"', + }); + } const areRemindersEnabled: undefined | boolean = val.are_reminders_enabled == void 0 ? void 0 : val.are_reminders_enabled; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "SignRequest"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.prefill_tags == void 0) && !sdIsList(val.prefill_tags)) { + throw new BoxSdkError({ + message: 'Expecting array for "prefill_tags" of type "SignRequest"', + }); + } const prefillTags: undefined | readonly SignRequestPrefillTag[] = val.prefill_tags == void 0 ? void 0 @@ -283,14 +397,38 @@ export function deserializeSignRequest(val: any): SignRequest { return deserializeSignRequestPrefillTag(itm); }) as readonly any[]) : []; + if (!(val.days_valid == void 0) && !sdIsNumber(val.days_valid)) { + throw new BoxSdkError({ + message: 'Expecting number for "days_valid" of type "SignRequest"', + }); + } const daysValid: undefined | number = val.days_valid == void 0 ? void 0 : val.days_valid; + if (!(val.external_id == void 0) && !sdIsString(val.external_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "external_id" of type "SignRequest"', + }); + } const externalId: undefined | string = val.external_id == void 0 ? void 0 : val.external_id; + if ( + !(val.is_phone_verification_required_to_view == void 0) && + !sdIsBoolean(val.is_phone_verification_required_to_view) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_phone_verification_required_to_view" of type "SignRequest"', + }); + } const isPhoneVerificationRequiredToView: undefined | boolean = val.is_phone_verification_required_to_view == void 0 ? void 0 : val.is_phone_verification_required_to_view; + if (!(val.template_id == void 0) && !sdIsString(val.template_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "template_id" of type "SignRequest"', + }); + } const templateId: undefined | string = val.template_id == void 0 ? void 0 : val.template_id; return { diff --git a/src/schemas/signRequestBase.generated.ts b/src/schemas/signRequestBase.generated.ts index 0029ea12..12e864d1 100644 --- a/src/schemas/signRequestBase.generated.ts +++ b/src/schemas/signRequestBase.generated.ts @@ -1,6 +1,7 @@ import { serializeSignRequestPrefillTag } from './signRequestPrefillTag.generated.js'; import { deserializeSignRequestPrefillTag } from './signRequestPrefillTag.generated.js'; import { SignRequestPrefillTag } from './signRequestPrefillTag.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -58,26 +59,92 @@ export function serializeSignRequestBase(val: SignRequestBase): SerializedData { ['template_id']: val.templateId == void 0 ? void 0 : val.templateId, }; } -export function deserializeSignRequestBase(val: any): SignRequestBase { +export function deserializeSignRequestBase( + val: SerializedData +): SignRequestBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "SignRequestBase"' }); + } + if ( + !(val.is_document_preparation_needed == void 0) && + !sdIsBoolean(val.is_document_preparation_needed) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_document_preparation_needed" of type "SignRequestBase"', + }); + } const isDocumentPreparationNeeded: undefined | boolean = val.is_document_preparation_needed == void 0 ? void 0 : val.is_document_preparation_needed; + if (!(val.redirect_url == void 0) && !sdIsString(val.redirect_url)) { + throw new BoxSdkError({ + message: 'Expecting string for "redirect_url" of type "SignRequestBase"', + }); + } const redirectUrl: undefined | string = val.redirect_url == void 0 ? void 0 : val.redirect_url; + if ( + !(val.declined_redirect_url == void 0) && + !sdIsString(val.declined_redirect_url) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "declined_redirect_url" of type "SignRequestBase"', + }); + } const declinedRedirectUrl: undefined | string = val.declined_redirect_url == void 0 ? void 0 : val.declined_redirect_url; + if ( + !(val.are_text_signatures_enabled == void 0) && + !sdIsBoolean(val.are_text_signatures_enabled) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "are_text_signatures_enabled" of type "SignRequestBase"', + }); + } const areTextSignaturesEnabled: undefined | boolean = val.are_text_signatures_enabled == void 0 ? void 0 : val.are_text_signatures_enabled; + if (!(val.email_subject == void 0) && !sdIsString(val.email_subject)) { + throw new BoxSdkError({ + message: 'Expecting string for "email_subject" of type "SignRequestBase"', + }); + } const emailSubject: undefined | string = val.email_subject == void 0 ? void 0 : val.email_subject; + if (!(val.email_message == void 0) && !sdIsString(val.email_message)) { + throw new BoxSdkError({ + message: 'Expecting string for "email_message" of type "SignRequestBase"', + }); + } const emailMessage: undefined | string = val.email_message == void 0 ? void 0 : val.email_message; + if ( + !(val.are_reminders_enabled == void 0) && + !sdIsBoolean(val.are_reminders_enabled) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "are_reminders_enabled" of type "SignRequestBase"', + }); + } const areRemindersEnabled: undefined | boolean = val.are_reminders_enabled == void 0 ? void 0 : val.are_reminders_enabled; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "SignRequestBase"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.prefill_tags == void 0) && !sdIsList(val.prefill_tags)) { + throw new BoxSdkError({ + message: 'Expecting array for "prefill_tags" of type "SignRequestBase"', + }); + } const prefillTags: undefined | readonly SignRequestPrefillTag[] = val.prefill_tags == void 0 ? void 0 @@ -88,14 +155,38 @@ export function deserializeSignRequestBase(val: any): SignRequestBase { return deserializeSignRequestPrefillTag(itm); }) as readonly any[]) : []; + if (!(val.days_valid == void 0) && !sdIsNumber(val.days_valid)) { + throw new BoxSdkError({ + message: 'Expecting number for "days_valid" of type "SignRequestBase"', + }); + } const daysValid: undefined | number = val.days_valid == void 0 ? void 0 : val.days_valid; + if (!(val.external_id == void 0) && !sdIsString(val.external_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "external_id" of type "SignRequestBase"', + }); + } const externalId: undefined | string = val.external_id == void 0 ? void 0 : val.external_id; + if ( + !(val.is_phone_verification_required_to_view == void 0) && + !sdIsBoolean(val.is_phone_verification_required_to_view) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_phone_verification_required_to_view" of type "SignRequestBase"', + }); + } const isPhoneVerificationRequiredToView: undefined | boolean = val.is_phone_verification_required_to_view == void 0 ? void 0 : val.is_phone_verification_required_to_view; + if (!(val.template_id == void 0) && !sdIsString(val.template_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "template_id" of type "SignRequestBase"', + }); + } const templateId: undefined | string = val.template_id == void 0 ? void 0 : val.template_id; return { diff --git a/src/schemas/signRequestCreateRequest.generated.ts b/src/schemas/signRequestCreateRequest.generated.ts index 9b210942..f29ff3a1 100644 --- a/src/schemas/signRequestCreateRequest.generated.ts +++ b/src/schemas/signRequestCreateRequest.generated.ts @@ -37,7 +37,7 @@ export function serializeSignRequestCreateRequestSignatureColorField( return val; } export function deserializeSignRequestCreateRequestSignatureColorField( - val: any + val: SerializedData ): SignRequestCreateRequestSignatureColorField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -95,8 +95,19 @@ export function serializeSignRequestCreateRequest( }; } export function deserializeSignRequestCreateRequest( - val: any + val: SerializedData ): SignRequestCreateRequest { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SignRequestCreateRequest"', + }); + } + if (!(val.source_files == void 0) && !sdIsList(val.source_files)) { + throw new BoxSdkError({ + message: + 'Expecting array for "source_files" of type "SignRequestCreateRequest"', + }); + } const sourceFiles: undefined | readonly FileBase[] = val.source_files == void 0 ? void 0 @@ -113,6 +124,18 @@ export function deserializeSignRequestCreateRequest( : deserializeSignRequestCreateRequestSignatureColorField( val.signature_color ); + if (val.signers == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "signers" of type "SignRequestCreateRequest" to be defined', + }); + } + if (!sdIsList(val.signers)) { + throw new BoxSdkError({ + message: + 'Expecting array for "signers" of type "SignRequestCreateRequest"', + }); + } const signers: readonly SignRequestCreateSigner[] = sdIsList(val.signers) ? (val.signers.map(function (itm: SerializedData): SignRequestCreateSigner { return deserializeSignRequestCreateSigner(itm); @@ -122,25 +145,90 @@ export function deserializeSignRequestCreateRequest( val.parent_folder == void 0 ? void 0 : deserializeFolderMini(val.parent_folder); + if ( + !(val.is_document_preparation_needed == void 0) && + !sdIsBoolean(val.is_document_preparation_needed) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_document_preparation_needed" of type "SignRequestCreateRequest"', + }); + } const isDocumentPreparationNeeded: undefined | boolean = val.is_document_preparation_needed == void 0 ? void 0 : val.is_document_preparation_needed; + if (!(val.redirect_url == void 0) && !sdIsString(val.redirect_url)) { + throw new BoxSdkError({ + message: + 'Expecting string for "redirect_url" of type "SignRequestCreateRequest"', + }); + } const redirectUrl: undefined | string = val.redirect_url == void 0 ? void 0 : val.redirect_url; + if ( + !(val.declined_redirect_url == void 0) && + !sdIsString(val.declined_redirect_url) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "declined_redirect_url" of type "SignRequestCreateRequest"', + }); + } const declinedRedirectUrl: undefined | string = val.declined_redirect_url == void 0 ? void 0 : val.declined_redirect_url; + if ( + !(val.are_text_signatures_enabled == void 0) && + !sdIsBoolean(val.are_text_signatures_enabled) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "are_text_signatures_enabled" of type "SignRequestCreateRequest"', + }); + } const areTextSignaturesEnabled: undefined | boolean = val.are_text_signatures_enabled == void 0 ? void 0 : val.are_text_signatures_enabled; + if (!(val.email_subject == void 0) && !sdIsString(val.email_subject)) { + throw new BoxSdkError({ + message: + 'Expecting string for "email_subject" of type "SignRequestCreateRequest"', + }); + } const emailSubject: undefined | string = val.email_subject == void 0 ? void 0 : val.email_subject; + if (!(val.email_message == void 0) && !sdIsString(val.email_message)) { + throw new BoxSdkError({ + message: + 'Expecting string for "email_message" of type "SignRequestCreateRequest"', + }); + } const emailMessage: undefined | string = val.email_message == void 0 ? void 0 : val.email_message; + if ( + !(val.are_reminders_enabled == void 0) && + !sdIsBoolean(val.are_reminders_enabled) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "are_reminders_enabled" of type "SignRequestCreateRequest"', + }); + } const areRemindersEnabled: undefined | boolean = val.are_reminders_enabled == void 0 ? void 0 : val.are_reminders_enabled; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "SignRequestCreateRequest"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.prefill_tags == void 0) && !sdIsList(val.prefill_tags)) { + throw new BoxSdkError({ + message: + 'Expecting array for "prefill_tags" of type "SignRequestCreateRequest"', + }); + } const prefillTags: undefined | readonly SignRequestPrefillTag[] = val.prefill_tags == void 0 ? void 0 @@ -151,14 +239,41 @@ export function deserializeSignRequestCreateRequest( return deserializeSignRequestPrefillTag(itm); }) as readonly any[]) : []; + if (!(val.days_valid == void 0) && !sdIsNumber(val.days_valid)) { + throw new BoxSdkError({ + message: + 'Expecting number for "days_valid" of type "SignRequestCreateRequest"', + }); + } const daysValid: undefined | number = val.days_valid == void 0 ? void 0 : val.days_valid; + if (!(val.external_id == void 0) && !sdIsString(val.external_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "external_id" of type "SignRequestCreateRequest"', + }); + } const externalId: undefined | string = val.external_id == void 0 ? void 0 : val.external_id; + if ( + !(val.is_phone_verification_required_to_view == void 0) && + !sdIsBoolean(val.is_phone_verification_required_to_view) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_phone_verification_required_to_view" of type "SignRequestCreateRequest"', + }); + } const isPhoneVerificationRequiredToView: undefined | boolean = val.is_phone_verification_required_to_view == void 0 ? void 0 : val.is_phone_verification_required_to_view; + if (!(val.template_id == void 0) && !sdIsString(val.template_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "template_id" of type "SignRequestCreateRequest"', + }); + } const templateId: undefined | string = val.template_id == void 0 ? void 0 : val.template_id; return { diff --git a/src/schemas/signRequestCreateSigner.generated.ts b/src/schemas/signRequestCreateSigner.generated.ts index 7800dd87..927b71d4 100644 --- a/src/schemas/signRequestCreateSigner.generated.ts +++ b/src/schemas/signRequestCreateSigner.generated.ts @@ -29,7 +29,7 @@ export function serializeSignRequestCreateSignerRoleField( return val; } export function deserializeSignRequestCreateSignerRoleField( - val: any + val: SerializedData ): SignRequestCreateSignerRoleField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -79,32 +79,104 @@ export function serializeSignRequestCreateSigner( }; } export function deserializeSignRequestCreateSigner( - val: any + val: SerializedData ): SignRequestCreateSigner { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SignRequestCreateSigner"', + }); + } + if (!(val.email == void 0) && !sdIsString(val.email)) { + throw new BoxSdkError({ + message: 'Expecting string for "email" of type "SignRequestCreateSigner"', + }); + } const email: undefined | string = val.email == void 0 ? void 0 : val.email; const role: undefined | SignRequestCreateSignerRoleField = val.role == void 0 ? void 0 : deserializeSignRequestCreateSignerRoleField(val.role); + if (!(val.is_in_person == void 0) && !sdIsBoolean(val.is_in_person)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_in_person" of type "SignRequestCreateSigner"', + }); + } const isInPerson: undefined | boolean = val.is_in_person == void 0 ? void 0 : val.is_in_person; + if (!(val.order == void 0) && !sdIsNumber(val.order)) { + throw new BoxSdkError({ + message: 'Expecting number for "order" of type "SignRequestCreateSigner"', + }); + } const order: undefined | number = val.order == void 0 ? void 0 : val.order; + if ( + !(val.embed_url_external_user_id == void 0) && + !sdIsString(val.embed_url_external_user_id) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "embed_url_external_user_id" of type "SignRequestCreateSigner"', + }); + } const embedUrlExternalUserId: undefined | string = val.embed_url_external_user_id == void 0 ? void 0 : val.embed_url_external_user_id; + if (!(val.redirect_url == void 0) && !sdIsString(val.redirect_url)) { + throw new BoxSdkError({ + message: + 'Expecting string for "redirect_url" of type "SignRequestCreateSigner"', + }); + } const redirectUrl: undefined | string = val.redirect_url == void 0 ? void 0 : val.redirect_url; + if ( + !(val.declined_redirect_url == void 0) && + !sdIsString(val.declined_redirect_url) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "declined_redirect_url" of type "SignRequestCreateSigner"', + }); + } const declinedRedirectUrl: undefined | string = val.declined_redirect_url == void 0 ? void 0 : val.declined_redirect_url; + if (!(val.login_required == void 0) && !sdIsBoolean(val.login_required)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "login_required" of type "SignRequestCreateSigner"', + }); + } const loginRequired: undefined | boolean = val.login_required == void 0 ? void 0 : val.login_required; + if ( + !(val.verification_phone_number == void 0) && + !sdIsString(val.verification_phone_number) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "verification_phone_number" of type "SignRequestCreateSigner"', + }); + } const verificationPhoneNumber: undefined | string = val.verification_phone_number == void 0 ? void 0 : val.verification_phone_number; + if (!(val.password == void 0) && !sdIsString(val.password)) { + throw new BoxSdkError({ + message: + 'Expecting string for "password" of type "SignRequestCreateSigner"', + }); + } const password: undefined | string = val.password == void 0 ? void 0 : val.password; + if (!(val.signer_group_id == void 0) && !sdIsString(val.signer_group_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "signer_group_id" of type "SignRequestCreateSigner"', + }); + } const signerGroupId: undefined | string = val.signer_group_id == void 0 ? void 0 : val.signer_group_id; return { diff --git a/src/schemas/signRequestPrefillTag.generated.ts b/src/schemas/signRequestPrefillTag.generated.ts index 04ae4485..ab5dfcbb 100644 --- a/src/schemas/signRequestPrefillTag.generated.ts +++ b/src/schemas/signRequestPrefillTag.generated.ts @@ -1,6 +1,7 @@ import { serializeDate } from '../internal/utils.js'; import { deserializeDate } from '../internal/utils.js'; import { Date } from '../internal/utils.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -28,14 +29,43 @@ export function serializeSignRequestPrefillTag( }; } export function deserializeSignRequestPrefillTag( - val: any + val: SerializedData ): SignRequestPrefillTag { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SignRequestPrefillTag"', + }); + } + if (!(val.document_tag_id == void 0) && !sdIsString(val.document_tag_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "document_tag_id" of type "SignRequestPrefillTag"', + }); + } const documentTagId: undefined | string = val.document_tag_id == void 0 ? void 0 : val.document_tag_id; + if (!(val.text_value == void 0) && !sdIsString(val.text_value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "text_value" of type "SignRequestPrefillTag"', + }); + } const textValue: undefined | string = val.text_value == void 0 ? void 0 : val.text_value; + if (!(val.checkbox_value == void 0) && !sdIsBoolean(val.checkbox_value)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "checkbox_value" of type "SignRequestPrefillTag"', + }); + } const checkboxValue: undefined | boolean = val.checkbox_value == void 0 ? void 0 : val.checkbox_value; + if (!(val.date_value == void 0) && !sdIsString(val.date_value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "date_value" of type "SignRequestPrefillTag"', + }); + } const dateValue: undefined | Date = val.date_value == void 0 ? void 0 : deserializeDate(val.date_value); return { diff --git a/src/schemas/signRequestSigner.generated.ts b/src/schemas/signRequestSigner.generated.ts index c8a49ad6..0a9322df 100644 --- a/src/schemas/signRequestSigner.generated.ts +++ b/src/schemas/signRequestSigner.generated.ts @@ -37,7 +37,7 @@ export function serializeSignRequestSignerSignerDecisionTypeField( return val; } export function deserializeSignRequestSignerSignerDecisionTypeField( - val: any + val: SerializedData ): SignRequestSignerSignerDecisionTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -70,14 +70,31 @@ export function serializeSignRequestSignerSignerDecisionField( }; } export function deserializeSignRequestSignerSignerDecisionField( - val: any + val: SerializedData ): SignRequestSignerSignerDecisionField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SignRequestSignerSignerDecisionField"', + }); + } const type: undefined | SignRequestSignerSignerDecisionTypeField = val.type == void 0 ? void 0 : deserializeSignRequestSignerSignerDecisionTypeField(val.type); + if (!(val.finalized_at == void 0) && !sdIsString(val.finalized_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "finalized_at" of type "SignRequestSignerSignerDecisionField"', + }); + } const finalizedAt: undefined | DateTime = val.finalized_at == void 0 ? void 0 : deserializeDateTime(val.finalized_at); + if (!(val.additional_info == void 0) && !sdIsString(val.additional_info)) { + throw new BoxSdkError({ + message: + 'Expecting string for "additional_info" of type "SignRequestSignerSignerDecisionField"', + }); + } const additionalInfo: undefined | string = val.additional_info == void 0 ? void 0 : val.additional_info; return { @@ -118,13 +135,34 @@ export function serializeSignRequestSigner( }, }; } -export function deserializeSignRequestSigner(val: any): SignRequestSigner { +export function deserializeSignRequestSigner( + val: SerializedData +): SignRequestSigner { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SignRequestSigner"', + }); + } + if ( + !(val.has_viewed_document == void 0) && + !sdIsBoolean(val.has_viewed_document) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "has_viewed_document" of type "SignRequestSigner"', + }); + } const hasViewedDocument: undefined | boolean = val.has_viewed_document == void 0 ? void 0 : val.has_viewed_document; const signerDecision: undefined | SignRequestSignerSignerDecisionField = val.signer_decision == void 0 ? void 0 : deserializeSignRequestSignerSignerDecisionField(val.signer_decision); + if (!(val.inputs == void 0) && !sdIsList(val.inputs)) { + throw new BoxSdkError({ + message: 'Expecting array for "inputs" of type "SignRequestSigner"', + }); + } const inputs: undefined | readonly SignRequestSignerInput[] = val.inputs == void 0 ? void 0 @@ -133,34 +171,114 @@ export function deserializeSignRequestSigner(val: any): SignRequestSigner { return deserializeSignRequestSignerInput(itm); }) as readonly any[]) : []; + if (!(val.embed_url == void 0) && !sdIsString(val.embed_url)) { + throw new BoxSdkError({ + message: 'Expecting string for "embed_url" of type "SignRequestSigner"', + }); + } const embedUrl: undefined | string = val.embed_url == void 0 ? void 0 : val.embed_url; + if ( + !(val.iframeable_embed_url == void 0) && + !sdIsString(val.iframeable_embed_url) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "iframeable_embed_url" of type "SignRequestSigner"', + }); + } const iframeableEmbedUrl: undefined | string = val.iframeable_embed_url == void 0 ? void 0 : val.iframeable_embed_url; + if (!(val.email == void 0) && !sdIsString(val.email)) { + throw new BoxSdkError({ + message: 'Expecting string for "email" of type "SignRequestSigner"', + }); + } const email: undefined | string = val.email == void 0 ? void 0 : val.email; const role: undefined | SignRequestCreateSignerRoleField = val.role == void 0 ? void 0 : deserializeSignRequestCreateSignerRoleField(val.role); + if (!(val.is_in_person == void 0) && !sdIsBoolean(val.is_in_person)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_in_person" of type "SignRequestSigner"', + }); + } const isInPerson: undefined | boolean = val.is_in_person == void 0 ? void 0 : val.is_in_person; + if (!(val.order == void 0) && !sdIsNumber(val.order)) { + throw new BoxSdkError({ + message: 'Expecting number for "order" of type "SignRequestSigner"', + }); + } const order: undefined | number = val.order == void 0 ? void 0 : val.order; + if ( + !(val.embed_url_external_user_id == void 0) && + !sdIsString(val.embed_url_external_user_id) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "embed_url_external_user_id" of type "SignRequestSigner"', + }); + } const embedUrlExternalUserId: undefined | string = val.embed_url_external_user_id == void 0 ? void 0 : val.embed_url_external_user_id; + if (!(val.redirect_url == void 0) && !sdIsString(val.redirect_url)) { + throw new BoxSdkError({ + message: + 'Expecting string for "redirect_url" of type "SignRequestSigner"', + }); + } const redirectUrl: undefined | string = val.redirect_url == void 0 ? void 0 : val.redirect_url; + if ( + !(val.declined_redirect_url == void 0) && + !sdIsString(val.declined_redirect_url) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "declined_redirect_url" of type "SignRequestSigner"', + }); + } const declinedRedirectUrl: undefined | string = val.declined_redirect_url == void 0 ? void 0 : val.declined_redirect_url; + if (!(val.login_required == void 0) && !sdIsBoolean(val.login_required)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "login_required" of type "SignRequestSigner"', + }); + } const loginRequired: undefined | boolean = val.login_required == void 0 ? void 0 : val.login_required; + if ( + !(val.verification_phone_number == void 0) && + !sdIsString(val.verification_phone_number) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "verification_phone_number" of type "SignRequestSigner"', + }); + } const verificationPhoneNumber: undefined | string = val.verification_phone_number == void 0 ? void 0 : val.verification_phone_number; + if (!(val.password == void 0) && !sdIsString(val.password)) { + throw new BoxSdkError({ + message: 'Expecting string for "password" of type "SignRequestSigner"', + }); + } const password: undefined | string = val.password == void 0 ? void 0 : val.password; + if (!(val.signer_group_id == void 0) && !sdIsString(val.signer_group_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "signer_group_id" of type "SignRequestSigner"', + }); + } const signerGroupId: undefined | string = val.signer_group_id == void 0 ? void 0 : val.signer_group_id; return { diff --git a/src/schemas/signRequestSignerInput.generated.ts b/src/schemas/signRequestSignerInput.generated.ts index f3c3d0a1..95cda748 100644 --- a/src/schemas/signRequestSignerInput.generated.ts +++ b/src/schemas/signRequestSignerInput.generated.ts @@ -47,7 +47,7 @@ export function serializeSignRequestSignerInputTypeField( return val; } export function deserializeSignRequestSignerInputTypeField( - val: any + val: SerializedData ): SignRequestSignerInputTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -82,7 +82,7 @@ export function serializeSignRequestSignerInputContentTypeField( return val; } export function deserializeSignRequestSignerInputContentTypeField( - val: any + val: SerializedData ): SignRequestSignerInputContentTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -165,8 +165,13 @@ export function serializeSignRequestSignerInput( }; } export function deserializeSignRequestSignerInput( - val: any + val: SerializedData ): SignRequestSignerInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SignRequestSignerInput"', + }); + } const type: undefined | SignRequestSignerInputTypeField = val.type == void 0 ? void 0 @@ -175,15 +180,57 @@ export function deserializeSignRequestSignerInput( val.content_type == void 0 ? void 0 : deserializeSignRequestSignerInputContentTypeField(val.content_type); + if (val.page_index == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "page_index" of type "SignRequestSignerInput" to be defined', + }); + } + if (!sdIsNumber(val.page_index)) { + throw new BoxSdkError({ + message: + 'Expecting number for "page_index" of type "SignRequestSignerInput"', + }); + } const pageIndex: number = val.page_index; + if (!(val.read_only == void 0) && !sdIsBoolean(val.read_only)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "read_only" of type "SignRequestSignerInput"', + }); + } const readOnly: undefined | boolean = val.read_only == void 0 ? void 0 : val.read_only; + if (!(val.document_tag_id == void 0) && !sdIsString(val.document_tag_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "document_tag_id" of type "SignRequestSignerInput"', + }); + } const documentTagId: undefined | string = val.document_tag_id == void 0 ? void 0 : val.document_tag_id; + if (!(val.text_value == void 0) && !sdIsString(val.text_value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "text_value" of type "SignRequestSignerInput"', + }); + } const textValue: undefined | string = val.text_value == void 0 ? void 0 : val.text_value; + if (!(val.checkbox_value == void 0) && !sdIsBoolean(val.checkbox_value)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "checkbox_value" of type "SignRequestSignerInput"', + }); + } const checkboxValue: undefined | boolean = val.checkbox_value == void 0 ? void 0 : val.checkbox_value; + if (!(val.date_value == void 0) && !sdIsString(val.date_value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "date_value" of type "SignRequestSignerInput"', + }); + } const dateValue: undefined | Date = val.date_value == void 0 ? void 0 : deserializeDate(val.date_value); return { diff --git a/src/schemas/signRequests.generated.ts b/src/schemas/signRequests.generated.ts index 1ed32513..d3ac1b1f 100644 --- a/src/schemas/signRequests.generated.ts +++ b/src/schemas/signRequests.generated.ts @@ -1,6 +1,7 @@ import { serializeSignRequest } from './signRequest.generated.js'; import { deserializeSignRequest } from './signRequest.generated.js'; import { SignRequest } from './signRequest.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -25,10 +26,28 @@ export function serializeSignRequests(val: SignRequests): SerializedData { }) as readonly any[]), }; } -export function deserializeSignRequests(val: any): SignRequests { +export function deserializeSignRequests(val: SerializedData): SignRequests { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "SignRequests"' }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "SignRequests"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "next_marker" of type "SignRequests"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "SignRequests"', + }); + } const entries: undefined | readonly SignRequest[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/signTemplate.generated.ts b/src/schemas/signTemplate.generated.ts index a2b6728a..5b03b8ef 100644 --- a/src/schemas/signTemplate.generated.ts +++ b/src/schemas/signTemplate.generated.ts @@ -70,7 +70,7 @@ export function serializeSignTemplateTypeField( return val; } export function deserializeSignTemplateTypeField( - val: any + val: SerializedData ): SignTemplateTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -90,7 +90,7 @@ export function serializeSignTemplateAdditionalInfoNonEditableField( return val; } export function deserializeSignTemplateAdditionalInfoNonEditableField( - val: any + val: SerializedData ): SignTemplateAdditionalInfoNonEditableField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -126,7 +126,7 @@ export function serializeSignTemplateAdditionalInfoRequiredSignersField( return val; } export function deserializeSignTemplateAdditionalInfoRequiredSignersField( - val: any + val: SerializedData ): SignTemplateAdditionalInfoRequiredSignersField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -162,8 +162,19 @@ export function serializeSignTemplateAdditionalInfoRequiredField( }; } export function deserializeSignTemplateAdditionalInfoRequiredField( - val: any + val: SerializedData ): SignTemplateAdditionalInfoRequiredField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SignTemplateAdditionalInfoRequiredField"', + }); + } + if (!(val.signers == void 0) && !sdIsList(val.signers)) { + throw new BoxSdkError({ + message: + 'Expecting array for "signers" of type "SignTemplateAdditionalInfoRequiredField"', + }); + } const signers: | undefined | readonly (readonly SignTemplateAdditionalInfoRequiredSignersField[])[] = @@ -205,8 +216,19 @@ export function serializeSignTemplateAdditionalInfoField( }; } export function deserializeSignTemplateAdditionalInfoField( - val: any + val: SerializedData ): SignTemplateAdditionalInfoField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SignTemplateAdditionalInfoField"', + }); + } + if (!(val.non_editable == void 0) && !sdIsList(val.non_editable)) { + throw new BoxSdkError({ + message: + 'Expecting array for "non_editable" of type "SignTemplateAdditionalInfoField"', + }); + } const nonEditable: | undefined | readonly SignTemplateAdditionalInfoNonEditableField[] = @@ -244,18 +266,62 @@ export function serializeSignTemplateReadySignLinkField( }; } export function deserializeSignTemplateReadySignLinkField( - val: any + val: SerializedData ): SignTemplateReadySignLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SignTemplateReadySignLinkField"', + }); + } + if (!(val.url == void 0) && !sdIsString(val.url)) { + throw new BoxSdkError({ + message: + 'Expecting string for "url" of type "SignTemplateReadySignLinkField"', + }); + } const url: undefined | string = val.url == void 0 ? void 0 : val.url; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "SignTemplateReadySignLinkField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.instructions == void 0) && !sdIsString(val.instructions)) { + throw new BoxSdkError({ + message: + 'Expecting string for "instructions" of type "SignTemplateReadySignLinkField"', + }); + } const instructions: undefined | string = val.instructions == void 0 ? void 0 : val.instructions; + if (!(val.folder_id == void 0) && !sdIsString(val.folder_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "folder_id" of type "SignTemplateReadySignLinkField"', + }); + } const folderId: undefined | string = val.folder_id == void 0 ? void 0 : val.folder_id; + if ( + !(val.is_notification_disabled == void 0) && + !sdIsBoolean(val.is_notification_disabled) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_notification_disabled" of type "SignTemplateReadySignLinkField"', + }); + } const isNotificationDisabled: undefined | boolean = val.is_notification_disabled == void 0 ? void 0 : val.is_notification_disabled; + if (!(val.is_active == void 0) && !sdIsBoolean(val.is_active)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_active" of type "SignTemplateReadySignLinkField"', + }); + } const isActive: undefined | boolean = val.is_active == void 0 ? void 0 : val.is_active; return { @@ -280,14 +346,46 @@ export function serializeSignTemplateCustomBrandingField( }; } export function deserializeSignTemplateCustomBrandingField( - val: any + val: SerializedData ): SignTemplateCustomBrandingField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SignTemplateCustomBrandingField"', + }); + } + if (!(val.company_name == void 0) && !sdIsString(val.company_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "company_name" of type "SignTemplateCustomBrandingField"', + }); + } const companyName: undefined | string = val.company_name == void 0 ? void 0 : val.company_name; + if (!(val.logo_uri == void 0) && !sdIsString(val.logo_uri)) { + throw new BoxSdkError({ + message: + 'Expecting string for "logo_uri" of type "SignTemplateCustomBrandingField"', + }); + } const logoUri: undefined | string = val.logo_uri == void 0 ? void 0 : val.logo_uri; + if (!(val.branding_color == void 0) && !sdIsString(val.branding_color)) { + throw new BoxSdkError({ + message: + 'Expecting string for "branding_color" of type "SignTemplateCustomBrandingField"', + }); + } const brandingColor: undefined | string = val.branding_color == void 0 ? void 0 : val.branding_color; + if ( + !(val.email_footer_text == void 0) && + !sdIsString(val.email_footer_text) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "email_footer_text" of type "SignTemplateCustomBrandingField"', + }); + } const emailFooterText: undefined | string = val.email_footer_text == void 0 ? void 0 : val.email_footer_text; return { @@ -348,21 +446,54 @@ export function serializeSignTemplate(val: SignTemplate): SerializedData { : serializeSignTemplateCustomBrandingField(val.customBranding), }; } -export function deserializeSignTemplate(val: any): SignTemplate { +export function deserializeSignTemplate(val: SerializedData): SignTemplate { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "SignTemplate"' }); + } const type: undefined | SignTemplateTypeField = val.type == void 0 ? void 0 : deserializeSignTemplateTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "SignTemplate"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "SignTemplate"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.email_subject == void 0) && !sdIsString(val.email_subject)) { + throw new BoxSdkError({ + message: 'Expecting string for "email_subject" of type "SignTemplate"', + }); + } const emailSubject: undefined | string = val.email_subject == void 0 ? void 0 : val.email_subject; + if (!(val.email_message == void 0) && !sdIsString(val.email_message)) { + throw new BoxSdkError({ + message: 'Expecting string for "email_message" of type "SignTemplate"', + }); + } const emailMessage: undefined | string = val.email_message == void 0 ? void 0 : val.email_message; + if (!(val.days_valid == void 0) && !sdIsNumber(val.days_valid)) { + throw new BoxSdkError({ + message: 'Expecting number for "days_valid" of type "SignTemplate"', + }); + } const daysValid: undefined | number = val.days_valid == void 0 ? void 0 : val.days_valid; const parentFolder: undefined | FolderMini = val.parent_folder == void 0 ? void 0 : deserializeFolderMini(val.parent_folder); + if (!(val.source_files == void 0) && !sdIsList(val.source_files)) { + throw new BoxSdkError({ + message: 'Expecting array for "source_files" of type "SignTemplate"', + }); + } const sourceFiles: undefined | readonly FileMini[] = val.source_files == void 0 ? void 0 @@ -371,18 +502,65 @@ export function deserializeSignTemplate(val: any): SignTemplate { return deserializeFileMini(itm); }) as readonly any[]) : []; + if ( + !(val.are_fields_locked == void 0) && + !sdIsBoolean(val.are_fields_locked) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "are_fields_locked" of type "SignTemplate"', + }); + } const areFieldsLocked: undefined | boolean = val.are_fields_locked == void 0 ? void 0 : val.are_fields_locked; + if ( + !(val.are_options_locked == void 0) && + !sdIsBoolean(val.are_options_locked) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "are_options_locked" of type "SignTemplate"', + }); + } const areOptionsLocked: undefined | boolean = val.are_options_locked == void 0 ? void 0 : val.are_options_locked; + if ( + !(val.are_recipients_locked == void 0) && + !sdIsBoolean(val.are_recipients_locked) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "are_recipients_locked" of type "SignTemplate"', + }); + } const areRecipientsLocked: undefined | boolean = val.are_recipients_locked == void 0 ? void 0 : val.are_recipients_locked; + if ( + !(val.are_email_settings_locked == void 0) && + !sdIsBoolean(val.are_email_settings_locked) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "are_email_settings_locked" of type "SignTemplate"', + }); + } const areEmailSettingsLocked: undefined | boolean = val.are_email_settings_locked == void 0 ? void 0 : val.are_email_settings_locked; + if (!(val.are_files_locked == void 0) && !sdIsBoolean(val.are_files_locked)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "are_files_locked" of type "SignTemplate"', + }); + } const areFilesLocked: undefined | boolean = val.are_files_locked == void 0 ? void 0 : val.are_files_locked; + if (!(val.signers == void 0) && !sdIsList(val.signers)) { + throw new BoxSdkError({ + message: 'Expecting array for "signers" of type "SignTemplate"', + }); + } const signers: undefined | readonly TemplateSigner[] = val.signers == void 0 ? void 0 diff --git a/src/schemas/signTemplates.generated.ts b/src/schemas/signTemplates.generated.ts index c1a1c730..a4a55d3c 100644 --- a/src/schemas/signTemplates.generated.ts +++ b/src/schemas/signTemplates.generated.ts @@ -1,6 +1,7 @@ import { serializeSignTemplate } from './signTemplate.generated.js'; import { deserializeSignTemplate } from './signTemplate.generated.js'; import { SignTemplate } from './signTemplate.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -27,12 +28,35 @@ export function serializeSignTemplates(val: SignTemplates): SerializedData { }) as readonly any[]), }; } -export function deserializeSignTemplates(val: any): SignTemplates { +export function deserializeSignTemplates(val: SerializedData): SignTemplates { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "SignTemplates"' }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "SignTemplates"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "next_marker" of type "SignTemplates"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "prev_marker" of type "SignTemplates"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "SignTemplates"', + }); + } const entries: undefined | readonly SignTemplate[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/skillCardsMetadata.generated.ts b/src/schemas/skillCardsMetadata.generated.ts index e3007a82..7c2682a2 100644 --- a/src/schemas/skillCardsMetadata.generated.ts +++ b/src/schemas/skillCardsMetadata.generated.ts @@ -1,6 +1,7 @@ import { serializeKeywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard } from './keywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard.generated.js'; import { deserializeKeywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard } from './keywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard.generated.js'; import { KeywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard } from './keywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -43,20 +44,73 @@ export function serializeSkillCardsMetadata( }) as readonly any[]), }; } -export function deserializeSkillCardsMetadata(val: any): SkillCardsMetadata { +export function deserializeSkillCardsMetadata( + val: SerializedData +): SkillCardsMetadata { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SkillCardsMetadata"', + }); + } + if (!(val.$canEdit == void 0) && !sdIsBoolean(val.$canEdit)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "$canEdit" of type "SkillCardsMetadata"', + }); + } const canEdit: undefined | boolean = val.$canEdit == void 0 ? void 0 : val.$canEdit; + if (!(val.$id == void 0) && !sdIsString(val.$id)) { + throw new BoxSdkError({ + message: 'Expecting string for "$id" of type "SkillCardsMetadata"', + }); + } const id: undefined | string = val.$id == void 0 ? void 0 : val.$id; + if (!(val.$parent == void 0) && !sdIsString(val.$parent)) { + throw new BoxSdkError({ + message: 'Expecting string for "$parent" of type "SkillCardsMetadata"', + }); + } const parent: undefined | string = val.$parent == void 0 ? void 0 : val.$parent; + if (!(val.$scope == void 0) && !sdIsString(val.$scope)) { + throw new BoxSdkError({ + message: 'Expecting string for "$scope" of type "SkillCardsMetadata"', + }); + } const scope: undefined | string = val.$scope == void 0 ? void 0 : val.$scope; + if (!(val.$template == void 0) && !sdIsString(val.$template)) { + throw new BoxSdkError({ + message: 'Expecting string for "$template" of type "SkillCardsMetadata"', + }); + } const template: undefined | string = val.$template == void 0 ? void 0 : val.$template; + if (!(val.$type == void 0) && !sdIsString(val.$type)) { + throw new BoxSdkError({ + message: 'Expecting string for "$type" of type "SkillCardsMetadata"', + }); + } const type: undefined | string = val.$type == void 0 ? void 0 : val.$type; + if (!(val.$typeVersion == void 0) && !sdIsNumber(val.$typeVersion)) { + throw new BoxSdkError({ + message: + 'Expecting number for "$typeVersion" of type "SkillCardsMetadata"', + }); + } const typeVersion: undefined | number = val.$typeVersion == void 0 ? void 0 : val.$typeVersion; + if (!(val.$version == void 0) && !sdIsNumber(val.$version)) { + throw new BoxSdkError({ + message: 'Expecting number for "$version" of type "SkillCardsMetadata"', + }); + } const version: undefined | number = val.$version == void 0 ? void 0 : val.$version; + if (!(val.cards == void 0) && !sdIsList(val.cards)) { + throw new BoxSdkError({ + message: 'Expecting array for "cards" of type "SkillCardsMetadata"', + }); + } const cards: | undefined | readonly KeywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard[] = diff --git a/src/schemas/skillInvocation.generated.ts b/src/schemas/skillInvocation.generated.ts index 331eee89..49aa3009 100644 --- a/src/schemas/skillInvocation.generated.ts +++ b/src/schemas/skillInvocation.generated.ts @@ -77,7 +77,7 @@ export function serializeSkillInvocationTypeField( return val; } export function deserializeSkillInvocationTypeField( - val: any + val: SerializedData ): SkillInvocationTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -97,7 +97,7 @@ export function serializeSkillInvocationSkillTypeField( return val; } export function deserializeSkillInvocationSkillTypeField( - val: any + val: SerializedData ): SkillInvocationSkillTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -125,14 +125,36 @@ export function serializeSkillInvocationSkillField( }; } export function deserializeSkillInvocationSkillField( - val: any + val: SerializedData ): SkillInvocationSkillField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SkillInvocationSkillField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "SkillInvocationSkillField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | SkillInvocationSkillTypeField = val.type == void 0 ? void 0 : deserializeSkillInvocationSkillTypeField(val.type); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "SkillInvocationSkillField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.api_key == void 0) && !sdIsString(val.api_key)) { + throw new BoxSdkError({ + message: + 'Expecting string for "api_key" of type "SkillInvocationSkillField"', + }); + } const apiKey: undefined | string = val.api_key == void 0 ? void 0 : val.api_key; return { @@ -148,7 +170,7 @@ export function serializeSkillInvocationTokenReadTokenTypeField( return val; } export function deserializeSkillInvocationTokenReadTokenTypeField( - val: any + val: SerializedData ): SkillInvocationTokenReadTokenTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -177,16 +199,39 @@ export function serializeSkillInvocationTokenReadField( }; } export function deserializeSkillInvocationTokenReadField( - val: any + val: SerializedData ): SkillInvocationTokenReadField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SkillInvocationTokenReadField"', + }); + } + if (!(val.access_token == void 0) && !sdIsString(val.access_token)) { + throw new BoxSdkError({ + message: + 'Expecting string for "access_token" of type "SkillInvocationTokenReadField"', + }); + } const accessToken: undefined | string = val.access_token == void 0 ? void 0 : val.access_token; + if (!(val.expires_in == void 0) && !sdIsNumber(val.expires_in)) { + throw new BoxSdkError({ + message: + 'Expecting number for "expires_in" of type "SkillInvocationTokenReadField"', + }); + } const expiresIn: undefined | number = val.expires_in == void 0 ? void 0 : val.expires_in; const tokenType: undefined | SkillInvocationTokenReadTokenTypeField = val.token_type == void 0 ? void 0 : deserializeSkillInvocationTokenReadTokenTypeField(val.token_type); + if (!(val.restricted_to == void 0) && !sdIsString(val.restricted_to)) { + throw new BoxSdkError({ + message: + 'Expecting string for "restricted_to" of type "SkillInvocationTokenReadField"', + }); + } const restrictedTo: undefined | string = val.restricted_to == void 0 ? void 0 : val.restricted_to; return { @@ -202,7 +247,7 @@ export function serializeSkillInvocationTokenWriteTokenTypeField( return val; } export function deserializeSkillInvocationTokenWriteTokenTypeField( - val: any + val: SerializedData ): SkillInvocationTokenWriteTokenTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -231,16 +276,39 @@ export function serializeSkillInvocationTokenWriteField( }; } export function deserializeSkillInvocationTokenWriteField( - val: any + val: SerializedData ): SkillInvocationTokenWriteField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SkillInvocationTokenWriteField"', + }); + } + if (!(val.access_token == void 0) && !sdIsString(val.access_token)) { + throw new BoxSdkError({ + message: + 'Expecting string for "access_token" of type "SkillInvocationTokenWriteField"', + }); + } const accessToken: undefined | string = val.access_token == void 0 ? void 0 : val.access_token; + if (!(val.expires_in == void 0) && !sdIsNumber(val.expires_in)) { + throw new BoxSdkError({ + message: + 'Expecting number for "expires_in" of type "SkillInvocationTokenWriteField"', + }); + } const expiresIn: undefined | number = val.expires_in == void 0 ? void 0 : val.expires_in; const tokenType: undefined | SkillInvocationTokenWriteTokenTypeField = val.token_type == void 0 ? void 0 : deserializeSkillInvocationTokenWriteTokenTypeField(val.token_type); + if (!(val.restricted_to == void 0) && !sdIsString(val.restricted_to)) { + throw new BoxSdkError({ + message: + 'Expecting string for "restricted_to" of type "SkillInvocationTokenWriteField"', + }); + } const restrictedTo: undefined | string = val.restricted_to == void 0 ? void 0 : val.restricted_to; return { @@ -265,8 +333,13 @@ export function serializeSkillInvocationTokenField( }; } export function deserializeSkillInvocationTokenField( - val: any + val: SerializedData ): SkillInvocationTokenField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SkillInvocationTokenField"', + }); + } const read: undefined | SkillInvocationTokenReadField = val.read == void 0 ? void 0 @@ -283,7 +356,7 @@ export function serializeSkillInvocationStatusStateField( return val; } export function deserializeSkillInvocationStatusStateField( - val: any + val: SerializedData ): SkillInvocationStatusStateField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -324,16 +397,39 @@ export function serializeSkillInvocationStatusField( }; } export function deserializeSkillInvocationStatusField( - val: any + val: SerializedData ): SkillInvocationStatusField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SkillInvocationStatusField"', + }); + } const state: undefined | SkillInvocationStatusStateField = val.state == void 0 ? void 0 : deserializeSkillInvocationStatusStateField(val.state); + if (!(val.message == void 0) && !sdIsString(val.message)) { + throw new BoxSdkError({ + message: + 'Expecting string for "message" of type "SkillInvocationStatusField"', + }); + } const message: undefined | string = val.message == void 0 ? void 0 : val.message; + if (!(val.error_code == void 0) && !sdIsString(val.error_code)) { + throw new BoxSdkError({ + message: + 'Expecting string for "error_code" of type "SkillInvocationStatusField"', + }); + } const errorCode: undefined | string = val.error_code == void 0 ? void 0 : val.error_code; + if (!(val.additional_info == void 0) && !sdIsString(val.additional_info)) { + throw new BoxSdkError({ + message: + 'Expecting string for "additional_info" of type "SkillInvocationStatusField"', + }); + } const additionalInfo: undefined | string = val.additional_info == void 0 ? void 0 : val.additional_info; return { @@ -349,7 +445,7 @@ export function serializeSkillInvocationEnterpriseTypeField( return val; } export function deserializeSkillInvocationEnterpriseTypeField( - val: any + val: SerializedData ): SkillInvocationEnterpriseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -376,13 +472,30 @@ export function serializeSkillInvocationEnterpriseField( }; } export function deserializeSkillInvocationEnterpriseField( - val: any + val: SerializedData ): SkillInvocationEnterpriseField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SkillInvocationEnterpriseField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "SkillInvocationEnterpriseField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | SkillInvocationEnterpriseTypeField = val.type == void 0 ? void 0 : deserializeSkillInvocationEnterpriseTypeField(val.type); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "SkillInvocationEnterpriseField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; return { id: id, @@ -419,9 +532,19 @@ export function serializeSkillInvocation(val: SkillInvocation): SerializedData { ['event']: val.event == void 0 ? void 0 : serializeEvent(val.event), }; } -export function deserializeSkillInvocation(val: any): SkillInvocation { +export function deserializeSkillInvocation( + val: SerializedData +): SkillInvocation { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "SkillInvocation"' }); + } const type: undefined | SkillInvocationTypeField = val.type == void 0 ? void 0 : deserializeSkillInvocationTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "SkillInvocation"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const skill: undefined | SkillInvocationSkillField = val.skill == void 0 @@ -435,8 +558,18 @@ export function deserializeSkillInvocation(val: any): SkillInvocation { val.status == void 0 ? void 0 : deserializeSkillInvocationStatusField(val.status); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "SkillInvocation"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.trigger == void 0) && !sdIsString(val.trigger)) { + throw new BoxSdkError({ + message: 'Expecting string for "trigger" of type "SkillInvocation"', + }); + } const trigger: undefined | string = val.trigger == void 0 ? void 0 : val.trigger; const enterprise: undefined | SkillInvocationEnterpriseField = diff --git a/src/schemas/statusSkillCard.generated.ts b/src/schemas/statusSkillCard.generated.ts index 23dd4739..ca5f3d0e 100644 --- a/src/schemas/statusSkillCard.generated.ts +++ b/src/schemas/statusSkillCard.generated.ts @@ -119,7 +119,7 @@ export function serializeStatusSkillCardTypeField( return val; } export function deserializeStatusSkillCardTypeField( - val: any + val: SerializedData ): StatusSkillCardTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -139,7 +139,7 @@ export function serializeStatusSkillCardSkillCardTypeField( return val; } export function deserializeStatusSkillCardSkillCardTypeField( - val: any + val: SerializedData ): StatusSkillCardSkillCardTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -162,9 +162,32 @@ export function serializeStatusSkillCardSkillCardTitleField( }; } export function deserializeStatusSkillCardSkillCardTitleField( - val: any + val: SerializedData ): StatusSkillCardSkillCardTitleField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StatusSkillCardSkillCardTitleField"', + }); + } + if (!(val.code == void 0) && !sdIsString(val.code)) { + throw new BoxSdkError({ + message: + 'Expecting string for "code" of type "StatusSkillCardSkillCardTitleField"', + }); + } const code: undefined | string = val.code == void 0 ? void 0 : val.code; + if (val.message == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "message" of type "StatusSkillCardSkillCardTitleField" to be defined', + }); + } + if (!sdIsString(val.message)) { + throw new BoxSdkError({ + message: + 'Expecting string for "message" of type "StatusSkillCardSkillCardTitleField"', + }); + } const message: string = val.message; return { code: code, @@ -177,7 +200,7 @@ export function serializeStatusSkillCardStatusCodeField( return val; } export function deserializeStatusSkillCardStatusCodeField( - val: any + val: SerializedData ): StatusSkillCardStatusCodeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -212,10 +235,27 @@ export function serializeStatusSkillCardStatusField( }; } export function deserializeStatusSkillCardStatusField( - val: any + val: SerializedData ): StatusSkillCardStatusField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StatusSkillCardStatusField"', + }); + } + if (val.code == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "code" of type "StatusSkillCardStatusField" to be defined', + }); + } const code: StatusSkillCardStatusCodeField = deserializeStatusSkillCardStatusCodeField(val.code); + if (!(val.message == void 0) && !sdIsString(val.message)) { + throw new BoxSdkError({ + message: + 'Expecting string for "message" of type "StatusSkillCardStatusField"', + }); + } const message: undefined | string = val.message == void 0 ? void 0 : val.message; return { code: code, message: message } satisfies StatusSkillCardStatusField; @@ -226,7 +266,7 @@ export function serializeStatusSkillCardSkillTypeField( return val; } export function deserializeStatusSkillCardSkillTypeField( - val: any + val: SerializedData ): StatusSkillCardSkillTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -249,10 +289,32 @@ export function serializeStatusSkillCardSkillField( }; } export function deserializeStatusSkillCardSkillField( - val: any + val: SerializedData ): StatusSkillCardSkillField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StatusSkillCardSkillField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "StatusSkillCardSkillField" to be defined', + }); + } const type: StatusSkillCardSkillTypeField = deserializeStatusSkillCardSkillTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "StatusSkillCardSkillField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "StatusSkillCardSkillField"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies StatusSkillCardSkillField; } @@ -268,12 +330,29 @@ export function serializeStatusSkillCardSkillFieldInput( }; } export function deserializeStatusSkillCardSkillFieldInput( - val: any + val: SerializedData ): StatusSkillCardSkillFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StatusSkillCardSkillFieldInput"', + }); + } const type: undefined | StatusSkillCardSkillTypeField = val.type == void 0 ? void 0 : deserializeStatusSkillCardSkillTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "StatusSkillCardSkillFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "StatusSkillCardSkillFieldInput"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies StatusSkillCardSkillFieldInput; } @@ -283,7 +362,7 @@ export function serializeStatusSkillCardInvocationTypeField( return val; } export function deserializeStatusSkillCardInvocationTypeField( - val: any + val: SerializedData ): StatusSkillCardInvocationTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -306,10 +385,33 @@ export function serializeStatusSkillCardInvocationField( }; } export function deserializeStatusSkillCardInvocationField( - val: any + val: SerializedData ): StatusSkillCardInvocationField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StatusSkillCardInvocationField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "StatusSkillCardInvocationField" to be defined', + }); + } const type: StatusSkillCardInvocationTypeField = deserializeStatusSkillCardInvocationTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "StatusSkillCardInvocationField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "StatusSkillCardInvocationField"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies StatusSkillCardInvocationField; } @@ -325,12 +427,29 @@ export function serializeStatusSkillCardInvocationFieldInput( }; } export function deserializeStatusSkillCardInvocationFieldInput( - val: any + val: SerializedData ): StatusSkillCardInvocationFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StatusSkillCardInvocationFieldInput"', + }); + } const type: undefined | StatusSkillCardInvocationTypeField = val.type == void 0 ? void 0 : deserializeStatusSkillCardInvocationTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "StatusSkillCardInvocationFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "StatusSkillCardInvocationFieldInput"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies StatusSkillCardInvocationFieldInput; } @@ -351,23 +470,59 @@ export function serializeStatusSkillCard(val: StatusSkillCard): SerializedData { ['invocation']: serializeStatusSkillCardInvocationField(val.invocation), }; } -export function deserializeStatusSkillCard(val: any): StatusSkillCard { +export function deserializeStatusSkillCard( + val: SerializedData +): StatusSkillCard { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "StatusSkillCard"' }); + } + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "StatusSkillCard"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "StatusSkillCard" to be defined', + }); + } const type: StatusSkillCardTypeField = deserializeStatusSkillCardTypeField( val.type ); + if (val.skill_card_type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "skill_card_type" of type "StatusSkillCard" to be defined', + }); + } const skillCardType: StatusSkillCardSkillCardTypeField = deserializeStatusSkillCardSkillCardTypeField(val.skill_card_type); const skillCardTitle: undefined | StatusSkillCardSkillCardTitleField = val.skill_card_title == void 0 ? void 0 : deserializeStatusSkillCardSkillCardTitleField(val.skill_card_title); + if (val.status == void 0) { + throw new BoxSdkError({ + message: 'Expecting "status" of type "StatusSkillCard" to be defined', + }); + } const status: StatusSkillCardStatusField = deserializeStatusSkillCardStatusField(val.status); + if (val.skill == void 0) { + throw new BoxSdkError({ + message: 'Expecting "skill" of type "StatusSkillCard" to be defined', + }); + } const skill: StatusSkillCardSkillField = deserializeStatusSkillCardSkillField( val.skill ); + if (val.invocation == void 0) { + throw new BoxSdkError({ + message: 'Expecting "invocation" of type "StatusSkillCard" to be defined', + }); + } const invocation: StatusSkillCardInvocationField = deserializeStatusSkillCardInvocationField(val.invocation); return { @@ -402,8 +557,19 @@ export function serializeStatusSkillCardInput( }; } export function deserializeStatusSkillCardInput( - val: any + val: SerializedData ): StatusSkillCardInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StatusSkillCardInput"', + }); + } + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "StatusSkillCardInput"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); const type: undefined | StatusSkillCardTypeField = @@ -416,11 +582,28 @@ export function deserializeStatusSkillCardInput( val.skill_card_title == void 0 ? void 0 : deserializeStatusSkillCardSkillCardTitleField(val.skill_card_title); + if (val.status == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "status" of type "StatusSkillCardInput" to be defined', + }); + } const status: StatusSkillCardStatusField = deserializeStatusSkillCardStatusField(val.status); + if (val.skill == void 0) { + throw new BoxSdkError({ + message: 'Expecting "skill" of type "StatusSkillCardInput" to be defined', + }); + } const skill: StatusSkillCardSkillField = deserializeStatusSkillCardSkillField( val.skill ); + if (val.invocation == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "invocation" of type "StatusSkillCardInput" to be defined', + }); + } const invocation: StatusSkillCardInvocationField = deserializeStatusSkillCardInvocationField(val.invocation); return { diff --git a/src/schemas/storagePolicies.generated.ts b/src/schemas/storagePolicies.generated.ts index f4cf3991..67b049de 100644 --- a/src/schemas/storagePolicies.generated.ts +++ b/src/schemas/storagePolicies.generated.ts @@ -1,6 +1,7 @@ import { serializeStoragePolicy } from './storagePolicy.generated.js'; import { deserializeStoragePolicy } from './storagePolicy.generated.js'; import { StoragePolicy } from './storagePolicy.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -27,12 +28,37 @@ export function serializeStoragePolicies(val: StoragePolicies): SerializedData { }) as readonly any[]), }; } -export function deserializeStoragePolicies(val: any): StoragePolicies { +export function deserializeStoragePolicies( + val: SerializedData +): StoragePolicies { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "StoragePolicies"' }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "StoragePolicies"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "next_marker" of type "StoragePolicies"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "prev_marker" of type "StoragePolicies"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "StoragePolicies"', + }); + } const entries: undefined | readonly StoragePolicy[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/storagePolicy.generated.ts b/src/schemas/storagePolicy.generated.ts index 6e28e05d..03006a46 100644 --- a/src/schemas/storagePolicy.generated.ts +++ b/src/schemas/storagePolicy.generated.ts @@ -25,9 +25,32 @@ export function serializeStoragePolicy(val: StoragePolicy): SerializedData { } return { ...base, ...{ ['name']: val.name == void 0 ? void 0 : val.name } }; } -export function deserializeStoragePolicy(val: any): StoragePolicy { +export function deserializeStoragePolicy(val: SerializedData): StoragePolicy { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "StoragePolicy"' }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "StoragePolicy"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "StoragePolicy" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "StoragePolicy"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "StoragePolicy" to be defined', + }); + } const type: StoragePolicyMiniTypeField = deserializeStoragePolicyMiniTypeField(val.type); return { name: name, id: id, type: type } satisfies StoragePolicy; diff --git a/src/schemas/storagePolicyAssignment.generated.ts b/src/schemas/storagePolicyAssignment.generated.ts index 072e1421..70182055 100644 --- a/src/schemas/storagePolicyAssignment.generated.ts +++ b/src/schemas/storagePolicyAssignment.generated.ts @@ -50,7 +50,7 @@ export function serializeStoragePolicyAssignmentTypeField( return val; } export function deserializeStoragePolicyAssignmentTypeField( - val: any + val: SerializedData ): StoragePolicyAssignmentTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -73,9 +73,26 @@ export function serializeStoragePolicyAssignmentAssignedToField( }; } export function deserializeStoragePolicyAssignmentAssignedToField( - val: any + val: SerializedData ): StoragePolicyAssignmentAssignedToField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StoragePolicyAssignmentAssignedToField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "StoragePolicyAssignmentAssignedToField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (!(val.type == void 0) && !sdIsString(val.type)) { + throw new BoxSdkError({ + message: + 'Expecting string for "type" of type "StoragePolicyAssignmentAssignedToField"', + }); + } const type: undefined | string = val.type == void 0 ? void 0 : val.type; return { id: id, @@ -99,9 +116,30 @@ export function serializeStoragePolicyAssignment( }; } export function deserializeStoragePolicyAssignment( - val: any + val: SerializedData ): StoragePolicyAssignment { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StoragePolicyAssignment"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "StoragePolicyAssignment" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "StoragePolicyAssignment"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "StoragePolicyAssignment" to be defined', + }); + } const type: StoragePolicyAssignmentTypeField = deserializeStoragePolicyAssignmentTypeField(val.type); const storagePolicy: undefined | StoragePolicyMini = @@ -139,8 +177,25 @@ export function serializeStoragePolicyAssignmentInput( }; } export function deserializeStoragePolicyAssignmentInput( - val: any + val: SerializedData ): StoragePolicyAssignmentInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StoragePolicyAssignmentInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "StoragePolicyAssignmentInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "StoragePolicyAssignmentInput"', + }); + } const id: string = val.id; const type: undefined | StoragePolicyAssignmentTypeField = val.type == void 0 diff --git a/src/schemas/storagePolicyAssignments.generated.ts b/src/schemas/storagePolicyAssignments.generated.ts index 697deb95..e490f34a 100644 --- a/src/schemas/storagePolicyAssignments.generated.ts +++ b/src/schemas/storagePolicyAssignments.generated.ts @@ -1,6 +1,7 @@ import { serializeStoragePolicyAssignment } from './storagePolicyAssignment.generated.js'; import { deserializeStoragePolicyAssignment } from './storagePolicyAssignment.generated.js'; import { StoragePolicyAssignment } from './storagePolicyAssignment.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -32,13 +33,42 @@ export function serializeStoragePolicyAssignments( }; } export function deserializeStoragePolicyAssignments( - val: any + val: SerializedData ): StoragePolicyAssignments { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StoragePolicyAssignments"', + }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "StoragePolicyAssignments"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "next_marker" of type "StoragePolicyAssignments"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: + 'Expecting string for "prev_marker" of type "StoragePolicyAssignments"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "StoragePolicyAssignments"', + }); + } const entries: undefined | readonly StoragePolicyAssignment[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/storagePolicyMini.generated.ts b/src/schemas/storagePolicyMini.generated.ts index 476f27d4..5c02daf4 100644 --- a/src/schemas/storagePolicyMini.generated.ts +++ b/src/schemas/storagePolicyMini.generated.ts @@ -33,7 +33,7 @@ export function serializeStoragePolicyMiniTypeField( return val; } export function deserializeStoragePolicyMiniTypeField( - val: any + val: SerializedData ): StoragePolicyMiniTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -55,8 +55,30 @@ export function serializeStoragePolicyMini( ['type']: serializeStoragePolicyMiniTypeField(val.type), }; } -export function deserializeStoragePolicyMini(val: any): StoragePolicyMini { +export function deserializeStoragePolicyMini( + val: SerializedData +): StoragePolicyMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StoragePolicyMini"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "StoragePolicyMini" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "StoragePolicyMini"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "StoragePolicyMini" to be defined', + }); + } const type: StoragePolicyMiniTypeField = deserializeStoragePolicyMiniTypeField(val.type); return { id: id, type: type } satisfies StoragePolicyMini; @@ -73,8 +95,23 @@ export function serializeStoragePolicyMiniInput( }; } export function deserializeStoragePolicyMiniInput( - val: any + val: SerializedData ): StoragePolicyMiniInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "StoragePolicyMiniInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "StoragePolicyMiniInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "StoragePolicyMiniInput"', + }); + } const id: string = val.id; const type: undefined | StoragePolicyMiniTypeField = val.type == void 0 diff --git a/src/schemas/task.generated.ts b/src/schemas/task.generated.ts index be74fa30..b796967f 100644 --- a/src/schemas/task.generated.ts +++ b/src/schemas/task.generated.ts @@ -37,7 +37,7 @@ export interface Task { export function serializeTaskTypeField(val: TaskTypeField): SerializedData { return val; } -export function deserializeTaskTypeField(val: any): TaskTypeField { +export function deserializeTaskTypeField(val: SerializedData): TaskTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "TaskTypeField"', @@ -53,7 +53,9 @@ export function deserializeTaskTypeField(val: any): TaskTypeField { export function serializeTaskActionField(val: TaskActionField): SerializedData { return val; } -export function deserializeTaskActionField(val: any): TaskActionField { +export function deserializeTaskActionField( + val: SerializedData +): TaskActionField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "TaskActionField"', @@ -75,7 +77,7 @@ export function serializeTaskCompletionRuleField( return val; } export function deserializeTaskCompletionRuleField( - val: any + val: SerializedData ): TaskCompletionRuleField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -116,26 +118,54 @@ export function serializeTask(val: Task): SerializedData { : serializeTaskCompletionRuleField(val.completionRule), }; } -export function deserializeTask(val: any): Task { +export function deserializeTask(val: SerializedData): Task { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Task"' }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "Task"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | TaskTypeField = val.type == void 0 ? void 0 : deserializeTaskTypeField(val.type); const item: undefined | FileMini = val.item == void 0 ? void 0 : deserializeFileMini(val.item); + if (!(val.due_at == void 0) && !sdIsString(val.due_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "due_at" of type "Task"', + }); + } const dueAt: undefined | DateTime = val.due_at == void 0 ? void 0 : deserializeDateTime(val.due_at); const action: undefined | TaskActionField = val.action == void 0 ? void 0 : deserializeTaskActionField(val.action); + if (!(val.message == void 0) && !sdIsString(val.message)) { + throw new BoxSdkError({ + message: 'Expecting string for "message" of type "Task"', + }); + } const message: undefined | string = val.message == void 0 ? void 0 : val.message; const taskAssignmentCollection: undefined | TaskAssignments = val.task_assignment_collection == void 0 ? void 0 : deserializeTaskAssignments(val.task_assignment_collection); + if (!(val.is_completed == void 0) && !sdIsBoolean(val.is_completed)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "is_completed" of type "Task"', + }); + } const isCompleted: undefined | boolean = val.is_completed == void 0 ? void 0 : val.is_completed; const createdBy: undefined | UserMini = val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "Task"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); const completionRule: undefined | TaskCompletionRuleField = diff --git a/src/schemas/taskAssignment.generated.ts b/src/schemas/taskAssignment.generated.ts index 6dd49fd1..4bc48566 100644 --- a/src/schemas/taskAssignment.generated.ts +++ b/src/schemas/taskAssignment.generated.ts @@ -39,7 +39,7 @@ export function serializeTaskAssignmentTypeField( return val; } export function deserializeTaskAssignmentTypeField( - val: any + val: SerializedData ): TaskAssignmentTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -59,7 +59,7 @@ export function serializeTaskAssignmentResolutionStateField( return val; } export function deserializeTaskAssignmentResolutionStateField( - val: any + val: SerializedData ): TaskAssignmentResolutionStateField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -105,7 +105,15 @@ export function serializeTaskAssignment(val: TaskAssignment): SerializedData { val.assignedBy == void 0 ? void 0 : serializeUserMini(val.assignedBy), }; } -export function deserializeTaskAssignment(val: any): TaskAssignment { +export function deserializeTaskAssignment(val: SerializedData): TaskAssignment { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "TaskAssignment"' }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "TaskAssignment"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | TaskAssignmentTypeField = val.type == void 0 ? void 0 : deserializeTaskAssignmentTypeField(val.type); @@ -113,12 +121,32 @@ export function deserializeTaskAssignment(val: any): TaskAssignment { val.item == void 0 ? void 0 : deserializeFileMini(val.item); const assignedTo: undefined | UserMini = val.assigned_to == void 0 ? void 0 : deserializeUserMini(val.assigned_to); + if (!(val.message == void 0) && !sdIsString(val.message)) { + throw new BoxSdkError({ + message: 'Expecting string for "message" of type "TaskAssignment"', + }); + } const message: undefined | string = val.message == void 0 ? void 0 : val.message; + if (!(val.completed_at == void 0) && !sdIsString(val.completed_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "completed_at" of type "TaskAssignment"', + }); + } const completedAt: undefined | DateTime = val.completed_at == void 0 ? void 0 : deserializeDateTime(val.completed_at); + if (!(val.assigned_at == void 0) && !sdIsString(val.assigned_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "assigned_at" of type "TaskAssignment"', + }); + } const assignedAt: undefined | DateTime = val.assigned_at == void 0 ? void 0 : deserializeDateTime(val.assigned_at); + if (!(val.reminded_at == void 0) && !sdIsString(val.reminded_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "reminded_at" of type "TaskAssignment"', + }); + } const remindedAt: undefined | DateTime = val.reminded_at == void 0 ? void 0 : deserializeDateTime(val.reminded_at); const resolutionState: undefined | TaskAssignmentResolutionStateField = diff --git a/src/schemas/taskAssignments.generated.ts b/src/schemas/taskAssignments.generated.ts index 9c2b12e1..0b233a32 100644 --- a/src/schemas/taskAssignments.generated.ts +++ b/src/schemas/taskAssignments.generated.ts @@ -1,6 +1,7 @@ import { serializeTaskAssignment } from './taskAssignment.generated.js'; import { deserializeTaskAssignment } from './taskAssignment.generated.js'; import { TaskAssignment } from './taskAssignment.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -23,9 +24,24 @@ export function serializeTaskAssignments(val: TaskAssignments): SerializedData { }) as readonly any[]), }; } -export function deserializeTaskAssignments(val: any): TaskAssignments { +export function deserializeTaskAssignments( + val: SerializedData +): TaskAssignments { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "TaskAssignments"' }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "TaskAssignments"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "TaskAssignments"', + }); + } const entries: undefined | readonly TaskAssignment[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/tasks.generated.ts b/src/schemas/tasks.generated.ts index f5e7ea4b..3595965c 100644 --- a/src/schemas/tasks.generated.ts +++ b/src/schemas/tasks.generated.ts @@ -1,6 +1,7 @@ import { serializeTask } from './task.generated.js'; import { deserializeTask } from './task.generated.js'; import { Task } from './task.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -23,9 +24,22 @@ export function serializeTasks(val: Tasks): SerializedData { }) as readonly any[]), }; } -export function deserializeTasks(val: any): Tasks { +export function deserializeTasks(val: SerializedData): Tasks { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Tasks"' }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "Tasks"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "Tasks"', + }); + } const entries: undefined | readonly Task[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/templateSigner.generated.ts b/src/schemas/templateSigner.generated.ts index 5e943781..15fc9fe6 100644 --- a/src/schemas/templateSigner.generated.ts +++ b/src/schemas/templateSigner.generated.ts @@ -27,7 +27,7 @@ export function serializeTemplateSignerRoleField( return val; } export function deserializeTemplateSignerRoleField( - val: any + val: SerializedData ): TemplateSignerRoleField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -64,7 +64,15 @@ export function serializeTemplateSigner(val: TemplateSigner): SerializedData { val.signerGroupId == void 0 ? void 0 : val.signerGroupId, }; } -export function deserializeTemplateSigner(val: any): TemplateSigner { +export function deserializeTemplateSigner(val: SerializedData): TemplateSigner { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "TemplateSigner"' }); + } + if (!(val.inputs == void 0) && !sdIsList(val.inputs)) { + throw new BoxSdkError({ + message: 'Expecting array for "inputs" of type "TemplateSigner"', + }); + } const inputs: undefined | readonly TemplateSignerInput[] = val.inputs == void 0 ? void 0 @@ -73,12 +81,33 @@ export function deserializeTemplateSigner(val: any): TemplateSigner { return deserializeTemplateSignerInput(itm); }) as readonly any[]) : []; + if (!(val.email == void 0) && !sdIsString(val.email)) { + throw new BoxSdkError({ + message: 'Expecting string for "email" of type "TemplateSigner"', + }); + } const email: undefined | string = val.email == void 0 ? void 0 : val.email; const role: undefined | TemplateSignerRoleField = val.role == void 0 ? void 0 : deserializeTemplateSignerRoleField(val.role); + if (!(val.is_in_person == void 0) && !sdIsBoolean(val.is_in_person)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "is_in_person" of type "TemplateSigner"', + }); + } const isInPerson: undefined | boolean = val.is_in_person == void 0 ? void 0 : val.is_in_person; + if (!(val.order == void 0) && !sdIsNumber(val.order)) { + throw new BoxSdkError({ + message: 'Expecting number for "order" of type "TemplateSigner"', + }); + } const order: undefined | number = val.order == void 0 ? void 0 : val.order; + if (!(val.signer_group_id == void 0) && !sdIsString(val.signer_group_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "signer_group_id" of type "TemplateSigner"', + }); + } const signerGroupId: undefined | string = val.signer_group_id == void 0 ? void 0 : val.signer_group_id; return { diff --git a/src/schemas/templateSignerInput.generated.ts b/src/schemas/templateSignerInput.generated.ts index 1f9e1cfd..4402fe15 100644 --- a/src/schemas/templateSignerInput.generated.ts +++ b/src/schemas/templateSignerInput.generated.ts @@ -63,7 +63,7 @@ export function serializeTemplateSignerInputTypeField( return val; } export function deserializeTemplateSignerInputTypeField( - val: any + val: SerializedData ): TemplateSignerInputTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -101,7 +101,7 @@ export function serializeTemplateSignerInputContentTypeField( return val; } export function deserializeTemplateSignerInputContentTypeField( - val: any + val: SerializedData ): TemplateSignerInputContentTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -166,9 +166,26 @@ export function serializeTemplateSignerInputCoordinatesField( }; } export function deserializeTemplateSignerInputCoordinatesField( - val: any + val: SerializedData ): TemplateSignerInputCoordinatesField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TemplateSignerInputCoordinatesField"', + }); + } + if (!(val.x == void 0) && !sdIsNumber(val.x)) { + throw new BoxSdkError({ + message: + 'Expecting number for "x" of type "TemplateSignerInputCoordinatesField"', + }); + } const x: undefined | number = val.x == void 0 ? void 0 : val.x; + if (!(val.y == void 0) && !sdIsNumber(val.y)) { + throw new BoxSdkError({ + message: + 'Expecting number for "y" of type "TemplateSignerInputCoordinatesField"', + }); + } const y: undefined | number = val.y == void 0 ? void 0 : val.y; return { x: x, y: y } satisfies TemplateSignerInputCoordinatesField; } @@ -181,9 +198,26 @@ export function serializeTemplateSignerInputDimensionsField( }; } export function deserializeTemplateSignerInputDimensionsField( - val: any + val: SerializedData ): TemplateSignerInputDimensionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TemplateSignerInputDimensionsField"', + }); + } + if (!(val.width == void 0) && !sdIsNumber(val.width)) { + throw new BoxSdkError({ + message: + 'Expecting number for "width" of type "TemplateSignerInputDimensionsField"', + }); + } const width: undefined | number = val.width == void 0 ? void 0 : val.width; + if (!(val.height == void 0) && !sdIsNumber(val.height)) { + throw new BoxSdkError({ + message: + 'Expecting number for "height" of type "TemplateSignerInputDimensionsField"', + }); + } const height: undefined | number = val.height == void 0 ? void 0 : val.height; return { width: width, @@ -233,7 +267,14 @@ export function serializeTemplateSignerInput( }, }; } -export function deserializeTemplateSignerInput(val: any): TemplateSignerInput { +export function deserializeTemplateSignerInput( + val: SerializedData +): TemplateSignerInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TemplateSignerInput"', + }); + } const type: undefined | TemplateSignerInputTypeField = val.type == void 0 ? void 0 @@ -242,17 +283,59 @@ export function deserializeTemplateSignerInput(val: any): TemplateSignerInput { val.content_type == void 0 ? void 0 : deserializeTemplateSignerInputContentTypeField(val.content_type); + if (!(val.is_required == void 0) && !sdIsBoolean(val.is_required)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_required" of type "TemplateSignerInput"', + }); + } const isRequired: undefined | boolean = val.is_required == void 0 ? void 0 : val.is_required; + if (val.page_index == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "page_index" of type "TemplateSignerInput" to be defined', + }); + } + if (!sdIsNumber(val.page_index)) { + throw new BoxSdkError({ + message: + 'Expecting number for "page_index" of type "TemplateSignerInput"', + }); + } const pageIndex: number = val.page_index; + if (!(val.document_id == void 0) && !sdIsString(val.document_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "document_id" of type "TemplateSignerInput"', + }); + } const documentId: undefined | string = val.document_id == void 0 ? void 0 : val.document_id; + if (!(val.dropdown_choices == void 0) && !sdIsList(val.dropdown_choices)) { + throw new BoxSdkError({ + message: + 'Expecting array for "dropdown_choices" of type "TemplateSignerInput"', + }); + } const dropdownChoices: undefined | readonly string[] = val.dropdown_choices == void 0 ? void 0 : sdIsList(val.dropdown_choices) - ? val.dropdown_choices + ? (val.dropdown_choices.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: 'Expecting string for "TemplateSignerInput"', + }); + } + return itm; + }) as readonly any[]) : []; + if (!(val.group_id == void 0) && !sdIsString(val.group_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "group_id" of type "TemplateSignerInput"', + }); + } const groupId: undefined | string = val.group_id == void 0 ? void 0 : val.group_id; const coordinates: undefined | TemplateSignerInputCoordinatesField = @@ -263,15 +346,50 @@ export function deserializeTemplateSignerInput(val: any): TemplateSignerInput { val.dimensions == void 0 ? void 0 : deserializeTemplateSignerInputDimensionsField(val.dimensions); + if (!(val.label == void 0) && !sdIsString(val.label)) { + throw new BoxSdkError({ + message: 'Expecting string for "label" of type "TemplateSignerInput"', + }); + } const label: undefined | string = val.label == void 0 ? void 0 : val.label; + if (!(val.read_only == void 0) && !sdIsBoolean(val.read_only)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "read_only" of type "TemplateSignerInput"', + }); + } const readOnly: undefined | boolean = val.read_only == void 0 ? void 0 : val.read_only; + if (!(val.document_tag_id == void 0) && !sdIsString(val.document_tag_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "document_tag_id" of type "TemplateSignerInput"', + }); + } const documentTagId: undefined | string = val.document_tag_id == void 0 ? void 0 : val.document_tag_id; + if (!(val.text_value == void 0) && !sdIsString(val.text_value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "text_value" of type "TemplateSignerInput"', + }); + } const textValue: undefined | string = val.text_value == void 0 ? void 0 : val.text_value; + if (!(val.checkbox_value == void 0) && !sdIsBoolean(val.checkbox_value)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "checkbox_value" of type "TemplateSignerInput"', + }); + } const checkboxValue: undefined | boolean = val.checkbox_value == void 0 ? void 0 : val.checkbox_value; + if (!(val.date_value == void 0) && !sdIsString(val.date_value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "date_value" of type "TemplateSignerInput"', + }); + } const dateValue: undefined | Date = val.date_value == void 0 ? void 0 : deserializeDate(val.date_value); return { diff --git a/src/schemas/termsOfService.generated.ts b/src/schemas/termsOfService.generated.ts index f6b7405a..f41e2813 100644 --- a/src/schemas/termsOfService.generated.ts +++ b/src/schemas/termsOfService.generated.ts @@ -40,7 +40,7 @@ export function serializeTermsOfServiceStatusField( return val; } export function deserializeTermsOfServiceStatusField( - val: any + val: SerializedData ): TermsOfServiceStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -63,7 +63,7 @@ export function serializeTermsOfServiceEnterpriseTypeField( return val; } export function deserializeTermsOfServiceEnterpriseTypeField( - val: any + val: SerializedData ): TermsOfServiceEnterpriseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -90,13 +90,30 @@ export function serializeTermsOfServiceEnterpriseField( }; } export function deserializeTermsOfServiceEnterpriseField( - val: any + val: SerializedData ): TermsOfServiceEnterpriseField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TermsOfServiceEnterpriseField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "TermsOfServiceEnterpriseField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | TermsOfServiceEnterpriseTypeField = val.type == void 0 ? void 0 : deserializeTermsOfServiceEnterpriseTypeField(val.type); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "TermsOfServiceEnterpriseField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; return { id: id, @@ -110,7 +127,7 @@ export function serializeTermsOfServiceTosTypeField( return val; } export function deserializeTermsOfServiceTosTypeField( - val: any + val: SerializedData ): TermsOfServiceTosTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -155,7 +172,10 @@ export function serializeTermsOfService(val: TermsOfService): SerializedData { }, }; } -export function deserializeTermsOfService(val: any): TermsOfService { +export function deserializeTermsOfService(val: SerializedData): TermsOfService { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "TermsOfService"' }); + } const status: undefined | TermsOfServiceStatusField = val.status == void 0 ? void 0 @@ -168,12 +188,42 @@ export function deserializeTermsOfService(val: any): TermsOfService { val.tos_type == void 0 ? void 0 : deserializeTermsOfServiceTosTypeField(val.tos_type); + if (!(val.text == void 0) && !sdIsString(val.text)) { + throw new BoxSdkError({ + message: 'Expecting string for "text" of type "TermsOfService"', + }); + } const text: undefined | string = val.text == void 0 ? void 0 : val.text; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "TermsOfService"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "TermsOfService"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "TermsOfService" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "TermsOfService"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "TermsOfService" to be defined', + }); + } const type: TermsOfServiceBaseTypeField = deserializeTermsOfServiceBaseTypeField(val.type); return { diff --git a/src/schemas/termsOfServiceBase.generated.ts b/src/schemas/termsOfServiceBase.generated.ts index b9161261..648f2dbc 100644 --- a/src/schemas/termsOfServiceBase.generated.ts +++ b/src/schemas/termsOfServiceBase.generated.ts @@ -33,7 +33,7 @@ export function serializeTermsOfServiceBaseTypeField( return val; } export function deserializeTermsOfServiceBaseTypeField( - val: any + val: SerializedData ): TermsOfServiceBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -55,8 +55,30 @@ export function serializeTermsOfServiceBase( ['type']: serializeTermsOfServiceBaseTypeField(val.type), }; } -export function deserializeTermsOfServiceBase(val: any): TermsOfServiceBase { +export function deserializeTermsOfServiceBase( + val: SerializedData +): TermsOfServiceBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TermsOfServiceBase"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "TermsOfServiceBase" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "TermsOfServiceBase"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "TermsOfServiceBase" to be defined', + }); + } const type: TermsOfServiceBaseTypeField = deserializeTermsOfServiceBaseTypeField(val.type); return { id: id, type: type } satisfies TermsOfServiceBase; @@ -73,8 +95,23 @@ export function serializeTermsOfServiceBaseInput( }; } export function deserializeTermsOfServiceBaseInput( - val: any + val: SerializedData ): TermsOfServiceBaseInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TermsOfServiceBaseInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "TermsOfServiceBaseInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "TermsOfServiceBaseInput"', + }); + } const id: string = val.id; const type: undefined | TermsOfServiceBaseTypeField = val.type == void 0 diff --git a/src/schemas/termsOfServiceUserStatus.generated.ts b/src/schemas/termsOfServiceUserStatus.generated.ts index 78f11d0d..6f8d9518 100644 --- a/src/schemas/termsOfServiceUserStatus.generated.ts +++ b/src/schemas/termsOfServiceUserStatus.generated.ts @@ -67,7 +67,7 @@ export function serializeTermsOfServiceUserStatusTypeField( return val; } export function deserializeTermsOfServiceUserStatusTypeField( - val: any + val: SerializedData ): TermsOfServiceUserStatusTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -97,19 +97,59 @@ export function serializeTermsOfServiceUserStatus( }; } export function deserializeTermsOfServiceUserStatus( - val: any + val: SerializedData ): TermsOfServiceUserStatus { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TermsOfServiceUserStatus"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "TermsOfServiceUserStatus" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "TermsOfServiceUserStatus"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "TermsOfServiceUserStatus" to be defined', + }); + } const type: TermsOfServiceUserStatusTypeField = deserializeTermsOfServiceUserStatusTypeField(val.type); const tos: undefined | TermsOfServiceBase = val.tos == void 0 ? void 0 : deserializeTermsOfServiceBase(val.tos); const user: undefined | UserMini = val.user == void 0 ? void 0 : deserializeUserMini(val.user); + if (!(val.is_accepted == void 0) && !sdIsBoolean(val.is_accepted)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_accepted" of type "TermsOfServiceUserStatus"', + }); + } const isAccepted: undefined | boolean = val.is_accepted == void 0 ? void 0 : val.is_accepted; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "TermsOfServiceUserStatus"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "modified_at" of type "TermsOfServiceUserStatus"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); return { @@ -141,8 +181,25 @@ export function serializeTermsOfServiceUserStatusInput( }; } export function deserializeTermsOfServiceUserStatusInput( - val: any + val: SerializedData ): TermsOfServiceUserStatusInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TermsOfServiceUserStatusInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "TermsOfServiceUserStatusInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "TermsOfServiceUserStatusInput"', + }); + } const id: string = val.id; const type: undefined | TermsOfServiceUserStatusTypeField = val.type == void 0 @@ -152,10 +209,28 @@ export function deserializeTermsOfServiceUserStatusInput( val.tos == void 0 ? void 0 : deserializeTermsOfServiceBase(val.tos); const user: undefined | UserMini = val.user == void 0 ? void 0 : deserializeUserMini(val.user); + if (!(val.is_accepted == void 0) && !sdIsBoolean(val.is_accepted)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_accepted" of type "TermsOfServiceUserStatusInput"', + }); + } const isAccepted: undefined | boolean = val.is_accepted == void 0 ? void 0 : val.is_accepted; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "TermsOfServiceUserStatusInput"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "modified_at" of type "TermsOfServiceUserStatusInput"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); return { diff --git a/src/schemas/termsOfServiceUserStatuses.generated.ts b/src/schemas/termsOfServiceUserStatuses.generated.ts index 6b49bde9..fc54ebfd 100644 --- a/src/schemas/termsOfServiceUserStatuses.generated.ts +++ b/src/schemas/termsOfServiceUserStatuses.generated.ts @@ -1,6 +1,7 @@ import { serializeTermsOfServiceUserStatus } from './termsOfServiceUserStatus.generated.js'; import { deserializeTermsOfServiceUserStatus } from './termsOfServiceUserStatus.generated.js'; import { TermsOfServiceUserStatus } from './termsOfServiceUserStatus.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -28,10 +29,27 @@ export function serializeTermsOfServiceUserStatuses( }; } export function deserializeTermsOfServiceUserStatuses( - val: any + val: SerializedData ): TermsOfServiceUserStatuses { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TermsOfServiceUserStatuses"', + }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "total_count" of type "TermsOfServiceUserStatuses"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "TermsOfServiceUserStatuses"', + }); + } const entries: undefined | readonly TermsOfServiceUserStatus[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/termsOfServices.generated.ts b/src/schemas/termsOfServices.generated.ts index 8f432ad7..1693f064 100644 --- a/src/schemas/termsOfServices.generated.ts +++ b/src/schemas/termsOfServices.generated.ts @@ -1,6 +1,7 @@ import { serializeTermsOfService } from './termsOfService.generated.js'; import { deserializeTermsOfService } from './termsOfService.generated.js'; import { TermsOfService } from './termsOfService.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -23,9 +24,24 @@ export function serializeTermsOfServices(val: TermsOfServices): SerializedData { }) as readonly any[]), }; } -export function deserializeTermsOfServices(val: any): TermsOfServices { +export function deserializeTermsOfServices( + val: SerializedData +): TermsOfServices { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "TermsOfServices"' }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "TermsOfServices"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "TermsOfServices"', + }); + } const entries: undefined | readonly TermsOfService[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/timelineSkillCard.generated.ts b/src/schemas/timelineSkillCard.generated.ts index ea7f5fda..995976cd 100644 --- a/src/schemas/timelineSkillCard.generated.ts +++ b/src/schemas/timelineSkillCard.generated.ts @@ -123,7 +123,7 @@ export function serializeTimelineSkillCardTypeField( return val; } export function deserializeTimelineSkillCardTypeField( - val: any + val: SerializedData ): TimelineSkillCardTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -143,7 +143,7 @@ export function serializeTimelineSkillCardSkillCardTypeField( return val; } export function deserializeTimelineSkillCardSkillCardTypeField( - val: any + val: SerializedData ): TimelineSkillCardSkillCardTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -166,9 +166,32 @@ export function serializeTimelineSkillCardSkillCardTitleField( }; } export function deserializeTimelineSkillCardSkillCardTitleField( - val: any + val: SerializedData ): TimelineSkillCardSkillCardTitleField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TimelineSkillCardSkillCardTitleField"', + }); + } + if (!(val.code == void 0) && !sdIsString(val.code)) { + throw new BoxSdkError({ + message: + 'Expecting string for "code" of type "TimelineSkillCardSkillCardTitleField"', + }); + } const code: undefined | string = val.code == void 0 ? void 0 : val.code; + if (val.message == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "message" of type "TimelineSkillCardSkillCardTitleField" to be defined', + }); + } + if (!sdIsString(val.message)) { + throw new BoxSdkError({ + message: + 'Expecting string for "message" of type "TimelineSkillCardSkillCardTitleField"', + }); + } const message: string = val.message; return { code: code, @@ -181,7 +204,7 @@ export function serializeTimelineSkillCardSkillTypeField( return val; } export function deserializeTimelineSkillCardSkillTypeField( - val: any + val: SerializedData ): TimelineSkillCardSkillTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -204,10 +227,33 @@ export function serializeTimelineSkillCardSkillField( }; } export function deserializeTimelineSkillCardSkillField( - val: any + val: SerializedData ): TimelineSkillCardSkillField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TimelineSkillCardSkillField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "TimelineSkillCardSkillField" to be defined', + }); + } const type: TimelineSkillCardSkillTypeField = deserializeTimelineSkillCardSkillTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "TimelineSkillCardSkillField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "TimelineSkillCardSkillField"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies TimelineSkillCardSkillField; } @@ -223,12 +269,29 @@ export function serializeTimelineSkillCardSkillFieldInput( }; } export function deserializeTimelineSkillCardSkillFieldInput( - val: any + val: SerializedData ): TimelineSkillCardSkillFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TimelineSkillCardSkillFieldInput"', + }); + } const type: undefined | TimelineSkillCardSkillTypeField = val.type == void 0 ? void 0 : deserializeTimelineSkillCardSkillTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "TimelineSkillCardSkillFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "TimelineSkillCardSkillFieldInput"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies TimelineSkillCardSkillFieldInput; } @@ -238,7 +301,7 @@ export function serializeTimelineSkillCardInvocationTypeField( return val; } export function deserializeTimelineSkillCardInvocationTypeField( - val: any + val: SerializedData ): TimelineSkillCardInvocationTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -261,10 +324,33 @@ export function serializeTimelineSkillCardInvocationField( }; } export function deserializeTimelineSkillCardInvocationField( - val: any + val: SerializedData ): TimelineSkillCardInvocationField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TimelineSkillCardInvocationField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "TimelineSkillCardInvocationField" to be defined', + }); + } const type: TimelineSkillCardInvocationTypeField = deserializeTimelineSkillCardInvocationTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "TimelineSkillCardInvocationField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "TimelineSkillCardInvocationField"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies TimelineSkillCardInvocationField; } @@ -280,12 +366,29 @@ export function serializeTimelineSkillCardInvocationFieldInput( }; } export function deserializeTimelineSkillCardInvocationFieldInput( - val: any + val: SerializedData ): TimelineSkillCardInvocationFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TimelineSkillCardInvocationFieldInput"', + }); + } const type: undefined | TimelineSkillCardInvocationTypeField = val.type == void 0 ? void 0 : deserializeTimelineSkillCardInvocationTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "TimelineSkillCardInvocationFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "TimelineSkillCardInvocationFieldInput"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies TimelineSkillCardInvocationFieldInput; } @@ -298,9 +401,26 @@ export function serializeTimelineSkillCardEntriesAppearsField( }; } export function deserializeTimelineSkillCardEntriesAppearsField( - val: any + val: SerializedData ): TimelineSkillCardEntriesAppearsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TimelineSkillCardEntriesAppearsField"', + }); + } + if (!(val.start == void 0) && !sdIsNumber(val.start)) { + throw new BoxSdkError({ + message: + 'Expecting number for "start" of type "TimelineSkillCardEntriesAppearsField"', + }); + } const start: undefined | number = val.start == void 0 ? void 0 : val.start; + if (!(val.end == void 0) && !sdIsNumber(val.end)) { + throw new BoxSdkError({ + message: + 'Expecting number for "end" of type "TimelineSkillCardEntriesAppearsField"', + }); + } const end: undefined | number = val.end == void 0 ? void 0 : val.end; return { start: start, @@ -324,9 +444,26 @@ export function serializeTimelineSkillCardEntriesField( }; } export function deserializeTimelineSkillCardEntriesField( - val: any + val: SerializedData ): TimelineSkillCardEntriesField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TimelineSkillCardEntriesField"', + }); + } + if (!(val.text == void 0) && !sdIsString(val.text)) { + throw new BoxSdkError({ + message: + 'Expecting string for "text" of type "TimelineSkillCardEntriesField"', + }); + } const text: undefined | string = val.text == void 0 ? void 0 : val.text; + if (!(val.appears == void 0) && !sdIsList(val.appears)) { + throw new BoxSdkError({ + message: + 'Expecting array for "appears" of type "TimelineSkillCardEntriesField"', + }); + } const appears: undefined | readonly TimelineSkillCardEntriesAppearsField[] = val.appears == void 0 ? void 0 @@ -337,6 +474,12 @@ export function deserializeTimelineSkillCardEntriesField( return deserializeTimelineSkillCardEntriesAppearsField(itm); }) as readonly any[]) : []; + if (!(val.image_url == void 0) && !sdIsString(val.image_url)) { + throw new BoxSdkError({ + message: + 'Expecting string for "image_url" of type "TimelineSkillCardEntriesField"', + }); + } const imageUrl: undefined | string = val.image_url == void 0 ? void 0 : val.image_url; return { @@ -369,23 +512,72 @@ export function serializeTimelineSkillCard( }) as readonly any[], }; } -export function deserializeTimelineSkillCard(val: any): TimelineSkillCard { +export function deserializeTimelineSkillCard( + val: SerializedData +): TimelineSkillCard { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TimelineSkillCard"', + }); + } + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "TimelineSkillCard"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "TimelineSkillCard" to be defined', + }); + } const type: TimelineSkillCardTypeField = deserializeTimelineSkillCardTypeField(val.type); + if (val.skill_card_type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "skill_card_type" of type "TimelineSkillCard" to be defined', + }); + } const skillCardType: TimelineSkillCardSkillCardTypeField = deserializeTimelineSkillCardSkillCardTypeField(val.skill_card_type); const skillCardTitle: undefined | TimelineSkillCardSkillCardTitleField = val.skill_card_title == void 0 ? void 0 : deserializeTimelineSkillCardSkillCardTitleField(val.skill_card_title); + if (val.skill == void 0) { + throw new BoxSdkError({ + message: 'Expecting "skill" of type "TimelineSkillCard" to be defined', + }); + } const skill: TimelineSkillCardSkillField = deserializeTimelineSkillCardSkillField(val.skill); + if (val.invocation == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "invocation" of type "TimelineSkillCard" to be defined', + }); + } const invocation: TimelineSkillCardInvocationField = deserializeTimelineSkillCardInvocationField(val.invocation); + if (!(val.duration == void 0) && !sdIsNumber(val.duration)) { + throw new BoxSdkError({ + message: 'Expecting number for "duration" of type "TimelineSkillCard"', + }); + } const duration: undefined | number = val.duration == void 0 ? void 0 : val.duration; + if (val.entries == void 0) { + throw new BoxSdkError({ + message: 'Expecting "entries" of type "TimelineSkillCard" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "TimelineSkillCard"', + }); + } const entries: readonly TimelineSkillCardEntriesField[] = sdIsList( val.entries ) @@ -435,8 +627,19 @@ export function serializeTimelineSkillCardInput( }; } export function deserializeTimelineSkillCardInput( - val: any + val: SerializedData ): TimelineSkillCardInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TimelineSkillCardInput"', + }); + } + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "TimelineSkillCardInput"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); const type: undefined | TimelineSkillCardTypeField = @@ -451,12 +654,41 @@ export function deserializeTimelineSkillCardInput( val.skill_card_title == void 0 ? void 0 : deserializeTimelineSkillCardSkillCardTitleField(val.skill_card_title); + if (val.skill == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "skill" of type "TimelineSkillCardInput" to be defined', + }); + } const skill: TimelineSkillCardSkillField = deserializeTimelineSkillCardSkillField(val.skill); + if (val.invocation == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "invocation" of type "TimelineSkillCardInput" to be defined', + }); + } const invocation: TimelineSkillCardInvocationField = deserializeTimelineSkillCardInvocationField(val.invocation); + if (!(val.duration == void 0) && !sdIsNumber(val.duration)) { + throw new BoxSdkError({ + message: + 'Expecting number for "duration" of type "TimelineSkillCardInput"', + }); + } const duration: undefined | number = val.duration == void 0 ? void 0 : val.duration; + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "TimelineSkillCardInput" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "TimelineSkillCardInput"', + }); + } const entries: readonly TimelineSkillCardEntriesField[] = sdIsList( val.entries ) diff --git a/src/schemas/trackingCode.generated.ts b/src/schemas/trackingCode.generated.ts index 76647392..16fb0e9d 100644 --- a/src/schemas/trackingCode.generated.ts +++ b/src/schemas/trackingCode.generated.ts @@ -18,7 +18,7 @@ export function serializeTrackingCodeTypeField( return val; } export function deserializeTrackingCodeTypeField( - val: any + val: SerializedData ): TrackingCodeTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -40,10 +40,23 @@ export function serializeTrackingCode(val: TrackingCode): SerializedData { ['value']: val.value == void 0 ? void 0 : val.value, }; } -export function deserializeTrackingCode(val: any): TrackingCode { +export function deserializeTrackingCode(val: SerializedData): TrackingCode { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "TrackingCode"' }); + } const type: undefined | TrackingCodeTypeField = val.type == void 0 ? void 0 : deserializeTrackingCodeTypeField(val.type); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "TrackingCode"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.value == void 0) && !sdIsString(val.value)) { + throw new BoxSdkError({ + message: 'Expecting string for "value" of type "TrackingCode"', + }); + } const value: undefined | string = val.value == void 0 ? void 0 : val.value; return { type: type, name: name, value: value } satisfies TrackingCode; } diff --git a/src/schemas/transcriptSkillCard.generated.ts b/src/schemas/transcriptSkillCard.generated.ts index 7c26478b..d1572df0 100644 --- a/src/schemas/transcriptSkillCard.generated.ts +++ b/src/schemas/transcriptSkillCard.generated.ts @@ -121,7 +121,7 @@ export function serializeTranscriptSkillCardTypeField( return val; } export function deserializeTranscriptSkillCardTypeField( - val: any + val: SerializedData ): TranscriptSkillCardTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -141,7 +141,7 @@ export function serializeTranscriptSkillCardSkillCardTypeField( return val; } export function deserializeTranscriptSkillCardSkillCardTypeField( - val: any + val: SerializedData ): TranscriptSkillCardSkillCardTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -164,9 +164,32 @@ export function serializeTranscriptSkillCardSkillCardTitleField( }; } export function deserializeTranscriptSkillCardSkillCardTitleField( - val: any + val: SerializedData ): TranscriptSkillCardSkillCardTitleField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TranscriptSkillCardSkillCardTitleField"', + }); + } + if (!(val.code == void 0) && !sdIsString(val.code)) { + throw new BoxSdkError({ + message: + 'Expecting string for "code" of type "TranscriptSkillCardSkillCardTitleField"', + }); + } const code: undefined | string = val.code == void 0 ? void 0 : val.code; + if (val.message == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "message" of type "TranscriptSkillCardSkillCardTitleField" to be defined', + }); + } + if (!sdIsString(val.message)) { + throw new BoxSdkError({ + message: + 'Expecting string for "message" of type "TranscriptSkillCardSkillCardTitleField"', + }); + } const message: string = val.message; return { code: code, @@ -179,7 +202,7 @@ export function serializeTranscriptSkillCardSkillTypeField( return val; } export function deserializeTranscriptSkillCardSkillTypeField( - val: any + val: SerializedData ): TranscriptSkillCardSkillTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -202,10 +225,33 @@ export function serializeTranscriptSkillCardSkillField( }; } export function deserializeTranscriptSkillCardSkillField( - val: any + val: SerializedData ): TranscriptSkillCardSkillField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TranscriptSkillCardSkillField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "TranscriptSkillCardSkillField" to be defined', + }); + } const type: TranscriptSkillCardSkillTypeField = deserializeTranscriptSkillCardSkillTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "TranscriptSkillCardSkillField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "TranscriptSkillCardSkillField"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies TranscriptSkillCardSkillField; } @@ -221,12 +267,29 @@ export function serializeTranscriptSkillCardSkillFieldInput( }; } export function deserializeTranscriptSkillCardSkillFieldInput( - val: any + val: SerializedData ): TranscriptSkillCardSkillFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TranscriptSkillCardSkillFieldInput"', + }); + } const type: undefined | TranscriptSkillCardSkillTypeField = val.type == void 0 ? void 0 : deserializeTranscriptSkillCardSkillTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "TranscriptSkillCardSkillFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "TranscriptSkillCardSkillFieldInput"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies TranscriptSkillCardSkillFieldInput; } @@ -236,7 +299,7 @@ export function serializeTranscriptSkillCardInvocationTypeField( return val; } export function deserializeTranscriptSkillCardInvocationTypeField( - val: any + val: SerializedData ): TranscriptSkillCardInvocationTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -260,10 +323,33 @@ export function serializeTranscriptSkillCardInvocationField( }; } export function deserializeTranscriptSkillCardInvocationField( - val: any + val: SerializedData ): TranscriptSkillCardInvocationField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TranscriptSkillCardInvocationField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "TranscriptSkillCardInvocationField" to be defined', + }); + } const type: TranscriptSkillCardInvocationTypeField = deserializeTranscriptSkillCardInvocationTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "TranscriptSkillCardInvocationField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "TranscriptSkillCardInvocationField"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies TranscriptSkillCardInvocationField; } @@ -279,12 +365,29 @@ export function serializeTranscriptSkillCardInvocationFieldInput( }; } export function deserializeTranscriptSkillCardInvocationFieldInput( - val: any + val: SerializedData ): TranscriptSkillCardInvocationFieldInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TranscriptSkillCardInvocationFieldInput"', + }); + } const type: undefined | TranscriptSkillCardInvocationTypeField = val.type == void 0 ? void 0 : deserializeTranscriptSkillCardInvocationTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "TranscriptSkillCardInvocationFieldInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "TranscriptSkillCardInvocationFieldInput"', + }); + } const id: string = val.id; return { type: type, @@ -297,8 +400,19 @@ export function serializeTranscriptSkillCardEntriesAppearsField( return { ['start']: val.start == void 0 ? void 0 : val.start }; } export function deserializeTranscriptSkillCardEntriesAppearsField( - val: any + val: SerializedData ): TranscriptSkillCardEntriesAppearsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TranscriptSkillCardEntriesAppearsField"', + }); + } + if (!(val.start == void 0) && !sdIsNumber(val.start)) { + throw new BoxSdkError({ + message: + 'Expecting number for "start" of type "TranscriptSkillCardEntriesAppearsField"', + }); + } const start: undefined | number = val.start == void 0 ? void 0 : val.start; return { start: start } satisfies TranscriptSkillCardEntriesAppearsField; } @@ -318,9 +432,26 @@ export function serializeTranscriptSkillCardEntriesField( }; } export function deserializeTranscriptSkillCardEntriesField( - val: any + val: SerializedData ): TranscriptSkillCardEntriesField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TranscriptSkillCardEntriesField"', + }); + } + if (!(val.text == void 0) && !sdIsString(val.text)) { + throw new BoxSdkError({ + message: + 'Expecting string for "text" of type "TranscriptSkillCardEntriesField"', + }); + } const text: undefined | string = val.text == void 0 ? void 0 : val.text; + if (!(val.appears == void 0) && !sdIsList(val.appears)) { + throw new BoxSdkError({ + message: + 'Expecting array for "appears" of type "TranscriptSkillCardEntriesField"', + }); + } const appears: undefined | readonly TranscriptSkillCardEntriesAppearsField[] = val.appears == void 0 ? void 0 @@ -360,23 +491,74 @@ export function serializeTranscriptSkillCard( }) as readonly any[], }; } -export function deserializeTranscriptSkillCard(val: any): TranscriptSkillCard { +export function deserializeTranscriptSkillCard( + val: SerializedData +): TranscriptSkillCard { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TranscriptSkillCard"', + }); + } + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "TranscriptSkillCard"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "TranscriptSkillCard" to be defined', + }); + } const type: TranscriptSkillCardTypeField = deserializeTranscriptSkillCardTypeField(val.type); + if (val.skill_card_type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "skill_card_type" of type "TranscriptSkillCard" to be defined', + }); + } const skillCardType: TranscriptSkillCardSkillCardTypeField = deserializeTranscriptSkillCardSkillCardTypeField(val.skill_card_type); const skillCardTitle: undefined | TranscriptSkillCardSkillCardTitleField = val.skill_card_title == void 0 ? void 0 : deserializeTranscriptSkillCardSkillCardTitleField(val.skill_card_title); + if (val.skill == void 0) { + throw new BoxSdkError({ + message: 'Expecting "skill" of type "TranscriptSkillCard" to be defined', + }); + } const skill: TranscriptSkillCardSkillField = deserializeTranscriptSkillCardSkillField(val.skill); + if (val.invocation == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "invocation" of type "TranscriptSkillCard" to be defined', + }); + } const invocation: TranscriptSkillCardInvocationField = deserializeTranscriptSkillCardInvocationField(val.invocation); + if (!(val.duration == void 0) && !sdIsNumber(val.duration)) { + throw new BoxSdkError({ + message: 'Expecting number for "duration" of type "TranscriptSkillCard"', + }); + } const duration: undefined | number = val.duration == void 0 ? void 0 : val.duration; + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "TranscriptSkillCard" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "TranscriptSkillCard"', + }); + } const entries: readonly TranscriptSkillCardEntriesField[] = sdIsList( val.entries ) @@ -426,8 +608,19 @@ export function serializeTranscriptSkillCardInput( }; } export function deserializeTranscriptSkillCardInput( - val: any + val: SerializedData ): TranscriptSkillCardInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TranscriptSkillCardInput"', + }); + } + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "TranscriptSkillCardInput"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); const type: undefined | TranscriptSkillCardTypeField = @@ -442,12 +635,42 @@ export function deserializeTranscriptSkillCardInput( val.skill_card_title == void 0 ? void 0 : deserializeTranscriptSkillCardSkillCardTitleField(val.skill_card_title); + if (val.skill == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "skill" of type "TranscriptSkillCardInput" to be defined', + }); + } const skill: TranscriptSkillCardSkillField = deserializeTranscriptSkillCardSkillField(val.skill); + if (val.invocation == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "invocation" of type "TranscriptSkillCardInput" to be defined', + }); + } const invocation: TranscriptSkillCardInvocationField = deserializeTranscriptSkillCardInvocationField(val.invocation); + if (!(val.duration == void 0) && !sdIsNumber(val.duration)) { + throw new BoxSdkError({ + message: + 'Expecting number for "duration" of type "TranscriptSkillCardInput"', + }); + } const duration: undefined | number = val.duration == void 0 ? void 0 : val.duration; + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "TranscriptSkillCardInput" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "TranscriptSkillCardInput"', + }); + } const entries: readonly TranscriptSkillCardEntriesField[] = sdIsList( val.entries ) diff --git a/src/schemas/trashFile.generated.ts b/src/schemas/trashFile.generated.ts index 38a0486b..4aa06374 100644 --- a/src/schemas/trashFile.generated.ts +++ b/src/schemas/trashFile.generated.ts @@ -155,7 +155,9 @@ export function serializeTrashFileTypeField( ): SerializedData { return val; } -export function deserializeTrashFileTypeField(val: any): TrashFileTypeField { +export function deserializeTrashFileTypeField( + val: SerializedData +): TrashFileTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "TrashFileTypeField"', @@ -174,7 +176,7 @@ export function serializeTrashFilePathCollectionEntriesTypeField( return val; } export function deserializeTrashFilePathCollectionEntriesTypeField( - val: any + val: SerializedData ): TrashFilePathCollectionEntriesTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -204,16 +206,45 @@ export function serializeTrashFilePathCollectionEntriesField( }; } export function deserializeTrashFilePathCollectionEntriesField( - val: any + val: SerializedData ): TrashFilePathCollectionEntriesField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TrashFilePathCollectionEntriesField"', + }); + } const type: undefined | TrashFilePathCollectionEntriesTypeField = val.type == void 0 ? void 0 : deserializeTrashFilePathCollectionEntriesTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "TrashFilePathCollectionEntriesField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "sequence_id" of type "TrashFilePathCollectionEntriesField"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: + 'Expecting string for "etag" of type "TrashFilePathCollectionEntriesField"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "TrashFilePathCollectionEntriesField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; return { type: type, @@ -236,9 +267,38 @@ export function serializeTrashFilePathCollectionField( }; } export function deserializeTrashFilePathCollectionField( - val: any + val: SerializedData ): TrashFilePathCollectionField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TrashFilePathCollectionField"', + }); + } + if (val.total_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "total_count" of type "TrashFilePathCollectionField" to be defined', + }); + } + if (!sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "total_count" of type "TrashFilePathCollectionField"', + }); + } const totalCount: number = val.total_count; + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "TrashFilePathCollectionField" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "TrashFilePathCollectionField"', + }); + } const entries: readonly TrashFilePathCollectionEntriesField[] = sdIsList( val.entries ) @@ -259,7 +319,7 @@ export function serializeTrashFileItemStatusField( return val; } export function deserializeTrashFileItemStatusField( - val: any + val: SerializedData ): TrashFileItemStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -319,43 +379,182 @@ export function serializeTrashFile(val: TrashFile): SerializedData { ['item_status']: serializeTrashFileItemStatusField(val.itemStatus), }; } -export function deserializeTrashFile(val: any): TrashFile { +export function deserializeTrashFile(val: SerializedData): TrashFile { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "TrashFile"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "TrashFile" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "TrashFile"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "TrashFile"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "TrashFile" to be defined', + }); + } const type: TrashFileTypeField = deserializeTrashFileTypeField(val.type); + if (val.sequence_id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "sequence_id" of type "TrashFile" to be defined', + }); + } + if (!sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "TrashFile"', + }); + } const sequenceId: string = val.sequence_id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "TrashFile"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (val.sha1 == void 0) { + throw new BoxSdkError({ + message: 'Expecting "sha1" of type "TrashFile" to be defined', + }); + } + if (!sdIsString(val.sha1)) { + throw new BoxSdkError({ + message: 'Expecting string for "sha1" of type "TrashFile"', + }); + } const sha1: string = val.sha1; const fileVersion: undefined | FileVersionMini = val.file_version == void 0 ? void 0 : deserializeFileVersionMini(val.file_version); + if (val.description == void 0) { + throw new BoxSdkError({ + message: 'Expecting "description" of type "TrashFile" to be defined', + }); + } + if (!sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "TrashFile"', + }); + } const description: string = val.description; + if (val.size == void 0) { + throw new BoxSdkError({ + message: 'Expecting "size" of type "TrashFile" to be defined', + }); + } + if (!sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "TrashFile"', + }); + } const size: number = val.size; + if (val.path_collection == void 0) { + throw new BoxSdkError({ + message: 'Expecting "path_collection" of type "TrashFile" to be defined', + }); + } const pathCollection: TrashFilePathCollectionField = deserializeTrashFilePathCollectionField(val.path_collection); + if (val.created_at == void 0) { + throw new BoxSdkError({ + message: 'Expecting "created_at" of type "TrashFile" to be defined', + }); + } + if (!sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "TrashFile"', + }); + } const createdAt: DateTime = deserializeDateTime(val.created_at); + if (val.modified_at == void 0) { + throw new BoxSdkError({ + message: 'Expecting "modified_at" of type "TrashFile" to be defined', + }); + } + if (!sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "TrashFile"', + }); + } const modifiedAt: DateTime = deserializeDateTime(val.modified_at); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "trashed_at" of type "TrashFile"', + }); + } const trashedAt: undefined | DateTime = val.trashed_at == void 0 ? void 0 : deserializeDateTime(val.trashed_at); + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "purged_at" of type "TrashFile"', + }); + } const purgedAt: undefined | DateTime = val.purged_at == void 0 ? void 0 : deserializeDateTime(val.purged_at); + if ( + !(val.content_created_at == void 0) && + !sdIsString(val.content_created_at) + ) { + throw new BoxSdkError({ + message: 'Expecting string for "content_created_at" of type "TrashFile"', + }); + } const contentCreatedAt: undefined | DateTime = val.content_created_at == void 0 ? void 0 : deserializeDateTime(val.content_created_at); + if ( + !(val.content_modified_at == void 0) && + !sdIsString(val.content_modified_at) + ) { + throw new BoxSdkError({ + message: 'Expecting string for "content_modified_at" of type "TrashFile"', + }); + } const contentModifiedAt: undefined | DateTime = val.content_modified_at == void 0 ? void 0 : deserializeDateTime(val.content_modified_at); const createdBy: undefined | UserMini = val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); + if (val.modified_by == void 0) { + throw new BoxSdkError({ + message: 'Expecting "modified_by" of type "TrashFile" to be defined', + }); + } const modifiedBy: UserMini = deserializeUserMini(val.modified_by); + if (val.owned_by == void 0) { + throw new BoxSdkError({ + message: 'Expecting "owned_by" of type "TrashFile" to be defined', + }); + } const ownedBy: UserMini = deserializeUserMini(val.owned_by); + if (!(val.shared_link == void 0) && !sdIsString(val.shared_link)) { + throw new BoxSdkError({ + message: 'Expecting string for "shared_link" of type "TrashFile"', + }); + } const sharedLink: undefined | string = val.shared_link == void 0 ? void 0 : val.shared_link; const parent: undefined | FolderMini = val.parent == void 0 ? void 0 : deserializeFolderMini(val.parent); + if (val.item_status == void 0) { + throw new BoxSdkError({ + message: 'Expecting "item_status" of type "TrashFile" to be defined', + }); + } const itemStatus: TrashFileItemStatusField = deserializeTrashFileItemStatusField(val.item_status); return { @@ -424,44 +623,181 @@ export function serializeTrashFileInput(val: TrashFileInput): SerializedData { ['item_status']: serializeTrashFileItemStatusField(val.itemStatus), }; } -export function deserializeTrashFileInput(val: any): TrashFileInput { +export function deserializeTrashFileInput(val: SerializedData): TrashFileInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "TrashFileInput"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "TrashFileInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "TrashFileInput"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "TrashFileInput"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; const type: undefined | TrashFileTypeField = val.type == void 0 ? void 0 : deserializeTrashFileTypeField(val.type); + if (val.sequence_id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "sequence_id" of type "TrashFileInput" to be defined', + }); + } + if (!sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "TrashFileInput"', + }); + } const sequenceId: string = val.sequence_id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "TrashFileInput"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (val.sha1 == void 0) { + throw new BoxSdkError({ + message: 'Expecting "sha1" of type "TrashFileInput" to be defined', + }); + } + if (!sdIsString(val.sha1)) { + throw new BoxSdkError({ + message: 'Expecting string for "sha1" of type "TrashFileInput"', + }); + } const sha1: string = val.sha1; const fileVersion: undefined | FileVersionMini = val.file_version == void 0 ? void 0 : deserializeFileVersionMini(val.file_version); + if (val.description == void 0) { + throw new BoxSdkError({ + message: 'Expecting "description" of type "TrashFileInput" to be defined', + }); + } + if (!sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "TrashFileInput"', + }); + } const description: string = val.description; + if (val.size == void 0) { + throw new BoxSdkError({ + message: 'Expecting "size" of type "TrashFileInput" to be defined', + }); + } + if (!sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "TrashFileInput"', + }); + } const size: number = val.size; + if (val.path_collection == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "path_collection" of type "TrashFileInput" to be defined', + }); + } const pathCollection: TrashFilePathCollectionField = deserializeTrashFilePathCollectionField(val.path_collection); + if (val.created_at == void 0) { + throw new BoxSdkError({ + message: 'Expecting "created_at" of type "TrashFileInput" to be defined', + }); + } + if (!sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "TrashFileInput"', + }); + } const createdAt: DateTime = deserializeDateTime(val.created_at); + if (val.modified_at == void 0) { + throw new BoxSdkError({ + message: 'Expecting "modified_at" of type "TrashFileInput" to be defined', + }); + } + if (!sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "TrashFileInput"', + }); + } const modifiedAt: DateTime = deserializeDateTime(val.modified_at); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "trashed_at" of type "TrashFileInput"', + }); + } const trashedAt: undefined | DateTime = val.trashed_at == void 0 ? void 0 : deserializeDateTime(val.trashed_at); + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "purged_at" of type "TrashFileInput"', + }); + } const purgedAt: undefined | DateTime = val.purged_at == void 0 ? void 0 : deserializeDateTime(val.purged_at); + if ( + !(val.content_created_at == void 0) && + !sdIsString(val.content_created_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_created_at" of type "TrashFileInput"', + }); + } const contentCreatedAt: undefined | DateTime = val.content_created_at == void 0 ? void 0 : deserializeDateTime(val.content_created_at); + if ( + !(val.content_modified_at == void 0) && + !sdIsString(val.content_modified_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_modified_at" of type "TrashFileInput"', + }); + } const contentModifiedAt: undefined | DateTime = val.content_modified_at == void 0 ? void 0 : deserializeDateTime(val.content_modified_at); const createdBy: undefined | UserMini = val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); + if (val.modified_by == void 0) { + throw new BoxSdkError({ + message: 'Expecting "modified_by" of type "TrashFileInput" to be defined', + }); + } const modifiedBy: UserMini = deserializeUserMini(val.modified_by); + if (val.owned_by == void 0) { + throw new BoxSdkError({ + message: 'Expecting "owned_by" of type "TrashFileInput" to be defined', + }); + } const ownedBy: UserMini = deserializeUserMini(val.owned_by); + if (!(val.shared_link == void 0) && !sdIsString(val.shared_link)) { + throw new BoxSdkError({ + message: 'Expecting string for "shared_link" of type "TrashFileInput"', + }); + } const sharedLink: undefined | string = val.shared_link == void 0 ? void 0 : val.shared_link; const parent: undefined | FolderMini = val.parent == void 0 ? void 0 : deserializeFolderMini(val.parent); + if (val.item_status == void 0) { + throw new BoxSdkError({ + message: 'Expecting "item_status" of type "TrashFileInput" to be defined', + }); + } const itemStatus: TrashFileItemStatusField = deserializeTrashFileItemStatusField(val.item_status); return { diff --git a/src/schemas/trashFileRestored.generated.ts b/src/schemas/trashFileRestored.generated.ts index 201f5717..8de52f85 100644 --- a/src/schemas/trashFileRestored.generated.ts +++ b/src/schemas/trashFileRestored.generated.ts @@ -150,7 +150,7 @@ export function serializeTrashFileRestoredTypeField( return val; } export function deserializeTrashFileRestoredTypeField( - val: any + val: SerializedData ): TrashFileRestoredTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -175,9 +175,38 @@ export function serializeTrashFileRestoredPathCollectionField( }; } export function deserializeTrashFileRestoredPathCollectionField( - val: any + val: SerializedData ): TrashFileRestoredPathCollectionField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TrashFileRestoredPathCollectionField"', + }); + } + if (val.total_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "total_count" of type "TrashFileRestoredPathCollectionField" to be defined', + }); + } + if (!sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "total_count" of type "TrashFileRestoredPathCollectionField"', + }); + } const totalCount: number = val.total_count; + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "TrashFileRestoredPathCollectionField" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "TrashFileRestoredPathCollectionField"', + }); + } const entries: readonly FolderMini[] = sdIsList(val.entries) ? (val.entries.map(function (itm: SerializedData): FolderMini { return deserializeFolderMini(itm); @@ -194,7 +223,7 @@ export function serializeTrashFileRestoredItemStatusField( return val; } export function deserializeTrashFileRestoredItemStatusField( - val: any + val: SerializedData ): TrashFileRestoredItemStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -254,44 +283,196 @@ export function serializeTrashFileRestored( ['item_status']: serializeTrashFileRestoredItemStatusField(val.itemStatus), }; } -export function deserializeTrashFileRestored(val: any): TrashFileRestored { +export function deserializeTrashFileRestored( + val: SerializedData +): TrashFileRestored { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TrashFileRestored"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "TrashFileRestored" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "TrashFileRestored"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "TrashFileRestored"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "TrashFileRestored" to be defined', + }); + } const type: TrashFileRestoredTypeField = deserializeTrashFileRestoredTypeField(val.type); + if (val.sequence_id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "sequence_id" of type "TrashFileRestored" to be defined', + }); + } + if (!sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "TrashFileRestored"', + }); + } const sequenceId: string = val.sequence_id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "TrashFileRestored"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (val.sha1 == void 0) { + throw new BoxSdkError({ + message: 'Expecting "sha1" of type "TrashFileRestored" to be defined', + }); + } + if (!sdIsString(val.sha1)) { + throw new BoxSdkError({ + message: 'Expecting string for "sha1" of type "TrashFileRestored"', + }); + } const sha1: string = val.sha1; const fileVersion: undefined | FileVersionMini = val.file_version == void 0 ? void 0 : deserializeFileVersionMini(val.file_version); + if (val.description == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "description" of type "TrashFileRestored" to be defined', + }); + } + if (!sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "TrashFileRestored"', + }); + } const description: string = val.description; + if (val.size == void 0) { + throw new BoxSdkError({ + message: 'Expecting "size" of type "TrashFileRestored" to be defined', + }); + } + if (!sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "TrashFileRestored"', + }); + } const size: number = val.size; + if (val.path_collection == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "path_collection" of type "TrashFileRestored" to be defined', + }); + } const pathCollection: TrashFileRestoredPathCollectionField = deserializeTrashFileRestoredPathCollectionField(val.path_collection); + if (val.created_at == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "created_at" of type "TrashFileRestored" to be defined', + }); + } + if (!sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "TrashFileRestored"', + }); + } const createdAt: DateTime = deserializeDateTime(val.created_at); + if (val.modified_at == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "modified_at" of type "TrashFileRestored" to be defined', + }); + } + if (!sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "TrashFileRestored"', + }); + } const modifiedAt: DateTime = deserializeDateTime(val.modified_at); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "trashed_at" of type "TrashFileRestored"', + }); + } const trashedAt: undefined | string = val.trashed_at == void 0 ? void 0 : val.trashed_at; + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "purged_at" of type "TrashFileRestored"', + }); + } const purgedAt: undefined | string = val.purged_at == void 0 ? void 0 : val.purged_at; + if ( + !(val.content_created_at == void 0) && + !sdIsString(val.content_created_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_created_at" of type "TrashFileRestored"', + }); + } const contentCreatedAt: undefined | DateTime = val.content_created_at == void 0 ? void 0 : deserializeDateTime(val.content_created_at); + if ( + !(val.content_modified_at == void 0) && + !sdIsString(val.content_modified_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_modified_at" of type "TrashFileRestored"', + }); + } const contentModifiedAt: undefined | DateTime = val.content_modified_at == void 0 ? void 0 : deserializeDateTime(val.content_modified_at); const createdBy: undefined | UserMini = val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); + if (val.modified_by == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "modified_by" of type "TrashFileRestored" to be defined', + }); + } const modifiedBy: UserMini = deserializeUserMini(val.modified_by); + if (val.owned_by == void 0) { + throw new BoxSdkError({ + message: 'Expecting "owned_by" of type "TrashFileRestored" to be defined', + }); + } const ownedBy: UserMini = deserializeUserMini(val.owned_by); + if (!(val.shared_link == void 0) && !sdIsString(val.shared_link)) { + throw new BoxSdkError({ + message: 'Expecting string for "shared_link" of type "TrashFileRestored"', + }); + } const sharedLink: undefined | string = val.shared_link == void 0 ? void 0 : val.shared_link; const parent: undefined | FolderMini = val.parent == void 0 ? void 0 : deserializeFolderMini(val.parent); + if (val.item_status == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "item_status" of type "TrashFileRestored" to be defined', + }); + } const itemStatus: TrashFileRestoredItemStatusField = deserializeTrashFileRestoredItemStatusField(val.item_status); return { @@ -363,47 +544,202 @@ export function serializeTrashFileRestoredInput( }; } export function deserializeTrashFileRestoredInput( - val: any + val: SerializedData ): TrashFileRestoredInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TrashFileRestoredInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "TrashFileRestoredInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "TrashFileRestoredInput"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "TrashFileRestoredInput"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; const type: undefined | TrashFileRestoredTypeField = val.type == void 0 ? void 0 : deserializeTrashFileRestoredTypeField(val.type); + if (val.sequence_id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "sequence_id" of type "TrashFileRestoredInput" to be defined', + }); + } + if (!sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "sequence_id" of type "TrashFileRestoredInput"', + }); + } const sequenceId: string = val.sequence_id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "TrashFileRestoredInput"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (val.sha1 == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "sha1" of type "TrashFileRestoredInput" to be defined', + }); + } + if (!sdIsString(val.sha1)) { + throw new BoxSdkError({ + message: 'Expecting string for "sha1" of type "TrashFileRestoredInput"', + }); + } const sha1: string = val.sha1; const fileVersion: undefined | FileVersionMini = val.file_version == void 0 ? void 0 : deserializeFileVersionMini(val.file_version); + if (val.description == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "description" of type "TrashFileRestoredInput" to be defined', + }); + } + if (!sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "TrashFileRestoredInput"', + }); + } const description: string = val.description; + if (val.size == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "size" of type "TrashFileRestoredInput" to be defined', + }); + } + if (!sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "TrashFileRestoredInput"', + }); + } const size: number = val.size; + if (val.path_collection == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "path_collection" of type "TrashFileRestoredInput" to be defined', + }); + } const pathCollection: TrashFileRestoredPathCollectionField = deserializeTrashFileRestoredPathCollectionField(val.path_collection); + if (val.created_at == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "created_at" of type "TrashFileRestoredInput" to be defined', + }); + } + if (!sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "TrashFileRestoredInput"', + }); + } const createdAt: DateTime = deserializeDateTime(val.created_at); + if (val.modified_at == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "modified_at" of type "TrashFileRestoredInput" to be defined', + }); + } + if (!sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "modified_at" of type "TrashFileRestoredInput"', + }); + } const modifiedAt: DateTime = deserializeDateTime(val.modified_at); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "trashed_at" of type "TrashFileRestoredInput"', + }); + } const trashedAt: undefined | string = val.trashed_at == void 0 ? void 0 : val.trashed_at; + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "purged_at" of type "TrashFileRestoredInput"', + }); + } const purgedAt: undefined | string = val.purged_at == void 0 ? void 0 : val.purged_at; + if ( + !(val.content_created_at == void 0) && + !sdIsString(val.content_created_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_created_at" of type "TrashFileRestoredInput"', + }); + } const contentCreatedAt: undefined | DateTime = val.content_created_at == void 0 ? void 0 : deserializeDateTime(val.content_created_at); + if ( + !(val.content_modified_at == void 0) && + !sdIsString(val.content_modified_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_modified_at" of type "TrashFileRestoredInput"', + }); + } const contentModifiedAt: undefined | DateTime = val.content_modified_at == void 0 ? void 0 : deserializeDateTime(val.content_modified_at); const createdBy: undefined | UserMini = val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); + if (val.modified_by == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "modified_by" of type "TrashFileRestoredInput" to be defined', + }); + } const modifiedBy: UserMini = deserializeUserMini(val.modified_by); + if (val.owned_by == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "owned_by" of type "TrashFileRestoredInput" to be defined', + }); + } const ownedBy: UserMini = deserializeUserMini(val.owned_by); + if (!(val.shared_link == void 0) && !sdIsString(val.shared_link)) { + throw new BoxSdkError({ + message: + 'Expecting string for "shared_link" of type "TrashFileRestoredInput"', + }); + } const sharedLink: undefined | string = val.shared_link == void 0 ? void 0 : val.shared_link; const parent: undefined | FolderMini = val.parent == void 0 ? void 0 : deserializeFolderMini(val.parent); + if (val.item_status == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "item_status" of type "TrashFileRestoredInput" to be defined', + }); + } const itemStatus: TrashFileRestoredItemStatusField = deserializeTrashFileRestoredItemStatusField(val.item_status); return { diff --git a/src/schemas/trashFolder.generated.ts b/src/schemas/trashFolder.generated.ts index d6565b5f..a865756a 100644 --- a/src/schemas/trashFolder.generated.ts +++ b/src/schemas/trashFolder.generated.ts @@ -148,7 +148,7 @@ export function serializeTrashFolderTypeField( return val; } export function deserializeTrashFolderTypeField( - val: any + val: SerializedData ): TrashFolderTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -168,7 +168,7 @@ export function serializeTrashFolderPathCollectionEntriesTypeField( return val; } export function deserializeTrashFolderPathCollectionEntriesTypeField( - val: any + val: SerializedData ): TrashFolderPathCollectionEntriesTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -198,16 +198,45 @@ export function serializeTrashFolderPathCollectionEntriesField( }; } export function deserializeTrashFolderPathCollectionEntriesField( - val: any + val: SerializedData ): TrashFolderPathCollectionEntriesField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TrashFolderPathCollectionEntriesField"', + }); + } const type: undefined | TrashFolderPathCollectionEntriesTypeField = val.type == void 0 ? void 0 : deserializeTrashFolderPathCollectionEntriesTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "TrashFolderPathCollectionEntriesField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "sequence_id" of type "TrashFolderPathCollectionEntriesField"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: + 'Expecting string for "etag" of type "TrashFolderPathCollectionEntriesField"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "TrashFolderPathCollectionEntriesField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; return { type: type, @@ -230,9 +259,38 @@ export function serializeTrashFolderPathCollectionField( }; } export function deserializeTrashFolderPathCollectionField( - val: any + val: SerializedData ): TrashFolderPathCollectionField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TrashFolderPathCollectionField"', + }); + } + if (val.total_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "total_count" of type "TrashFolderPathCollectionField" to be defined', + }); + } + if (!sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "total_count" of type "TrashFolderPathCollectionField"', + }); + } const totalCount: number = val.total_count; + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "TrashFolderPathCollectionField" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "TrashFolderPathCollectionField"', + }); + } const entries: readonly TrashFolderPathCollectionEntriesField[] = sdIsList( val.entries ) @@ -253,7 +311,7 @@ export function serializeTrashFolderItemStatusField( return val; } export function deserializeTrashFolderItemStatusField( - val: any + val: SerializedData ): TrashFolderItemStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -311,42 +369,178 @@ export function serializeTrashFolder(val: TrashFolder): SerializedData { ['item_status']: serializeTrashFolderItemStatusField(val.itemStatus), }; } -export function deserializeTrashFolder(val: any): TrashFolder { +export function deserializeTrashFolder(val: SerializedData): TrashFolder { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "TrashFolder"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "TrashFolder" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "TrashFolder"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "TrashFolder"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "TrashFolder" to be defined', + }); + } const type: TrashFolderTypeField = deserializeTrashFolderTypeField(val.type); + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "TrashFolder"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (val.name == void 0) { + throw new BoxSdkError({ + message: 'Expecting "name" of type "TrashFolder" to be defined', + }); + } + if (!sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "TrashFolder"', + }); + } const name: string = val.name; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "TrashFolder"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "TrashFolder"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (val.description == void 0) { + throw new BoxSdkError({ + message: 'Expecting "description" of type "TrashFolder" to be defined', + }); + } + if (!sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "TrashFolder"', + }); + } const description: string = val.description; + if (val.size == void 0) { + throw new BoxSdkError({ + message: 'Expecting "size" of type "TrashFolder" to be defined', + }); + } + if (!sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "TrashFolder"', + }); + } const size: number = val.size; + if (val.path_collection == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "path_collection" of type "TrashFolder" to be defined', + }); + } const pathCollection: TrashFolderPathCollectionField = deserializeTrashFolderPathCollectionField(val.path_collection); + if (val.created_by == void 0) { + throw new BoxSdkError({ + message: 'Expecting "created_by" of type "TrashFolder" to be defined', + }); + } const createdBy: UserMini = deserializeUserMini(val.created_by); + if (val.modified_by == void 0) { + throw new BoxSdkError({ + message: 'Expecting "modified_by" of type "TrashFolder" to be defined', + }); + } const modifiedBy: UserMini = deserializeUserMini(val.modified_by); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "trashed_at" of type "TrashFolder"', + }); + } const trashedAt: undefined | DateTime = val.trashed_at == void 0 ? void 0 : deserializeDateTime(val.trashed_at); + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "purged_at" of type "TrashFolder"', + }); + } const purgedAt: undefined | DateTime = val.purged_at == void 0 ? void 0 : deserializeDateTime(val.purged_at); + if ( + !(val.content_created_at == void 0) && + !sdIsString(val.content_created_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_created_at" of type "TrashFolder"', + }); + } const contentCreatedAt: undefined | DateTime = val.content_created_at == void 0 ? void 0 : deserializeDateTime(val.content_created_at); + if ( + !(val.content_modified_at == void 0) && + !sdIsString(val.content_modified_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_modified_at" of type "TrashFolder"', + }); + } const contentModifiedAt: undefined | DateTime = val.content_modified_at == void 0 ? void 0 : deserializeDateTime(val.content_modified_at); + if (val.owned_by == void 0) { + throw new BoxSdkError({ + message: 'Expecting "owned_by" of type "TrashFolder" to be defined', + }); + } const ownedBy: UserMini = deserializeUserMini(val.owned_by); + if (!(val.shared_link == void 0) && !sdIsString(val.shared_link)) { + throw new BoxSdkError({ + message: 'Expecting string for "shared_link" of type "TrashFolder"', + }); + } const sharedLink: undefined | string = val.shared_link == void 0 ? void 0 : val.shared_link; + if ( + !(val.folder_upload_email == void 0) && + !sdIsString(val.folder_upload_email) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "folder_upload_email" of type "TrashFolder"', + }); + } const folderUploadEmail: undefined | string = val.folder_upload_email == void 0 ? void 0 : val.folder_upload_email; const parent: undefined | FolderMini = val.parent == void 0 ? void 0 : deserializeFolderMini(val.parent); + if (val.item_status == void 0) { + throw new BoxSdkError({ + message: 'Expecting "item_status" of type "TrashFolder" to be defined', + }); + } const itemStatus: TrashFolderItemStatusField = deserializeTrashFolderItemStatusField(val.item_status); return { @@ -414,43 +608,182 @@ export function serializeTrashFolderInput( ['item_status']: serializeTrashFolderItemStatusField(val.itemStatus), }; } -export function deserializeTrashFolderInput(val: any): TrashFolderInput { +export function deserializeTrashFolderInput( + val: SerializedData +): TrashFolderInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TrashFolderInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "TrashFolderInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "TrashFolderInput"', + }); + } const id: string = val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "TrashFolderInput"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; const type: undefined | TrashFolderTypeField = val.type == void 0 ? void 0 : deserializeTrashFolderTypeField(val.type); + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "TrashFolderInput"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (val.name == void 0) { + throw new BoxSdkError({ + message: 'Expecting "name" of type "TrashFolderInput" to be defined', + }); + } + if (!sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "TrashFolderInput"', + }); + } const name: string = val.name; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "TrashFolderInput"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "TrashFolderInput"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (val.description == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "description" of type "TrashFolderInput" to be defined', + }); + } + if (!sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "TrashFolderInput"', + }); + } const description: string = val.description; + if (val.size == void 0) { + throw new BoxSdkError({ + message: 'Expecting "size" of type "TrashFolderInput" to be defined', + }); + } + if (!sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "TrashFolderInput"', + }); + } const size: number = val.size; + if (val.path_collection == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "path_collection" of type "TrashFolderInput" to be defined', + }); + } const pathCollection: TrashFolderPathCollectionField = deserializeTrashFolderPathCollectionField(val.path_collection); + if (val.created_by == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "created_by" of type "TrashFolderInput" to be defined', + }); + } const createdBy: UserMini = deserializeUserMini(val.created_by); + if (val.modified_by == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "modified_by" of type "TrashFolderInput" to be defined', + }); + } const modifiedBy: UserMini = deserializeUserMini(val.modified_by); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "trashed_at" of type "TrashFolderInput"', + }); + } const trashedAt: undefined | DateTime = val.trashed_at == void 0 ? void 0 : deserializeDateTime(val.trashed_at); + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "purged_at" of type "TrashFolderInput"', + }); + } const purgedAt: undefined | DateTime = val.purged_at == void 0 ? void 0 : deserializeDateTime(val.purged_at); + if ( + !(val.content_created_at == void 0) && + !sdIsString(val.content_created_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_created_at" of type "TrashFolderInput"', + }); + } const contentCreatedAt: undefined | DateTime = val.content_created_at == void 0 ? void 0 : deserializeDateTime(val.content_created_at); + if ( + !(val.content_modified_at == void 0) && + !sdIsString(val.content_modified_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_modified_at" of type "TrashFolderInput"', + }); + } const contentModifiedAt: undefined | DateTime = val.content_modified_at == void 0 ? void 0 : deserializeDateTime(val.content_modified_at); + if (val.owned_by == void 0) { + throw new BoxSdkError({ + message: 'Expecting "owned_by" of type "TrashFolderInput" to be defined', + }); + } const ownedBy: UserMini = deserializeUserMini(val.owned_by); + if (!(val.shared_link == void 0) && !sdIsString(val.shared_link)) { + throw new BoxSdkError({ + message: 'Expecting string for "shared_link" of type "TrashFolderInput"', + }); + } const sharedLink: undefined | string = val.shared_link == void 0 ? void 0 : val.shared_link; + if ( + !(val.folder_upload_email == void 0) && + !sdIsString(val.folder_upload_email) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "folder_upload_email" of type "TrashFolderInput"', + }); + } const folderUploadEmail: undefined | string = val.folder_upload_email == void 0 ? void 0 : val.folder_upload_email; const parent: undefined | FolderMini = val.parent == void 0 ? void 0 : deserializeFolderMini(val.parent); + if (val.item_status == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "item_status" of type "TrashFolderInput" to be defined', + }); + } const itemStatus: TrashFolderItemStatusField = deserializeTrashFolderItemStatusField(val.item_status); return { diff --git a/src/schemas/trashFolderRestored.generated.ts b/src/schemas/trashFolderRestored.generated.ts index cbfb2bf4..206c57eb 100644 --- a/src/schemas/trashFolderRestored.generated.ts +++ b/src/schemas/trashFolderRestored.generated.ts @@ -53,7 +53,7 @@ export function serializeTrashFolderRestoredTypeField( return val; } export function deserializeTrashFolderRestoredTypeField( - val: any + val: SerializedData ): TrashFolderRestoredTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -78,9 +78,38 @@ export function serializeTrashFolderRestoredPathCollectionField( }; } export function deserializeTrashFolderRestoredPathCollectionField( - val: any + val: SerializedData ): TrashFolderRestoredPathCollectionField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TrashFolderRestoredPathCollectionField"', + }); + } + if (val.total_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "total_count" of type "TrashFolderRestoredPathCollectionField" to be defined', + }); + } + if (!sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "total_count" of type "TrashFolderRestoredPathCollectionField"', + }); + } const totalCount: number = val.total_count; + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "TrashFolderRestoredPathCollectionField" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "TrashFolderRestoredPathCollectionField"', + }); + } const entries: readonly FolderMini[] = sdIsList(val.entries) ? (val.entries.map(function (itm: SerializedData): FolderMini { return deserializeFolderMini(itm); @@ -97,7 +126,7 @@ export function serializeTrashFolderRestoredItemStatusField( return val; } export function deserializeTrashFolderRestoredItemStatusField( - val: any + val: SerializedData ): TrashFolderRestoredItemStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -165,22 +194,73 @@ export function serializeTrashFolderRestored( : serializeTrashFolderRestoredItemStatusField(val.itemStatus), }; } -export function deserializeTrashFolderRestored(val: any): TrashFolderRestored { +export function deserializeTrashFolderRestored( + val: SerializedData +): TrashFolderRestored { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TrashFolderRestored"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "TrashFolderRestored"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "TrashFolderRestored"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; const type: undefined | TrashFolderRestoredTypeField = val.type == void 0 ? void 0 : deserializeTrashFolderRestoredTypeField(val.type); + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "sequence_id" of type "TrashFolderRestored"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "TrashFolderRestored"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "TrashFolderRestored"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "modified_at" of type "TrashFolderRestored"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "TrashFolderRestored"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if (!(val.size == void 0) && !sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "TrashFolderRestored"', + }); + } const size: undefined | number = val.size == void 0 ? void 0 : val.size; const pathCollection: undefined | TrashFolderRestoredPathCollectionField = val.path_collection == void 0 @@ -190,22 +270,66 @@ export function deserializeTrashFolderRestored(val: any): TrashFolderRestored { val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); const modifiedBy: undefined | UserMini = val.modified_by == void 0 ? void 0 : deserializeUserMini(val.modified_by); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "trashed_at" of type "TrashFolderRestored"', + }); + } const trashedAt: undefined | string = val.trashed_at == void 0 ? void 0 : val.trashed_at; + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "purged_at" of type "TrashFolderRestored"', + }); + } const purgedAt: undefined | string = val.purged_at == void 0 ? void 0 : val.purged_at; + if ( + !(val.content_created_at == void 0) && + !sdIsString(val.content_created_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_created_at" of type "TrashFolderRestored"', + }); + } const contentCreatedAt: undefined | DateTime = val.content_created_at == void 0 ? void 0 : deserializeDateTime(val.content_created_at); + if ( + !(val.content_modified_at == void 0) && + !sdIsString(val.content_modified_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "content_modified_at" of type "TrashFolderRestored"', + }); + } const contentModifiedAt: undefined | DateTime = val.content_modified_at == void 0 ? void 0 : deserializeDateTime(val.content_modified_at); const ownedBy: undefined | UserMini = val.owned_by == void 0 ? void 0 : deserializeUserMini(val.owned_by); + if (!(val.shared_link == void 0) && !sdIsString(val.shared_link)) { + throw new BoxSdkError({ + message: + 'Expecting string for "shared_link" of type "TrashFolderRestored"', + }); + } const sharedLink: undefined | string = val.shared_link == void 0 ? void 0 : val.shared_link; + if ( + !(val.folder_upload_email == void 0) && + !sdIsString(val.folder_upload_email) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "folder_upload_email" of type "TrashFolderRestored"', + }); + } const folderUploadEmail: undefined | string = val.folder_upload_email == void 0 ? void 0 : val.folder_upload_email; const parent: undefined | FolderMini = diff --git a/src/schemas/trashWebLink.generated.ts b/src/schemas/trashWebLink.generated.ts index 3ae432c2..88b41635 100644 --- a/src/schemas/trashWebLink.generated.ts +++ b/src/schemas/trashWebLink.generated.ts @@ -55,7 +55,7 @@ export function serializeTrashWebLinkTypeField( return val; } export function deserializeTrashWebLinkTypeField( - val: any + val: SerializedData ): TrashWebLinkTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -75,7 +75,7 @@ export function serializeTrashWebLinkPathCollectionEntriesTypeField( return val; } export function deserializeTrashWebLinkPathCollectionEntriesTypeField( - val: any + val: SerializedData ): TrashWebLinkPathCollectionEntriesTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -105,16 +105,45 @@ export function serializeTrashWebLinkPathCollectionEntriesField( }; } export function deserializeTrashWebLinkPathCollectionEntriesField( - val: any + val: SerializedData ): TrashWebLinkPathCollectionEntriesField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TrashWebLinkPathCollectionEntriesField"', + }); + } const type: undefined | TrashWebLinkPathCollectionEntriesTypeField = val.type == void 0 ? void 0 : deserializeTrashWebLinkPathCollectionEntriesTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "TrashWebLinkPathCollectionEntriesField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "sequence_id" of type "TrashWebLinkPathCollectionEntriesField"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: + 'Expecting string for "etag" of type "TrashWebLinkPathCollectionEntriesField"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "TrashWebLinkPathCollectionEntriesField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; return { type: type, @@ -137,9 +166,38 @@ export function serializeTrashWebLinkPathCollectionField( }; } export function deserializeTrashWebLinkPathCollectionField( - val: any + val: SerializedData ): TrashWebLinkPathCollectionField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TrashWebLinkPathCollectionField"', + }); + } + if (val.total_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "total_count" of type "TrashWebLinkPathCollectionField" to be defined', + }); + } + if (!sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "total_count" of type "TrashWebLinkPathCollectionField"', + }); + } const totalCount: number = val.total_count; + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "TrashWebLinkPathCollectionField" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "TrashWebLinkPathCollectionField"', + }); + } const entries: readonly TrashWebLinkPathCollectionEntriesField[] = sdIsList( val.entries ) @@ -160,7 +218,7 @@ export function serializeTrashWebLinkItemStatusField( return val; } export function deserializeTrashWebLinkItemStatusField( - val: any + val: SerializedData ): TrashWebLinkItemStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -216,29 +274,82 @@ export function serializeTrashWebLink(val: TrashWebLink): SerializedData { : serializeTrashWebLinkItemStatusField(val.itemStatus), }; } -export function deserializeTrashWebLink(val: any): TrashWebLink { +export function deserializeTrashWebLink(val: SerializedData): TrashWebLink { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "TrashWebLink"' }); + } const type: undefined | TrashWebLinkTypeField = val.type == void 0 ? void 0 : deserializeTrashWebLinkTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "TrashWebLink"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "TrashWebLink"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "TrashWebLink"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "TrashWebLink"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.url == void 0) && !sdIsString(val.url)) { + throw new BoxSdkError({ + message: 'Expecting string for "url" of type "TrashWebLink"', + }); + } const url: undefined | string = val.url == void 0 ? void 0 : val.url; const parent: undefined | FolderMini = val.parent == void 0 ? void 0 : deserializeFolderMini(val.parent); + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "TrashWebLink"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; const pathCollection: undefined | TrashWebLinkPathCollectionField = val.path_collection == void 0 ? void 0 : deserializeTrashWebLinkPathCollectionField(val.path_collection); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "TrashWebLink"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "TrashWebLink"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "trashed_at" of type "TrashWebLink"', + }); + } const trashedAt: undefined | DateTime = val.trashed_at == void 0 ? void 0 : deserializeDateTime(val.trashed_at); + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "purged_at" of type "TrashWebLink"', + }); + } const purgedAt: undefined | DateTime = val.purged_at == void 0 ? void 0 : deserializeDateTime(val.purged_at); const createdBy: undefined | UserMini = @@ -247,6 +358,11 @@ export function deserializeTrashWebLink(val: any): TrashWebLink { val.modified_by == void 0 ? void 0 : deserializeUserMini(val.modified_by); const ownedBy: undefined | UserMini = val.owned_by == void 0 ? void 0 : deserializeUserMini(val.owned_by); + if (!(val.shared_link == void 0) && !sdIsString(val.shared_link)) { + throw new BoxSdkError({ + message: 'Expecting string for "shared_link" of type "TrashWebLink"', + }); + } const sharedLink: undefined | string = val.shared_link == void 0 ? void 0 : val.shared_link; const itemStatus: undefined | TrashWebLinkItemStatusField = diff --git a/src/schemas/trashWebLinkRestored.generated.ts b/src/schemas/trashWebLinkRestored.generated.ts index 0716d56e..cb7f14bd 100644 --- a/src/schemas/trashWebLinkRestored.generated.ts +++ b/src/schemas/trashWebLinkRestored.generated.ts @@ -50,7 +50,7 @@ export function serializeTrashWebLinkRestoredTypeField( return val; } export function deserializeTrashWebLinkRestoredTypeField( - val: any + val: SerializedData ): TrashWebLinkRestoredTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -75,9 +75,38 @@ export function serializeTrashWebLinkRestoredPathCollectionField( }; } export function deserializeTrashWebLinkRestoredPathCollectionField( - val: any + val: SerializedData ): TrashWebLinkRestoredPathCollectionField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TrashWebLinkRestoredPathCollectionField"', + }); + } + if (val.total_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "total_count" of type "TrashWebLinkRestoredPathCollectionField" to be defined', + }); + } + if (!sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "total_count" of type "TrashWebLinkRestoredPathCollectionField"', + }); + } const totalCount: number = val.total_count; + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "TrashWebLinkRestoredPathCollectionField" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "TrashWebLinkRestoredPathCollectionField"', + }); + } const entries: readonly FolderMini[] = sdIsList(val.entries) ? (val.entries.map(function (itm: SerializedData): FolderMini { return deserializeFolderMini(itm); @@ -94,7 +123,7 @@ export function serializeTrashWebLinkRestoredItemStatusField( return val; } export function deserializeTrashWebLinkRestoredItemStatusField( - val: any + val: SerializedData ): TrashWebLinkRestoredItemStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -152,29 +181,102 @@ export function serializeTrashWebLinkRestored( }; } export function deserializeTrashWebLinkRestored( - val: any + val: SerializedData ): TrashWebLinkRestored { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "TrashWebLinkRestored"', + }); + } const type: undefined | TrashWebLinkRestoredTypeField = val.type == void 0 ? void 0 : deserializeTrashWebLinkRestoredTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "TrashWebLinkRestored"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; + if (val.sequence_id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "sequence_id" of type "TrashWebLinkRestored" to be defined', + }); + } + if (!sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "sequence_id" of type "TrashWebLinkRestored"', + }); + } const sequenceId: string = val.sequence_id; + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "TrashWebLinkRestored"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "TrashWebLinkRestored"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.url == void 0) && !sdIsString(val.url)) { + throw new BoxSdkError({ + message: 'Expecting string for "url" of type "TrashWebLinkRestored"', + }); + } const url: undefined | string = val.url == void 0 ? void 0 : val.url; const parent: undefined | FolderMini = val.parent == void 0 ? void 0 : deserializeFolderMini(val.parent); + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: + 'Expecting string for "description" of type "TrashWebLinkRestored"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if (val.path_collection == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "path_collection" of type "TrashWebLinkRestored" to be defined', + }); + } const pathCollection: TrashWebLinkRestoredPathCollectionField = deserializeTrashWebLinkRestoredPathCollectionField(val.path_collection); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "TrashWebLinkRestored"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "modified_at" of type "TrashWebLinkRestored"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "trashed_at" of type "TrashWebLinkRestored"', + }); + } const trashedAt: undefined | string = val.trashed_at == void 0 ? void 0 : val.trashed_at; + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "purged_at" of type "TrashWebLinkRestored"', + }); + } const purgedAt: undefined | string = val.purged_at == void 0 ? void 0 : val.purged_at; const createdBy: undefined | UserMini = @@ -183,6 +285,12 @@ export function deserializeTrashWebLinkRestored( val.modified_by == void 0 ? void 0 : deserializeUserMini(val.modified_by); const ownedBy: undefined | UserMini = val.owned_by == void 0 ? void 0 : deserializeUserMini(val.owned_by); + if (!(val.shared_link == void 0) && !sdIsString(val.shared_link)) { + throw new BoxSdkError({ + message: + 'Expecting string for "shared_link" of type "TrashWebLinkRestored"', + }); + } const sharedLink: undefined | string = val.shared_link == void 0 ? void 0 : val.shared_link; const itemStatus: undefined | TrashWebLinkRestoredItemStatusField = diff --git a/src/schemas/uploadPart.generated.ts b/src/schemas/uploadPart.generated.ts index 0fc0ab53..e28fad0e 100644 --- a/src/schemas/uploadPart.generated.ts +++ b/src/schemas/uploadPart.generated.ts @@ -19,11 +19,34 @@ export function serializeUploadPart(val: UploadPart): SerializedData { } return { ...base, ...{ ['sha1']: val.sha1 == void 0 ? void 0 : val.sha1 } }; } -export function deserializeUploadPart(val: any): UploadPart { +export function deserializeUploadPart(val: SerializedData): UploadPart { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "UploadPart"' }); + } + if (!(val.sha1 == void 0) && !sdIsString(val.sha1)) { + throw new BoxSdkError({ + message: 'Expecting string for "sha1" of type "UploadPart"', + }); + } const sha1: undefined | string = val.sha1 == void 0 ? void 0 : val.sha1; + if (!(val.part_id == void 0) && !sdIsString(val.part_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "part_id" of type "UploadPart"', + }); + } const partId: undefined | string = val.part_id == void 0 ? void 0 : val.part_id; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: 'Expecting number for "offset" of type "UploadPart"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; + if (!(val.size == void 0) && !sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "UploadPart"', + }); + } const size: undefined | number = val.size == void 0 ? void 0 : val.size; return { sha1: sha1, diff --git a/src/schemas/uploadPartMini.generated.ts b/src/schemas/uploadPartMini.generated.ts index 1d68928b..064d02b2 100644 --- a/src/schemas/uploadPartMini.generated.ts +++ b/src/schemas/uploadPartMini.generated.ts @@ -1,3 +1,4 @@ +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -17,10 +18,28 @@ export function serializeUploadPartMini(val: UploadPartMini): SerializedData { ['size']: val.size == void 0 ? void 0 : val.size, }; } -export function deserializeUploadPartMini(val: any): UploadPartMini { +export function deserializeUploadPartMini(val: SerializedData): UploadPartMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "UploadPartMini"' }); + } + if (!(val.part_id == void 0) && !sdIsString(val.part_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "part_id" of type "UploadPartMini"', + }); + } const partId: undefined | string = val.part_id == void 0 ? void 0 : val.part_id; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: 'Expecting number for "offset" of type "UploadPartMini"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; + if (!(val.size == void 0) && !sdIsNumber(val.size)) { + throw new BoxSdkError({ + message: 'Expecting number for "size" of type "UploadPartMini"', + }); + } const size: undefined | number = val.size == void 0 ? void 0 : val.size; return { partId: partId, diff --git a/src/schemas/uploadParts.generated.ts b/src/schemas/uploadParts.generated.ts index d81a5eb2..f4029fa9 100644 --- a/src/schemas/uploadParts.generated.ts +++ b/src/schemas/uploadParts.generated.ts @@ -27,7 +27,7 @@ export function serializeUploadPartsOrderDirectionField( return val; } export function deserializeUploadPartsOrderDirectionField( - val: any + val: SerializedData ): UploadPartsOrderDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -56,8 +56,18 @@ export function serializeUploadPartsOrderField( }; } export function deserializeUploadPartsOrderField( - val: any + val: SerializedData ): UploadPartsOrderField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UploadPartsOrderField"', + }); + } + if (!(val.by == void 0) && !sdIsString(val.by)) { + throw new BoxSdkError({ + message: 'Expecting string for "by" of type "UploadPartsOrderField"', + }); + } const by: undefined | string = val.by == void 0 ? void 0 : val.by; const direction: undefined | UploadPartsOrderDirectionField = val.direction == void 0 @@ -86,11 +96,34 @@ export function serializeUploadParts(val: UploadParts): SerializedData { }) as readonly any[]), }; } -export function deserializeUploadParts(val: any): UploadParts { +export function deserializeUploadParts(val: SerializedData): UploadParts { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "UploadParts"' }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "UploadParts"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "UploadParts"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: 'Expecting number for "offset" of type "UploadParts"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; + if (!(val.order == void 0) && !sdIsList(val.order)) { + throw new BoxSdkError({ + message: 'Expecting array for "order" of type "UploadParts"', + }); + } const order: undefined | readonly UploadPartsOrderField[] = val.order == void 0 ? void 0 @@ -99,6 +132,11 @@ export function deserializeUploadParts(val: any): UploadParts { return deserializeUploadPartsOrderField(itm); }) as readonly any[]) : []; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "UploadParts"', + }); + } const entries: undefined | readonly UploadPart[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/uploadSession.generated.ts b/src/schemas/uploadSession.generated.ts index eaf252c1..06a2a79d 100644 --- a/src/schemas/uploadSession.generated.ts +++ b/src/schemas/uploadSession.generated.ts @@ -33,7 +33,7 @@ export function serializeUploadSessionTypeField( return val; } export function deserializeUploadSessionTypeField( - val: any + val: SerializedData ): UploadSessionTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -60,15 +60,56 @@ export function serializeUploadSessionSessionEndpointsField( }; } export function deserializeUploadSessionSessionEndpointsField( - val: any + val: SerializedData ): UploadSessionSessionEndpointsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UploadSessionSessionEndpointsField"', + }); + } + if (!(val.upload_part == void 0) && !sdIsString(val.upload_part)) { + throw new BoxSdkError({ + message: + 'Expecting string for "upload_part" of type "UploadSessionSessionEndpointsField"', + }); + } const uploadPart: undefined | string = val.upload_part == void 0 ? void 0 : val.upload_part; + if (!(val.commit == void 0) && !sdIsString(val.commit)) { + throw new BoxSdkError({ + message: + 'Expecting string for "commit" of type "UploadSessionSessionEndpointsField"', + }); + } const commit: undefined | string = val.commit == void 0 ? void 0 : val.commit; + if (!(val.abort == void 0) && !sdIsString(val.abort)) { + throw new BoxSdkError({ + message: + 'Expecting string for "abort" of type "UploadSessionSessionEndpointsField"', + }); + } const abort: undefined | string = val.abort == void 0 ? void 0 : val.abort; + if (!(val.list_parts == void 0) && !sdIsString(val.list_parts)) { + throw new BoxSdkError({ + message: + 'Expecting string for "list_parts" of type "UploadSessionSessionEndpointsField"', + }); + } const listParts: undefined | string = val.list_parts == void 0 ? void 0 : val.list_parts; + if (!(val.status == void 0) && !sdIsString(val.status)) { + throw new BoxSdkError({ + message: + 'Expecting string for "status" of type "UploadSessionSessionEndpointsField"', + }); + } const status: undefined | string = val.status == void 0 ? void 0 : val.status; + if (!(val.log_event == void 0) && !sdIsString(val.log_event)) { + throw new BoxSdkError({ + message: + 'Expecting string for "log_event" of type "UploadSessionSessionEndpointsField"', + }); + } const logEvent: undefined | string = val.log_event == void 0 ? void 0 : val.log_event; return { @@ -99,18 +140,54 @@ export function serializeUploadSession(val: UploadSession): SerializedData { : serializeUploadSessionSessionEndpointsField(val.sessionEndpoints), }; } -export function deserializeUploadSession(val: any): UploadSession { +export function deserializeUploadSession(val: SerializedData): UploadSession { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "UploadSession"' }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "UploadSession"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | UploadSessionTypeField = val.type == void 0 ? void 0 : deserializeUploadSessionTypeField(val.type); + if ( + !(val.session_expires_at == void 0) && + !sdIsString(val.session_expires_at) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "session_expires_at" of type "UploadSession"', + }); + } const sessionExpiresAt: undefined | DateTime = val.session_expires_at == void 0 ? void 0 : deserializeDateTime(val.session_expires_at); + if (!(val.part_size == void 0) && !sdIsNumber(val.part_size)) { + throw new BoxSdkError({ + message: 'Expecting number for "part_size" of type "UploadSession"', + }); + } const partSize: undefined | number = val.part_size == void 0 ? void 0 : val.part_size; + if (!(val.total_parts == void 0) && !sdIsNumber(val.total_parts)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_parts" of type "UploadSession"', + }); + } const totalParts: undefined | number = val.total_parts == void 0 ? void 0 : val.total_parts; + if ( + !(val.num_parts_processed == void 0) && + !sdIsNumber(val.num_parts_processed) + ) { + throw new BoxSdkError({ + message: + 'Expecting number for "num_parts_processed" of type "UploadSession"', + }); + } const numPartsProcessed: undefined | number = val.num_parts_processed == void 0 ? void 0 : val.num_parts_processed; const sessionEndpoints: undefined | UploadSessionSessionEndpointsField = diff --git a/src/schemas/uploadUrl.generated.ts b/src/schemas/uploadUrl.generated.ts index bf7b93a1..72d74cce 100644 --- a/src/schemas/uploadUrl.generated.ts +++ b/src/schemas/uploadUrl.generated.ts @@ -1,3 +1,4 @@ +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -15,9 +16,22 @@ export function serializeUploadUrl(val: UploadUrl): SerializedData { ['upload_token']: val.uploadToken == void 0 ? void 0 : val.uploadToken, }; } -export function deserializeUploadUrl(val: any): UploadUrl { +export function deserializeUploadUrl(val: SerializedData): UploadUrl { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "UploadUrl"' }); + } + if (!(val.upload_url == void 0) && !sdIsString(val.upload_url)) { + throw new BoxSdkError({ + message: 'Expecting string for "upload_url" of type "UploadUrl"', + }); + } const uploadUrl: undefined | string = val.upload_url == void 0 ? void 0 : val.upload_url; + if (!(val.upload_token == void 0) && !sdIsString(val.upload_token)) { + throw new BoxSdkError({ + message: 'Expecting string for "upload_token" of type "UploadUrl"', + }); + } const uploadToken: undefined | string = val.upload_token == void 0 ? void 0 : val.upload_token; return { uploadUrl: uploadUrl, uploadToken: uploadToken } satisfies UploadUrl; diff --git a/src/schemas/uploadedPart.generated.ts b/src/schemas/uploadedPart.generated.ts index 2e0dfc75..70502df1 100644 --- a/src/schemas/uploadedPart.generated.ts +++ b/src/schemas/uploadedPart.generated.ts @@ -1,6 +1,7 @@ import { serializeUploadPart } from './uploadPart.generated.js'; import { deserializeUploadPart } from './uploadPart.generated.js'; import { UploadPart } from './uploadPart.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -16,7 +17,10 @@ export function serializeUploadedPart(val: UploadedPart): SerializedData { ['part']: val.part == void 0 ? void 0 : serializeUploadPart(val.part), }; } -export function deserializeUploadedPart(val: any): UploadedPart { +export function deserializeUploadedPart(val: SerializedData): UploadedPart { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "UploadedPart"' }); + } const part: undefined | UploadPart = val.part == void 0 ? void 0 : deserializeUploadPart(val.part); return { part: part } satisfies UploadedPart; diff --git a/src/schemas/user.generated.ts b/src/schemas/user.generated.ts index d815ce71..d49440bc 100644 --- a/src/schemas/user.generated.ts +++ b/src/schemas/user.generated.ts @@ -48,7 +48,9 @@ export class User extends UserMini { export function serializeUserStatusField(val: UserStatusField): SerializedData { return val; } -export function deserializeUserStatusField(val: any): UserStatusField { +export function deserializeUserStatusField( + val: SerializedData +): UserStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "UserStatusField"', @@ -79,9 +81,26 @@ export function serializeUserNotificationEmailField( }; } export function deserializeUserNotificationEmailField( - val: any + val: SerializedData ): UserNotificationEmailField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UserNotificationEmailField"', + }); + } + if (!(val.email == void 0) && !sdIsString(val.email)) { + throw new BoxSdkError({ + message: + 'Expecting string for "email" of type "UserNotificationEmailField"', + }); + } const email: undefined | string = val.email == void 0 ? void 0 : val.email; + if (!(val.is_confirmed == void 0) && !sdIsBoolean(val.is_confirmed)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_confirmed" of type "UserNotificationEmailField"', + }); + } const isConfirmed: undefined | boolean = val.is_confirmed == void 0 ? void 0 : val.is_confirmed; return { @@ -120,37 +139,120 @@ export function serializeUser(val: User): SerializedData { }, }; } -export function deserializeUser(val: any): User { +export function deserializeUser(val: SerializedData): User { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "User"' }); + } + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "User"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "User"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (!(val.language == void 0) && !sdIsString(val.language)) { + throw new BoxSdkError({ + message: 'Expecting string for "language" of type "User"', + }); + } const language: undefined | string = val.language == void 0 ? void 0 : val.language; + if (!(val.timezone == void 0) && !sdIsString(val.timezone)) { + throw new BoxSdkError({ + message: 'Expecting string for "timezone" of type "User"', + }); + } const timezone: undefined | string = val.timezone == void 0 ? void 0 : val.timezone; + if (!(val.space_amount == void 0) && !sdIsNumber(val.space_amount)) { + throw new BoxSdkError({ + message: 'Expecting number for "space_amount" of type "User"', + }); + } const spaceAmount: undefined | number = val.space_amount == void 0 ? void 0 : val.space_amount; + if (!(val.space_used == void 0) && !sdIsNumber(val.space_used)) { + throw new BoxSdkError({ + message: 'Expecting number for "space_used" of type "User"', + }); + } const spaceUsed: undefined | number = val.space_used == void 0 ? void 0 : val.space_used; + if (!(val.max_upload_size == void 0) && !sdIsNumber(val.max_upload_size)) { + throw new BoxSdkError({ + message: 'Expecting number for "max_upload_size" of type "User"', + }); + } const maxUploadSize: undefined | number = val.max_upload_size == void 0 ? void 0 : val.max_upload_size; const status: undefined | UserStatusField = val.status == void 0 ? void 0 : deserializeUserStatusField(val.status); + if (!(val.job_title == void 0) && !sdIsString(val.job_title)) { + throw new BoxSdkError({ + message: 'Expecting string for "job_title" of type "User"', + }); + } const jobTitle: undefined | string = val.job_title == void 0 ? void 0 : val.job_title; + if (!(val.phone == void 0) && !sdIsString(val.phone)) { + throw new BoxSdkError({ + message: 'Expecting string for "phone" of type "User"', + }); + } const phone: undefined | string = val.phone == void 0 ? void 0 : val.phone; + if (!(val.address == void 0) && !sdIsString(val.address)) { + throw new BoxSdkError({ + message: 'Expecting string for "address" of type "User"', + }); + } const address: undefined | string = val.address == void 0 ? void 0 : val.address; + if (!(val.avatar_url == void 0) && !sdIsString(val.avatar_url)) { + throw new BoxSdkError({ + message: 'Expecting string for "avatar_url" of type "User"', + }); + } const avatarUrl: undefined | string = val.avatar_url == void 0 ? void 0 : val.avatar_url; const notificationEmail: undefined | UserNotificationEmailField = val.notification_email == void 0 ? void 0 : deserializeUserNotificationEmailField(val.notification_email); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "User"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.login == void 0) && !sdIsString(val.login)) { + throw new BoxSdkError({ + message: 'Expecting string for "login" of type "User"', + }); + } const login: undefined | string = val.login == void 0 ? void 0 : val.login; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "User" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "User"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "User" to be defined', + }); + } const type: UserBaseTypeField = deserializeUserBaseTypeField(val.type); return { createdAt: createdAt, diff --git a/src/schemas/userAvatar.generated.ts b/src/schemas/userAvatar.generated.ts index 923c8f3f..872a0092 100644 --- a/src/schemas/userAvatar.generated.ts +++ b/src/schemas/userAvatar.generated.ts @@ -1,3 +1,4 @@ +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -23,10 +24,31 @@ export function serializeUserAvatarPicUrlsField( }; } export function deserializeUserAvatarPicUrlsField( - val: any + val: SerializedData ): UserAvatarPicUrlsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UserAvatarPicUrlsField"', + }); + } + if (!(val.small == void 0) && !sdIsString(val.small)) { + throw new BoxSdkError({ + message: 'Expecting string for "small" of type "UserAvatarPicUrlsField"', + }); + } const small: undefined | string = val.small == void 0 ? void 0 : val.small; + if (!(val.large == void 0) && !sdIsString(val.large)) { + throw new BoxSdkError({ + message: 'Expecting string for "large" of type "UserAvatarPicUrlsField"', + }); + } const large: undefined | string = val.large == void 0 ? void 0 : val.large; + if (!(val.preview == void 0) && !sdIsString(val.preview)) { + throw new BoxSdkError({ + message: + 'Expecting string for "preview" of type "UserAvatarPicUrlsField"', + }); + } const preview: undefined | string = val.preview == void 0 ? void 0 : val.preview; return { @@ -43,7 +65,10 @@ export function serializeUserAvatar(val: UserAvatar): SerializedData { : serializeUserAvatarPicUrlsField(val.picUrls), }; } -export function deserializeUserAvatar(val: any): UserAvatar { +export function deserializeUserAvatar(val: SerializedData): UserAvatar { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "UserAvatar"' }); + } const picUrls: undefined | UserAvatarPicUrlsField = val.pic_urls == void 0 ? void 0 diff --git a/src/schemas/userBase.generated.ts b/src/schemas/userBase.generated.ts index c932424b..c9b5d1b7 100644 --- a/src/schemas/userBase.generated.ts +++ b/src/schemas/userBase.generated.ts @@ -30,7 +30,9 @@ export function serializeUserBaseTypeField( ): SerializedData { return val; } -export function deserializeUserBaseTypeField(val: any): UserBaseTypeField { +export function deserializeUserBaseTypeField( + val: SerializedData +): UserBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "UserBaseTypeField"', @@ -46,8 +48,26 @@ export function deserializeUserBaseTypeField(val: any): UserBaseTypeField { export function serializeUserBase(val: UserBase): SerializedData { return { ['id']: val.id, ['type']: serializeUserBaseTypeField(val.type) }; } -export function deserializeUserBase(val: any): UserBase { +export function deserializeUserBase(val: SerializedData): UserBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "UserBase"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "UserBase" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "UserBase"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "UserBase" to be defined', + }); + } const type: UserBaseTypeField = deserializeUserBaseTypeField(val.type); return { id: id, type: type } satisfies UserBase; } @@ -58,7 +78,20 @@ export function serializeUserBaseInput(val: UserBaseInput): SerializedData { val.type == void 0 ? void 0 : serializeUserBaseTypeField(val.type), }; } -export function deserializeUserBaseInput(val: any): UserBaseInput { +export function deserializeUserBaseInput(val: SerializedData): UserBaseInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "UserBaseInput"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "UserBaseInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "UserBaseInput"', + }); + } const id: string = val.id; const type: undefined | UserBaseTypeField = val.type == void 0 ? void 0 : deserializeUserBaseTypeField(val.type); diff --git a/src/schemas/userCollaborations.generated.ts b/src/schemas/userCollaborations.generated.ts index 2b1d4e67..80a99b00 100644 --- a/src/schemas/userCollaborations.generated.ts +++ b/src/schemas/userCollaborations.generated.ts @@ -36,10 +36,42 @@ export function serializeUserCollaborations( }, }; } -export function deserializeUserCollaborations(val: any): UserCollaborations { +export function deserializeUserCollaborations( + val: SerializedData +): UserCollaborations { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UserCollaborations"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "UserCollaborations"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.login == void 0) && !sdIsString(val.login)) { + throw new BoxSdkError({ + message: 'Expecting string for "login" of type "UserCollaborations"', + }); + } const login: undefined | string = val.login == void 0 ? void 0 : val.login; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "UserCollaborations" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "UserCollaborations"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "UserCollaborations" to be defined', + }); + } const type: UserBaseTypeField = deserializeUserBaseTypeField(val.type); return { name: name, diff --git a/src/schemas/userFull.generated.ts b/src/schemas/userFull.generated.ts index d97dc448..f0505870 100644 --- a/src/schemas/userFull.generated.ts +++ b/src/schemas/userFull.generated.ts @@ -59,7 +59,9 @@ export function serializeUserFullRoleField( ): SerializedData { return val; } -export function deserializeUserFullRoleField(val: any): UserFullRoleField { +export function deserializeUserFullRoleField( + val: SerializedData +): UserFullRoleField { if (!sdIsString(val)) { throw new BoxSdkError({ message: 'Expecting a string for "UserFullRoleField"', @@ -84,7 +86,7 @@ export function serializeUserFullEnterpriseTypeField( return val; } export function deserializeUserFullEnterpriseTypeField( - val: any + val: SerializedData ): UserFullEnterpriseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -111,13 +113,28 @@ export function serializeUserFullEnterpriseField( }; } export function deserializeUserFullEnterpriseField( - val: any + val: SerializedData ): UserFullEnterpriseField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UserFullEnterpriseField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "UserFullEnterpriseField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | UserFullEnterpriseTypeField = val.type == void 0 ? void 0 : deserializeUserFullEnterpriseTypeField(val.type); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "UserFullEnterpriseField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; return { id: id, type: type, name: name } satisfies UserFullEnterpriseField; } @@ -173,9 +190,17 @@ export function serializeUserFull(val: UserFull): SerializedData { }, }; } -export function deserializeUserFull(val: any): UserFull { +export function deserializeUserFull(val: SerializedData): UserFull { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "UserFull"' }); + } const role: undefined | UserFullRoleField = val.role == void 0 ? void 0 : deserializeUserFullRoleField(val.role); + if (!(val.tracking_codes == void 0) && !sdIsList(val.tracking_codes)) { + throw new BoxSdkError({ + message: 'Expecting array for "tracking_codes" of type "UserFull"', + }); + } const trackingCodes: undefined | readonly TrackingCode[] = val.tracking_codes == void 0 ? void 0 @@ -184,18 +209,59 @@ export function deserializeUserFull(val: any): UserFull { return deserializeTrackingCode(itm); }) as readonly any[]) : []; + if ( + !(val.can_see_managed_users == void 0) && + !sdIsBoolean(val.can_see_managed_users) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_see_managed_users" of type "UserFull"', + }); + } const canSeeManagedUsers: undefined | boolean = val.can_see_managed_users == void 0 ? void 0 : val.can_see_managed_users; + if (!(val.is_sync_enabled == void 0) && !sdIsBoolean(val.is_sync_enabled)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "is_sync_enabled" of type "UserFull"', + }); + } const isSyncEnabled: undefined | boolean = val.is_sync_enabled == void 0 ? void 0 : val.is_sync_enabled; + if ( + !(val.is_external_collab_restricted == void 0) && + !sdIsBoolean(val.is_external_collab_restricted) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_external_collab_restricted" of type "UserFull"', + }); + } const isExternalCollabRestricted: undefined | boolean = val.is_external_collab_restricted == void 0 ? void 0 : val.is_external_collab_restricted; + if ( + !(val.is_exempt_from_device_limits == void 0) && + !sdIsBoolean(val.is_exempt_from_device_limits) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_exempt_from_device_limits" of type "UserFull"', + }); + } const isExemptFromDeviceLimits: undefined | boolean = val.is_exempt_from_device_limits == void 0 ? void 0 : val.is_exempt_from_device_limits; + if ( + !(val.is_exempt_from_login_verification == void 0) && + !sdIsBoolean(val.is_exempt_from_login_verification) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_exempt_from_login_verification" of type "UserFull"', + }); + } const isExemptFromLoginVerification: undefined | boolean = val.is_exempt_from_login_verification == void 0 ? void 0 @@ -204,46 +270,164 @@ export function deserializeUserFull(val: any): UserFull { val.enterprise == void 0 ? void 0 : deserializeUserFullEnterpriseField(val.enterprise); + if (!(val.my_tags == void 0) && !sdIsList(val.my_tags)) { + throw new BoxSdkError({ + message: 'Expecting array for "my_tags" of type "UserFull"', + }); + } const myTags: undefined | readonly string[] = - val.my_tags == void 0 ? void 0 : sdIsList(val.my_tags) ? val.my_tags : []; + val.my_tags == void 0 + ? void 0 + : sdIsList(val.my_tags) + ? (val.my_tags.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: 'Expecting string for "UserFull"', + }); + } + return itm; + }) as readonly any[]) + : []; + if (!(val.hostname == void 0) && !sdIsString(val.hostname)) { + throw new BoxSdkError({ + message: 'Expecting string for "hostname" of type "UserFull"', + }); + } const hostname: undefined | string = val.hostname == void 0 ? void 0 : val.hostname; + if ( + !(val.is_platform_access_only == void 0) && + !sdIsBoolean(val.is_platform_access_only) + ) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_platform_access_only" of type "UserFull"', + }); + } const isPlatformAccessOnly: undefined | boolean = val.is_platform_access_only == void 0 ? void 0 : val.is_platform_access_only; + if ( + !(val.external_app_user_id == void 0) && + !sdIsString(val.external_app_user_id) + ) { + throw new BoxSdkError({ + message: 'Expecting string for "external_app_user_id" of type "UserFull"', + }); + } const externalAppUserId: undefined | string = val.external_app_user_id == void 0 ? void 0 : val.external_app_user_id; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "UserFull"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "UserFull"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (!(val.language == void 0) && !sdIsString(val.language)) { + throw new BoxSdkError({ + message: 'Expecting string for "language" of type "UserFull"', + }); + } const language: undefined | string = val.language == void 0 ? void 0 : val.language; + if (!(val.timezone == void 0) && !sdIsString(val.timezone)) { + throw new BoxSdkError({ + message: 'Expecting string for "timezone" of type "UserFull"', + }); + } const timezone: undefined | string = val.timezone == void 0 ? void 0 : val.timezone; + if (!(val.space_amount == void 0) && !sdIsNumber(val.space_amount)) { + throw new BoxSdkError({ + message: 'Expecting number for "space_amount" of type "UserFull"', + }); + } const spaceAmount: undefined | number = val.space_amount == void 0 ? void 0 : val.space_amount; + if (!(val.space_used == void 0) && !sdIsNumber(val.space_used)) { + throw new BoxSdkError({ + message: 'Expecting number for "space_used" of type "UserFull"', + }); + } const spaceUsed: undefined | number = val.space_used == void 0 ? void 0 : val.space_used; + if (!(val.max_upload_size == void 0) && !sdIsNumber(val.max_upload_size)) { + throw new BoxSdkError({ + message: 'Expecting number for "max_upload_size" of type "UserFull"', + }); + } const maxUploadSize: undefined | number = val.max_upload_size == void 0 ? void 0 : val.max_upload_size; const status: undefined | UserStatusField = val.status == void 0 ? void 0 : deserializeUserStatusField(val.status); + if (!(val.job_title == void 0) && !sdIsString(val.job_title)) { + throw new BoxSdkError({ + message: 'Expecting string for "job_title" of type "UserFull"', + }); + } const jobTitle: undefined | string = val.job_title == void 0 ? void 0 : val.job_title; + if (!(val.phone == void 0) && !sdIsString(val.phone)) { + throw new BoxSdkError({ + message: 'Expecting string for "phone" of type "UserFull"', + }); + } const phone: undefined | string = val.phone == void 0 ? void 0 : val.phone; + if (!(val.address == void 0) && !sdIsString(val.address)) { + throw new BoxSdkError({ + message: 'Expecting string for "address" of type "UserFull"', + }); + } const address: undefined | string = val.address == void 0 ? void 0 : val.address; + if (!(val.avatar_url == void 0) && !sdIsString(val.avatar_url)) { + throw new BoxSdkError({ + message: 'Expecting string for "avatar_url" of type "UserFull"', + }); + } const avatarUrl: undefined | string = val.avatar_url == void 0 ? void 0 : val.avatar_url; const notificationEmail: undefined | UserNotificationEmailField = val.notification_email == void 0 ? void 0 : deserializeUserNotificationEmailField(val.notification_email); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "UserFull"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.login == void 0) && !sdIsString(val.login)) { + throw new BoxSdkError({ + message: 'Expecting string for "login" of type "UserFull"', + }); + } const login: undefined | string = val.login == void 0 ? void 0 : val.login; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "UserFull" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "UserFull"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "UserFull" to be defined', + }); + } const type: UserBaseTypeField = deserializeUserBaseTypeField(val.type); return { role: role, diff --git a/src/schemas/userIntegrationMappings.generated.ts b/src/schemas/userIntegrationMappings.generated.ts index c5f4af55..d8a2d165 100644 --- a/src/schemas/userIntegrationMappings.generated.ts +++ b/src/schemas/userIntegrationMappings.generated.ts @@ -37,11 +37,42 @@ export function serializeUserIntegrationMappings( }; } export function deserializeUserIntegrationMappings( - val: any + val: SerializedData ): UserIntegrationMappings { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "UserIntegrationMappings"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "UserIntegrationMappings"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.login == void 0) && !sdIsString(val.login)) { + throw new BoxSdkError({ + message: 'Expecting string for "login" of type "UserIntegrationMappings"', + }); + } const login: undefined | string = val.login == void 0 ? void 0 : val.login; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "UserIntegrationMappings" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "UserIntegrationMappings"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "UserIntegrationMappings" to be defined', + }); + } const type: UserBaseTypeField = deserializeUserBaseTypeField(val.type); return { name: name, diff --git a/src/schemas/userMini.generated.ts b/src/schemas/userMini.generated.ts index 690390b6..da26c571 100644 --- a/src/schemas/userMini.generated.ts +++ b/src/schemas/userMini.generated.ts @@ -32,10 +32,38 @@ export function serializeUserMini(val: UserMini): SerializedData { }, }; } -export function deserializeUserMini(val: any): UserMini { +export function deserializeUserMini(val: SerializedData): UserMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "UserMini"' }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "UserMini"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.login == void 0) && !sdIsString(val.login)) { + throw new BoxSdkError({ + message: 'Expecting string for "login" of type "UserMini"', + }); + } const login: undefined | string = val.login == void 0 ? void 0 : val.login; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "UserMini" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "UserMini"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "UserMini" to be defined', + }); + } const type: UserBaseTypeField = deserializeUserBaseTypeField(val.type); return { name: name, login: login, id: id, type: type } satisfies UserMini; } diff --git a/src/schemas/users.generated.ts b/src/schemas/users.generated.ts index e93f3ab7..48f001cb 100644 --- a/src/schemas/users.generated.ts +++ b/src/schemas/users.generated.ts @@ -27,7 +27,7 @@ export function serializeUsersOrderDirectionField( return val; } export function deserializeUsersOrderDirectionField( - val: any + val: SerializedData ): UsersOrderDirectionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -53,7 +53,17 @@ export function serializeUsersOrderField(val: UsersOrderField): SerializedData { : serializeUsersOrderDirectionField(val.direction), }; } -export function deserializeUsersOrderField(val: any): UsersOrderField { +export function deserializeUsersOrderField( + val: SerializedData +): UsersOrderField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "UsersOrderField"' }); + } + if (!(val.by == void 0) && !sdIsString(val.by)) { + throw new BoxSdkError({ + message: 'Expecting string for "by" of type "UsersOrderField"', + }); + } const by: undefined | string = val.by == void 0 ? void 0 : val.by; const direction: undefined | UsersOrderDirectionField = val.direction == void 0 @@ -80,11 +90,34 @@ export function serializeUsers(val: Users): SerializedData { }) as readonly any[]), }; } -export function deserializeUsers(val: any): Users { +export function deserializeUsers(val: SerializedData): Users { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Users"' }); + } + if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: 'Expecting number for "total_count" of type "Users"', + }); + } const totalCount: undefined | number = val.total_count == void 0 ? void 0 : val.total_count; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "Users"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.offset == void 0) && !sdIsNumber(val.offset)) { + throw new BoxSdkError({ + message: 'Expecting number for "offset" of type "Users"', + }); + } const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset; + if (!(val.order == void 0) && !sdIsList(val.order)) { + throw new BoxSdkError({ + message: 'Expecting array for "order" of type "Users"', + }); + } const order: undefined | readonly UsersOrderField[] = val.order == void 0 ? void 0 @@ -93,6 +126,11 @@ export function deserializeUsers(val: any): Users { return deserializeUsersOrderField(itm); }) as readonly any[]) : []; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "Users"', + }); + } const entries: undefined | readonly UserFull[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/watermark.generated.ts b/src/schemas/watermark.generated.ts index dd969fae..5c0221a0 100644 --- a/src/schemas/watermark.generated.ts +++ b/src/schemas/watermark.generated.ts @@ -1,6 +1,7 @@ import { serializeDateTime } from '../internal/utils.js'; import { deserializeDateTime } from '../internal/utils.js'; import { DateTime } from '../internal/utils.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -26,10 +27,27 @@ export function serializeWatermarkWatermarkField( }; } export function deserializeWatermarkWatermarkField( - val: any + val: SerializedData ): WatermarkWatermarkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "WatermarkWatermarkField"', + }); + } + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "WatermarkWatermarkField"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "modified_at" of type "WatermarkWatermarkField"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); return { @@ -45,7 +63,10 @@ export function serializeWatermark(val: Watermark): SerializedData { : serializeWatermarkWatermarkField(val.watermark), }; } -export function deserializeWatermark(val: any): Watermark { +export function deserializeWatermark(val: SerializedData): Watermark { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Watermark"' }); + } const watermark: undefined | WatermarkWatermarkField = val.watermark == void 0 ? void 0 diff --git a/src/schemas/webLink.generated.ts b/src/schemas/webLink.generated.ts index 3f7a6202..97b64864 100644 --- a/src/schemas/webLink.generated.ts +++ b/src/schemas/webLink.generated.ts @@ -86,9 +86,38 @@ export function serializeWebLinkPathCollectionField( }; } export function deserializeWebLinkPathCollectionField( - val: any + val: SerializedData ): WebLinkPathCollectionField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "WebLinkPathCollectionField"', + }); + } + if (val.total_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "total_count" of type "WebLinkPathCollectionField" to be defined', + }); + } + if (!sdIsNumber(val.total_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "total_count" of type "WebLinkPathCollectionField"', + }); + } const totalCount: number = val.total_count; + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "WebLinkPathCollectionField" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "WebLinkPathCollectionField"', + }); + } const entries: readonly FolderMini[] = sdIsList(val.entries) ? (val.entries.map(function (itm: SerializedData): FolderMini { return deserializeFolderMini(itm); @@ -105,7 +134,7 @@ export function serializeWebLinkSharedLinkAccessField( return val; } export function deserializeWebLinkSharedLinkAccessField( - val: any + val: SerializedData ): WebLinkSharedLinkAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -131,7 +160,7 @@ export function serializeWebLinkSharedLinkEffectiveAccessField( return val; } export function deserializeWebLinkSharedLinkEffectiveAccessField( - val: any + val: SerializedData ): WebLinkSharedLinkEffectiveAccessField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -157,7 +186,7 @@ export function serializeWebLinkSharedLinkEffectivePermissionField( return val; } export function deserializeWebLinkSharedLinkEffectivePermissionField( - val: any + val: SerializedData ): WebLinkSharedLinkEffectivePermissionField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -191,10 +220,51 @@ export function serializeWebLinkSharedLinkPermissionsField( }; } export function deserializeWebLinkSharedLinkPermissionsField( - val: any + val: SerializedData ): WebLinkSharedLinkPermissionsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "WebLinkSharedLinkPermissionsField"', + }); + } + if (val.can_download == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_download" of type "WebLinkSharedLinkPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_download)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_download" of type "WebLinkSharedLinkPermissionsField"', + }); + } const canDownload: boolean = val.can_download; + if (val.can_preview == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_preview" of type "WebLinkSharedLinkPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_preview)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_preview" of type "WebLinkSharedLinkPermissionsField"', + }); + } const canPreview: boolean = val.can_preview; + if (val.can_edit == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "can_edit" of type "WebLinkSharedLinkPermissionsField" to be defined', + }); + } + if (!sdIsBoolean(val.can_edit)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "can_edit" of type "WebLinkSharedLinkPermissionsField"', + }); + } const canEdit: boolean = val.can_edit; return { canDownload: canDownload, @@ -233,33 +303,120 @@ export function serializeWebLinkSharedLinkField( }; } export function deserializeWebLinkSharedLinkField( - val: any + val: SerializedData ): WebLinkSharedLinkField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "WebLinkSharedLinkField"', + }); + } + if (val.url == void 0) { + throw new BoxSdkError({ + message: 'Expecting "url" of type "WebLinkSharedLinkField" to be defined', + }); + } + if (!sdIsString(val.url)) { + throw new BoxSdkError({ + message: 'Expecting string for "url" of type "WebLinkSharedLinkField"', + }); + } const url: string = val.url; + if (!(val.download_url == void 0) && !sdIsString(val.download_url)) { + throw new BoxSdkError({ + message: + 'Expecting string for "download_url" of type "WebLinkSharedLinkField"', + }); + } const downloadUrl: undefined | string = val.download_url == void 0 ? void 0 : val.download_url; + if (!(val.vanity_url == void 0) && !sdIsString(val.vanity_url)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_url" of type "WebLinkSharedLinkField"', + }); + } const vanityUrl: undefined | string = val.vanity_url == void 0 ? void 0 : val.vanity_url; + if (!(val.vanity_name == void 0) && !sdIsString(val.vanity_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "vanity_name" of type "WebLinkSharedLinkField"', + }); + } const vanityName: undefined | string = val.vanity_name == void 0 ? void 0 : val.vanity_name; const access: undefined | WebLinkSharedLinkAccessField = val.access == void 0 ? void 0 : deserializeWebLinkSharedLinkAccessField(val.access); + if (val.effective_access == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "effective_access" of type "WebLinkSharedLinkField" to be defined', + }); + } const effectiveAccess: WebLinkSharedLinkEffectiveAccessField = deserializeWebLinkSharedLinkEffectiveAccessField(val.effective_access); + if (val.effective_permission == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "effective_permission" of type "WebLinkSharedLinkField" to be defined', + }); + } const effectivePermission: WebLinkSharedLinkEffectivePermissionField = deserializeWebLinkSharedLinkEffectivePermissionField( val.effective_permission ); + if (!(val.unshared_at == void 0) && !sdIsString(val.unshared_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "unshared_at" of type "WebLinkSharedLinkField"', + }); + } const unsharedAt: undefined | DateTime = val.unshared_at == void 0 ? void 0 : deserializeDateTime(val.unshared_at); + if (val.is_password_enabled == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "is_password_enabled" of type "WebLinkSharedLinkField" to be defined', + }); + } + if (!sdIsBoolean(val.is_password_enabled)) { + throw new BoxSdkError({ + message: + 'Expecting boolean for "is_password_enabled" of type "WebLinkSharedLinkField"', + }); + } const isPasswordEnabled: boolean = val.is_password_enabled; const permissions: undefined | WebLinkSharedLinkPermissionsField = val.permissions == void 0 ? void 0 : deserializeWebLinkSharedLinkPermissionsField(val.permissions); + if (val.download_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "download_count" of type "WebLinkSharedLinkField" to be defined', + }); + } + if (!sdIsNumber(val.download_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "download_count" of type "WebLinkSharedLinkField"', + }); + } const downloadCount: number = val.download_count; + if (val.preview_count == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "preview_count" of type "WebLinkSharedLinkField" to be defined', + }); + } + if (!sdIsNumber(val.preview_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "preview_count" of type "WebLinkSharedLinkField"', + }); + } const previewCount: number = val.preview_count; return { url: url, @@ -282,7 +439,7 @@ export function serializeWebLinkItemStatusField( return val; } export function deserializeWebLinkItemStatusField( - val: any + val: SerializedData ): WebLinkItemStatusField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -342,21 +499,49 @@ export function serializeWebLink(val: WebLink): SerializedData { }, }; } -export function deserializeWebLink(val: any): WebLink { +export function deserializeWebLink(val: SerializedData): WebLink { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "WebLink"' }); + } const parent: undefined | FolderMini = val.parent == void 0 ? void 0 : deserializeFolderMini(val.parent); + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "WebLink"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; const pathCollection: undefined | WebLinkPathCollectionField = val.path_collection == void 0 ? void 0 : deserializeWebLinkPathCollectionField(val.path_collection); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "WebLink"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "WebLink"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); + if (!(val.trashed_at == void 0) && !sdIsString(val.trashed_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "trashed_at" of type "WebLink"', + }); + } const trashedAt: undefined | DateTime = val.trashed_at == void 0 ? void 0 : deserializeDateTime(val.trashed_at); + if (!(val.purged_at == void 0) && !sdIsString(val.purged_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "purged_at" of type "WebLink"', + }); + } const purgedAt: undefined | DateTime = val.purged_at == void 0 ? void 0 : deserializeDateTime(val.purged_at); const createdBy: undefined | UserMini = @@ -373,12 +558,47 @@ export function deserializeWebLink(val: any): WebLink { val.item_status == void 0 ? void 0 : deserializeWebLinkItemStatusField(val.item_status); + if (!(val.url == void 0) && !sdIsString(val.url)) { + throw new BoxSdkError({ + message: 'Expecting string for "url" of type "WebLink"', + }); + } const url: undefined | string = val.url == void 0 ? void 0 : val.url; + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "WebLink"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "WebLink"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "WebLink" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "WebLink"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "WebLink" to be defined', + }); + } const type: WebLinkBaseTypeField = deserializeWebLinkBaseTypeField(val.type); + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "WebLink"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; return { parent: parent, diff --git a/src/schemas/webLinkBase.generated.ts b/src/schemas/webLinkBase.generated.ts index 3c5c7035..5ef591a3 100644 --- a/src/schemas/webLinkBase.generated.ts +++ b/src/schemas/webLinkBase.generated.ts @@ -36,7 +36,7 @@ export function serializeWebLinkBaseTypeField( return val; } export function deserializeWebLinkBaseTypeField( - val: any + val: SerializedData ): WebLinkBaseTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -57,9 +57,32 @@ export function serializeWebLinkBase(val: WebLinkBase): SerializedData { ['etag']: val.etag == void 0 ? void 0 : val.etag, }; } -export function deserializeWebLinkBase(val: any): WebLinkBase { +export function deserializeWebLinkBase(val: SerializedData): WebLinkBase { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "WebLinkBase"' }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "WebLinkBase" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "WebLinkBase"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "WebLinkBase" to be defined', + }); + } const type: WebLinkBaseTypeField = deserializeWebLinkBaseTypeField(val.type); + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "WebLinkBase"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; return { id: id, type: type, etag: etag } satisfies WebLinkBase; } @@ -73,10 +96,32 @@ export function serializeWebLinkBaseInput( ['etag']: val.etag == void 0 ? void 0 : val.etag, }; } -export function deserializeWebLinkBaseInput(val: any): WebLinkBaseInput { +export function deserializeWebLinkBaseInput( + val: SerializedData +): WebLinkBaseInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "WebLinkBaseInput"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "WebLinkBaseInput" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "WebLinkBaseInput"', + }); + } const id: string = val.id; const type: undefined | WebLinkBaseTypeField = val.type == void 0 ? void 0 : deserializeWebLinkBaseTypeField(val.type); + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "WebLinkBaseInput"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; return { id: id, type: type, etag: etag } satisfies WebLinkBaseInput; } diff --git a/src/schemas/webLinkMini.generated.ts b/src/schemas/webLinkMini.generated.ts index 6a86dadb..d3907d67 100644 --- a/src/schemas/webLinkMini.generated.ts +++ b/src/schemas/webLinkMini.generated.ts @@ -34,13 +34,51 @@ export function serializeWebLinkMini(val: WebLinkMini): SerializedData { }, }; } -export function deserializeWebLinkMini(val: any): WebLinkMini { +export function deserializeWebLinkMini(val: SerializedData): WebLinkMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "WebLinkMini"' }); + } + if (!(val.url == void 0) && !sdIsString(val.url)) { + throw new BoxSdkError({ + message: 'Expecting string for "url" of type "WebLinkMini"', + }); + } const url: undefined | string = val.url == void 0 ? void 0 : val.url; + if (!(val.sequence_id == void 0) && !sdIsString(val.sequence_id)) { + throw new BoxSdkError({ + message: 'Expecting string for "sequence_id" of type "WebLinkMini"', + }); + } const sequenceId: undefined | string = val.sequence_id == void 0 ? void 0 : val.sequence_id; + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "WebLinkMini"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "WebLinkMini" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "WebLinkMini"', + }); + } const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "WebLinkMini" to be defined', + }); + } const type: WebLinkBaseTypeField = deserializeWebLinkBaseTypeField(val.type); + if (!(val.etag == void 0) && !sdIsString(val.etag)) { + throw new BoxSdkError({ + message: 'Expecting string for "etag" of type "WebLinkMini"', + }); + } const etag: undefined | string = val.etag == void 0 ? void 0 : val.etag; return { url: url, diff --git a/src/schemas/webhook.generated.ts b/src/schemas/webhook.generated.ts index 32a39907..9e42aa5e 100644 --- a/src/schemas/webhook.generated.ts +++ b/src/schemas/webhook.generated.ts @@ -74,7 +74,7 @@ export function serializeWebhookTriggersField( return val; } export function deserializeWebhookTriggersField( - val: any + val: SerializedData ): WebhookTriggersField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -229,13 +229,31 @@ export function serializeWebhook(val: Webhook): SerializedData { }, }; } -export function deserializeWebhook(val: any): Webhook { +export function deserializeWebhook(val: SerializedData): Webhook { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Webhook"' }); + } const createdBy: undefined | UserMini = val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "Webhook"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.address == void 0) && !sdIsString(val.address)) { + throw new BoxSdkError({ + message: 'Expecting string for "address" of type "Webhook"', + }); + } const address: undefined | string = val.address == void 0 ? void 0 : val.address; + if (!(val.triggers == void 0) && !sdIsList(val.triggers)) { + throw new BoxSdkError({ + message: 'Expecting array for "triggers" of type "Webhook"', + }); + } const triggers: undefined | readonly WebhookTriggersField[] = val.triggers == void 0 ? void 0 @@ -244,6 +262,11 @@ export function deserializeWebhook(val: any): Webhook { return deserializeWebhookTriggersField(itm); }) as readonly any[]) : []; + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "Webhook"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | WebhookMiniTypeField = val.type == void 0 ? void 0 : deserializeWebhookMiniTypeField(val.type); diff --git a/src/schemas/webhookInvocation.generated.ts b/src/schemas/webhookInvocation.generated.ts index e2c241a0..c9f1f32c 100644 --- a/src/schemas/webhookInvocation.generated.ts +++ b/src/schemas/webhookInvocation.generated.ts @@ -75,7 +75,7 @@ export function serializeWebhookInvocationTypeField( return val; } export function deserializeWebhookInvocationTypeField( - val: any + val: SerializedData ): WebhookInvocationTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -95,7 +95,7 @@ export function serializeWebhookInvocationTriggerField( return val; } export function deserializeWebhookInvocationTriggerField( - val: any + val: SerializedData ): WebhookInvocationTriggerField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -248,7 +248,19 @@ export function serializeWebhookInvocation( val.source == void 0 ? void 0 : serializeFileOrFolder(val.source), }; } -export function deserializeWebhookInvocation(val: any): WebhookInvocation { +export function deserializeWebhookInvocation( + val: SerializedData +): WebhookInvocation { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "WebhookInvocation"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "WebhookInvocation"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | WebhookInvocationTypeField = val.type == void 0 @@ -258,6 +270,11 @@ export function deserializeWebhookInvocation(val: any): WebhookInvocation { val.webhook == void 0 ? void 0 : deserializeWebhook(val.webhook); const createdBy: undefined | UserMini = val.created_by == void 0 ? void 0 : deserializeUserMini(val.created_by); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "WebhookInvocation"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); const trigger: undefined | WebhookInvocationTriggerField = diff --git a/src/schemas/webhookMini.generated.ts b/src/schemas/webhookMini.generated.ts index 587708db..65c1486e 100644 --- a/src/schemas/webhookMini.generated.ts +++ b/src/schemas/webhookMini.generated.ts @@ -23,7 +23,7 @@ export function serializeWebhookMiniTypeField( return val; } export function deserializeWebhookMiniTypeField( - val: any + val: SerializedData ): WebhookMiniTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -43,7 +43,7 @@ export function serializeWebhookMiniTargetTypeField( return val; } export function deserializeWebhookMiniTargetTypeField( - val: any + val: SerializedData ): WebhookMiniTargetTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -72,8 +72,18 @@ export function serializeWebhookMiniTargetField( }; } export function deserializeWebhookMiniTargetField( - val: any + val: SerializedData ): WebhookMiniTargetField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "WebhookMiniTargetField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "WebhookMiniTargetField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | WebhookMiniTargetTypeField = val.type == void 0 @@ -92,7 +102,15 @@ export function serializeWebhookMini(val: WebhookMini): SerializedData { : serializeWebhookMiniTargetField(val.target), }; } -export function deserializeWebhookMini(val: any): WebhookMini { +export function deserializeWebhookMini(val: SerializedData): WebhookMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "WebhookMini"' }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "WebhookMini"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | WebhookMiniTypeField = val.type == void 0 ? void 0 : deserializeWebhookMiniTypeField(val.type); diff --git a/src/schemas/webhooks.generated.ts b/src/schemas/webhooks.generated.ts index a9b4e3ca..c7908b4c 100644 --- a/src/schemas/webhooks.generated.ts +++ b/src/schemas/webhooks.generated.ts @@ -1,6 +1,7 @@ import { serializeWebhookMini } from './webhookMini.generated.js'; import { deserializeWebhookMini } from './webhookMini.generated.js'; import { WebhookMini } from './webhookMini.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -27,12 +28,35 @@ export function serializeWebhooks(val: Webhooks): SerializedData { }) as readonly any[]), }; } -export function deserializeWebhooks(val: any): Webhooks { +export function deserializeWebhooks(val: SerializedData): Webhooks { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Webhooks"' }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "Webhooks"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "next_marker" of type "Webhooks"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "prev_marker" of type "Webhooks"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "Webhooks"', + }); + } const entries: undefined | readonly WebhookMini[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/workflow.generated.ts b/src/schemas/workflow.generated.ts index 37366de0..7cf884eb 100644 --- a/src/schemas/workflow.generated.ts +++ b/src/schemas/workflow.generated.ts @@ -117,7 +117,7 @@ export function serializeWorkflowFlowsTypeField( return val; } export function deserializeWorkflowFlowsTypeField( - val: any + val: SerializedData ): WorkflowFlowsTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -137,7 +137,7 @@ export function serializeWorkflowFlowsTriggerTypeField( return val; } export function deserializeWorkflowFlowsTriggerTypeField( - val: any + val: SerializedData ): WorkflowFlowsTriggerTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -157,7 +157,7 @@ export function serializeWorkflowFlowsTriggerTriggerTypeField( return val; } export function deserializeWorkflowFlowsTriggerTriggerTypeField( - val: any + val: SerializedData ): WorkflowFlowsTriggerTriggerTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -177,7 +177,7 @@ export function serializeWorkflowFlowsTriggerScopeTypeField( return val; } export function deserializeWorkflowFlowsTriggerScopeTypeField( - val: any + val: SerializedData ): WorkflowFlowsTriggerScopeTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -197,7 +197,7 @@ export function serializeWorkflowFlowsTriggerScopeObjectTypeField( return val; } export function deserializeWorkflowFlowsTriggerScopeObjectTypeField( - val: any + val: SerializedData ): WorkflowFlowsTriggerScopeObjectTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -224,12 +224,23 @@ export function serializeWorkflowFlowsTriggerScopeObjectField( }; } export function deserializeWorkflowFlowsTriggerScopeObjectField( - val: any + val: SerializedData ): WorkflowFlowsTriggerScopeObjectField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "WorkflowFlowsTriggerScopeObjectField"', + }); + } const type: undefined | WorkflowFlowsTriggerScopeObjectTypeField = val.type == void 0 ? void 0 : deserializeWorkflowFlowsTriggerScopeObjectTypeField(val.type); + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "WorkflowFlowsTriggerScopeObjectField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; return { type: type, id: id } satisfies WorkflowFlowsTriggerScopeObjectField; } @@ -249,12 +260,23 @@ export function serializeWorkflowFlowsTriggerScopeField( }; } export function deserializeWorkflowFlowsTriggerScopeField( - val: any + val: SerializedData ): WorkflowFlowsTriggerScopeField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "WorkflowFlowsTriggerScopeField"', + }); + } const type: undefined | WorkflowFlowsTriggerScopeTypeField = val.type == void 0 ? void 0 : deserializeWorkflowFlowsTriggerScopeTypeField(val.type); + if (!(val.ref == void 0) && !sdIsString(val.ref)) { + throw new BoxSdkError({ + message: + 'Expecting string for "ref" of type "WorkflowFlowsTriggerScopeField"', + }); + } const ref: undefined | string = val.ref == void 0 ? void 0 : val.ref; const object: undefined | WorkflowFlowsTriggerScopeObjectField = val.object == void 0 @@ -289,8 +311,13 @@ export function serializeWorkflowFlowsTriggerField( }; } export function deserializeWorkflowFlowsTriggerField( - val: any + val: SerializedData ): WorkflowFlowsTriggerField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "WorkflowFlowsTriggerField"', + }); + } const type: undefined | WorkflowFlowsTriggerTypeField = val.type == void 0 ? void 0 @@ -299,6 +326,12 @@ export function deserializeWorkflowFlowsTriggerField( val.trigger_type == void 0 ? void 0 : deserializeWorkflowFlowsTriggerTriggerTypeField(val.trigger_type); + if (!(val.scope == void 0) && !sdIsList(val.scope)) { + throw new BoxSdkError({ + message: + 'Expecting array for "scope" of type "WorkflowFlowsTriggerField"', + }); + } const scope: undefined | readonly WorkflowFlowsTriggerScopeField[] = val.scope == void 0 ? void 0 @@ -321,7 +354,7 @@ export function serializeWorkflowFlowsOutcomesTypeField( return val; } export function deserializeWorkflowFlowsOutcomesTypeField( - val: any + val: SerializedData ): WorkflowFlowsOutcomesTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -341,7 +374,7 @@ export function serializeWorkflowFlowsOutcomesActionTypeField( return val; } export function deserializeWorkflowFlowsOutcomesActionTypeField( - val: any + val: SerializedData ): WorkflowFlowsOutcomesActionTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -427,7 +460,7 @@ export function serializeWorkflowFlowsOutcomesIfRejectedTypeField( return val; } export function deserializeWorkflowFlowsOutcomesIfRejectedTypeField( - val: any + val: SerializedData ): WorkflowFlowsOutcomesIfRejectedTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -448,7 +481,7 @@ export function serializeWorkflowFlowsOutcomesIfRejectedActionTypeField( return val; } export function deserializeWorkflowFlowsOutcomesIfRejectedActionTypeField( - val: any + val: SerializedData ): WorkflowFlowsOutcomesIfRejectedActionTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -548,13 +581,30 @@ export function serializeWorkflowFlowsOutcomesIfRejectedField( }; } export function deserializeWorkflowFlowsOutcomesIfRejectedField( - val: any + val: SerializedData ): WorkflowFlowsOutcomesIfRejectedField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "WorkflowFlowsOutcomesIfRejectedField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "WorkflowFlowsOutcomesIfRejectedField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | WorkflowFlowsOutcomesIfRejectedTypeField = val.type == void 0 ? void 0 : deserializeWorkflowFlowsOutcomesIfRejectedTypeField(val.type); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "WorkflowFlowsOutcomesIfRejectedField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; const actionType: undefined | WorkflowFlowsOutcomesIfRejectedActionTypeField = val.action_type == void 0 @@ -594,18 +644,40 @@ export function serializeWorkflowFlowsOutcomesField( }; } export function deserializeWorkflowFlowsOutcomesField( - val: any + val: SerializedData ): WorkflowFlowsOutcomesField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "WorkflowFlowsOutcomesField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "WorkflowFlowsOutcomesField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | WorkflowFlowsOutcomesTypeField = val.type == void 0 ? void 0 : deserializeWorkflowFlowsOutcomesTypeField(val.type); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "WorkflowFlowsOutcomesField"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; const actionType: undefined | WorkflowFlowsOutcomesActionTypeField = val.action_type == void 0 ? void 0 : deserializeWorkflowFlowsOutcomesActionTypeField(val.action_type); + if (!(val.if_rejected == void 0) && !sdIsList(val.if_rejected)) { + throw new BoxSdkError({ + message: + 'Expecting array for "if_rejected" of type "WorkflowFlowsOutcomesField"', + }); + } const ifRejected: | undefined | readonly WorkflowFlowsOutcomesIfRejectedField[] = @@ -651,7 +723,19 @@ export function serializeWorkflowFlowsField( val.createdBy == void 0 ? void 0 : serializeUserBase(val.createdBy), }; } -export function deserializeWorkflowFlowsField(val: any): WorkflowFlowsField { +export function deserializeWorkflowFlowsField( + val: SerializedData +): WorkflowFlowsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "WorkflowFlowsField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "WorkflowFlowsField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | WorkflowFlowsTypeField = val.type == void 0 ? void 0 : deserializeWorkflowFlowsTypeField(val.type); @@ -659,6 +743,11 @@ export function deserializeWorkflowFlowsField(val: any): WorkflowFlowsField { val.trigger == void 0 ? void 0 : deserializeWorkflowFlowsTriggerField(val.trigger); + if (!(val.outcomes == void 0) && !sdIsList(val.outcomes)) { + throw new BoxSdkError({ + message: 'Expecting array for "outcomes" of type "WorkflowFlowsField"', + }); + } const outcomes: undefined | readonly WorkflowFlowsOutcomesField[] = val.outcomes == void 0 ? void 0 @@ -669,6 +758,11 @@ export function deserializeWorkflowFlowsField(val: any): WorkflowFlowsField { return deserializeWorkflowFlowsOutcomesField(itm); }) as readonly any[]) : []; + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "WorkflowFlowsField"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); const createdBy: undefined | UserBase = @@ -699,7 +793,15 @@ export function serializeWorkflow(val: Workflow): SerializedData { }, }; } -export function deserializeWorkflow(val: any): Workflow { +export function deserializeWorkflow(val: SerializedData): Workflow { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Workflow"' }); + } + if (!(val.flows == void 0) && !sdIsList(val.flows)) { + throw new BoxSdkError({ + message: 'Expecting array for "flows" of type "Workflow"', + }); + } const flows: undefined | readonly WorkflowFlowsField[] = val.flows == void 0 ? void 0 @@ -708,12 +810,32 @@ export function deserializeWorkflow(val: any): Workflow { return deserializeWorkflowFlowsField(itm); }) as readonly any[]) : []; + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "Workflow"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | WorkflowMiniTypeField = val.type == void 0 ? void 0 : deserializeWorkflowMiniTypeField(val.type); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "Workflow"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "Workflow"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if (!(val.is_enabled == void 0) && !sdIsBoolean(val.is_enabled)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "is_enabled" of type "Workflow"', + }); + } const isEnabled: undefined | boolean = val.is_enabled == void 0 ? void 0 : val.is_enabled; return { diff --git a/src/schemas/workflowFull.generated.ts b/src/schemas/workflowFull.generated.ts index 8fb3688a..dfb40d0e 100644 --- a/src/schemas/workflowFull.generated.ts +++ b/src/schemas/workflowFull.generated.ts @@ -49,15 +49,33 @@ export function serializeWorkflowFull(val: WorkflowFull): SerializedData { }, }; } -export function deserializeWorkflowFull(val: any): WorkflowFull { +export function deserializeWorkflowFull(val: SerializedData): WorkflowFull { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "WorkflowFull"' }); + } + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "created_at" of type "WorkflowFull"', + }); + } const createdAt: undefined | DateTime = val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + if (!(val.modified_at == void 0) && !sdIsString(val.modified_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "modified_at" of type "WorkflowFull"', + }); + } const modifiedAt: undefined | DateTime = val.modified_at == void 0 ? void 0 : deserializeDateTime(val.modified_at); const createdBy: undefined | UserBase = val.created_by == void 0 ? void 0 : deserializeUserBase(val.created_by); const modifiedBy: undefined | UserBase = val.modified_by == void 0 ? void 0 : deserializeUserBase(val.modified_by); + if (!(val.flows == void 0) && !sdIsList(val.flows)) { + throw new BoxSdkError({ + message: 'Expecting array for "flows" of type "WorkflowFull"', + }); + } const flows: undefined | readonly WorkflowFlowsField[] = val.flows == void 0 ? void 0 @@ -66,12 +84,32 @@ export function deserializeWorkflowFull(val: any): WorkflowFull { return deserializeWorkflowFlowsField(itm); }) as readonly any[]) : []; + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "WorkflowFull"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | WorkflowMiniTypeField = val.type == void 0 ? void 0 : deserializeWorkflowMiniTypeField(val.type); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "WorkflowFull"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "WorkflowFull"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if (!(val.is_enabled == void 0) && !sdIsBoolean(val.is_enabled)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "is_enabled" of type "WorkflowFull"', + }); + } const isEnabled: undefined | boolean = val.is_enabled == void 0 ? void 0 : val.is_enabled; return { diff --git a/src/schemas/workflowMini.generated.ts b/src/schemas/workflowMini.generated.ts index 0b964815..cb6ac9dd 100644 --- a/src/schemas/workflowMini.generated.ts +++ b/src/schemas/workflowMini.generated.ts @@ -20,7 +20,7 @@ export function serializeWorkflowMiniTypeField( return val; } export function deserializeWorkflowMiniTypeField( - val: any + val: SerializedData ): WorkflowMiniTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -44,13 +44,36 @@ export function serializeWorkflowMini(val: WorkflowMini): SerializedData { ['is_enabled']: val.isEnabled == void 0 ? void 0 : val.isEnabled, }; } -export function deserializeWorkflowMini(val: any): WorkflowMini { +export function deserializeWorkflowMini(val: SerializedData): WorkflowMini { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "WorkflowMini"' }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "WorkflowMini"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | WorkflowMiniTypeField = val.type == void 0 ? void 0 : deserializeWorkflowMiniTypeField(val.type); + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: 'Expecting string for "name" of type "WorkflowMini"', + }); + } const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "WorkflowMini"', + }); + } const description: undefined | string = val.description == void 0 ? void 0 : val.description; + if (!(val.is_enabled == void 0) && !sdIsBoolean(val.is_enabled)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "is_enabled" of type "WorkflowMini"', + }); + } const isEnabled: undefined | boolean = val.is_enabled == void 0 ? void 0 : val.is_enabled; return { diff --git a/src/schemas/workflows.generated.ts b/src/schemas/workflows.generated.ts index 2b4158f0..723ca0e6 100644 --- a/src/schemas/workflows.generated.ts +++ b/src/schemas/workflows.generated.ts @@ -1,6 +1,7 @@ import { serializeWorkflow } from './workflow.generated.js'; import { deserializeWorkflow } from './workflow.generated.js'; import { Workflow } from './workflow.generated.js'; +import { BoxSdkError } from '../box/errors.js'; import { SerializedData } from '../serialization/json.js'; import { sdIsEmpty } from '../serialization/json.js'; import { sdIsBoolean } from '../serialization/json.js'; @@ -27,12 +28,35 @@ export function serializeWorkflows(val: Workflows): SerializedData { }) as readonly any[]), }; } -export function deserializeWorkflows(val: any): Workflows { +export function deserializeWorkflows(val: SerializedData): Workflows { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "Workflows"' }); + } + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "Workflows"', + }); + } const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit; + if (!(val.next_marker == void 0) && !sdIsString(val.next_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "next_marker" of type "Workflows"', + }); + } const nextMarker: undefined | string = val.next_marker == void 0 ? void 0 : val.next_marker; + if (!(val.prev_marker == void 0) && !sdIsString(val.prev_marker)) { + throw new BoxSdkError({ + message: 'Expecting string for "prev_marker" of type "Workflows"', + }); + } const prevMarker: undefined | string = val.prev_marker == void 0 ? void 0 : val.prev_marker; + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "Workflows"', + }); + } const entries: undefined | readonly Workflow[] = val.entries == void 0 ? void 0 diff --git a/src/schemas/zipDownload.generated.ts b/src/schemas/zipDownload.generated.ts index ec75436e..9cf86f5a 100644 --- a/src/schemas/zipDownload.generated.ts +++ b/src/schemas/zipDownload.generated.ts @@ -28,7 +28,7 @@ export function serializeZipDownloadNameConflictsTypeField( return val; } export function deserializeZipDownloadNameConflictsTypeField( - val: any + val: SerializedData ): ZipDownloadNameConflictsTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -59,15 +59,38 @@ export function serializeZipDownloadNameConflictsField( }; } export function deserializeZipDownloadNameConflictsField( - val: any + val: SerializedData ): ZipDownloadNameConflictsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ZipDownloadNameConflictsField"', + }); + } + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ZipDownloadNameConflictsField"', + }); + } const id: undefined | string = val.id == void 0 ? void 0 : val.id; const type: undefined | ZipDownloadNameConflictsTypeField = val.type == void 0 ? void 0 : deserializeZipDownloadNameConflictsTypeField(val.type); + if (!(val.original_name == void 0) && !sdIsString(val.original_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "original_name" of type "ZipDownloadNameConflictsField"', + }); + } const originalName: undefined | string = val.original_name == void 0 ? void 0 : val.original_name; + if (!(val.download_name == void 0) && !sdIsString(val.download_name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "download_name" of type "ZipDownloadNameConflictsField"', + }); + } const downloadName: undefined | string = val.download_name == void 0 ? void 0 : val.download_name; return { @@ -97,13 +120,36 @@ export function serializeZipDownload(val: ZipDownload): SerializedData { }) as readonly any[]), }; } -export function deserializeZipDownload(val: any): ZipDownload { +export function deserializeZipDownload(val: SerializedData): ZipDownload { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "ZipDownload"' }); + } + if (!(val.download_url == void 0) && !sdIsString(val.download_url)) { + throw new BoxSdkError({ + message: 'Expecting string for "download_url" of type "ZipDownload"', + }); + } const downloadUrl: undefined | string = val.download_url == void 0 ? void 0 : val.download_url; + if (!(val.status_url == void 0) && !sdIsString(val.status_url)) { + throw new BoxSdkError({ + message: 'Expecting string for "status_url" of type "ZipDownload"', + }); + } const statusUrl: undefined | string = val.status_url == void 0 ? void 0 : val.status_url; + if (!(val.expires_at == void 0) && !sdIsString(val.expires_at)) { + throw new BoxSdkError({ + message: 'Expecting string for "expires_at" of type "ZipDownload"', + }); + } const expiresAt: undefined | DateTime = val.expires_at == void 0 ? void 0 : deserializeDateTime(val.expires_at); + if (!(val.name_conflicts == void 0) && !sdIsList(val.name_conflicts)) { + throw new BoxSdkError({ + message: 'Expecting array for "name_conflicts" of type "ZipDownload"', + }); + } const nameConflicts: | undefined | readonly (readonly ZipDownloadNameConflictsField[])[] = diff --git a/src/schemas/zipDownloadRequest.generated.ts b/src/schemas/zipDownloadRequest.generated.ts index 89d4853e..2dafd55a 100644 --- a/src/schemas/zipDownloadRequest.generated.ts +++ b/src/schemas/zipDownloadRequest.generated.ts @@ -21,7 +21,7 @@ export function serializeZipDownloadRequestItemsTypeField( return val; } export function deserializeZipDownloadRequestItemsTypeField( - val: any + val: SerializedData ): ZipDownloadRequestItemsTypeField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -47,10 +47,33 @@ export function serializeZipDownloadRequestItemsField( }; } export function deserializeZipDownloadRequestItemsField( - val: any + val: SerializedData ): ZipDownloadRequestItemsField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ZipDownloadRequestItemsField"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "ZipDownloadRequestItemsField" to be defined', + }); + } const type: ZipDownloadRequestItemsTypeField = deserializeZipDownloadRequestItemsTypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "ZipDownloadRequestItemsField" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "ZipDownloadRequestItemsField"', + }); + } const id: string = val.id; return { type: type, id: id } satisfies ZipDownloadRequestItemsField; } @@ -67,7 +90,24 @@ export function serializeZipDownloadRequest( val.downloadFileName == void 0 ? void 0 : val.downloadFileName, }; } -export function deserializeZipDownloadRequest(val: any): ZipDownloadRequest { +export function deserializeZipDownloadRequest( + val: SerializedData +): ZipDownloadRequest { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ZipDownloadRequest"', + }); + } + if (val.items == void 0) { + throw new BoxSdkError({ + message: 'Expecting "items" of type "ZipDownloadRequest" to be defined', + }); + } + if (!sdIsList(val.items)) { + throw new BoxSdkError({ + message: 'Expecting array for "items" of type "ZipDownloadRequest"', + }); + } const items: readonly ZipDownloadRequestItemsField[] = sdIsList(val.items) ? (val.items.map(function ( itm: SerializedData @@ -75,6 +115,15 @@ export function deserializeZipDownloadRequest(val: any): ZipDownloadRequest { return deserializeZipDownloadRequestItemsField(itm); }) as readonly any[]) : []; + if ( + !(val.download_file_name == void 0) && + !sdIsString(val.download_file_name) + ) { + throw new BoxSdkError({ + message: + 'Expecting string for "download_file_name" of type "ZipDownloadRequest"', + }); + } const downloadFileName: undefined | string = val.download_file_name == void 0 ? void 0 : val.download_file_name; return { diff --git a/src/schemas/zipDownloadStatus.generated.ts b/src/schemas/zipDownloadStatus.generated.ts index 00d3fd7f..cd8e999a 100644 --- a/src/schemas/zipDownloadStatus.generated.ts +++ b/src/schemas/zipDownloadStatus.generated.ts @@ -23,7 +23,7 @@ export function serializeZipDownloadStatusStateField( return val; } export function deserializeZipDownloadStatusStateField( - val: any + val: SerializedData ): ZipDownloadStatusStateField { if (!sdIsString(val)) { throw new BoxSdkError({ @@ -61,13 +61,53 @@ export function serializeZipDownloadStatus( : serializeZipDownloadStatusStateField(val.state), }; } -export function deserializeZipDownloadStatus(val: any): ZipDownloadStatus { +export function deserializeZipDownloadStatus( + val: SerializedData +): ZipDownloadStatus { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "ZipDownloadStatus"', + }); + } + if (!(val.total_file_count == void 0) && !sdIsNumber(val.total_file_count)) { + throw new BoxSdkError({ + message: + 'Expecting number for "total_file_count" of type "ZipDownloadStatus"', + }); + } const totalFileCount: undefined | number = val.total_file_count == void 0 ? void 0 : val.total_file_count; + if ( + !(val.downloaded_file_count == void 0) && + !sdIsNumber(val.downloaded_file_count) + ) { + throw new BoxSdkError({ + message: + 'Expecting number for "downloaded_file_count" of type "ZipDownloadStatus"', + }); + } const downloadedFileCount: undefined | number = val.downloaded_file_count == void 0 ? void 0 : val.downloaded_file_count; + if ( + !(val.skipped_file_count == void 0) && + !sdIsNumber(val.skipped_file_count) + ) { + throw new BoxSdkError({ + message: + 'Expecting number for "skipped_file_count" of type "ZipDownloadStatus"', + }); + } const skippedFileCount: undefined | number = val.skipped_file_count == void 0 ? void 0 : val.skipped_file_count; + if ( + !(val.skipped_folder_count == void 0) && + !sdIsNumber(val.skipped_folder_count) + ) { + throw new BoxSdkError({ + message: + 'Expecting number for "skipped_folder_count" of type "ZipDownloadStatus"', + }); + } const skippedFolderCount: undefined | number = val.skipped_folder_count == void 0 ? void 0 : val.skipped_folder_count; const state: undefined | ZipDownloadStatusStateField =