diff --git a/.codegen.json b/.codegen.json index e35c3070..fd0fd88e 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "d55532c", "specHash": "e21eebc", "version": "4.18.0" } +{ "engineHash": "d55532c", "specHash": "fcfcd5d", "version": "4.18.0" } diff --git a/docs/sdk-gen/README.md b/docs/sdk-gen/README.md index 682ae014..ea6ba620 100644 --- a/docs/sdk-gen/README.md +++ b/docs/sdk-gen/README.md @@ -29,6 +29,7 @@ the SDK are available by topic: * [Device pinners](devicePinners.md) * [Docgen](docgen.md) * [Docgen template](docgenTemplate.md) +* [Document split](documentSplit.md) * [Downloads](downloads.md) * [Email aliases](emailAliases.md) * [Enterprise configurations](enterpriseConfigurations.md) diff --git a/docs/sdk-gen/documentSplit.md b/docs/sdk-gen/documentSplit.md new file mode 100644 index 00000000..9325ac70 --- /dev/null +++ b/docs/sdk-gen/documentSplit.md @@ -0,0 +1,103 @@ +# DocumentSplitManager + + +- [Create Document Split job](#create-document-split-job) +- [List Document Split jobs](#list-document-split-jobs) +- [Get Document Split job by ID](#get-document-split-job-by-id) + +## Create Document Split job + +Initiates a Document Split job for the supplied source file. The job runs +asynchronously; clients can poll the returned job ID to track progress. + +All split-specific input lives under `split_input`. When +`split_input.split_type` is `manual`, provide +`split_input.split_definition` (continuous page ranges; `version` may be +omitted or `v_1`). When `split_input.split_type` is `page_selection`, +provide `split_input.page_selection` (non-linear page segments; `version` +may be omitted or `v_2`). `split_input.prompt` must not be provided for +either of those variants. When `split_input.split_type` is `smart`, +`split_input.prompt` is required and neither +`split_input.split_definition` nor `split_input.page_selection` must be +provided. + +This operation is performed by calling function `createDocumentSplitV2026R0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2026.0/post-document-splits/). + +*Currently we don't have an example for calling `createDocumentSplitV2026R0` in integration tests* + +### Arguments + +- requestBody `DocumentSplitCreateRequestV2026R0` + - Request body of createDocumentSplitV2026R0 method +- optionalsInput `CreateDocumentSplitV2026R0OptionalsInput` + + + +### Returns + +This function returns a value of type `DocumentSplitCreateResponseV2026R0`. + +The Document Split job was accepted for processing. Returns a reference +to the newly created job. + + +## List Document Split jobs + +Returns a paginated list of Document Split jobs accessible to the +authenticated user. + +This operation is performed by calling function `getDocumentSplitsV2026R0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2026.0/get-document-splits/). + +*Currently we don't have an example for calling `getDocumentSplitsV2026R0` in integration tests* + +### Arguments + +- queryParams `GetDocumentSplitsV2026R0QueryParams` + - Query parameters of getDocumentSplitsV2026R0 method +- headersInput `GetDocumentSplitsV2026R0HeadersInput` + - Headers of getDocumentSplitsV2026R0 method +- cancellationToken `undefined | CancellationToken` + - Token used for request cancellation. + + +### Returns + +This function returns a value of type `DocumentSplitsV2026R0`. + +Returns a paginated list of Document Split jobs. + + +## Get Document Split job by ID + +Returns details for a single Document Split job identified by its ID, +including the current status, the input definition, and any output files +produced by the job. + +This operation is performed by calling function `getDocumentSplitByIdV2026R0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2026.0/get-document-splits-id/). + +*Currently we don't have an example for calling `getDocumentSplitByIdV2026R0` in integration tests* + +### Arguments + +- documentSplitId `string` + - The unique identifier for the Document Split job. Example: "1748426" +- optionalsInput `GetDocumentSplitByIdV2026R0OptionalsInput` + + + +### Returns + +This function returns a value of type `DocumentSplitV2026R0`. + +Returns the Document Split job. + + diff --git a/docs/sdk-gen/users.md b/docs/sdk-gen/users.md index 40bcd440..d13da003 100644 --- a/docs/sdk-gen/users.md +++ b/docs/sdk-gen/users.md @@ -197,6 +197,12 @@ still owns any content. To proceed, move their owned content first, or use the `force` parameter to delete the user and their files. +If the enterprise has a retention policy, including a retired one, or a +legal hold that is not fully released, you can't delete a user who owns +content, even with `force`. Transfer the user's content first by using the +[Transfer owned folders](https://developer.box.com/reference/put-users-id-folders-0) +endpoint. + This operation is performed by calling function `deleteUserById`. See the endpoint docs at diff --git a/src/sdk-gen/client.ts b/src/sdk-gen/client.ts index 4ac033ac..8abf7093 100644 --- a/src/sdk-gen/client.ts +++ b/src/sdk-gen/client.ts @@ -87,6 +87,7 @@ import { ArchivesManager } from './managers/archives'; import { ExternalUsersManager } from './managers/externalUsers'; import { AutomateWorkflowsManager } from './managers/automateWorkflows'; import { NotesManager } from './managers/notes'; +import { DocumentSplitManager } from './managers/documentSplit'; import { QueryManager } from './managers/query'; import { Authentication } from './networking/auth'; import { NetworkSession } from './networking/network'; @@ -195,6 +196,7 @@ export class BoxClient { readonly externalUsers: ExternalUsersManager; readonly automateWorkflows: AutomateWorkflowsManager; readonly notes: NotesManager; + readonly documentSplit: DocumentSplitManager; readonly query: QueryManager; constructor( fields: Omit< @@ -284,6 +286,7 @@ export class BoxClient { | 'externalUsers' | 'automateWorkflows' | 'notes' + | 'documentSplit' | 'query' | 'networkSession' | 'makeRequest' @@ -650,6 +653,10 @@ export class BoxClient { auth: this.auth, networkSession: this.networkSession, }); + this.documentSplit = new DocumentSplitManager({ + auth: this.auth, + networkSession: this.networkSession, + }); this.query = new QueryManager({ auth: this.auth, networkSession: this.networkSession, diff --git a/src/sdk-gen/managers/documentSplit.ts b/src/sdk-gen/managers/documentSplit.ts new file mode 100644 index 00000000..d1956e6b --- /dev/null +++ b/src/sdk-gen/managers/documentSplit.ts @@ -0,0 +1,396 @@ +import { serializeDocumentSplitCreateResponseV2026R0 } from '../schemas/v2026R0/documentSplitCreateResponseV2026R0'; +import { deserializeDocumentSplitCreateResponseV2026R0 } from '../schemas/v2026R0/documentSplitCreateResponseV2026R0'; +import { serializeClientErrorV2026R0 } from '../schemas/v2026R0/clientErrorV2026R0'; +import { deserializeClientErrorV2026R0 } from '../schemas/v2026R0/clientErrorV2026R0'; +import { serializeBoxVersionHeaderV2026R0 } from '../parameters/v2026R0/boxVersionHeaderV2026R0'; +import { deserializeBoxVersionHeaderV2026R0 } from '../parameters/v2026R0/boxVersionHeaderV2026R0'; +import { serializeDocumentSplitCreateRequestV2026R0 } from '../schemas/v2026R0/documentSplitCreateRequestV2026R0'; +import { deserializeDocumentSplitCreateRequestV2026R0 } from '../schemas/v2026R0/documentSplitCreateRequestV2026R0'; +import { serializeDocumentSplitsV2026R0 } from '../schemas/v2026R0/documentSplitsV2026R0'; +import { deserializeDocumentSplitsV2026R0 } from '../schemas/v2026R0/documentSplitsV2026R0'; +import { serializeDocumentSplitV2026R0 } from '../schemas/v2026R0/documentSplitV2026R0'; +import { deserializeDocumentSplitV2026R0 } from '../schemas/v2026R0/documentSplitV2026R0'; +import { ResponseFormat } from '../networking/fetchOptions'; +import { DocumentSplitCreateResponseV2026R0 } from '../schemas/v2026R0/documentSplitCreateResponseV2026R0'; +import { ClientErrorV2026R0 } from '../schemas/v2026R0/clientErrorV2026R0'; +import { BoxVersionHeaderV2026R0 } from '../parameters/v2026R0/boxVersionHeaderV2026R0'; +import { DocumentSplitCreateRequestV2026R0 } from '../schemas/v2026R0/documentSplitCreateRequestV2026R0'; +import { DocumentSplitsV2026R0 } from '../schemas/v2026R0/documentSplitsV2026R0'; +import { DocumentSplitV2026R0 } from '../schemas/v2026R0/documentSplitV2026R0'; +import { BoxSdkError } from '../box/errors'; +import { Authentication } from '../networking/auth'; +import { NetworkSession } from '../networking/network'; +import { FetchOptions } from '../networking/fetchOptions'; +import { FetchResponse } from '../networking/fetchResponse'; +import { prepareParams } from '../internal/utils'; +import { toString } from '../internal/utils'; +import { ByteStream } from '../internal/utils'; +import { CancellationToken } from '../internal/utils'; +import { sdToJson } from '../serialization/json'; +import { SerializedData } from '../serialization/json'; +import { sdIsEmpty } from '../serialization/json'; +import { sdIsBoolean } from '../serialization/json'; +import { sdIsNumber } from '../serialization/json'; +import { sdIsString } from '../serialization/json'; +import { sdIsList } from '../serialization/json'; +import { sdIsMap } from '../serialization/json'; +export class CreateDocumentSplitV2026R0Optionals { + readonly headers: CreateDocumentSplitV2026R0Headers = + new CreateDocumentSplitV2026R0Headers({}); + readonly cancellationToken?: CancellationToken = void 0; + constructor( + fields: Omit< + CreateDocumentSplitV2026R0Optionals, + 'headers' | 'cancellationToken' + > & + Partial< + Pick< + CreateDocumentSplitV2026R0Optionals, + 'headers' | 'cancellationToken' + > + > + ) { + if (fields.headers !== undefined) { + this.headers = fields.headers; + } + if (fields.cancellationToken !== undefined) { + this.cancellationToken = fields.cancellationToken; + } + } +} +export interface CreateDocumentSplitV2026R0OptionalsInput { + readonly headers?: CreateDocumentSplitV2026R0Headers; + readonly cancellationToken?: CancellationToken; +} +export class GetDocumentSplitByIdV2026R0Optionals { + readonly headers: GetDocumentSplitByIdV2026R0Headers = + new GetDocumentSplitByIdV2026R0Headers({}); + readonly cancellationToken?: CancellationToken = void 0; + constructor( + fields: Omit< + GetDocumentSplitByIdV2026R0Optionals, + 'headers' | 'cancellationToken' + > & + Partial< + Pick< + GetDocumentSplitByIdV2026R0Optionals, + 'headers' | 'cancellationToken' + > + > + ) { + if (fields.headers !== undefined) { + this.headers = fields.headers; + } + if (fields.cancellationToken !== undefined) { + this.cancellationToken = fields.cancellationToken; + } + } +} +export interface GetDocumentSplitByIdV2026R0OptionalsInput { + readonly headers?: GetDocumentSplitByIdV2026R0Headers; + readonly cancellationToken?: CancellationToken; +} +export class CreateDocumentSplitV2026R0Headers { + /** + * Version header. */ + readonly boxVersion: BoxVersionHeaderV2026R0 = + '2026.0' as BoxVersionHeaderV2026R0; + /** + * Extra headers that will be included in the HTTP request. */ + readonly extraHeaders?: { + readonly [key: string]: undefined | string; + } = {}; + constructor( + fields: Omit< + CreateDocumentSplitV2026R0Headers, + 'boxVersion' | 'extraHeaders' + > & + Partial< + Pick + > + ) { + if (fields.boxVersion !== undefined) { + this.boxVersion = fields.boxVersion; + } + if (fields.extraHeaders !== undefined) { + this.extraHeaders = fields.extraHeaders; + } + } +} +export interface CreateDocumentSplitV2026R0HeadersInput { + /** + * Version header. */ + readonly boxVersion?: BoxVersionHeaderV2026R0; + /** + * Extra headers that will be included in the HTTP request. */ + readonly extraHeaders?: { + readonly [key: string]: undefined | string; + }; +} +export interface GetDocumentSplitsV2026R0QueryParams { + /** + * Defines the position marker at which to begin returning results. This is + * used when paginating using marker-based pagination. + * + * This requires `usemarker` to be set to `true`. */ + readonly marker?: string; + /** + * The maximum number of items to return per page. */ + readonly limit?: number; +} +export class GetDocumentSplitsV2026R0Headers { + /** + * Version header. */ + readonly boxVersion: BoxVersionHeaderV2026R0 = + '2026.0' as BoxVersionHeaderV2026R0; + /** + * Extra headers that will be included in the HTTP request. */ + readonly extraHeaders?: { + readonly [key: string]: undefined | string; + } = {}; + constructor( + fields: Omit< + GetDocumentSplitsV2026R0Headers, + 'boxVersion' | 'extraHeaders' + > & + Partial< + Pick + > + ) { + if (fields.boxVersion !== undefined) { + this.boxVersion = fields.boxVersion; + } + if (fields.extraHeaders !== undefined) { + this.extraHeaders = fields.extraHeaders; + } + } +} +export interface GetDocumentSplitsV2026R0HeadersInput { + /** + * Version header. */ + readonly boxVersion?: BoxVersionHeaderV2026R0; + /** + * Extra headers that will be included in the HTTP request. */ + readonly extraHeaders?: { + readonly [key: string]: undefined | string; + }; +} +export class GetDocumentSplitByIdV2026R0Headers { + /** + * Version header. */ + readonly boxVersion: BoxVersionHeaderV2026R0 = + '2026.0' as BoxVersionHeaderV2026R0; + /** + * Extra headers that will be included in the HTTP request. */ + readonly extraHeaders?: { + readonly [key: string]: undefined | string; + } = {}; + constructor( + fields: Omit< + GetDocumentSplitByIdV2026R0Headers, + 'boxVersion' | 'extraHeaders' + > & + Partial< + Pick + > + ) { + if (fields.boxVersion !== undefined) { + this.boxVersion = fields.boxVersion; + } + if (fields.extraHeaders !== undefined) { + this.extraHeaders = fields.extraHeaders; + } + } +} +export interface GetDocumentSplitByIdV2026R0HeadersInput { + /** + * Version header. */ + readonly boxVersion?: BoxVersionHeaderV2026R0; + /** + * Extra headers that will be included in the HTTP request. */ + readonly extraHeaders?: { + readonly [key: string]: undefined | string; + }; +} +export class DocumentSplitManager { + readonly auth?: Authentication; + readonly networkSession: NetworkSession = new NetworkSession({}); + constructor( + fields: Omit< + DocumentSplitManager, + | 'networkSession' + | 'createDocumentSplitV2026R0' + | 'getDocumentSplitsV2026R0' + | 'getDocumentSplitByIdV2026R0' + > & + Partial> + ) { + if (fields.auth !== undefined) { + this.auth = fields.auth; + } + if (fields.networkSession !== undefined) { + this.networkSession = fields.networkSession; + } + } + /** + * Initiates a Document Split job for the supplied source file. The job runs + * asynchronously; clients can poll the returned job ID to track progress. + * + * All split-specific input lives under `split_input`. When + * `split_input.split_type` is `manual`, provide + * `split_input.split_definition` (continuous page ranges; `version` may be + * omitted or `v_1`). When `split_input.split_type` is `page_selection`, + * provide `split_input.page_selection` (non-linear page segments; `version` + * may be omitted or `v_2`). `split_input.prompt` must not be provided for + * either of those variants. When `split_input.split_type` is `smart`, + * `split_input.prompt` is required and neither + * `split_input.split_definition` nor `split_input.page_selection` must be + * provided. + * @param {DocumentSplitCreateRequestV2026R0} requestBody Request body of createDocumentSplitV2026R0 method + * @param {CreateDocumentSplitV2026R0OptionalsInput} optionalsInput + * @returns {Promise} + */ + async createDocumentSplitV2026R0( + requestBody: DocumentSplitCreateRequestV2026R0, + optionalsInput: CreateDocumentSplitV2026R0OptionalsInput = {} + ): Promise { + const optionals: CreateDocumentSplitV2026R0Optionals = + new CreateDocumentSplitV2026R0Optionals({ + headers: optionalsInput.headers, + cancellationToken: optionalsInput.cancellationToken, + }); + const headers: any = optionals.headers; + const cancellationToken: any = optionals.cancellationToken; + const headersMap: { + readonly [key: string]: string; + } = prepareParams({ + ...{ ['box-version']: toString(headers.boxVersion) as string }, + ...headers.extraHeaders, + }); + const response: FetchResponse = + await this.networkSession.networkClient.fetch( + new FetchOptions({ + url: ''.concat( + this.networkSession.baseUrls.baseUrl, + '/2.0/document_splits' + ) as string, + method: 'POST', + headers: headersMap, + data: serializeDocumentSplitCreateRequestV2026R0(requestBody), + contentType: 'application/json', + responseFormat: 'json' as ResponseFormat, + auth: this.auth, + networkSession: this.networkSession, + cancellationToken: cancellationToken, + }) + ); + return { + ...deserializeDocumentSplitCreateResponseV2026R0(response.data!), + rawData: response.data!, + }; + } + /** + * Returns a paginated list of Document Split jobs accessible to the + * authenticated user. + * @param {GetDocumentSplitsV2026R0QueryParams} queryParams Query parameters of getDocumentSplitsV2026R0 method + * @param {GetDocumentSplitsV2026R0HeadersInput} headersInput Headers of getDocumentSplitsV2026R0 method + * @param {CancellationToken} cancellationToken Token used for request cancellation. + * @returns {Promise} + */ + async getDocumentSplitsV2026R0( + queryParams: GetDocumentSplitsV2026R0QueryParams = {} satisfies GetDocumentSplitsV2026R0QueryParams, + headersInput: GetDocumentSplitsV2026R0HeadersInput = new GetDocumentSplitsV2026R0Headers( + {} + ), + cancellationToken?: CancellationToken + ): Promise { + const headers: GetDocumentSplitsV2026R0Headers = + new GetDocumentSplitsV2026R0Headers({ + boxVersion: headersInput.boxVersion, + extraHeaders: headersInput.extraHeaders, + }); + const queryParamsMap: { + readonly [key: string]: string; + } = prepareParams({ + ['marker']: toString(queryParams.marker) as string, + ['limit']: toString(queryParams.limit) as string, + }); + const headersMap: { + readonly [key: string]: string; + } = prepareParams({ + ...{ ['box-version']: toString(headers.boxVersion) as string }, + ...headers.extraHeaders, + }); + const response: FetchResponse = + await this.networkSession.networkClient.fetch( + new FetchOptions({ + url: ''.concat( + this.networkSession.baseUrls.baseUrl, + '/2.0/document_splits' + ) as string, + method: 'GET', + params: queryParamsMap, + headers: headersMap, + responseFormat: 'json' as ResponseFormat, + auth: this.auth, + networkSession: this.networkSession, + cancellationToken: cancellationToken, + }) + ); + return { + ...deserializeDocumentSplitsV2026R0(response.data!), + rawData: response.data!, + }; + } + /** + * Returns details for a single Document Split job identified by its ID, + * including the current status, the input definition, and any output files + * produced by the job. + * @param {string} documentSplitId The unique identifier for the Document Split job. + Example: "1748426" + * @param {GetDocumentSplitByIdV2026R0OptionalsInput} optionalsInput + * @returns {Promise} + */ + async getDocumentSplitByIdV2026R0( + documentSplitId: string, + optionalsInput: GetDocumentSplitByIdV2026R0OptionalsInput = {} + ): Promise { + const optionals: GetDocumentSplitByIdV2026R0Optionals = + new GetDocumentSplitByIdV2026R0Optionals({ + headers: optionalsInput.headers, + cancellationToken: optionalsInput.cancellationToken, + }); + const headers: any = optionals.headers; + const cancellationToken: any = optionals.cancellationToken; + const headersMap: { + readonly [key: string]: string; + } = prepareParams({ + ...{ ['box-version']: toString(headers.boxVersion) as string }, + ...headers.extraHeaders, + }); + const response: FetchResponse = + await this.networkSession.networkClient.fetch( + new FetchOptions({ + url: ''.concat( + this.networkSession.baseUrls.baseUrl, + '/2.0/document_splits/', + (toString(documentSplitId) as string)! + ) as string, + method: 'GET', + headers: headersMap, + responseFormat: 'json' as ResponseFormat, + auth: this.auth, + networkSession: this.networkSession, + cancellationToken: cancellationToken, + }) + ); + return { + ...deserializeDocumentSplitV2026R0(response.data!), + rawData: response.data!, + }; + } +} +export interface DocumentSplitManagerInput { + readonly auth?: Authentication; + readonly networkSession?: NetworkSession; +} diff --git a/src/sdk-gen/managers/files.ts b/src/sdk-gen/managers/files.ts index fa71e3ad..ac202c42 100644 --- a/src/sdk-gen/managers/files.ts +++ b/src/sdk-gen/managers/files.ts @@ -1,12 +1,24 @@ +import { serializeSharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { deserializeSharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { serializeSharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { deserializeSharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { serializeSharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; +import { deserializeSharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; import { serializeFileFull } from '../schemas/fileFull'; import { deserializeFileFull } from '../schemas/fileFull'; import { serializeClientError } from '../schemas/clientError'; import { deserializeClientError } from '../schemas/clientError'; +import { serializeSharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; +import { deserializeSharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; import { serializeDateTime } from '../internal/utils'; import { deserializeDateTime } from '../internal/utils'; +import { SharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { SharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { SharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; import { ResponseFormat } from '../networking/fetchOptions'; import { FileFull } from '../schemas/fileFull'; import { ClientError } from '../schemas/clientError'; +import { SharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; import { BoxSdkError } from '../box/errors'; import { Authentication } from '../networking/auth'; import { NetworkSession } from '../networking/network'; @@ -403,6 +415,7 @@ export interface UpdateFileByIdRequestBodySharedLinkField { * users with paid accounts. */ readonly unsharedAt?: DateTime; readonly permissions?: UpdateFileByIdRequestBodySharedLinkPermissionsField; + readonly oneTimePasscode?: SharedLinkOtpWritable; readonly rawData?: SerializedData; } export type UpdateFileByIdRequestBodyLockAccessField = 'lock' | string; @@ -1265,6 +1278,10 @@ export function serializeUpdateFileByIdRequestBodySharedLinkField( : serializeUpdateFileByIdRequestBodySharedLinkPermissionsField( val.permissions ), + ['one_time_passcode']: + val.oneTimePasscode == void 0 + ? val.oneTimePasscode + : serializeSharedLinkOtpWritable(val.oneTimePasscode), }; } export function deserializeUpdateFileByIdRequestBodySharedLinkField( @@ -1310,12 +1327,17 @@ export function deserializeUpdateFileByIdRequestBodySharedLinkField( : deserializeUpdateFileByIdRequestBodySharedLinkPermissionsField( val.permissions ); + const oneTimePasscode: undefined | SharedLinkOtpWritable = + val.one_time_passcode == void 0 + ? void 0 + : deserializeSharedLinkOtpWritable(val.one_time_passcode); return { access: access, password: password, vanityName: vanityName, unsharedAt: unsharedAt, permissions: permissions, + oneTimePasscode: oneTimePasscode, } satisfies UpdateFileByIdRequestBodySharedLinkField; } export function serializeUpdateFileByIdRequestBodyLockAccessField( diff --git a/src/sdk-gen/managers/folders.ts b/src/sdk-gen/managers/folders.ts index 1bb2d94c..9ca2e8c7 100644 --- a/src/sdk-gen/managers/folders.ts +++ b/src/sdk-gen/managers/folders.ts @@ -1,14 +1,26 @@ +import { serializeSharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { deserializeSharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { serializeSharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { deserializeSharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { serializeSharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; +import { deserializeSharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; import { serializeFolderFull } from '../schemas/folderFull'; import { deserializeFolderFull } from '../schemas/folderFull'; import { serializeClientError } from '../schemas/clientError'; import { deserializeClientError } from '../schemas/clientError'; +import { serializeSharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; +import { deserializeSharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; import { serializeItems } from '../schemas/items'; import { deserializeItems } from '../schemas/items'; import { serializeDateTime } from '../internal/utils'; import { deserializeDateTime } from '../internal/utils'; +import { SharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { SharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { SharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; import { ResponseFormat } from '../networking/fetchOptions'; import { FolderFull } from '../schemas/folderFull'; import { ClientError } from '../schemas/clientError'; +import { SharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; import { Items } from '../schemas/items'; import { BoxSdkError } from '../box/errors'; import { Authentication } from '../networking/auth'; @@ -423,6 +435,7 @@ export interface UpdateFolderByIdRequestBodySharedLinkField { * users with paid accounts. */ readonly unsharedAt?: DateTime; readonly permissions?: UpdateFolderByIdRequestBodySharedLinkPermissionsField; + readonly oneTimePasscode?: SharedLinkOtpWritable; readonly rawData?: SerializedData; } export type UpdateFolderByIdRequestBodyFolderUploadEmailAccessField = @@ -1504,6 +1517,10 @@ export function serializeUpdateFolderByIdRequestBodySharedLinkField( : serializeUpdateFolderByIdRequestBodySharedLinkPermissionsField( val.permissions ), + ['one_time_passcode']: + val.oneTimePasscode == void 0 + ? val.oneTimePasscode + : serializeSharedLinkOtpWritable(val.oneTimePasscode), }; } export function deserializeUpdateFolderByIdRequestBodySharedLinkField( @@ -1550,12 +1567,17 @@ export function deserializeUpdateFolderByIdRequestBodySharedLinkField( : deserializeUpdateFolderByIdRequestBodySharedLinkPermissionsField( val.permissions ); + const oneTimePasscode: undefined | SharedLinkOtpWritable = + val.one_time_passcode == void 0 + ? void 0 + : deserializeSharedLinkOtpWritable(val.one_time_passcode); return { access: access, password: password, vanityName: vanityName, unsharedAt: unsharedAt, permissions: permissions, + oneTimePasscode: oneTimePasscode, } satisfies UpdateFolderByIdRequestBodySharedLinkField; } export function serializeUpdateFolderByIdRequestBodyFolderUploadEmailAccessField( diff --git a/src/sdk-gen/managers/index.ts b/src/sdk-gen/managers/index.ts index 01c94c9c..fd564adb 100644 --- a/src/sdk-gen/managers/index.ts +++ b/src/sdk-gen/managers/index.ts @@ -83,4 +83,5 @@ export * from './archives'; export * from './externalUsers'; export * from './automateWorkflows'; export * from './notes'; +export * from './documentSplit'; export * from './query'; diff --git a/src/sdk-gen/managers/sharedLinksFiles.ts b/src/sdk-gen/managers/sharedLinksFiles.ts index a5762808..9acfa185 100644 --- a/src/sdk-gen/managers/sharedLinksFiles.ts +++ b/src/sdk-gen/managers/sharedLinksFiles.ts @@ -1,12 +1,24 @@ +import { serializeSharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { deserializeSharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { serializeSharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { deserializeSharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { serializeSharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; +import { deserializeSharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; import { serializeFileFull } from '../schemas/fileFull'; import { deserializeFileFull } from '../schemas/fileFull'; import { serializeClientError } from '../schemas/clientError'; import { deserializeClientError } from '../schemas/clientError'; +import { serializeSharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; +import { deserializeSharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; import { serializeDateTime } from '../internal/utils'; import { deserializeDateTime } from '../internal/utils'; +import { SharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { SharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { SharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; import { ResponseFormat } from '../networking/fetchOptions'; import { FileFull } from '../schemas/fileFull'; import { ClientError } from '../schemas/clientError'; +import { SharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; import { BoxSdkError } from '../box/errors'; import { Authentication } from '../networking/auth'; import { NetworkSession } from '../networking/network'; @@ -298,6 +310,7 @@ export interface AddShareLinkToFileRequestBodySharedLinkField { * current date and time. */ readonly unsharedAt?: DateTime; readonly permissions?: AddShareLinkToFileRequestBodySharedLinkPermissionsField; + readonly oneTimePasscode?: SharedLinkOtpWritable; readonly rawData?: SerializedData; } export interface AddShareLinkToFileRequestBody { @@ -396,6 +409,7 @@ export interface UpdateSharedLinkOnFileRequestBodySharedLinkField { * current date and time. */ readonly unsharedAt?: DateTime; readonly permissions?: UpdateSharedLinkOnFileRequestBodySharedLinkPermissionsField; + readonly oneTimePasscode?: SharedLinkOtpWritable; readonly rawData?: SerializedData; } export interface UpdateSharedLinkOnFileRequestBody { @@ -893,6 +907,10 @@ export function serializeAddShareLinkToFileRequestBodySharedLinkField( : serializeAddShareLinkToFileRequestBodySharedLinkPermissionsField( val.permissions ), + ['one_time_passcode']: + val.oneTimePasscode == void 0 + ? val.oneTimePasscode + : serializeSharedLinkOtpWritable(val.oneTimePasscode), }; } export function deserializeAddShareLinkToFileRequestBodySharedLinkField( @@ -941,12 +959,17 @@ export function deserializeAddShareLinkToFileRequestBodySharedLinkField( : deserializeAddShareLinkToFileRequestBodySharedLinkPermissionsField( val.permissions ); + const oneTimePasscode: undefined | SharedLinkOtpWritable = + val.one_time_passcode == void 0 + ? void 0 + : deserializeSharedLinkOtpWritable(val.one_time_passcode); return { access: access, password: password, vanityName: vanityName, unsharedAt: unsharedAt, permissions: permissions, + oneTimePasscode: oneTimePasscode, } satisfies AddShareLinkToFileRequestBodySharedLinkField; } export function serializeAddShareLinkToFileRequestBody( @@ -1070,6 +1093,10 @@ export function serializeUpdateSharedLinkOnFileRequestBodySharedLinkField( : serializeUpdateSharedLinkOnFileRequestBodySharedLinkPermissionsField( val.permissions ), + ['one_time_passcode']: + val.oneTimePasscode == void 0 + ? val.oneTimePasscode + : serializeSharedLinkOtpWritable(val.oneTimePasscode), }; } export function deserializeUpdateSharedLinkOnFileRequestBodySharedLinkField( @@ -1119,12 +1146,17 @@ export function deserializeUpdateSharedLinkOnFileRequestBodySharedLinkField( : deserializeUpdateSharedLinkOnFileRequestBodySharedLinkPermissionsField( val.permissions ); + const oneTimePasscode: undefined | SharedLinkOtpWritable = + val.one_time_passcode == void 0 + ? void 0 + : deserializeSharedLinkOtpWritable(val.one_time_passcode); return { access: access, password: password, vanityName: vanityName, unsharedAt: unsharedAt, permissions: permissions, + oneTimePasscode: oneTimePasscode, } satisfies UpdateSharedLinkOnFileRequestBodySharedLinkField; } export function serializeUpdateSharedLinkOnFileRequestBody( diff --git a/src/sdk-gen/managers/sharedLinksFolders.ts b/src/sdk-gen/managers/sharedLinksFolders.ts index d23445df..4199389c 100644 --- a/src/sdk-gen/managers/sharedLinksFolders.ts +++ b/src/sdk-gen/managers/sharedLinksFolders.ts @@ -1,12 +1,24 @@ +import { serializeSharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { deserializeSharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { serializeSharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { deserializeSharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { serializeSharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; +import { deserializeSharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; import { serializeFolderFull } from '../schemas/folderFull'; import { deserializeFolderFull } from '../schemas/folderFull'; import { serializeClientError } from '../schemas/clientError'; import { deserializeClientError } from '../schemas/clientError'; +import { serializeSharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; +import { deserializeSharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; import { serializeDateTime } from '../internal/utils'; import { deserializeDateTime } from '../internal/utils'; +import { SharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { SharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { SharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; import { ResponseFormat } from '../networking/fetchOptions'; import { FolderFull } from '../schemas/folderFull'; import { ClientError } from '../schemas/clientError'; +import { SharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; import { BoxSdkError } from '../box/errors'; import { Authentication } from '../networking/auth'; import { NetworkSession } from '../networking/network'; @@ -300,6 +312,7 @@ export interface AddShareLinkToFolderRequestBodySharedLinkField { * current date and time. */ readonly unsharedAt?: DateTime; readonly permissions?: AddShareLinkToFolderRequestBodySharedLinkPermissionsField; + readonly oneTimePasscode?: SharedLinkOtpWritable; readonly rawData?: SerializedData; } export interface AddShareLinkToFolderRequestBody { @@ -396,6 +409,7 @@ export interface UpdateSharedLinkOnFolderRequestBodySharedLinkField { * current date and time. */ readonly unsharedAt?: DateTime; readonly permissions?: UpdateSharedLinkOnFolderRequestBodySharedLinkPermissionsField; + readonly oneTimePasscode?: SharedLinkOtpWritable; readonly rawData?: SerializedData; } export interface UpdateSharedLinkOnFolderRequestBody { @@ -902,6 +916,10 @@ export function serializeAddShareLinkToFolderRequestBodySharedLinkField( : serializeAddShareLinkToFolderRequestBodySharedLinkPermissionsField( val.permissions ), + ['one_time_passcode']: + val.oneTimePasscode == void 0 + ? val.oneTimePasscode + : serializeSharedLinkOtpWritable(val.oneTimePasscode), }; } export function deserializeAddShareLinkToFolderRequestBodySharedLinkField( @@ -951,12 +969,17 @@ export function deserializeAddShareLinkToFolderRequestBodySharedLinkField( : deserializeAddShareLinkToFolderRequestBodySharedLinkPermissionsField( val.permissions ); + const oneTimePasscode: undefined | SharedLinkOtpWritable = + val.one_time_passcode == void 0 + ? void 0 + : deserializeSharedLinkOtpWritable(val.one_time_passcode); return { access: access, password: password, vanityName: vanityName, unsharedAt: unsharedAt, permissions: permissions, + oneTimePasscode: oneTimePasscode, } satisfies AddShareLinkToFolderRequestBodySharedLinkField; } export function serializeAddShareLinkToFolderRequestBody( @@ -1082,6 +1105,10 @@ export function serializeUpdateSharedLinkOnFolderRequestBodySharedLinkField( : serializeUpdateSharedLinkOnFolderRequestBodySharedLinkPermissionsField( val.permissions ), + ['one_time_passcode']: + val.oneTimePasscode == void 0 + ? val.oneTimePasscode + : serializeSharedLinkOtpWritable(val.oneTimePasscode), }; } export function deserializeUpdateSharedLinkOnFolderRequestBodySharedLinkField( @@ -1131,12 +1158,17 @@ export function deserializeUpdateSharedLinkOnFolderRequestBodySharedLinkField( : deserializeUpdateSharedLinkOnFolderRequestBodySharedLinkPermissionsField( val.permissions ); + const oneTimePasscode: undefined | SharedLinkOtpWritable = + val.one_time_passcode == void 0 + ? void 0 + : deserializeSharedLinkOtpWritable(val.one_time_passcode); return { access: access, password: password, vanityName: vanityName, unsharedAt: unsharedAt, permissions: permissions, + oneTimePasscode: oneTimePasscode, } satisfies UpdateSharedLinkOnFolderRequestBodySharedLinkField; } export function serializeUpdateSharedLinkOnFolderRequestBody( diff --git a/src/sdk-gen/managers/sharedLinksWebLinks.ts b/src/sdk-gen/managers/sharedLinksWebLinks.ts index fe0155fd..d9e48b8f 100644 --- a/src/sdk-gen/managers/sharedLinksWebLinks.ts +++ b/src/sdk-gen/managers/sharedLinksWebLinks.ts @@ -1,12 +1,24 @@ +import { serializeSharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { deserializeSharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { serializeSharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { deserializeSharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { serializeSharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; +import { deserializeSharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; import { serializeWebLink } from '../schemas/webLink'; import { deserializeWebLink } from '../schemas/webLink'; import { serializeClientError } from '../schemas/clientError'; import { deserializeClientError } from '../schemas/clientError'; +import { serializeSharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; +import { deserializeSharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; import { serializeDateTime } from '../internal/utils'; import { deserializeDateTime } from '../internal/utils'; +import { SharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { SharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { SharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; import { ResponseFormat } from '../networking/fetchOptions'; import { WebLink } from '../schemas/webLink'; import { ClientError } from '../schemas/clientError'; +import { SharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; import { BoxSdkError } from '../box/errors'; import { Authentication } from '../networking/auth'; import { NetworkSession } from '../networking/network'; @@ -302,6 +314,7 @@ export interface AddShareLinkToWebLinkRequestBodySharedLinkField { * current date and time. */ readonly unsharedAt?: DateTime; readonly permissions?: AddShareLinkToWebLinkRequestBodySharedLinkPermissionsField; + readonly oneTimePasscode?: SharedLinkOtpWritable; readonly rawData?: SerializedData; } export interface AddShareLinkToWebLinkRequestBody { @@ -397,6 +410,7 @@ export interface UpdateSharedLinkOnWebLinkRequestBodySharedLinkField { * current date and time. */ readonly unsharedAt?: DateTime; readonly permissions?: UpdateSharedLinkOnWebLinkRequestBodySharedLinkPermissionsField; + readonly oneTimePasscode?: SharedLinkOtpWritable; readonly rawData?: SerializedData; } export interface UpdateSharedLinkOnWebLinkRequestBody { @@ -867,6 +881,10 @@ export function serializeAddShareLinkToWebLinkRequestBodySharedLinkField( : serializeAddShareLinkToWebLinkRequestBodySharedLinkPermissionsField( val.permissions ), + ['one_time_passcode']: + val.oneTimePasscode == void 0 + ? val.oneTimePasscode + : serializeSharedLinkOtpWritable(val.oneTimePasscode), }; } export function deserializeAddShareLinkToWebLinkRequestBodySharedLinkField( @@ -916,12 +934,17 @@ export function deserializeAddShareLinkToWebLinkRequestBodySharedLinkField( : deserializeAddShareLinkToWebLinkRequestBodySharedLinkPermissionsField( val.permissions ); + const oneTimePasscode: undefined | SharedLinkOtpWritable = + val.one_time_passcode == void 0 + ? void 0 + : deserializeSharedLinkOtpWritable(val.one_time_passcode); return { access: access, password: password, vanityName: vanityName, unsharedAt: unsharedAt, permissions: permissions, + oneTimePasscode: oneTimePasscode, } satisfies AddShareLinkToWebLinkRequestBodySharedLinkField; } export function serializeAddShareLinkToWebLinkRequestBody( @@ -1048,6 +1071,10 @@ export function serializeUpdateSharedLinkOnWebLinkRequestBodySharedLinkField( : serializeUpdateSharedLinkOnWebLinkRequestBodySharedLinkPermissionsField( val.permissions ), + ['one_time_passcode']: + val.oneTimePasscode == void 0 + ? val.oneTimePasscode + : serializeSharedLinkOtpWritable(val.oneTimePasscode), }; } export function deserializeUpdateSharedLinkOnWebLinkRequestBodySharedLinkField( @@ -1097,12 +1124,17 @@ export function deserializeUpdateSharedLinkOnWebLinkRequestBodySharedLinkField( : deserializeUpdateSharedLinkOnWebLinkRequestBodySharedLinkPermissionsField( val.permissions ); + const oneTimePasscode: undefined | SharedLinkOtpWritable = + val.one_time_passcode == void 0 + ? void 0 + : deserializeSharedLinkOtpWritable(val.one_time_passcode); return { access: access, password: password, vanityName: vanityName, unsharedAt: unsharedAt, permissions: permissions, + oneTimePasscode: oneTimePasscode, } satisfies UpdateSharedLinkOnWebLinkRequestBodySharedLinkField; } export function serializeUpdateSharedLinkOnWebLinkRequestBody( diff --git a/src/sdk-gen/managers/users.ts b/src/sdk-gen/managers/users.ts index 4e01b82a..4ffddcea 100644 --- a/src/sdk-gen/managers/users.ts +++ b/src/sdk-gen/managers/users.ts @@ -587,7 +587,13 @@ export interface DeleteUserByIdQueryParams { * the deletion. */ readonly notify?: boolean; /** - * Specifies whether to delete the user even if they still own files. */ + * Specifies whether to delete the user even if they still own files. + * + * If the user owns content and the enterprise has a retention policy, + * including a retired one, or a legal hold that is not fully released, + * setting `force` to `true` doesn't delete the user. The request returns + * a `403` error, and you must transfer the user's content before deleting + * the user. */ readonly force?: boolean; } export class DeleteUserByIdHeaders { @@ -926,6 +932,12 @@ export class UsersManager { * still owns any content. * To proceed, move their owned content first, or use the `force` parameter to delete * the user and their files. + * + * If the enterprise has a retention policy, including a retired one, or a + * legal hold that is not fully released, you can't delete a user who owns + * content, even with `force`. Transfer the user's content first by using the + * [Transfer owned folders](https://developer.box.com/reference/put-users-id-folders-0) + * endpoint. * @param {string} userId The ID of the user. Example: "12345" * @param {DeleteUserByIdOptionalsInput} optionalsInput diff --git a/src/sdk-gen/managers/webLinks.ts b/src/sdk-gen/managers/webLinks.ts index af7727b7..ba1ab1f5 100644 --- a/src/sdk-gen/managers/webLinks.ts +++ b/src/sdk-gen/managers/webLinks.ts @@ -1,12 +1,24 @@ +import { serializeSharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { deserializeSharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { serializeSharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { deserializeSharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { serializeSharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; +import { deserializeSharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; import { serializeWebLink } from '../schemas/webLink'; import { deserializeWebLink } from '../schemas/webLink'; import { serializeClientError } from '../schemas/clientError'; import { deserializeClientError } from '../schemas/clientError'; +import { serializeSharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; +import { deserializeSharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; import { serializeDateTime } from '../internal/utils'; import { deserializeDateTime } from '../internal/utils'; +import { SharedLinkOtpWritableNone } from '../schemas/sharedLinkOtpWritableNone'; +import { SharedLinkOtpWritableOpen } from '../schemas/sharedLinkOtpWritableOpen'; +import { SharedLinkOtpWritableAllowlist } from '../schemas/sharedLinkOtpWritableAllowlist'; import { ResponseFormat } from '../networking/fetchOptions'; import { WebLink } from '../schemas/webLink'; import { ClientError } from '../schemas/clientError'; +import { SharedLinkOtpWritable } from '../schemas/sharedLinkOtpWritable'; import { BoxSdkError } from '../box/errors'; import { Authentication } from '../networking/auth'; import { NetworkSession } from '../networking/network'; @@ -256,6 +268,7 @@ export interface UpdateWebLinkByIdRequestBodySharedLinkField { * users with paid accounts. The value must be greater than the * current date and time. */ readonly unsharedAt?: DateTime; + readonly oneTimePasscode?: SharedLinkOtpWritable; readonly rawData?: SerializedData; } export interface UpdateWebLinkByIdRequestBody { @@ -676,6 +689,10 @@ export function serializeUpdateWebLinkByIdRequestBodySharedLinkField( val.unsharedAt == void 0 ? val.unsharedAt : serializeDateTime(val.unsharedAt), + ['one_time_passcode']: + val.oneTimePasscode == void 0 + ? val.oneTimePasscode + : serializeSharedLinkOtpWritable(val.oneTimePasscode), }; } export function deserializeUpdateWebLinkByIdRequestBodySharedLinkField( @@ -717,11 +734,16 @@ export function deserializeUpdateWebLinkByIdRequestBodySharedLinkField( } const unsharedAt: undefined | DateTime = val.unshared_at == void 0 ? void 0 : deserializeDateTime(val.unshared_at); + const oneTimePasscode: undefined | SharedLinkOtpWritable = + val.one_time_passcode == void 0 + ? void 0 + : deserializeSharedLinkOtpWritable(val.one_time_passcode); return { access: access, password: password, vanityName: vanityName, unsharedAt: unsharedAt, + oneTimePasscode: oneTimePasscode, } satisfies UpdateWebLinkByIdRequestBodySharedLinkField; } export function serializeUpdateWebLinkByIdRequestBody( diff --git a/src/sdk-gen/schemas/file.ts b/src/sdk-gen/schemas/file.ts index 14aeb5a0..7a58463c 100644 --- a/src/sdk-gen/schemas/file.ts +++ b/src/sdk-gen/schemas/file.ts @@ -10,6 +10,8 @@ import { serializeFolderMini } from './folderMini'; import { deserializeFolderMini } from './folderMini'; import { serializeUserMini } from './userMini'; import { deserializeUserMini } from './userMini'; +import { serializeSharedLinkOtpAllowlistEntry } from './sharedLinkOtpAllowlistEntry'; +import { deserializeSharedLinkOtpAllowlistEntry } from './sharedLinkOtpAllowlistEntry'; import { serializeDateTime } from '../internal/utils'; import { deserializeDateTime } from '../internal/utils'; import { FileBaseTypeField } from './fileBase'; @@ -18,6 +20,7 @@ import { FileVersionMini } from './fileVersionMini'; import { FileMini } from './fileMini'; import { FolderMini } from './folderMini'; import { UserMini } from './userMini'; +import { SharedLinkOtpAllowlistEntry } from './sharedLinkOtpAllowlistEntry'; import { BoxSdkError } from '../box/errors'; import { DateTime } from '../internal/utils'; import { SerializedData } from '../serialization/json'; @@ -64,6 +67,35 @@ export interface FileSharedLinkPermissionsField { readonly canEdit: boolean; readonly rawData?: SerializedData; } +export interface FileSharedLinkOneTimePasscodeField { + /** + * The current OTP enforcement mode for the shared link. + * + * * `none` - OTP enforcement is turned off. The shared link is accessible + * without any one-time-passcode verification. + * * `open` - Any anonymous recipient can request a one-time-passcode to + * any email address and access the shared link after verifying it. + * Collaborators and registered Box users access the link without + * being prompted. + * * `allowlist` - Anonymous recipients can request a one-time-passcode + * only when they enter an email that matches an entry on the + * `allowlist`. */ + readonly mode: string; + /** + * The list of email and domain entries that are permitted to access the + * shared link when `mode` is `allowlist`. Anonymous users whose + * email matches an entry can request and verify a one-time-passcode. + * + * Because the entries carry recipient email addresses and the identity + * of the user who added them, this field is only returned to users + * with owner, co-owner, or editor access on the item. For viewer + * collaborators and below the field is omitted. + * + * An allowlist contains at most 1000 entries, matching the limit + * enforced when setting the allowlist on a shared link. */ + readonly allowlist?: readonly SharedLinkOtpAllowlistEntry[]; + readonly rawData?: SerializedData; +} export interface FileSharedLinkField { /** * The URL that can be used to access the item on Box. @@ -129,6 +161,7 @@ export interface FileSharedLinkField { /** * The number of times this item has been previewed. */ readonly previewCount: number; + readonly oneTimePasscode: FileSharedLinkOneTimePasscodeField; readonly rawData?: SerializedData; } export type FileItemStatusField = 'active' | 'trashed' | 'deleted' | string; @@ -387,6 +420,63 @@ export function deserializeFileSharedLinkPermissionsField( canEdit: canEdit, } satisfies FileSharedLinkPermissionsField; } +export function serializeFileSharedLinkOneTimePasscodeField( + val: FileSharedLinkOneTimePasscodeField +): SerializedData { + return { + ['mode']: val.mode, + ['allowlist']: + val.allowlist == void 0 + ? val.allowlist + : (val.allowlist.map(function ( + item: SharedLinkOtpAllowlistEntry + ): SerializedData { + return serializeSharedLinkOtpAllowlistEntry(item); + }) as readonly any[]), + }; +} +export function deserializeFileSharedLinkOneTimePasscodeField( + val: SerializedData +): FileSharedLinkOneTimePasscodeField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileSharedLinkOneTimePasscodeField"', + }); + } + if (val.mode == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "mode" of type "FileSharedLinkOneTimePasscodeField" to be defined', + }); + } + if (!sdIsString(val.mode)) { + throw new BoxSdkError({ + message: + 'Expecting string for "mode" of type "FileSharedLinkOneTimePasscodeField"', + }); + } + const mode: string = val.mode; + if (!(val.allowlist == void 0) && !sdIsList(val.allowlist)) { + throw new BoxSdkError({ + message: + 'Expecting array for "allowlist" of type "FileSharedLinkOneTimePasscodeField"', + }); + } + const allowlist: undefined | readonly SharedLinkOtpAllowlistEntry[] = + val.allowlist == void 0 + ? void 0 + : sdIsList(val.allowlist) + ? (val.allowlist.map(function ( + itm: SerializedData + ): SharedLinkOtpAllowlistEntry { + return deserializeSharedLinkOtpAllowlistEntry(itm); + }) as readonly any[]) + : []; + return { + mode: mode, + allowlist: allowlist, + } satisfies FileSharedLinkOneTimePasscodeField; +} export function serializeFileSharedLinkField( val: FileSharedLinkField ): SerializedData { @@ -416,6 +506,9 @@ export function serializeFileSharedLinkField( : serializeFileSharedLinkPermissionsField(val.permissions), ['download_count']: val.downloadCount, ['preview_count']: val.previewCount, + ['one_time_passcode']: serializeFileSharedLinkOneTimePasscodeField( + val.oneTimePasscode + ), }; } export function deserializeFileSharedLinkField( @@ -532,6 +625,14 @@ export function deserializeFileSharedLinkField( }); } const previewCount: number = val.preview_count; + if (val.one_time_passcode == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "one_time_passcode" of type "FileSharedLinkField" to be defined', + }); + } + const oneTimePasscode: FileSharedLinkOneTimePasscodeField = + deserializeFileSharedLinkOneTimePasscodeField(val.one_time_passcode); return { url: url, downloadUrl: downloadUrl, @@ -545,6 +646,7 @@ export function deserializeFileSharedLinkField( permissions: permissions, downloadCount: downloadCount, previewCount: previewCount, + oneTimePasscode: oneTimePasscode, } satisfies FileSharedLinkField; } export function serializeFileItemStatusField( diff --git a/src/sdk-gen/schemas/folder.ts b/src/sdk-gen/schemas/folder.ts index 6e1adb73..18e74543 100644 --- a/src/sdk-gen/schemas/folder.ts +++ b/src/sdk-gen/schemas/folder.ts @@ -6,6 +6,8 @@ import { serializeFolderMini } from './folderMini'; import { deserializeFolderMini } from './folderMini'; import { serializeUserMini } from './userMini'; import { deserializeUserMini } from './userMini'; +import { serializeSharedLinkOtpAllowlistEntry } from './sharedLinkOtpAllowlistEntry'; +import { deserializeSharedLinkOtpAllowlistEntry } from './sharedLinkOtpAllowlistEntry'; import { serializeItems } from './items'; import { deserializeItems } from './items'; import { serializeDateTime } from '../internal/utils'; @@ -14,6 +16,7 @@ import { FolderBaseTypeField } from './folderBase'; import { FolderBase } from './folderBase'; import { FolderMini } from './folderMini'; import { UserMini } from './userMini'; +import { SharedLinkOtpAllowlistEntry } from './sharedLinkOtpAllowlistEntry'; import { Items } from './items'; import { BoxSdkError } from '../box/errors'; import { DateTime } from '../internal/utils'; @@ -61,6 +64,35 @@ export interface FolderSharedLinkPermissionsField { readonly canEdit: boolean; readonly rawData?: SerializedData; } +export interface FolderSharedLinkOneTimePasscodeField { + /** + * The current OTP enforcement mode for the shared link. + * + * * `none` - OTP enforcement is turned off. The shared link is accessible + * without any one-time-passcode verification. + * * `open` - Any anonymous recipient can request a one-time-passcode to + * any email address and access the shared link after verifying it. + * Collaborators and registered Box users access the link without + * being prompted. + * * `allowlist` - Anonymous recipients can request a one-time-passcode + * only when they enter an email that matches an entry on the + * `allowlist`. */ + readonly mode: string; + /** + * The list of email and domain entries that are permitted to access the + * shared link when `mode` is `allowlist`. Anonymous users whose + * email matches an entry can request and verify a one-time-passcode. + * + * Because the entries carry recipient email addresses and the identity + * of the user who added them, this field is only returned to users + * with owner, co-owner, or editor access on the item. For viewer + * collaborators and below the field is omitted. + * + * An allowlist contains at most 1000 entries, matching the limit + * enforced when setting the allowlist on a shared link. */ + readonly allowlist?: readonly SharedLinkOtpAllowlistEntry[]; + readonly rawData?: SerializedData; +} export interface FolderSharedLinkField { /** * The URL that can be used to access the item on Box. @@ -126,6 +158,7 @@ export interface FolderSharedLinkField { /** * The number of times this item has been previewed. */ readonly previewCount: number; + readonly oneTimePasscode: FolderSharedLinkOneTimePasscodeField; readonly rawData?: SerializedData; } export type FolderFolderUploadEmailAccessField = @@ -415,6 +448,63 @@ export function deserializeFolderSharedLinkPermissionsField( canEdit: canEdit, } satisfies FolderSharedLinkPermissionsField; } +export function serializeFolderSharedLinkOneTimePasscodeField( + val: FolderSharedLinkOneTimePasscodeField +): SerializedData { + return { + ['mode']: val.mode, + ['allowlist']: + val.allowlist == void 0 + ? val.allowlist + : (val.allowlist.map(function ( + item: SharedLinkOtpAllowlistEntry + ): SerializedData { + return serializeSharedLinkOtpAllowlistEntry(item); + }) as readonly any[]), + }; +} +export function deserializeFolderSharedLinkOneTimePasscodeField( + val: SerializedData +): FolderSharedLinkOneTimePasscodeField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FolderSharedLinkOneTimePasscodeField"', + }); + } + if (val.mode == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "mode" of type "FolderSharedLinkOneTimePasscodeField" to be defined', + }); + } + if (!sdIsString(val.mode)) { + throw new BoxSdkError({ + message: + 'Expecting string for "mode" of type "FolderSharedLinkOneTimePasscodeField"', + }); + } + const mode: string = val.mode; + if (!(val.allowlist == void 0) && !sdIsList(val.allowlist)) { + throw new BoxSdkError({ + message: + 'Expecting array for "allowlist" of type "FolderSharedLinkOneTimePasscodeField"', + }); + } + const allowlist: undefined | readonly SharedLinkOtpAllowlistEntry[] = + val.allowlist == void 0 + ? void 0 + : sdIsList(val.allowlist) + ? (val.allowlist.map(function ( + itm: SerializedData + ): SharedLinkOtpAllowlistEntry { + return deserializeSharedLinkOtpAllowlistEntry(itm); + }) as readonly any[]) + : []; + return { + mode: mode, + allowlist: allowlist, + } satisfies FolderSharedLinkOneTimePasscodeField; +} export function serializeFolderSharedLinkField( val: FolderSharedLinkField ): SerializedData { @@ -444,6 +534,9 @@ export function serializeFolderSharedLinkField( : serializeFolderSharedLinkPermissionsField(val.permissions), ['download_count']: val.downloadCount, ['preview_count']: val.previewCount, + ['one_time_passcode']: serializeFolderSharedLinkOneTimePasscodeField( + val.oneTimePasscode + ), }; } export function deserializeFolderSharedLinkField( @@ -562,6 +655,14 @@ export function deserializeFolderSharedLinkField( }); } const previewCount: number = val.preview_count; + if (val.one_time_passcode == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "one_time_passcode" of type "FolderSharedLinkField" to be defined', + }); + } + const oneTimePasscode: FolderSharedLinkOneTimePasscodeField = + deserializeFolderSharedLinkOneTimePasscodeField(val.one_time_passcode); return { url: url, downloadUrl: downloadUrl, @@ -575,6 +676,7 @@ export function deserializeFolderSharedLinkField( permissions: permissions, downloadCount: downloadCount, previewCount: previewCount, + oneTimePasscode: oneTimePasscode, } satisfies FolderSharedLinkField; } export function serializeFolderFolderUploadEmailAccessField( diff --git a/src/sdk-gen/schemas/index.ts b/src/sdk-gen/schemas/index.ts index f53681e9..a743613e 100644 --- a/src/sdk-gen/schemas/index.ts +++ b/src/sdk-gen/schemas/index.ts @@ -140,6 +140,11 @@ export * from './fileVersionRetentions'; export * from './roleVariable'; export * from './outcome'; export * from './sessionTerminationMessage'; +export * from './sharedLinkOtpAllowlistEntryWritable'; +export * from './sharedLinkOtpWritableAllowlist'; +export * from './sharedLinkOtpWritableNone'; +export * from './sharedLinkOtpWritableOpen'; +export * from './sharedLinkOtpWritable'; export * from './shieldInformationBarrierBase'; export * from './shieldInformationBarrierReference'; export * from './shieldInformationBarrierReportBase'; @@ -235,9 +240,6 @@ export * from './fileVersion'; export * from './fileVersionFull'; export * from './fileVersions'; export * from './fileRequest'; -export * from './file'; -export * from './fileFull'; -export * from './files'; export * from './eventSource'; export * from './devicePinner'; export * from './devicePinners'; @@ -260,6 +262,10 @@ export * from './shieldInformationBarrierReport'; export * from './shieldInformationBarrierReports'; export * from './shieldInformationBarrier'; export * from './shieldInformationBarriers'; +export * from './sharedLinkOtpAllowlistEntry'; +export * from './file'; +export * from './fileFull'; +export * from './files'; export * from './folderLock'; export * from './folderLocks'; export * from './aiAgentAllowedEntity'; diff --git a/src/sdk-gen/schemas/keywordSkillCard.ts b/src/sdk-gen/schemas/keywordSkillCard.ts index c1340768..4c57c41e 100644 --- a/src/sdk-gen/schemas/keywordSkillCard.ts +++ b/src/sdk-gen/schemas/keywordSkillCard.ts @@ -127,7 +127,7 @@ export class KeywordSkillCard { * which instance of a service applied the metadata. */ readonly invocation!: KeywordSkillCardInvocationField; /** - * An list of entries in the metadata card. */ + * A list of entries in the metadata card. */ readonly entries!: readonly KeywordSkillCardEntriesField[]; readonly rawData?: SerializedData; constructor( @@ -181,7 +181,7 @@ export interface KeywordSkillCardInput { * which instance of a service applied the metadata. */ readonly invocation: KeywordSkillCardInvocationField; /** - * An list of entries in the metadata card. */ + * A list of entries in the metadata card. */ readonly entries: readonly KeywordSkillCardEntriesField[]; readonly rawData?: SerializedData; } diff --git a/src/sdk-gen/schemas/sharedLinkOtpAllowlistEntry.ts b/src/sdk-gen/schemas/sharedLinkOtpAllowlistEntry.ts new file mode 100644 index 00000000..441b3795 --- /dev/null +++ b/src/sdk-gen/schemas/sharedLinkOtpAllowlistEntry.ts @@ -0,0 +1,119 @@ +import { serializeUserBase } from './userBase'; +import { deserializeUserBase } from './userBase'; +import { serializeDateTime } from '../internal/utils'; +import { deserializeDateTime } from '../internal/utils'; +import { UserBase } from './userBase'; +import { BoxSdkError } from '../box/errors'; +import { DateTime } from '../internal/utils'; +import { SerializedData } from '../serialization/json'; +import { sdIsEmpty } from '../serialization/json'; +import { sdIsBoolean } from '../serialization/json'; +import { sdIsNumber } from '../serialization/json'; +import { sdIsString } from '../serialization/json'; +import { sdIsList } from '../serialization/json'; +import { sdIsMap } from '../serialization/json'; +export type SharedLinkOtpAllowlistEntryTypeField = 'email' | 'domain'; +export interface SharedLinkOtpAllowlistEntry { + /** + * The kind of allowlist entry. + * + * * `email` - The entry matches a single email address. + * * `domain` - The entry matches every email address under the + * given domain. */ + readonly type: SharedLinkOtpAllowlistEntryTypeField; + /** + * The value of the allowlist entry. + * + * * For `email` entries, the full email address (must contain `@`). + * * For `domain` entries, the bare domain (e.g. `example.com`). */ + readonly value: string; + /** + * The date and time when the allowlist entry was added. */ + readonly createdAt: DateTime; + readonly createdBy: UserBase; + readonly rawData?: SerializedData; +} +export function serializeSharedLinkOtpAllowlistEntryTypeField( + val: SharedLinkOtpAllowlistEntryTypeField +): SerializedData { + return val; +} +export function deserializeSharedLinkOtpAllowlistEntryTypeField( + val: SerializedData +): SharedLinkOtpAllowlistEntryTypeField { + if (val == 'email') { + return val; + } + if (val == 'domain') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize SharedLinkOtpAllowlistEntryTypeField", + }); +} +export function serializeSharedLinkOtpAllowlistEntry( + val: SharedLinkOtpAllowlistEntry +): SerializedData { + return { + ['type']: serializeSharedLinkOtpAllowlistEntryTypeField(val.type), + ['value']: val.value, + ['created_at']: serializeDateTime(val.createdAt), + ['created_by']: serializeUserBase(val.createdBy), + }; +} +export function deserializeSharedLinkOtpAllowlistEntry( + val: SerializedData +): SharedLinkOtpAllowlistEntry { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SharedLinkOtpAllowlistEntry"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "SharedLinkOtpAllowlistEntry" to be defined', + }); + } + const type: SharedLinkOtpAllowlistEntryTypeField = + deserializeSharedLinkOtpAllowlistEntryTypeField(val.type); + if (val.value == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "value" of type "SharedLinkOtpAllowlistEntry" to be defined', + }); + } + if (!sdIsString(val.value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "value" of type "SharedLinkOtpAllowlistEntry"', + }); + } + const value: string = val.value; + if (val.created_at == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "created_at" of type "SharedLinkOtpAllowlistEntry" to be defined', + }); + } + if (!sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "SharedLinkOtpAllowlistEntry"', + }); + } + const createdAt: DateTime = deserializeDateTime(val.created_at); + if (val.created_by == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "created_by" of type "SharedLinkOtpAllowlistEntry" to be defined', + }); + } + const createdBy: UserBase = deserializeUserBase(val.created_by); + return { + type: type, + value: value, + createdAt: createdAt, + createdBy: createdBy, + } satisfies SharedLinkOtpAllowlistEntry; +} diff --git a/src/sdk-gen/schemas/sharedLinkOtpAllowlistEntryWritable.ts b/src/sdk-gen/schemas/sharedLinkOtpAllowlistEntryWritable.ts new file mode 100644 index 00000000..b50737dd --- /dev/null +++ b/src/sdk-gen/schemas/sharedLinkOtpAllowlistEntryWritable.ts @@ -0,0 +1,85 @@ +import { BoxSdkError } from '../box/errors'; +import { SerializedData } from '../serialization/json'; +import { sdIsEmpty } from '../serialization/json'; +import { sdIsBoolean } from '../serialization/json'; +import { sdIsNumber } from '../serialization/json'; +import { sdIsString } from '../serialization/json'; +import { sdIsList } from '../serialization/json'; +import { sdIsMap } from '../serialization/json'; +export type SharedLinkOtpAllowlistEntryWritableTypeField = 'email' | 'domain'; +export interface SharedLinkOtpAllowlistEntryWritable { + /** + * The kind of allowlist entry. + * + * * `email` - The entry matches a single email address. + * * `domain` - The entry matches every email address under the + * given domain. */ + readonly type: SharedLinkOtpAllowlistEntryWritableTypeField; + /** + * The value of the allowlist entry. + * + * * For `email` entries, the full email address (must contain `@`). + * * For `domain` entries, the bare domain (e.g. `example.com`). */ + readonly value: string; + readonly rawData?: SerializedData; +} +export function serializeSharedLinkOtpAllowlistEntryWritableTypeField( + val: SharedLinkOtpAllowlistEntryWritableTypeField +): SerializedData { + return val; +} +export function deserializeSharedLinkOtpAllowlistEntryWritableTypeField( + val: SerializedData +): SharedLinkOtpAllowlistEntryWritableTypeField { + if (val == 'email') { + return val; + } + if (val == 'domain') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize SharedLinkOtpAllowlistEntryWritableTypeField", + }); +} +export function serializeSharedLinkOtpAllowlistEntryWritable( + val: SharedLinkOtpAllowlistEntryWritable +): SerializedData { + return { + ['type']: serializeSharedLinkOtpAllowlistEntryWritableTypeField(val.type), + ['value']: val.value, + }; +} +export function deserializeSharedLinkOtpAllowlistEntryWritable( + val: SerializedData +): SharedLinkOtpAllowlistEntryWritable { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SharedLinkOtpAllowlistEntryWritable"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "SharedLinkOtpAllowlistEntryWritable" to be defined', + }); + } + const type: SharedLinkOtpAllowlistEntryWritableTypeField = + deserializeSharedLinkOtpAllowlistEntryWritableTypeField(val.type); + if (val.value == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "value" of type "SharedLinkOtpAllowlistEntryWritable" to be defined', + }); + } + if (!sdIsString(val.value)) { + throw new BoxSdkError({ + message: + 'Expecting string for "value" of type "SharedLinkOtpAllowlistEntryWritable"', + }); + } + const value: string = val.value; + return { + type: type, + value: value, + } satisfies SharedLinkOtpAllowlistEntryWritable; +} diff --git a/src/sdk-gen/schemas/sharedLinkOtpWritable.ts b/src/sdk-gen/schemas/sharedLinkOtpWritable.ts new file mode 100644 index 00000000..51760c12 --- /dev/null +++ b/src/sdk-gen/schemas/sharedLinkOtpWritable.ts @@ -0,0 +1,95 @@ +import { serializeSharedLinkOtpWritableNone } from './sharedLinkOtpWritableNone'; +import { deserializeSharedLinkOtpWritableNone } from './sharedLinkOtpWritableNone'; +import { serializeSharedLinkOtpWritableOpen } from './sharedLinkOtpWritableOpen'; +import { deserializeSharedLinkOtpWritableOpen } from './sharedLinkOtpWritableOpen'; +import { serializeSharedLinkOtpWritableAllowlist } from './sharedLinkOtpWritableAllowlist'; +import { deserializeSharedLinkOtpWritableAllowlist } from './sharedLinkOtpWritableAllowlist'; +import { SharedLinkOtpWritableNone } from './sharedLinkOtpWritableNone'; +import { SharedLinkOtpWritableOpen } from './sharedLinkOtpWritableOpen'; +import { SharedLinkOtpWritableAllowlist } from './sharedLinkOtpWritableAllowlist'; +import { BoxSdkError } from '../box/errors'; +import { SerializedData } from '../serialization/json'; +import { sdIsEmpty } from '../serialization/json'; +import { sdIsBoolean } from '../serialization/json'; +import { sdIsNumber } from '../serialization/json'; +import { sdIsString } from '../serialization/json'; +import { sdIsList } from '../serialization/json'; +import { sdIsMap } from '../serialization/json'; +export type SharedLinkOtpWritable = + | SharedLinkOtpWritableNone + | SharedLinkOtpWritableOpen + | SharedLinkOtpWritableAllowlist; +export function serializeSharedLinkOtpWritable(val: any): SerializedData { + try { + if (val.mode == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "mode" of type "SharedLinkOtpWritableNone" to be defined', + }); + } + return serializeSharedLinkOtpWritableNone(val); + } catch (error) { + void 0; + } finally { + } + try { + if (val.mode == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "mode" of type "SharedLinkOtpWritableOpen" to be defined', + }); + } + return serializeSharedLinkOtpWritableOpen(val); + } catch (error) { + void 0; + } finally { + } + try { + if (val.mode == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "mode" of type "SharedLinkOtpWritableAllowlist" to be defined', + }); + } + if (val.allowlist == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "allowlist" of type "SharedLinkOtpWritableAllowlist" to be defined', + }); + } + if (!sdIsList(val.allowlist)) { + throw new BoxSdkError({ + message: + 'Expecting array for "allowlist" of type "SharedLinkOtpWritableAllowlist"', + }); + } + return serializeSharedLinkOtpWritableAllowlist(val); + } catch (error) { + void 0; + } finally { + } + throw new BoxSdkError({ message: "Can't serialize SharedLinkOtpWritable" }); +} +export function deserializeSharedLinkOtpWritable( + val: SerializedData +): SharedLinkOtpWritable { + try { + return deserializeSharedLinkOtpWritableNone(val); + } catch (error) { + void 0; + } finally { + } + try { + return deserializeSharedLinkOtpWritableOpen(val); + } catch (error) { + void 0; + } finally { + } + try { + return deserializeSharedLinkOtpWritableAllowlist(val); + } catch (error) { + void 0; + } finally { + } + throw new BoxSdkError({ message: "Can't deserialize SharedLinkOtpWritable" }); +} diff --git a/src/sdk-gen/schemas/sharedLinkOtpWritableAllowlist.ts b/src/sdk-gen/schemas/sharedLinkOtpWritableAllowlist.ts new file mode 100644 index 00000000..623bdac4 --- /dev/null +++ b/src/sdk-gen/schemas/sharedLinkOtpWritableAllowlist.ts @@ -0,0 +1,182 @@ +import { serializeSharedLinkOtpAllowlistEntryWritable } from './sharedLinkOtpAllowlistEntryWritable'; +import { deserializeSharedLinkOtpAllowlistEntryWritable } from './sharedLinkOtpAllowlistEntryWritable'; +import { SharedLinkOtpAllowlistEntryWritable } from './sharedLinkOtpAllowlistEntryWritable'; +import { BoxSdkError } from '../box/errors'; +import { SerializedData } from '../serialization/json'; +import { sdIsEmpty } from '../serialization/json'; +import { sdIsBoolean } from '../serialization/json'; +import { sdIsNumber } from '../serialization/json'; +import { sdIsString } from '../serialization/json'; +import { sdIsList } from '../serialization/json'; +import { sdIsMap } from '../serialization/json'; +export type SharedLinkOtpWritableAllowlistModeField = 'allowlist' | string; +export class SharedLinkOtpWritableAllowlist { + /** + * Set to `allowlist` to restrict OTP requests to emails matching an + * entry on the `allowlist`. */ + readonly mode: SharedLinkOtpWritableAllowlistModeField = + 'allowlist' as SharedLinkOtpWritableAllowlistModeField; + /** + * The list of email and domain entries that are permitted to access the + * shared link when `mode` is `allowlist`. Anonymous users whose + * email matches an entry can request and verify a one-time-passcode. + * + * Providing this field replaces the entire existing allowlist; passing + * an empty array clears all entries. Required when `mode` is `allowlist`. */ + readonly allowlist!: readonly SharedLinkOtpAllowlistEntryWritable[]; + readonly rawData?: SerializedData; + constructor( + fields: Omit & + Partial> + ) { + if (fields.mode !== undefined) { + this.mode = fields.mode; + } + if (fields.allowlist !== undefined) { + this.allowlist = fields.allowlist; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + } +} +export interface SharedLinkOtpWritableAllowlistInput { + /** + * Set to `allowlist` to restrict OTP requests to emails matching an + * entry on the `allowlist`. */ + readonly mode?: SharedLinkOtpWritableAllowlistModeField; + /** + * The list of email and domain entries that are permitted to access the + * shared link when `mode` is `allowlist`. Anonymous users whose + * email matches an entry can request and verify a one-time-passcode. + * + * Providing this field replaces the entire existing allowlist; passing + * an empty array clears all entries. Required when `mode` is `allowlist`. */ + readonly allowlist: readonly SharedLinkOtpAllowlistEntryWritable[]; + readonly rawData?: SerializedData; +} +export function serializeSharedLinkOtpWritableAllowlistModeField( + val: SharedLinkOtpWritableAllowlistModeField +): SerializedData { + return val; +} +export function deserializeSharedLinkOtpWritableAllowlistModeField( + val: SerializedData +): SharedLinkOtpWritableAllowlistModeField { + if (val == 'allowlist') { + return val; + } + if (sdIsString(val)) { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize SharedLinkOtpWritableAllowlistModeField", + }); +} +export function serializeSharedLinkOtpWritableAllowlist( + val: SharedLinkOtpWritableAllowlist +): SerializedData { + return { + ['mode']: serializeSharedLinkOtpWritableAllowlistModeField(val.mode), + ['allowlist']: val.allowlist.map(function ( + item: SharedLinkOtpAllowlistEntryWritable + ): SerializedData { + return serializeSharedLinkOtpAllowlistEntryWritable(item); + }) as readonly any[], + }; +} +export function deserializeSharedLinkOtpWritableAllowlist( + val: SerializedData +): SharedLinkOtpWritableAllowlist { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SharedLinkOtpWritableAllowlist"', + }); + } + if (val.mode == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "mode" of type "SharedLinkOtpWritableAllowlist" to be defined', + }); + } + const mode: SharedLinkOtpWritableAllowlistModeField = + deserializeSharedLinkOtpWritableAllowlistModeField(val.mode); + if (val.allowlist == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "allowlist" of type "SharedLinkOtpWritableAllowlist" to be defined', + }); + } + if (!sdIsList(val.allowlist)) { + throw new BoxSdkError({ + message: + 'Expecting array for "allowlist" of type "SharedLinkOtpWritableAllowlist"', + }); + } + const allowlist: readonly SharedLinkOtpAllowlistEntryWritable[] = sdIsList( + val.allowlist + ) + ? (val.allowlist.map(function ( + itm: SerializedData + ): SharedLinkOtpAllowlistEntryWritable { + return deserializeSharedLinkOtpAllowlistEntryWritable(itm); + }) as readonly any[]) + : []; + return { + mode: mode, + allowlist: allowlist, + } satisfies SharedLinkOtpWritableAllowlist; +} +export function serializeSharedLinkOtpWritableAllowlistInput( + val: SharedLinkOtpWritableAllowlistInput +): SerializedData { + return { + ['mode']: + val.mode == void 0 + ? val.mode + : serializeSharedLinkOtpWritableAllowlistModeField(val.mode), + ['allowlist']: val.allowlist.map(function ( + item: SharedLinkOtpAllowlistEntryWritable + ): SerializedData { + return serializeSharedLinkOtpAllowlistEntryWritable(item); + }) as readonly any[], + }; +} +export function deserializeSharedLinkOtpWritableAllowlistInput( + val: SerializedData +): SharedLinkOtpWritableAllowlistInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SharedLinkOtpWritableAllowlistInput"', + }); + } + const mode: undefined | SharedLinkOtpWritableAllowlistModeField = + val.mode == void 0 + ? void 0 + : deserializeSharedLinkOtpWritableAllowlistModeField(val.mode); + if (val.allowlist == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "allowlist" of type "SharedLinkOtpWritableAllowlistInput" to be defined', + }); + } + if (!sdIsList(val.allowlist)) { + throw new BoxSdkError({ + message: + 'Expecting array for "allowlist" of type "SharedLinkOtpWritableAllowlistInput"', + }); + } + const allowlist: readonly SharedLinkOtpAllowlistEntryWritable[] = sdIsList( + val.allowlist + ) + ? (val.allowlist.map(function ( + itm: SerializedData + ): SharedLinkOtpAllowlistEntryWritable { + return deserializeSharedLinkOtpAllowlistEntryWritable(itm); + }) as readonly any[]) + : []; + return { + mode: mode, + allowlist: allowlist, + } satisfies SharedLinkOtpWritableAllowlistInput; +} diff --git a/src/sdk-gen/schemas/sharedLinkOtpWritableNone.ts b/src/sdk-gen/schemas/sharedLinkOtpWritableNone.ts new file mode 100644 index 00000000..a581936f --- /dev/null +++ b/src/sdk-gen/schemas/sharedLinkOtpWritableNone.ts @@ -0,0 +1,98 @@ +import { BoxSdkError } from '../box/errors'; +import { SerializedData } from '../serialization/json'; +import { sdIsEmpty } from '../serialization/json'; +import { sdIsBoolean } from '../serialization/json'; +import { sdIsNumber } from '../serialization/json'; +import { sdIsString } from '../serialization/json'; +import { sdIsList } from '../serialization/json'; +import { sdIsMap } from '../serialization/json'; +export type SharedLinkOtpWritableNoneModeField = 'none' | string; +export class SharedLinkOtpWritableNone { + /** + * Set to `none` to disable OTP enforcement for the shared link. */ + readonly mode: SharedLinkOtpWritableNoneModeField = + 'none' as SharedLinkOtpWritableNoneModeField; + readonly rawData?: SerializedData; + constructor( + fields: Omit & + Partial> + ) { + if (fields.mode !== undefined) { + this.mode = fields.mode; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + } +} +export interface SharedLinkOtpWritableNoneInput { + /** + * Set to `none` to disable OTP enforcement for the shared link. */ + readonly mode?: SharedLinkOtpWritableNoneModeField; + readonly rawData?: SerializedData; +} +export function serializeSharedLinkOtpWritableNoneModeField( + val: SharedLinkOtpWritableNoneModeField +): SerializedData { + return val; +} +export function deserializeSharedLinkOtpWritableNoneModeField( + val: SerializedData +): SharedLinkOtpWritableNoneModeField { + if (val == 'none') { + return val; + } + if (sdIsString(val)) { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize SharedLinkOtpWritableNoneModeField", + }); +} +export function serializeSharedLinkOtpWritableNone( + val: SharedLinkOtpWritableNone +): SerializedData { + return { ['mode']: serializeSharedLinkOtpWritableNoneModeField(val.mode) }; +} +export function deserializeSharedLinkOtpWritableNone( + val: SerializedData +): SharedLinkOtpWritableNone { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SharedLinkOtpWritableNone"', + }); + } + if (val.mode == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "mode" of type "SharedLinkOtpWritableNone" to be defined', + }); + } + const mode: SharedLinkOtpWritableNoneModeField = + deserializeSharedLinkOtpWritableNoneModeField(val.mode); + return { mode: mode } satisfies SharedLinkOtpWritableNone; +} +export function serializeSharedLinkOtpWritableNoneInput( + val: SharedLinkOtpWritableNoneInput +): SerializedData { + return { + ['mode']: + val.mode == void 0 + ? val.mode + : serializeSharedLinkOtpWritableNoneModeField(val.mode), + }; +} +export function deserializeSharedLinkOtpWritableNoneInput( + val: SerializedData +): SharedLinkOtpWritableNoneInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SharedLinkOtpWritableNoneInput"', + }); + } + const mode: undefined | SharedLinkOtpWritableNoneModeField = + val.mode == void 0 + ? void 0 + : deserializeSharedLinkOtpWritableNoneModeField(val.mode); + return { mode: mode } satisfies SharedLinkOtpWritableNoneInput; +} diff --git a/src/sdk-gen/schemas/sharedLinkOtpWritableOpen.ts b/src/sdk-gen/schemas/sharedLinkOtpWritableOpen.ts new file mode 100644 index 00000000..6409fb19 --- /dev/null +++ b/src/sdk-gen/schemas/sharedLinkOtpWritableOpen.ts @@ -0,0 +1,100 @@ +import { BoxSdkError } from '../box/errors'; +import { SerializedData } from '../serialization/json'; +import { sdIsEmpty } from '../serialization/json'; +import { sdIsBoolean } from '../serialization/json'; +import { sdIsNumber } from '../serialization/json'; +import { sdIsString } from '../serialization/json'; +import { sdIsList } from '../serialization/json'; +import { sdIsMap } from '../serialization/json'; +export type SharedLinkOtpWritableOpenModeField = 'open' | string; +export class SharedLinkOtpWritableOpen { + /** + * Set to `open` to allow any anonymous recipient to request a + * one-time-passcode to any email address. */ + readonly mode: SharedLinkOtpWritableOpenModeField = + 'open' as SharedLinkOtpWritableOpenModeField; + readonly rawData?: SerializedData; + constructor( + fields: Omit & + Partial> + ) { + if (fields.mode !== undefined) { + this.mode = fields.mode; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + } +} +export interface SharedLinkOtpWritableOpenInput { + /** + * Set to `open` to allow any anonymous recipient to request a + * one-time-passcode to any email address. */ + readonly mode?: SharedLinkOtpWritableOpenModeField; + readonly rawData?: SerializedData; +} +export function serializeSharedLinkOtpWritableOpenModeField( + val: SharedLinkOtpWritableOpenModeField +): SerializedData { + return val; +} +export function deserializeSharedLinkOtpWritableOpenModeField( + val: SerializedData +): SharedLinkOtpWritableOpenModeField { + if (val == 'open') { + return val; + } + if (sdIsString(val)) { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize SharedLinkOtpWritableOpenModeField", + }); +} +export function serializeSharedLinkOtpWritableOpen( + val: SharedLinkOtpWritableOpen +): SerializedData { + return { ['mode']: serializeSharedLinkOtpWritableOpenModeField(val.mode) }; +} +export function deserializeSharedLinkOtpWritableOpen( + val: SerializedData +): SharedLinkOtpWritableOpen { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SharedLinkOtpWritableOpen"', + }); + } + if (val.mode == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "mode" of type "SharedLinkOtpWritableOpen" to be defined', + }); + } + const mode: SharedLinkOtpWritableOpenModeField = + deserializeSharedLinkOtpWritableOpenModeField(val.mode); + return { mode: mode } satisfies SharedLinkOtpWritableOpen; +} +export function serializeSharedLinkOtpWritableOpenInput( + val: SharedLinkOtpWritableOpenInput +): SerializedData { + return { + ['mode']: + val.mode == void 0 + ? val.mode + : serializeSharedLinkOtpWritableOpenModeField(val.mode), + }; +} +export function deserializeSharedLinkOtpWritableOpenInput( + val: SerializedData +): SharedLinkOtpWritableOpenInput { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "SharedLinkOtpWritableOpenInput"', + }); + } + const mode: undefined | SharedLinkOtpWritableOpenModeField = + val.mode == void 0 + ? void 0 + : deserializeSharedLinkOtpWritableOpenModeField(val.mode); + return { mode: mode } satisfies SharedLinkOtpWritableOpenInput; +} diff --git a/src/sdk-gen/schemas/transcriptSkillCard.ts b/src/sdk-gen/schemas/transcriptSkillCard.ts index 7aec8eef..0db753d0 100644 --- a/src/sdk-gen/schemas/transcriptSkillCard.ts +++ b/src/sdk-gen/schemas/transcriptSkillCard.ts @@ -145,7 +145,7 @@ export class TranscriptSkillCard { * `timeline`. */ readonly duration?: number; /** - * An list of entries for the card. This represents the individual entries of + * A list of entries for the card. This represents the individual entries of * the transcription. */ readonly entries!: readonly TranscriptSkillCardEntriesField[]; readonly rawData?: SerializedData; @@ -209,7 +209,7 @@ export interface TranscriptSkillCardInput { * `timeline`. */ readonly duration?: number; /** - * An list of entries for the card. This represents the individual entries of + * A list of entries for the card. This represents the individual entries of * the transcription. */ readonly entries: readonly TranscriptSkillCardEntriesField[]; readonly rawData?: SerializedData; diff --git a/src/sdk-gen/schemas/uploadSession.ts b/src/sdk-gen/schemas/uploadSession.ts index 0df766e0..d2854438 100644 --- a/src/sdk-gen/schemas/uploadSession.ts +++ b/src/sdk-gen/schemas/uploadSession.ts @@ -46,7 +46,7 @@ export interface UploadSession { * The date and time when this session expires. */ readonly sessionExpiresAt?: DateTime; /** - * The size in bytes that must be used for all parts of of the + * The size in bytes that must be used for all parts of the * upload. * * Only the last part is allowed to be of a smaller size. */ @@ -59,7 +59,7 @@ export interface UploadSession { * The number of parts that have been uploaded and processed * by the server. This starts at `0`. * - * When committing a file files, inspecting this property can + * When committing a file, inspecting this property can * provide insight if all parts have been uploaded correctly. */ readonly numPartsProcessed?: number; readonly sessionEndpoints?: UploadSessionSessionEndpointsField; diff --git a/src/sdk-gen/schemas/v2026R0/documentFailuresV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentFailuresV2026R0.ts new file mode 100644 index 00000000..26d97ca8 --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentFailuresV2026R0.ts @@ -0,0 +1,85 @@ +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export interface DocumentFailuresV2026R0 { + /** + * A list of errors that occurred during the document job. */ + readonly errors: readonly string[]; + /** + * A list of warnings that occurred during the document job. */ + readonly warnings: readonly string[]; + readonly rawData?: SerializedData; +} +export function serializeDocumentFailuresV2026R0( + val: DocumentFailuresV2026R0 +): SerializedData { + return { + ['errors']: val.errors.map(function (item: string): SerializedData { + return item; + }) as readonly any[], + ['warnings']: val.warnings.map(function (item: string): SerializedData { + return item; + }) as readonly any[], + }; +} +export function deserializeDocumentFailuresV2026R0( + val: SerializedData +): DocumentFailuresV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "DocumentFailuresV2026R0"', + }); + } + if (val.errors == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "errors" of type "DocumentFailuresV2026R0" to be defined', + }); + } + if (!sdIsList(val.errors)) { + throw new BoxSdkError({ + message: 'Expecting array for "errors" of type "DocumentFailuresV2026R0"', + }); + } + const errors: readonly string[] = sdIsList(val.errors) + ? (val.errors.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: 'Expecting string for "DocumentFailuresV2026R0"', + }); + } + return itm; + }) as readonly any[]) + : []; + if (val.warnings == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "warnings" of type "DocumentFailuresV2026R0" to be defined', + }); + } + if (!sdIsList(val.warnings)) { + throw new BoxSdkError({ + message: + 'Expecting array for "warnings" of type "DocumentFailuresV2026R0"', + }); + } + const warnings: readonly string[] = sdIsList(val.warnings) + ? (val.warnings.map(function (itm: SerializedData): string { + if (!sdIsString(itm)) { + throw new BoxSdkError({ + message: 'Expecting string for "DocumentFailuresV2026R0"', + }); + } + return itm; + }) as readonly any[]) + : []; + return { + errors: errors, + warnings: warnings, + } satisfies DocumentFailuresV2026R0; +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestManualV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestManualV2026R0.ts new file mode 100644 index 00000000..0ac67826 --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestManualV2026R0.ts @@ -0,0 +1,245 @@ +import { serializeDocumentSplitPageRangeV2026R0 } from './documentSplitPageRangeV2026R0'; +import { deserializeDocumentSplitPageRangeV2026R0 } from './documentSplitPageRangeV2026R0'; +import { DocumentSplitPageRangeV2026R0 } from './documentSplitPageRangeV2026R0'; +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export type DocumentSplitCreateRequestManualV2026R0SplitTypeField = + 'manual' | string; +export type DocumentSplitCreateRequestManualV2026R0VersionField = + 'v_1' | string; +export class DocumentSplitCreateRequestManualV2026R0 { + /** + * Discriminator. Must be `manual` for this variant. */ + readonly splitType: DocumentSplitCreateRequestManualV2026R0SplitTypeField = + 'manual' as DocumentSplitCreateRequestManualV2026R0SplitTypeField; + /** + * The version of the manual split input format. Omitted or `v_1` is the + * legacy `split_definition` format. Existing clients may omit this field. */ + readonly version?: DocumentSplitCreateRequestManualV2026R0VersionField; + /** + * Page ranges that define the split. Each entry produces one output file + * containing the inclusive page range `[start, end]`. */ + readonly splitDefinition!: readonly DocumentSplitPageRangeV2026R0[]; + readonly rawData?: SerializedData; + constructor( + fields: Omit & + Partial> + ) { + if (fields.splitType !== undefined) { + this.splitType = fields.splitType; + } + if (fields.version !== undefined) { + this.version = fields.version; + } + if (fields.splitDefinition !== undefined) { + this.splitDefinition = fields.splitDefinition; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + } +} +export interface DocumentSplitCreateRequestManualV2026R0Input { + /** + * Discriminator. Must be `manual` for this variant. */ + readonly splitType?: DocumentSplitCreateRequestManualV2026R0SplitTypeField; + /** + * The version of the manual split input format. Omitted or `v_1` is the + * legacy `split_definition` format. Existing clients may omit this field. */ + readonly version?: DocumentSplitCreateRequestManualV2026R0VersionField; + /** + * Page ranges that define the split. Each entry produces one output file + * containing the inclusive page range `[start, end]`. */ + readonly splitDefinition: readonly DocumentSplitPageRangeV2026R0[]; + readonly rawData?: SerializedData; +} +export function serializeDocumentSplitCreateRequestManualV2026R0SplitTypeField( + val: DocumentSplitCreateRequestManualV2026R0SplitTypeField +): SerializedData { + return val; +} +export function deserializeDocumentSplitCreateRequestManualV2026R0SplitTypeField( + val: SerializedData +): DocumentSplitCreateRequestManualV2026R0SplitTypeField { + if (val == 'manual') { + return val; + } + if (sdIsString(val)) { + return val; + } + throw new BoxSdkError({ + message: + "Can't deserialize DocumentSplitCreateRequestManualV2026R0SplitTypeField", + }); +} +export function serializeDocumentSplitCreateRequestManualV2026R0VersionField( + val: DocumentSplitCreateRequestManualV2026R0VersionField +): SerializedData { + return val; +} +export function deserializeDocumentSplitCreateRequestManualV2026R0VersionField( + val: SerializedData +): DocumentSplitCreateRequestManualV2026R0VersionField { + if (val == 'v_1') { + return val; + } + if (sdIsString(val)) { + return val; + } + throw new BoxSdkError({ + message: + "Can't deserialize DocumentSplitCreateRequestManualV2026R0VersionField", + }); +} +export function serializeDocumentSplitCreateRequestManualV2026R0( + val: DocumentSplitCreateRequestManualV2026R0 +): SerializedData { + return { + ['split_type']: + serializeDocumentSplitCreateRequestManualV2026R0SplitTypeField( + val.splitType + ), + ['version']: + val.version == void 0 + ? val.version + : serializeDocumentSplitCreateRequestManualV2026R0VersionField( + val.version + ), + ['split_definition']: val.splitDefinition.map(function ( + item: DocumentSplitPageRangeV2026R0 + ): SerializedData { + return serializeDocumentSplitPageRangeV2026R0(item); + }) as readonly any[], + }; +} +export function deserializeDocumentSplitCreateRequestManualV2026R0( + val: SerializedData +): DocumentSplitCreateRequestManualV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "DocumentSplitCreateRequestManualV2026R0"', + }); + } + if (val.split_type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "split_type" of type "DocumentSplitCreateRequestManualV2026R0" to be defined', + }); + } + const splitType: DocumentSplitCreateRequestManualV2026R0SplitTypeField = + deserializeDocumentSplitCreateRequestManualV2026R0SplitTypeField( + val.split_type + ); + const version: + undefined | DocumentSplitCreateRequestManualV2026R0VersionField = + val.version == void 0 + ? void 0 + : deserializeDocumentSplitCreateRequestManualV2026R0VersionField( + val.version + ); + if (val.split_definition == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "split_definition" of type "DocumentSplitCreateRequestManualV2026R0" to be defined', + }); + } + if (!sdIsList(val.split_definition)) { + throw new BoxSdkError({ + message: + 'Expecting array for "split_definition" of type "DocumentSplitCreateRequestManualV2026R0"', + }); + } + const splitDefinition: readonly DocumentSplitPageRangeV2026R0[] = sdIsList( + val.split_definition + ) + ? (val.split_definition.map(function ( + itm: SerializedData + ): DocumentSplitPageRangeV2026R0 { + return deserializeDocumentSplitPageRangeV2026R0(itm); + }) as readonly any[]) + : []; + return { + splitType: splitType, + version: version, + splitDefinition: splitDefinition, + } satisfies DocumentSplitCreateRequestManualV2026R0; +} +export function serializeDocumentSplitCreateRequestManualV2026R0Input( + val: DocumentSplitCreateRequestManualV2026R0Input +): SerializedData { + return { + ['splitType']: + val.splitType == void 0 + ? val.splitType + : serializeDocumentSplitCreateRequestManualV2026R0SplitTypeField( + val.splitType + ), + ['version']: + val.version == void 0 + ? val.version + : serializeDocumentSplitCreateRequestManualV2026R0VersionField( + val.version + ), + ['split_definition']: val.splitDefinition.map(function ( + item: DocumentSplitPageRangeV2026R0 + ): SerializedData { + return serializeDocumentSplitPageRangeV2026R0(item); + }) as readonly any[], + }; +} +export function deserializeDocumentSplitCreateRequestManualV2026R0Input( + val: SerializedData +): DocumentSplitCreateRequestManualV2026R0Input { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "DocumentSplitCreateRequestManualV2026R0Input"', + }); + } + const splitType: + undefined | DocumentSplitCreateRequestManualV2026R0SplitTypeField = + val.splitType == void 0 + ? void 0 + : deserializeDocumentSplitCreateRequestManualV2026R0SplitTypeField( + val.splitType + ); + const version: + undefined | DocumentSplitCreateRequestManualV2026R0VersionField = + val.version == void 0 + ? void 0 + : deserializeDocumentSplitCreateRequestManualV2026R0VersionField( + val.version + ); + if (val.split_definition == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "split_definition" of type "DocumentSplitCreateRequestManualV2026R0Input" to be defined', + }); + } + if (!sdIsList(val.split_definition)) { + throw new BoxSdkError({ + message: + 'Expecting array for "split_definition" of type "DocumentSplitCreateRequestManualV2026R0Input"', + }); + } + const splitDefinition: readonly DocumentSplitPageRangeV2026R0[] = sdIsList( + val.split_definition + ) + ? (val.split_definition.map(function ( + itm: SerializedData + ): DocumentSplitPageRangeV2026R0 { + return deserializeDocumentSplitPageRangeV2026R0(itm); + }) as readonly any[]) + : []; + return { + splitType: splitType, + version: version, + splitDefinition: splitDefinition, + } satisfies DocumentSplitCreateRequestManualV2026R0Input; +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestPageSelectionV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestPageSelectionV2026R0.ts new file mode 100644 index 00000000..1f677996 --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestPageSelectionV2026R0.ts @@ -0,0 +1,210 @@ +import { serializeDocumentSplitPageSelectionV2026R0 } from './documentSplitPageSelectionV2026R0'; +import { deserializeDocumentSplitPageSelectionV2026R0 } from './documentSplitPageSelectionV2026R0'; +import { DocumentSplitPageSelectionV2026R0 } from './documentSplitPageSelectionV2026R0'; +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export type DocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField = + 'page_selection' | string; +export type DocumentSplitCreateRequestPageSelectionV2026R0VersionField = + 'v_2' | string; +export class DocumentSplitCreateRequestPageSelectionV2026R0 { + /** + * Discriminator. Must be `page_selection` for this variant. */ + readonly splitType: DocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField = + 'page_selection' as DocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField; + /** + * The version of the page selection input format. Optional. When provided + * must be `v_2`. */ + readonly version?: DocumentSplitCreateRequestPageSelectionV2026R0VersionField; + readonly pageSelection!: DocumentSplitPageSelectionV2026R0; + readonly rawData?: SerializedData; + constructor( + fields: Omit & + Partial> + ) { + if (fields.splitType !== undefined) { + this.splitType = fields.splitType; + } + if (fields.version !== undefined) { + this.version = fields.version; + } + if (fields.pageSelection !== undefined) { + this.pageSelection = fields.pageSelection; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + } +} +export interface DocumentSplitCreateRequestPageSelectionV2026R0Input { + /** + * Discriminator. Must be `page_selection` for this variant. */ + readonly splitType?: DocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField; + /** + * The version of the page selection input format. Optional. When provided + * must be `v_2`. */ + readonly version?: DocumentSplitCreateRequestPageSelectionV2026R0VersionField; + readonly pageSelection: DocumentSplitPageSelectionV2026R0; + readonly rawData?: SerializedData; +} +export function serializeDocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField( + val: DocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField +): SerializedData { + return val; +} +export function deserializeDocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField( + val: SerializedData +): DocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField { + if (val == 'page_selection') { + return val; + } + if (sdIsString(val)) { + return val; + } + throw new BoxSdkError({ + message: + "Can't deserialize DocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField", + }); +} +export function serializeDocumentSplitCreateRequestPageSelectionV2026R0VersionField( + val: DocumentSplitCreateRequestPageSelectionV2026R0VersionField +): SerializedData { + return val; +} +export function deserializeDocumentSplitCreateRequestPageSelectionV2026R0VersionField( + val: SerializedData +): DocumentSplitCreateRequestPageSelectionV2026R0VersionField { + if (val == 'v_2') { + return val; + } + if (sdIsString(val)) { + return val; + } + throw new BoxSdkError({ + message: + "Can't deserialize DocumentSplitCreateRequestPageSelectionV2026R0VersionField", + }); +} +export function serializeDocumentSplitCreateRequestPageSelectionV2026R0( + val: DocumentSplitCreateRequestPageSelectionV2026R0 +): SerializedData { + return { + ['split_type']: + serializeDocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField( + val.splitType + ), + ['version']: + val.version == void 0 + ? val.version + : serializeDocumentSplitCreateRequestPageSelectionV2026R0VersionField( + val.version + ), + ['page_selection']: serializeDocumentSplitPageSelectionV2026R0( + val.pageSelection + ), + }; +} +export function deserializeDocumentSplitCreateRequestPageSelectionV2026R0( + val: SerializedData +): DocumentSplitCreateRequestPageSelectionV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "DocumentSplitCreateRequestPageSelectionV2026R0"', + }); + } + if (val.split_type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "split_type" of type "DocumentSplitCreateRequestPageSelectionV2026R0" to be defined', + }); + } + const splitType: DocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField = + deserializeDocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField( + val.split_type + ); + const version: + undefined | DocumentSplitCreateRequestPageSelectionV2026R0VersionField = + val.version == void 0 + ? void 0 + : deserializeDocumentSplitCreateRequestPageSelectionV2026R0VersionField( + val.version + ); + if (val.page_selection == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "page_selection" of type "DocumentSplitCreateRequestPageSelectionV2026R0" to be defined', + }); + } + const pageSelection: DocumentSplitPageSelectionV2026R0 = + deserializeDocumentSplitPageSelectionV2026R0(val.page_selection); + return { + splitType: splitType, + version: version, + pageSelection: pageSelection, + } satisfies DocumentSplitCreateRequestPageSelectionV2026R0; +} +export function serializeDocumentSplitCreateRequestPageSelectionV2026R0Input( + val: DocumentSplitCreateRequestPageSelectionV2026R0Input +): SerializedData { + return { + ['splitType']: + val.splitType == void 0 + ? val.splitType + : serializeDocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField( + val.splitType + ), + ['version']: + val.version == void 0 + ? val.version + : serializeDocumentSplitCreateRequestPageSelectionV2026R0VersionField( + val.version + ), + ['page_selection']: serializeDocumentSplitPageSelectionV2026R0( + val.pageSelection + ), + }; +} +export function deserializeDocumentSplitCreateRequestPageSelectionV2026R0Input( + val: SerializedData +): DocumentSplitCreateRequestPageSelectionV2026R0Input { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "DocumentSplitCreateRequestPageSelectionV2026R0Input"', + }); + } + const splitType: + undefined | DocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField = + val.splitType == void 0 + ? void 0 + : deserializeDocumentSplitCreateRequestPageSelectionV2026R0SplitTypeField( + val.splitType + ); + const version: + undefined | DocumentSplitCreateRequestPageSelectionV2026R0VersionField = + val.version == void 0 + ? void 0 + : deserializeDocumentSplitCreateRequestPageSelectionV2026R0VersionField( + val.version + ); + if (val.page_selection == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "page_selection" of type "DocumentSplitCreateRequestPageSelectionV2026R0Input" to be defined', + }); + } + const pageSelection: DocumentSplitPageSelectionV2026R0 = + deserializeDocumentSplitPageSelectionV2026R0(val.page_selection); + return { + splitType: splitType, + version: version, + pageSelection: pageSelection, + } satisfies DocumentSplitCreateRequestPageSelectionV2026R0Input; +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestSmartV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestSmartV2026R0.ts new file mode 100644 index 00000000..c92dfc23 --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestSmartV2026R0.ts @@ -0,0 +1,156 @@ +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export type DocumentSplitCreateRequestSmartV2026R0SplitTypeField = + 'smart' | string; +export class DocumentSplitCreateRequestSmartV2026R0 { + /** + * Discriminator. Must be `smart` for this variant. */ + readonly splitType: DocumentSplitCreateRequestSmartV2026R0SplitTypeField = + 'smart' as DocumentSplitCreateRequestSmartV2026R0SplitTypeField; + /** + * A natural language prompt that guides automatic page range detection. */ + readonly prompt!: string; + readonly rawData?: SerializedData; + constructor( + fields: Omit & + Partial> + ) { + if (fields.splitType !== undefined) { + this.splitType = fields.splitType; + } + if (fields.prompt !== undefined) { + this.prompt = fields.prompt; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + } +} +export interface DocumentSplitCreateRequestSmartV2026R0Input { + /** + * Discriminator. Must be `smart` for this variant. */ + readonly splitType?: DocumentSplitCreateRequestSmartV2026R0SplitTypeField; + /** + * A natural language prompt that guides automatic page range detection. */ + readonly prompt: string; + readonly rawData?: SerializedData; +} +export function serializeDocumentSplitCreateRequestSmartV2026R0SplitTypeField( + val: DocumentSplitCreateRequestSmartV2026R0SplitTypeField +): SerializedData { + return val; +} +export function deserializeDocumentSplitCreateRequestSmartV2026R0SplitTypeField( + val: SerializedData +): DocumentSplitCreateRequestSmartV2026R0SplitTypeField { + if (val == 'smart') { + return val; + } + if (sdIsString(val)) { + return val; + } + throw new BoxSdkError({ + message: + "Can't deserialize DocumentSplitCreateRequestSmartV2026R0SplitTypeField", + }); +} +export function serializeDocumentSplitCreateRequestSmartV2026R0( + val: DocumentSplitCreateRequestSmartV2026R0 +): SerializedData { + return { + ['split_type']: + serializeDocumentSplitCreateRequestSmartV2026R0SplitTypeField( + val.splitType + ), + ['prompt']: val.prompt, + }; +} +export function deserializeDocumentSplitCreateRequestSmartV2026R0( + val: SerializedData +): DocumentSplitCreateRequestSmartV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "DocumentSplitCreateRequestSmartV2026R0"', + }); + } + if (val.split_type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "split_type" of type "DocumentSplitCreateRequestSmartV2026R0" to be defined', + }); + } + const splitType: DocumentSplitCreateRequestSmartV2026R0SplitTypeField = + deserializeDocumentSplitCreateRequestSmartV2026R0SplitTypeField( + val.split_type + ); + if (val.prompt == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "prompt" of type "DocumentSplitCreateRequestSmartV2026R0" to be defined', + }); + } + if (!sdIsString(val.prompt)) { + throw new BoxSdkError({ + message: + 'Expecting string for "prompt" of type "DocumentSplitCreateRequestSmartV2026R0"', + }); + } + const prompt: string = val.prompt; + return { + splitType: splitType, + prompt: prompt, + } satisfies DocumentSplitCreateRequestSmartV2026R0; +} +export function serializeDocumentSplitCreateRequestSmartV2026R0Input( + val: DocumentSplitCreateRequestSmartV2026R0Input +): SerializedData { + return { + ['splitType']: + val.splitType == void 0 + ? val.splitType + : serializeDocumentSplitCreateRequestSmartV2026R0SplitTypeField( + val.splitType + ), + ['prompt']: val.prompt, + }; +} +export function deserializeDocumentSplitCreateRequestSmartV2026R0Input( + val: SerializedData +): DocumentSplitCreateRequestSmartV2026R0Input { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "DocumentSplitCreateRequestSmartV2026R0Input"', + }); + } + const splitType: + undefined | DocumentSplitCreateRequestSmartV2026R0SplitTypeField = + val.splitType == void 0 + ? void 0 + : deserializeDocumentSplitCreateRequestSmartV2026R0SplitTypeField( + val.splitType + ); + if (val.prompt == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "prompt" of type "DocumentSplitCreateRequestSmartV2026R0Input" to be defined', + }); + } + if (!sdIsString(val.prompt)) { + throw new BoxSdkError({ + message: + 'Expecting string for "prompt" of type "DocumentSplitCreateRequestSmartV2026R0Input"', + }); + } + const prompt: string = val.prompt; + return { + splitType: splitType, + prompt: prompt, + } satisfies DocumentSplitCreateRequestSmartV2026R0Input; +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestTypeV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestTypeV2026R0.ts new file mode 100644 index 00000000..10ea345f --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestTypeV2026R0.ts @@ -0,0 +1,119 @@ +import { serializeDocumentSplitCreateRequestManualV2026R0 } from './documentSplitCreateRequestManualV2026R0'; +import { deserializeDocumentSplitCreateRequestManualV2026R0 } from './documentSplitCreateRequestManualV2026R0'; +import { serializeDocumentSplitCreateRequestPageSelectionV2026R0 } from './documentSplitCreateRequestPageSelectionV2026R0'; +import { deserializeDocumentSplitCreateRequestPageSelectionV2026R0 } from './documentSplitCreateRequestPageSelectionV2026R0'; +import { serializeDocumentSplitCreateRequestSmartV2026R0 } from './documentSplitCreateRequestSmartV2026R0'; +import { deserializeDocumentSplitCreateRequestSmartV2026R0 } from './documentSplitCreateRequestSmartV2026R0'; +import { DocumentSplitCreateRequestManualV2026R0 } from './documentSplitCreateRequestManualV2026R0'; +import { DocumentSplitCreateRequestPageSelectionV2026R0 } from './documentSplitCreateRequestPageSelectionV2026R0'; +import { DocumentSplitCreateRequestSmartV2026R0 } from './documentSplitCreateRequestSmartV2026R0'; +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export type DocumentSplitCreateRequestTypeV2026R0 = + | DocumentSplitCreateRequestManualV2026R0 + | DocumentSplitCreateRequestPageSelectionV2026R0 + | DocumentSplitCreateRequestSmartV2026R0; +export function serializeDocumentSplitCreateRequestTypeV2026R0( + val: any +): SerializedData { + try { + if (val.splitType == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "splitType" of type "DocumentSplitCreateRequestManualV2026R0" to be defined', + }); + } + if (val.splitDefinition == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "splitDefinition" of type "DocumentSplitCreateRequestManualV2026R0" to be defined', + }); + } + if (!sdIsList(val.splitDefinition)) { + throw new BoxSdkError({ + message: + 'Expecting array for "splitDefinition" of type "DocumentSplitCreateRequestManualV2026R0"', + }); + } + return serializeDocumentSplitCreateRequestManualV2026R0(val); + } catch (error) { + void 0; + } finally { + } + try { + if (val.splitType == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "splitType" of type "DocumentSplitCreateRequestPageSelectionV2026R0" to be defined', + }); + } + if (val.pageSelection == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "pageSelection" of type "DocumentSplitCreateRequestPageSelectionV2026R0" to be defined', + }); + } + return serializeDocumentSplitCreateRequestPageSelectionV2026R0(val); + } catch (error) { + void 0; + } finally { + } + try { + if (val.splitType == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "splitType" of type "DocumentSplitCreateRequestSmartV2026R0" to be defined', + }); + } + if (val.prompt == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "prompt" of type "DocumentSplitCreateRequestSmartV2026R0" to be defined', + }); + } + if (!sdIsString(val.prompt)) { + throw new BoxSdkError({ + message: + 'Expecting string for "prompt" of type "DocumentSplitCreateRequestSmartV2026R0"', + }); + } + return serializeDocumentSplitCreateRequestSmartV2026R0(val); + } catch (error) { + void 0; + } finally { + } + throw new BoxSdkError({ + message: "Can't serialize DocumentSplitCreateRequestTypeV2026R0", + }); +} +export function deserializeDocumentSplitCreateRequestTypeV2026R0( + val: SerializedData +): DocumentSplitCreateRequestTypeV2026R0 { + try { + return deserializeDocumentSplitCreateRequestManualV2026R0(val); + } catch (error) { + void 0; + } finally { + } + try { + return deserializeDocumentSplitCreateRequestPageSelectionV2026R0(val); + } catch (error) { + void 0; + } finally { + } + try { + return deserializeDocumentSplitCreateRequestSmartV2026R0(val); + } catch (error) { + void 0; + } finally { + } + throw new BoxSdkError({ + message: "Can't deserialize DocumentSplitCreateRequestTypeV2026R0", + }); +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestV2026R0.ts new file mode 100644 index 00000000..12fbd605 --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitCreateRequestV2026R0.ts @@ -0,0 +1,154 @@ +import { serializeDocumentSplitCreateRequestManualV2026R0 } from './documentSplitCreateRequestManualV2026R0'; +import { deserializeDocumentSplitCreateRequestManualV2026R0 } from './documentSplitCreateRequestManualV2026R0'; +import { serializeDocumentSplitCreateRequestPageSelectionV2026R0 } from './documentSplitCreateRequestPageSelectionV2026R0'; +import { deserializeDocumentSplitCreateRequestPageSelectionV2026R0 } from './documentSplitCreateRequestPageSelectionV2026R0'; +import { serializeDocumentSplitCreateRequestSmartV2026R0 } from './documentSplitCreateRequestSmartV2026R0'; +import { deserializeDocumentSplitCreateRequestSmartV2026R0 } from './documentSplitCreateRequestSmartV2026R0'; +import { serializeDocumentSplitCreateRequestTypeV2026R0 } from './documentSplitCreateRequestTypeV2026R0'; +import { deserializeDocumentSplitCreateRequestTypeV2026R0 } from './documentSplitCreateRequestTypeV2026R0'; +import { DocumentSplitCreateRequestManualV2026R0 } from './documentSplitCreateRequestManualV2026R0'; +import { DocumentSplitCreateRequestPageSelectionV2026R0 } from './documentSplitCreateRequestPageSelectionV2026R0'; +import { DocumentSplitCreateRequestSmartV2026R0 } from './documentSplitCreateRequestSmartV2026R0'; +import { DocumentSplitCreateRequestTypeV2026R0 } from './documentSplitCreateRequestTypeV2026R0'; +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export type DocumentSplitCreateRequestV2026R0InputSourceField = + 'api' | 'box' | 'relay' | 'salesforce' | string; +export interface DocumentSplitCreateRequestV2026R0 { + /** + * The ID of the source file to split. */ + readonly sourceFileId: string; + /** + * The ID of the folder where the resulting files will be uploaded. */ + readonly destinationFolderId: string; + /** + * The system that initiated the request, used for analytics and + * traceability. */ + readonly inputSource: DocumentSplitCreateRequestV2026R0InputSourceField; + readonly splitInput: DocumentSplitCreateRequestTypeV2026R0; + /** + * An optional identifier supplied by the caller for this Document Split job. + * The value is returned on job responses for correlation only. It is not + * a Box resource ID, is not required to be unique, and cannot be used to + * look up the job. */ + readonly externalId?: string; + readonly rawData?: SerializedData; +} +export function serializeDocumentSplitCreateRequestV2026R0InputSourceField( + val: DocumentSplitCreateRequestV2026R0InputSourceField +): SerializedData { + return val; +} +export function deserializeDocumentSplitCreateRequestV2026R0InputSourceField( + val: SerializedData +): DocumentSplitCreateRequestV2026R0InputSourceField { + if (val == 'api') { + return val; + } + if (val == 'box') { + return val; + } + if (val == 'relay') { + return val; + } + if (val == 'salesforce') { + return val; + } + if (sdIsString(val)) { + return val; + } + throw new BoxSdkError({ + message: + "Can't deserialize DocumentSplitCreateRequestV2026R0InputSourceField", + }); +} +export function serializeDocumentSplitCreateRequestV2026R0( + val: DocumentSplitCreateRequestV2026R0 +): SerializedData { + return { + ['source_file_id']: val.sourceFileId, + ['destination_folder_id']: val.destinationFolderId, + ['input_source']: + serializeDocumentSplitCreateRequestV2026R0InputSourceField( + val.inputSource + ), + ['split_input']: serializeDocumentSplitCreateRequestTypeV2026R0( + val.splitInput + ), + ['external_id']: val.externalId, + }; +} +export function deserializeDocumentSplitCreateRequestV2026R0( + val: SerializedData +): DocumentSplitCreateRequestV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "DocumentSplitCreateRequestV2026R0"', + }); + } + if (val.source_file_id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "source_file_id" of type "DocumentSplitCreateRequestV2026R0" to be defined', + }); + } + if (!sdIsString(val.source_file_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "source_file_id" of type "DocumentSplitCreateRequestV2026R0"', + }); + } + const sourceFileId: string = val.source_file_id; + if (val.destination_folder_id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "destination_folder_id" of type "DocumentSplitCreateRequestV2026R0" to be defined', + }); + } + if (!sdIsString(val.destination_folder_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "destination_folder_id" of type "DocumentSplitCreateRequestV2026R0"', + }); + } + const destinationFolderId: string = val.destination_folder_id; + if (val.input_source == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "input_source" of type "DocumentSplitCreateRequestV2026R0" to be defined', + }); + } + const inputSource: DocumentSplitCreateRequestV2026R0InputSourceField = + deserializeDocumentSplitCreateRequestV2026R0InputSourceField( + val.input_source + ); + if (val.split_input == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "split_input" of type "DocumentSplitCreateRequestV2026R0" to be defined', + }); + } + const splitInput: DocumentSplitCreateRequestTypeV2026R0 = + deserializeDocumentSplitCreateRequestTypeV2026R0(val.split_input); + if (!(val.external_id == void 0) && !sdIsString(val.external_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "external_id" of type "DocumentSplitCreateRequestV2026R0"', + }); + } + const externalId: undefined | string = + val.external_id == void 0 ? void 0 : val.external_id; + return { + sourceFileId: sourceFileId, + destinationFolderId: destinationFolderId, + inputSource: inputSource, + splitInput: splitInput, + externalId: externalId, + } satisfies DocumentSplitCreateRequestV2026R0; +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitCreateResponseV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitCreateResponseV2026R0.ts new file mode 100644 index 00000000..5b86e5b5 --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitCreateResponseV2026R0.ts @@ -0,0 +1,137 @@ +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export type DocumentSplitCreateResponseV2026R0TypeField = 'document_split'; +export class DocumentSplitCreateResponseV2026R0 { + /** + * The value will always be `document_split`. */ + readonly type: DocumentSplitCreateResponseV2026R0TypeField = + 'document_split' as DocumentSplitCreateResponseV2026R0TypeField; + /** + * The unique identifier of the created Document Split job. */ + readonly id!: string; + readonly rawData?: SerializedData; + constructor( + fields: Omit & + Partial> + ) { + if (fields.type !== undefined) { + this.type = fields.type; + } + if (fields.id !== undefined) { + this.id = fields.id; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + } +} +export interface DocumentSplitCreateResponseV2026R0Input { + /** + * The value will always be `document_split`. */ + readonly type?: DocumentSplitCreateResponseV2026R0TypeField; + /** + * The unique identifier of the created Document Split job. */ + readonly id: string; + readonly rawData?: SerializedData; +} +export function serializeDocumentSplitCreateResponseV2026R0TypeField( + val: DocumentSplitCreateResponseV2026R0TypeField +): SerializedData { + return val; +} +export function deserializeDocumentSplitCreateResponseV2026R0TypeField( + val: SerializedData +): DocumentSplitCreateResponseV2026R0TypeField { + if (val == 'document_split') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize DocumentSplitCreateResponseV2026R0TypeField", + }); +} +export function serializeDocumentSplitCreateResponseV2026R0( + val: DocumentSplitCreateResponseV2026R0 +): SerializedData { + return { + ['type']: serializeDocumentSplitCreateResponseV2026R0TypeField(val.type), + ['id']: val.id, + }; +} +export function deserializeDocumentSplitCreateResponseV2026R0( + val: SerializedData +): DocumentSplitCreateResponseV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "DocumentSplitCreateResponseV2026R0"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "DocumentSplitCreateResponseV2026R0" to be defined', + }); + } + const type: DocumentSplitCreateResponseV2026R0TypeField = + deserializeDocumentSplitCreateResponseV2026R0TypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "DocumentSplitCreateResponseV2026R0" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "DocumentSplitCreateResponseV2026R0"', + }); + } + const id: string = val.id; + return { type: type, id: id } satisfies DocumentSplitCreateResponseV2026R0; +} +export function serializeDocumentSplitCreateResponseV2026R0Input( + val: DocumentSplitCreateResponseV2026R0Input +): SerializedData { + return { + ['type']: + val.type == void 0 + ? val.type + : serializeDocumentSplitCreateResponseV2026R0TypeField(val.type), + ['id']: val.id, + }; +} +export function deserializeDocumentSplitCreateResponseV2026R0Input( + val: SerializedData +): DocumentSplitCreateResponseV2026R0Input { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "DocumentSplitCreateResponseV2026R0Input"', + }); + } + const type: undefined | DocumentSplitCreateResponseV2026R0TypeField = + val.type == void 0 + ? void 0 + : deserializeDocumentSplitCreateResponseV2026R0TypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "DocumentSplitCreateResponseV2026R0Input" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "DocumentSplitCreateResponseV2026R0Input"', + }); + } + const id: string = val.id; + return { + type: type, + id: id, + } satisfies DocumentSplitCreateResponseV2026R0Input; +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitFailuresV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitFailuresV2026R0.ts new file mode 100644 index 00000000..01c32d23 --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitFailuresV2026R0.ts @@ -0,0 +1,22 @@ +import { serializeDocumentFailuresV2026R0 } from './documentFailuresV2026R0'; +import { deserializeDocumentFailuresV2026R0 } from './documentFailuresV2026R0'; +import { DocumentFailuresV2026R0 } from './documentFailuresV2026R0'; +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export type DocumentSplitFailuresV2026R0 = DocumentFailuresV2026R0; +export function serializeDocumentSplitFailuresV2026R0( + val: DocumentSplitFailuresV2026R0 +): SerializedData { + return serializeDocumentFailuresV2026R0(val); +} +export function deserializeDocumentSplitFailuresV2026R0( + val: SerializedData +): DocumentSplitFailuresV2026R0 { + return deserializeDocumentFailuresV2026R0(val); +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitOutputV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitOutputV2026R0.ts new file mode 100644 index 00000000..240ee0ec --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitOutputV2026R0.ts @@ -0,0 +1,95 @@ +import { serializeFileReferenceV2026R0 } from './fileReferenceV2026R0'; +import { deserializeFileReferenceV2026R0 } from './fileReferenceV2026R0'; +import { serializeDocumentSplitPageRangeV2026R0 } from './documentSplitPageRangeV2026R0'; +import { deserializeDocumentSplitPageRangeV2026R0 } from './documentSplitPageRangeV2026R0'; +import { FileReferenceV2026R0 } from './fileReferenceV2026R0'; +import { DocumentSplitPageRangeV2026R0 } from './documentSplitPageRangeV2026R0'; +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export interface DocumentSplitOutputV2026R0 { + /** + * References to the files that were created by the split. */ + readonly generatedFiles?: readonly FileReferenceV2026R0[]; + /** + * The page ranges that Box produced for a `smart` split. Each entry + * corresponds to one generated file with the inclusive page range + * `[start, end]`. Omitted or `null` for `manual` splits, where the + * caller-supplied ranges are available in `split_input.split_definition`. + * Omitted for `page_selection` splits, where the caller-supplied page + * layout is available in `split_input.page_selection`. */ + readonly splitDefinition?: readonly DocumentSplitPageRangeV2026R0[] | null; + readonly rawData?: SerializedData; +} +export function serializeDocumentSplitOutputV2026R0( + val: DocumentSplitOutputV2026R0 +): SerializedData { + return { + ['generated_files']: + val.generatedFiles == void 0 + ? val.generatedFiles + : (val.generatedFiles.map(function ( + item: FileReferenceV2026R0 + ): SerializedData { + return serializeFileReferenceV2026R0(item); + }) as readonly any[]), + ['split_definition']: + val.splitDefinition == void 0 + ? val.splitDefinition + : (val.splitDefinition.map(function ( + item: DocumentSplitPageRangeV2026R0 + ): SerializedData { + return serializeDocumentSplitPageRangeV2026R0(item); + }) as readonly any[]), + }; +} +export function deserializeDocumentSplitOutputV2026R0( + val: SerializedData +): DocumentSplitOutputV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "DocumentSplitOutputV2026R0"', + }); + } + if (!(val.generated_files == void 0) && !sdIsList(val.generated_files)) { + throw new BoxSdkError({ + message: + 'Expecting array for "generated_files" of type "DocumentSplitOutputV2026R0"', + }); + } + const generatedFiles: undefined | readonly FileReferenceV2026R0[] = + val.generated_files == void 0 + ? void 0 + : sdIsList(val.generated_files) + ? (val.generated_files.map(function ( + itm: SerializedData + ): FileReferenceV2026R0 { + return deserializeFileReferenceV2026R0(itm); + }) as readonly any[]) + : []; + if (!(val.split_definition == void 0) && !sdIsList(val.split_definition)) { + throw new BoxSdkError({ + message: + 'Expecting array for "split_definition" of type "DocumentSplitOutputV2026R0"', + }); + } + const splitDefinition: undefined | readonly DocumentSplitPageRangeV2026R0[] = + val.split_definition == void 0 + ? void 0 + : sdIsList(val.split_definition) + ? (val.split_definition.map(function ( + itm: SerializedData + ): DocumentSplitPageRangeV2026R0 { + return deserializeDocumentSplitPageRangeV2026R0(itm); + }) as readonly any[]) + : []; + return { + generatedFiles: generatedFiles, + splitDefinition: splitDefinition, + } satisfies DocumentSplitOutputV2026R0; +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitPageRangeV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitPageRangeV2026R0.ts new file mode 100644 index 00000000..7d0ec36b --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitPageRangeV2026R0.ts @@ -0,0 +1,58 @@ +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export interface DocumentSplitPageRangeV2026R0 { + /** + * The first page (inclusive) included in this slice. */ + readonly start: number; + /** + * The last page (inclusive) included in this slice. */ + readonly end: number; + readonly rawData?: SerializedData; +} +export function serializeDocumentSplitPageRangeV2026R0( + val: DocumentSplitPageRangeV2026R0 +): SerializedData { + return { ['start']: val.start, ['end']: val.end }; +} +export function deserializeDocumentSplitPageRangeV2026R0( + val: SerializedData +): DocumentSplitPageRangeV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "DocumentSplitPageRangeV2026R0"', + }); + } + if (val.start == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "start" of type "DocumentSplitPageRangeV2026R0" to be defined', + }); + } + if (!sdIsNumber(val.start)) { + throw new BoxSdkError({ + message: + 'Expecting number for "start" of type "DocumentSplitPageRangeV2026R0"', + }); + } + const start: number = val.start; + if (val.end == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "end" of type "DocumentSplitPageRangeV2026R0" to be defined', + }); + } + if (!sdIsNumber(val.end)) { + throw new BoxSdkError({ + message: + 'Expecting number for "end" of type "DocumentSplitPageRangeV2026R0"', + }); + } + const end: number = val.end; + return { start: start, end: end } satisfies DocumentSplitPageRangeV2026R0; +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionItemV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionItemV2026R0.ts new file mode 100644 index 00000000..e42cbeaa --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionItemV2026R0.ts @@ -0,0 +1,80 @@ +import { serializeDocumentSplitPageSelectionSinglePageV2026R0 } from './documentSplitPageSelectionSinglePageV2026R0'; +import { deserializeDocumentSplitPageSelectionSinglePageV2026R0 } from './documentSplitPageSelectionSinglePageV2026R0'; +import { serializeDocumentSplitPageSelectionPageRangeV2026R0 } from './documentSplitPageSelectionPageRangeV2026R0'; +import { deserializeDocumentSplitPageSelectionPageRangeV2026R0 } from './documentSplitPageSelectionPageRangeV2026R0'; +import { serializeDocumentSplitPageSelectionSegmentV2026R0 } from './documentSplitPageSelectionSegmentV2026R0'; +import { deserializeDocumentSplitPageSelectionSegmentV2026R0 } from './documentSplitPageSelectionSegmentV2026R0'; +import { DocumentSplitPageSelectionSinglePageV2026R0 } from './documentSplitPageSelectionSinglePageV2026R0'; +import { DocumentSplitPageSelectionPageRangeV2026R0 } from './documentSplitPageSelectionPageRangeV2026R0'; +import { DocumentSplitPageSelectionSegmentV2026R0 } from './documentSplitPageSelectionSegmentV2026R0'; +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export interface DocumentSplitPageSelectionItemV2026R0 { + /** + * Optional name for the output file (without extension). When omitted the + * system generates a sequential name based on the source file name. */ + readonly name?: string; + /** + * An ordered list of page segments to include in this output file. Each + * segment specifies either a single page or a contiguous page range. */ + readonly segments: readonly DocumentSplitPageSelectionSegmentV2026R0[]; + readonly rawData?: SerializedData; +} +export function serializeDocumentSplitPageSelectionItemV2026R0( + val: DocumentSplitPageSelectionItemV2026R0 +): SerializedData { + return { + ['name']: val.name, + ['segments']: val.segments.map(function ( + item: DocumentSplitPageSelectionSegmentV2026R0 + ): SerializedData { + return serializeDocumentSplitPageSelectionSegmentV2026R0(item); + }) as readonly any[], + }; +} +export function deserializeDocumentSplitPageSelectionItemV2026R0( + val: SerializedData +): DocumentSplitPageSelectionItemV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "DocumentSplitPageSelectionItemV2026R0"', + }); + } + if (!(val.name == void 0) && !sdIsString(val.name)) { + throw new BoxSdkError({ + message: + 'Expecting string for "name" of type "DocumentSplitPageSelectionItemV2026R0"', + }); + } + const name: undefined | string = val.name == void 0 ? void 0 : val.name; + if (val.segments == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "segments" of type "DocumentSplitPageSelectionItemV2026R0" to be defined', + }); + } + if (!sdIsList(val.segments)) { + throw new BoxSdkError({ + message: + 'Expecting array for "segments" of type "DocumentSplitPageSelectionItemV2026R0"', + }); + } + const segments: readonly DocumentSplitPageSelectionSegmentV2026R0[] = + sdIsList(val.segments) + ? (val.segments.map(function ( + itm: SerializedData + ): DocumentSplitPageSelectionSegmentV2026R0 { + return deserializeDocumentSplitPageSelectionSegmentV2026R0(itm); + }) as readonly any[]) + : []; + return { + name: name, + segments: segments, + } satisfies DocumentSplitPageSelectionItemV2026R0; +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionPageRangeV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionPageRangeV2026R0.ts new file mode 100644 index 00000000..a047c28f --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionPageRangeV2026R0.ts @@ -0,0 +1,188 @@ +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export type DocumentSplitPageSelectionPageRangeV2026R0TypeField = 'page_range'; +export class DocumentSplitPageSelectionPageRangeV2026R0 { + /** + * Discriminator. Must be `page_range` for this variant. */ + readonly type: DocumentSplitPageSelectionPageRangeV2026R0TypeField = + 'page_range' as DocumentSplitPageSelectionPageRangeV2026R0TypeField; + /** + * The first page (inclusive) included in this segment. */ + readonly start!: number; + /** + * The last page (inclusive) included in this segment. */ + readonly end!: number; + readonly rawData?: SerializedData; + constructor( + fields: Omit & + Partial> + ) { + if (fields.type !== undefined) { + this.type = fields.type; + } + if (fields.start !== undefined) { + this.start = fields.start; + } + if (fields.end !== undefined) { + this.end = fields.end; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + } +} +export interface DocumentSplitPageSelectionPageRangeV2026R0Input { + /** + * Discriminator. Must be `page_range` for this variant. */ + readonly type?: DocumentSplitPageSelectionPageRangeV2026R0TypeField; + /** + * The first page (inclusive) included in this segment. */ + readonly start: number; + /** + * The last page (inclusive) included in this segment. */ + readonly end: number; + readonly rawData?: SerializedData; +} +export function serializeDocumentSplitPageSelectionPageRangeV2026R0TypeField( + val: DocumentSplitPageSelectionPageRangeV2026R0TypeField +): SerializedData { + return val; +} +export function deserializeDocumentSplitPageSelectionPageRangeV2026R0TypeField( + val: SerializedData +): DocumentSplitPageSelectionPageRangeV2026R0TypeField { + if (val == 'page_range') { + return val; + } + throw new BoxSdkError({ + message: + "Can't deserialize DocumentSplitPageSelectionPageRangeV2026R0TypeField", + }); +} +export function serializeDocumentSplitPageSelectionPageRangeV2026R0( + val: DocumentSplitPageSelectionPageRangeV2026R0 +): SerializedData { + return { + ['type']: serializeDocumentSplitPageSelectionPageRangeV2026R0TypeField( + val.type + ), + ['start']: val.start, + ['end']: val.end, + }; +} +export function deserializeDocumentSplitPageSelectionPageRangeV2026R0( + val: SerializedData +): DocumentSplitPageSelectionPageRangeV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "DocumentSplitPageSelectionPageRangeV2026R0"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "DocumentSplitPageSelectionPageRangeV2026R0" to be defined', + }); + } + const type: DocumentSplitPageSelectionPageRangeV2026R0TypeField = + deserializeDocumentSplitPageSelectionPageRangeV2026R0TypeField(val.type); + if (val.start == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "start" of type "DocumentSplitPageSelectionPageRangeV2026R0" to be defined', + }); + } + if (!sdIsNumber(val.start)) { + throw new BoxSdkError({ + message: + 'Expecting number for "start" of type "DocumentSplitPageSelectionPageRangeV2026R0"', + }); + } + const start: number = val.start; + if (val.end == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "end" of type "DocumentSplitPageSelectionPageRangeV2026R0" to be defined', + }); + } + if (!sdIsNumber(val.end)) { + throw new BoxSdkError({ + message: + 'Expecting number for "end" of type "DocumentSplitPageSelectionPageRangeV2026R0"', + }); + } + const end: number = val.end; + return { + type: type, + start: start, + end: end, + } satisfies DocumentSplitPageSelectionPageRangeV2026R0; +} +export function serializeDocumentSplitPageSelectionPageRangeV2026R0Input( + val: DocumentSplitPageSelectionPageRangeV2026R0Input +): SerializedData { + return { + ['type']: + val.type == void 0 + ? val.type + : serializeDocumentSplitPageSelectionPageRangeV2026R0TypeField( + val.type + ), + ['start']: val.start, + ['end']: val.end, + }; +} +export function deserializeDocumentSplitPageSelectionPageRangeV2026R0Input( + val: SerializedData +): DocumentSplitPageSelectionPageRangeV2026R0Input { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "DocumentSplitPageSelectionPageRangeV2026R0Input"', + }); + } + const type: undefined | DocumentSplitPageSelectionPageRangeV2026R0TypeField = + val.type == void 0 + ? void 0 + : deserializeDocumentSplitPageSelectionPageRangeV2026R0TypeField( + val.type + ); + if (val.start == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "start" of type "DocumentSplitPageSelectionPageRangeV2026R0Input" to be defined', + }); + } + if (!sdIsNumber(val.start)) { + throw new BoxSdkError({ + message: + 'Expecting number for "start" of type "DocumentSplitPageSelectionPageRangeV2026R0Input"', + }); + } + const start: number = val.start; + if (val.end == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "end" of type "DocumentSplitPageSelectionPageRangeV2026R0Input" to be defined', + }); + } + if (!sdIsNumber(val.end)) { + throw new BoxSdkError({ + message: + 'Expecting number for "end" of type "DocumentSplitPageSelectionPageRangeV2026R0Input"', + }); + } + const end: number = val.end; + return { + type: type, + start: start, + end: end, + } satisfies DocumentSplitPageSelectionPageRangeV2026R0Input; +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionSegmentV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionSegmentV2026R0.ts new file mode 100644 index 00000000..6b228a30 --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionSegmentV2026R0.ts @@ -0,0 +1,46 @@ +import { serializeDocumentSplitPageSelectionSinglePageV2026R0 } from './documentSplitPageSelectionSinglePageV2026R0'; +import { deserializeDocumentSplitPageSelectionSinglePageV2026R0 } from './documentSplitPageSelectionSinglePageV2026R0'; +import { serializeDocumentSplitPageSelectionPageRangeV2026R0 } from './documentSplitPageSelectionPageRangeV2026R0'; +import { deserializeDocumentSplitPageSelectionPageRangeV2026R0 } from './documentSplitPageSelectionPageRangeV2026R0'; +import { DocumentSplitPageSelectionSinglePageV2026R0 } from './documentSplitPageSelectionSinglePageV2026R0'; +import { DocumentSplitPageSelectionPageRangeV2026R0 } from './documentSplitPageSelectionPageRangeV2026R0'; +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export type DocumentSplitPageSelectionSegmentV2026R0 = + | DocumentSplitPageSelectionSinglePageV2026R0 + | DocumentSplitPageSelectionPageRangeV2026R0; +export function serializeDocumentSplitPageSelectionSegmentV2026R0( + val: any +): SerializedData { + if (val.type == 'single_page') { + return serializeDocumentSplitPageSelectionSinglePageV2026R0(val); + } + if (val.type == 'page_range') { + return serializeDocumentSplitPageSelectionPageRangeV2026R0(val); + } + throw new BoxSdkError({ message: 'unknown type' }); +} +export function deserializeDocumentSplitPageSelectionSegmentV2026R0( + val: SerializedData +): DocumentSplitPageSelectionSegmentV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "DocumentSplitPageSelectionSegmentV2026R0"', + }); + } + if (val.type == 'single_page') { + return deserializeDocumentSplitPageSelectionSinglePageV2026R0(val); + } + if (val.type == 'page_range') { + return deserializeDocumentSplitPageSelectionPageRangeV2026R0(val); + } + throw new BoxSdkError({ + message: "Can't deserialize DocumentSplitPageSelectionSegmentV2026R0", + }); +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionSinglePageV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionSinglePageV2026R0.ts new file mode 100644 index 00000000..5059d642 --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionSinglePageV2026R0.ts @@ -0,0 +1,150 @@ +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export type DocumentSplitPageSelectionSinglePageV2026R0TypeField = + 'single_page'; +export class DocumentSplitPageSelectionSinglePageV2026R0 { + /** + * Discriminator. Must be `single_page` for this variant. */ + readonly type: DocumentSplitPageSelectionSinglePageV2026R0TypeField = + 'single_page' as DocumentSplitPageSelectionSinglePageV2026R0TypeField; + /** + * A single page number to include. */ + readonly page!: number; + readonly rawData?: SerializedData; + constructor( + fields: Omit & + Partial> + ) { + if (fields.type !== undefined) { + this.type = fields.type; + } + if (fields.page !== undefined) { + this.page = fields.page; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + } +} +export interface DocumentSplitPageSelectionSinglePageV2026R0Input { + /** + * Discriminator. Must be `single_page` for this variant. */ + readonly type?: DocumentSplitPageSelectionSinglePageV2026R0TypeField; + /** + * A single page number to include. */ + readonly page: number; + readonly rawData?: SerializedData; +} +export function serializeDocumentSplitPageSelectionSinglePageV2026R0TypeField( + val: DocumentSplitPageSelectionSinglePageV2026R0TypeField +): SerializedData { + return val; +} +export function deserializeDocumentSplitPageSelectionSinglePageV2026R0TypeField( + val: SerializedData +): DocumentSplitPageSelectionSinglePageV2026R0TypeField { + if (val == 'single_page') { + return val; + } + throw new BoxSdkError({ + message: + "Can't deserialize DocumentSplitPageSelectionSinglePageV2026R0TypeField", + }); +} +export function serializeDocumentSplitPageSelectionSinglePageV2026R0( + val: DocumentSplitPageSelectionSinglePageV2026R0 +): SerializedData { + return { + ['type']: serializeDocumentSplitPageSelectionSinglePageV2026R0TypeField( + val.type + ), + ['page']: val.page, + }; +} +export function deserializeDocumentSplitPageSelectionSinglePageV2026R0( + val: SerializedData +): DocumentSplitPageSelectionSinglePageV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "DocumentSplitPageSelectionSinglePageV2026R0"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "DocumentSplitPageSelectionSinglePageV2026R0" to be defined', + }); + } + const type: DocumentSplitPageSelectionSinglePageV2026R0TypeField = + deserializeDocumentSplitPageSelectionSinglePageV2026R0TypeField(val.type); + if (val.page == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "page" of type "DocumentSplitPageSelectionSinglePageV2026R0" to be defined', + }); + } + if (!sdIsNumber(val.page)) { + throw new BoxSdkError({ + message: + 'Expecting number for "page" of type "DocumentSplitPageSelectionSinglePageV2026R0"', + }); + } + const page: number = val.page; + return { + type: type, + page: page, + } satisfies DocumentSplitPageSelectionSinglePageV2026R0; +} +export function serializeDocumentSplitPageSelectionSinglePageV2026R0Input( + val: DocumentSplitPageSelectionSinglePageV2026R0Input +): SerializedData { + return { + ['type']: + val.type == void 0 + ? val.type + : serializeDocumentSplitPageSelectionSinglePageV2026R0TypeField( + val.type + ), + ['page']: val.page, + }; +} +export function deserializeDocumentSplitPageSelectionSinglePageV2026R0Input( + val: SerializedData +): DocumentSplitPageSelectionSinglePageV2026R0Input { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: + 'Expecting a map for "DocumentSplitPageSelectionSinglePageV2026R0Input"', + }); + } + const type: undefined | DocumentSplitPageSelectionSinglePageV2026R0TypeField = + val.type == void 0 + ? void 0 + : deserializeDocumentSplitPageSelectionSinglePageV2026R0TypeField( + val.type + ); + if (val.page == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "page" of type "DocumentSplitPageSelectionSinglePageV2026R0Input" to be defined', + }); + } + if (!sdIsNumber(val.page)) { + throw new BoxSdkError({ + message: + 'Expecting number for "page" of type "DocumentSplitPageSelectionSinglePageV2026R0Input"', + }); + } + const page: number = val.page; + return { + type: type, + page: page, + } satisfies DocumentSplitPageSelectionSinglePageV2026R0Input; +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionV2026R0.ts new file mode 100644 index 00000000..a5bf5b8a --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitPageSelectionV2026R0.ts @@ -0,0 +1,33 @@ +import { serializeDocumentSplitPageSelectionItemV2026R0 } from './documentSplitPageSelectionItemV2026R0'; +import { deserializeDocumentSplitPageSelectionItemV2026R0 } from './documentSplitPageSelectionItemV2026R0'; +import { DocumentSplitPageSelectionItemV2026R0 } from './documentSplitPageSelectionItemV2026R0'; +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export type DocumentSplitPageSelectionV2026R0 = + readonly DocumentSplitPageSelectionItemV2026R0[]; +export function serializeDocumentSplitPageSelectionV2026R0( + val: DocumentSplitPageSelectionV2026R0 +): SerializedData { + return val.map(function ( + item: DocumentSplitPageSelectionItemV2026R0 + ): SerializedData { + return serializeDocumentSplitPageSelectionItemV2026R0(item); + }) as readonly any[]; +} +export function deserializeDocumentSplitPageSelectionV2026R0( + val: SerializedData +): DocumentSplitPageSelectionV2026R0 { + return sdIsList(val) + ? (val.map(function ( + itm: SerializedData + ): DocumentSplitPageSelectionItemV2026R0 { + return deserializeDocumentSplitPageSelectionItemV2026R0(itm); + }) as readonly any[]) + : []; +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitV2026R0.ts new file mode 100644 index 00000000..483a0b50 --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitV2026R0.ts @@ -0,0 +1,550 @@ +import { serializeDocumentSplitCreateRequestManualV2026R0 } from './documentSplitCreateRequestManualV2026R0'; +import { deserializeDocumentSplitCreateRequestManualV2026R0 } from './documentSplitCreateRequestManualV2026R0'; +import { serializeDocumentSplitCreateRequestPageSelectionV2026R0 } from './documentSplitCreateRequestPageSelectionV2026R0'; +import { deserializeDocumentSplitCreateRequestPageSelectionV2026R0 } from './documentSplitCreateRequestPageSelectionV2026R0'; +import { serializeDocumentSplitCreateRequestSmartV2026R0 } from './documentSplitCreateRequestSmartV2026R0'; +import { deserializeDocumentSplitCreateRequestSmartV2026R0 } from './documentSplitCreateRequestSmartV2026R0'; +import { serializeFileReferenceV2026R0 } from './fileReferenceV2026R0'; +import { deserializeFileReferenceV2026R0 } from './fileReferenceV2026R0'; +import { serializeDocumentSplitCreateRequestTypeV2026R0 } from './documentSplitCreateRequestTypeV2026R0'; +import { deserializeDocumentSplitCreateRequestTypeV2026R0 } from './documentSplitCreateRequestTypeV2026R0'; +import { serializeDocumentSplitOutputV2026R0 } from './documentSplitOutputV2026R0'; +import { deserializeDocumentSplitOutputV2026R0 } from './documentSplitOutputV2026R0'; +import { serializeFolderReferenceV2026R0 } from './folderReferenceV2026R0'; +import { deserializeFolderReferenceV2026R0 } from './folderReferenceV2026R0'; +import { serializeUserMiniV2026R0 } from './userMiniV2026R0'; +import { deserializeUserMiniV2026R0 } from './userMiniV2026R0'; +import { serializeEnterpriseReferenceV2026R0 } from './enterpriseReferenceV2026R0'; +import { deserializeEnterpriseReferenceV2026R0 } from './enterpriseReferenceV2026R0'; +import { serializeDocumentSplitFailuresV2026R0 } from './documentSplitFailuresV2026R0'; +import { deserializeDocumentSplitFailuresV2026R0 } from './documentSplitFailuresV2026R0'; +import { serializeDateTime } from '../../internal/utils'; +import { deserializeDateTime } from '../../internal/utils'; +import { DocumentSplitCreateRequestManualV2026R0 } from './documentSplitCreateRequestManualV2026R0'; +import { DocumentSplitCreateRequestPageSelectionV2026R0 } from './documentSplitCreateRequestPageSelectionV2026R0'; +import { DocumentSplitCreateRequestSmartV2026R0 } from './documentSplitCreateRequestSmartV2026R0'; +import { FileReferenceV2026R0 } from './fileReferenceV2026R0'; +import { DocumentSplitCreateRequestTypeV2026R0 } from './documentSplitCreateRequestTypeV2026R0'; +import { DocumentSplitOutputV2026R0 } from './documentSplitOutputV2026R0'; +import { FolderReferenceV2026R0 } from './folderReferenceV2026R0'; +import { UserMiniV2026R0 } from './userMiniV2026R0'; +import { EnterpriseReferenceV2026R0 } from './enterpriseReferenceV2026R0'; +import { DocumentSplitFailuresV2026R0 } from './documentSplitFailuresV2026R0'; +import { BoxSdkError } from '../../box/errors'; +import { DateTime } from '../../internal/utils'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export type DocumentSplitV2026R0TypeField = 'document_split'; +export type DocumentSplitV2026R0StatusField = + 'submitted' | 'completed' | 'failed' | 'completed_with_error' | string; +export type DocumentSplitV2026R0InputSourceField = + 'api' | 'box' | 'relay' | 'salesforce' | string; +export class DocumentSplitV2026R0 { + /** + * The unique identifier for the Document Split job. */ + readonly id!: string; + /** + * The value will always be `document_split`. */ + readonly type: DocumentSplitV2026R0TypeField = + 'document_split' as DocumentSplitV2026R0TypeField; + readonly sourceFile!: FileReferenceV2026R0; + /** + * The current state of the Document Split job. */ + readonly status!: DocumentSplitV2026R0StatusField; + readonly splitInput!: DocumentSplitCreateRequestTypeV2026R0; + /** + * The result of the Document Split job. `null` until the job has produced + * output. */ + readonly output?: DocumentSplitOutputV2026R0; + readonly destinationFolder!: FolderReferenceV2026R0; + /** + * The system that initiated the request, used for analytics and + * traceability. */ + readonly inputSource!: DocumentSplitV2026R0InputSourceField; + /** + * When the Document Split job was created. */ + readonly createdAt?: DateTime; + readonly createdBy?: UserMiniV2026R0; + readonly enterprise?: EnterpriseReferenceV2026R0; + /** + * Errors and warnings that occurred during the document split. `null` when + * no failures were recorded. */ + readonly failures?: DocumentSplitFailuresV2026R0; + /** + * An optional identifier supplied by the caller when the Document Split + * job was created. Returned for correlation only. It is not a Box + * resource ID, is not required to be unique, and cannot be used to + * look up the job. */ + readonly externalId?: string; + readonly rawData?: SerializedData; + constructor( + fields: Omit & + Partial> + ) { + if (fields.id !== undefined) { + this.id = fields.id; + } + if (fields.type !== undefined) { + this.type = fields.type; + } + if (fields.sourceFile !== undefined) { + this.sourceFile = fields.sourceFile; + } + if (fields.status !== undefined) { + this.status = fields.status; + } + if (fields.splitInput !== undefined) { + this.splitInput = fields.splitInput; + } + if (fields.output !== undefined) { + this.output = fields.output; + } + if (fields.destinationFolder !== undefined) { + this.destinationFolder = fields.destinationFolder; + } + if (fields.inputSource !== undefined) { + this.inputSource = fields.inputSource; + } + if (fields.createdAt !== undefined) { + this.createdAt = fields.createdAt; + } + if (fields.createdBy !== undefined) { + this.createdBy = fields.createdBy; + } + if (fields.enterprise !== undefined) { + this.enterprise = fields.enterprise; + } + if (fields.failures !== undefined) { + this.failures = fields.failures; + } + if (fields.externalId !== undefined) { + this.externalId = fields.externalId; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + } +} +export interface DocumentSplitV2026R0Input { + /** + * The unique identifier for the Document Split job. */ + readonly id: string; + /** + * The value will always be `document_split`. */ + readonly type?: DocumentSplitV2026R0TypeField; + readonly sourceFile: FileReferenceV2026R0; + /** + * The current state of the Document Split job. */ + readonly status: DocumentSplitV2026R0StatusField; + readonly splitInput: DocumentSplitCreateRequestTypeV2026R0; + /** + * The result of the Document Split job. `null` until the job has produced + * output. */ + readonly output?: DocumentSplitOutputV2026R0; + readonly destinationFolder: FolderReferenceV2026R0; + /** + * The system that initiated the request, used for analytics and + * traceability. */ + readonly inputSource: DocumentSplitV2026R0InputSourceField; + /** + * When the Document Split job was created. */ + readonly createdAt?: DateTime; + readonly createdBy?: UserMiniV2026R0; + readonly enterprise?: EnterpriseReferenceV2026R0; + /** + * Errors and warnings that occurred during the document split. `null` when + * no failures were recorded. */ + readonly failures?: DocumentSplitFailuresV2026R0; + /** + * An optional identifier supplied by the caller when the Document Split + * job was created. Returned for correlation only. It is not a Box + * resource ID, is not required to be unique, and cannot be used to + * look up the job. */ + readonly externalId?: string; + readonly rawData?: SerializedData; +} +export function serializeDocumentSplitV2026R0TypeField( + val: DocumentSplitV2026R0TypeField +): SerializedData { + return val; +} +export function deserializeDocumentSplitV2026R0TypeField( + val: SerializedData +): DocumentSplitV2026R0TypeField { + if (val == 'document_split') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize DocumentSplitV2026R0TypeField", + }); +} +export function serializeDocumentSplitV2026R0StatusField( + val: DocumentSplitV2026R0StatusField +): SerializedData { + return val; +} +export function deserializeDocumentSplitV2026R0StatusField( + val: SerializedData +): DocumentSplitV2026R0StatusField { + if (val == 'submitted') { + return val; + } + if (val == 'completed') { + return val; + } + if (val == 'failed') { + return val; + } + if (val == 'completed_with_error') { + return val; + } + if (sdIsString(val)) { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize DocumentSplitV2026R0StatusField", + }); +} +export function serializeDocumentSplitV2026R0InputSourceField( + val: DocumentSplitV2026R0InputSourceField +): SerializedData { + return val; +} +export function deserializeDocumentSplitV2026R0InputSourceField( + val: SerializedData +): DocumentSplitV2026R0InputSourceField { + if (val == 'api') { + return val; + } + if (val == 'box') { + return val; + } + if (val == 'relay') { + return val; + } + if (val == 'salesforce') { + return val; + } + if (sdIsString(val)) { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize DocumentSplitV2026R0InputSourceField", + }); +} +export function serializeDocumentSplitV2026R0( + val: DocumentSplitV2026R0 +): SerializedData { + return { + ['id']: val.id, + ['type']: serializeDocumentSplitV2026R0TypeField(val.type), + ['source_file']: serializeFileReferenceV2026R0(val.sourceFile), + ['status']: serializeDocumentSplitV2026R0StatusField(val.status), + ['split_input']: serializeDocumentSplitCreateRequestTypeV2026R0( + val.splitInput + ), + ['output']: + val.output == void 0 + ? val.output + : serializeDocumentSplitOutputV2026R0(val.output), + ['destination_folder']: serializeFolderReferenceV2026R0( + val.destinationFolder + ), + ['input_source']: serializeDocumentSplitV2026R0InputSourceField( + val.inputSource + ), + ['created_at']: + val.createdAt == void 0 + ? val.createdAt + : serializeDateTime(val.createdAt), + ['created_by']: + val.createdBy == void 0 + ? val.createdBy + : serializeUserMiniV2026R0(val.createdBy), + ['enterprise']: + val.enterprise == void 0 + ? val.enterprise + : serializeEnterpriseReferenceV2026R0(val.enterprise), + ['failures']: + val.failures == void 0 + ? val.failures + : serializeDocumentSplitFailuresV2026R0(val.failures), + ['external_id']: val.externalId, + }; +} +export function deserializeDocumentSplitV2026R0( + val: SerializedData +): DocumentSplitV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "DocumentSplitV2026R0"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "DocumentSplitV2026R0" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "DocumentSplitV2026R0"', + }); + } + const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "DocumentSplitV2026R0" to be defined', + }); + } + const type: DocumentSplitV2026R0TypeField = + deserializeDocumentSplitV2026R0TypeField(val.type); + if (val.source_file == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "source_file" of type "DocumentSplitV2026R0" to be defined', + }); + } + const sourceFile: FileReferenceV2026R0 = deserializeFileReferenceV2026R0( + val.source_file + ); + if (val.status == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "status" of type "DocumentSplitV2026R0" to be defined', + }); + } + const status: DocumentSplitV2026R0StatusField = + deserializeDocumentSplitV2026R0StatusField(val.status); + if (val.split_input == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "split_input" of type "DocumentSplitV2026R0" to be defined', + }); + } + const splitInput: DocumentSplitCreateRequestTypeV2026R0 = + deserializeDocumentSplitCreateRequestTypeV2026R0(val.split_input); + const output: DocumentSplitOutputV2026R0 | undefined = + val.output == void 0 + ? void 0 + : deserializeDocumentSplitOutputV2026R0(val.output); + if (val.destination_folder == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "destination_folder" of type "DocumentSplitV2026R0" to be defined', + }); + } + const destinationFolder: FolderReferenceV2026R0 = + deserializeFolderReferenceV2026R0(val.destination_folder); + if (val.input_source == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "input_source" of type "DocumentSplitV2026R0" to be defined', + }); + } + const inputSource: DocumentSplitV2026R0InputSourceField = + deserializeDocumentSplitV2026R0InputSourceField(val.input_source); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "DocumentSplitV2026R0"', + }); + } + const createdAt: undefined | DateTime = + val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + const createdBy: undefined | UserMiniV2026R0 = + val.created_by == void 0 + ? void 0 + : deserializeUserMiniV2026R0(val.created_by); + const enterprise: undefined | EnterpriseReferenceV2026R0 = + val.enterprise == void 0 + ? void 0 + : deserializeEnterpriseReferenceV2026R0(val.enterprise); + const failures: DocumentSplitFailuresV2026R0 | undefined = + val.failures == void 0 + ? void 0 + : deserializeDocumentSplitFailuresV2026R0(val.failures); + if (!(val.external_id == void 0) && !sdIsString(val.external_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "external_id" of type "DocumentSplitV2026R0"', + }); + } + const externalId: undefined | string = + val.external_id == void 0 ? void 0 : val.external_id; + return { + id: id, + type: type, + sourceFile: sourceFile, + status: status, + splitInput: splitInput, + output: output, + destinationFolder: destinationFolder, + inputSource: inputSource, + createdAt: createdAt, + createdBy: createdBy, + enterprise: enterprise, + failures: failures, + externalId: externalId, + } satisfies DocumentSplitV2026R0; +} +export function serializeDocumentSplitV2026R0Input( + val: DocumentSplitV2026R0Input +): SerializedData { + return { + ['id']: val.id, + ['type']: + val.type == void 0 + ? val.type + : serializeDocumentSplitV2026R0TypeField(val.type), + ['source_file']: serializeFileReferenceV2026R0(val.sourceFile), + ['status']: serializeDocumentSplitV2026R0StatusField(val.status), + ['split_input']: serializeDocumentSplitCreateRequestTypeV2026R0( + val.splitInput + ), + ['output']: + val.output == void 0 + ? val.output + : serializeDocumentSplitOutputV2026R0(val.output), + ['destination_folder']: serializeFolderReferenceV2026R0( + val.destinationFolder + ), + ['input_source']: serializeDocumentSplitV2026R0InputSourceField( + val.inputSource + ), + ['created_at']: + val.createdAt == void 0 + ? val.createdAt + : serializeDateTime(val.createdAt), + ['created_by']: + val.createdBy == void 0 + ? val.createdBy + : serializeUserMiniV2026R0(val.createdBy), + ['enterprise']: + val.enterprise == void 0 + ? val.enterprise + : serializeEnterpriseReferenceV2026R0(val.enterprise), + ['failures']: + val.failures == void 0 + ? val.failures + : serializeDocumentSplitFailuresV2026R0(val.failures), + ['external_id']: val.externalId, + }; +} +export function deserializeDocumentSplitV2026R0Input( + val: SerializedData +): DocumentSplitV2026R0Input { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "DocumentSplitV2026R0Input"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "DocumentSplitV2026R0Input" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "DocumentSplitV2026R0Input"', + }); + } + const id: string = val.id; + const type: undefined | DocumentSplitV2026R0TypeField = + val.type == void 0 + ? void 0 + : deserializeDocumentSplitV2026R0TypeField(val.type); + if (val.source_file == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "source_file" of type "DocumentSplitV2026R0Input" to be defined', + }); + } + const sourceFile: FileReferenceV2026R0 = deserializeFileReferenceV2026R0( + val.source_file + ); + if (val.status == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "status" of type "DocumentSplitV2026R0Input" to be defined', + }); + } + const status: DocumentSplitV2026R0StatusField = + deserializeDocumentSplitV2026R0StatusField(val.status); + if (val.split_input == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "split_input" of type "DocumentSplitV2026R0Input" to be defined', + }); + } + const splitInput: DocumentSplitCreateRequestTypeV2026R0 = + deserializeDocumentSplitCreateRequestTypeV2026R0(val.split_input); + const output: DocumentSplitOutputV2026R0 | undefined = + val.output == void 0 + ? void 0 + : deserializeDocumentSplitOutputV2026R0(val.output); + if (val.destination_folder == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "destination_folder" of type "DocumentSplitV2026R0Input" to be defined', + }); + } + const destinationFolder: FolderReferenceV2026R0 = + deserializeFolderReferenceV2026R0(val.destination_folder); + if (val.input_source == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "input_source" of type "DocumentSplitV2026R0Input" to be defined', + }); + } + const inputSource: DocumentSplitV2026R0InputSourceField = + deserializeDocumentSplitV2026R0InputSourceField(val.input_source); + if (!(val.created_at == void 0) && !sdIsString(val.created_at)) { + throw new BoxSdkError({ + message: + 'Expecting string for "created_at" of type "DocumentSplitV2026R0Input"', + }); + } + const createdAt: undefined | DateTime = + val.created_at == void 0 ? void 0 : deserializeDateTime(val.created_at); + const createdBy: undefined | UserMiniV2026R0 = + val.created_by == void 0 + ? void 0 + : deserializeUserMiniV2026R0(val.created_by); + const enterprise: undefined | EnterpriseReferenceV2026R0 = + val.enterprise == void 0 + ? void 0 + : deserializeEnterpriseReferenceV2026R0(val.enterprise); + const failures: DocumentSplitFailuresV2026R0 | undefined = + val.failures == void 0 + ? void 0 + : deserializeDocumentSplitFailuresV2026R0(val.failures); + if (!(val.external_id == void 0) && !sdIsString(val.external_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "external_id" of type "DocumentSplitV2026R0Input"', + }); + } + const externalId: undefined | string = + val.external_id == void 0 ? void 0 : val.external_id; + return { + id: id, + type: type, + sourceFile: sourceFile, + status: status, + splitInput: splitInput, + output: output, + destinationFolder: destinationFolder, + inputSource: inputSource, + createdAt: createdAt, + createdBy: createdBy, + enterprise: enterprise, + failures: failures, + externalId: externalId, + } satisfies DocumentSplitV2026R0Input; +} diff --git a/src/sdk-gen/schemas/v2026R0/documentSplitsV2026R0.ts b/src/sdk-gen/schemas/v2026R0/documentSplitsV2026R0.ts new file mode 100644 index 00000000..a6f9f69c --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/documentSplitsV2026R0.ts @@ -0,0 +1,84 @@ +import { serializeDocumentSplitV2026R0 } from './documentSplitV2026R0'; +import { deserializeDocumentSplitV2026R0 } from './documentSplitV2026R0'; +import { DocumentSplitV2026R0 } from './documentSplitV2026R0'; +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export interface DocumentSplitsV2026R0 { + /** + * A list of Document Split jobs. */ + readonly entries?: readonly DocumentSplitV2026R0[]; + /** + * The limit that was used for these entries. This will be the same as the + * `limit` query parameter unless that value exceeded the maximum value + * allowed. The maximum value varies by API. */ + readonly limit?: number; + /** + * The marker for the start of the next page of results. */ + readonly nextMarker?: string | null; + readonly rawData?: SerializedData; +} +export function serializeDocumentSplitsV2026R0( + val: DocumentSplitsV2026R0 +): SerializedData { + return { + ['entries']: + val.entries == void 0 + ? val.entries + : (val.entries.map(function ( + item: DocumentSplitV2026R0 + ): SerializedData { + return serializeDocumentSplitV2026R0(item); + }) as readonly any[]), + ['limit']: val.limit, + ['next_marker']: val.nextMarker, + }; +} +export function deserializeDocumentSplitsV2026R0( + val: SerializedData +): DocumentSplitsV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "DocumentSplitsV2026R0"', + }); + } + if (!(val.entries == void 0) && !sdIsList(val.entries)) { + throw new BoxSdkError({ + message: 'Expecting array for "entries" of type "DocumentSplitsV2026R0"', + }); + } + const entries: undefined | readonly DocumentSplitV2026R0[] = + val.entries == void 0 + ? void 0 + : sdIsList(val.entries) + ? (val.entries.map(function ( + itm: SerializedData + ): DocumentSplitV2026R0 { + return deserializeDocumentSplitV2026R0(itm); + }) as readonly any[]) + : []; + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "DocumentSplitsV2026R0"', + }); + } + 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 "DocumentSplitsV2026R0"', + }); + } + const nextMarker: undefined | string = + val.next_marker == void 0 ? void 0 : val.next_marker; + return { + entries: entries, + limit: limit, + nextMarker: nextMarker, + } satisfies DocumentSplitsV2026R0; +} diff --git a/src/sdk-gen/schemas/v2026R0/enterpriseReferenceV2026R0.ts b/src/sdk-gen/schemas/v2026R0/enterpriseReferenceV2026R0.ts new file mode 100644 index 00000000..a2f16a68 --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/enterpriseReferenceV2026R0.ts @@ -0,0 +1,133 @@ +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export type EnterpriseReferenceV2026R0TypeField = 'enterprise'; +export class EnterpriseReferenceV2026R0 { + /** + * The unique identifier for this enterprise. */ + readonly id!: string; + /** + * The value will always be `enterprise`. */ + readonly type: EnterpriseReferenceV2026R0TypeField = + 'enterprise' as EnterpriseReferenceV2026R0TypeField; + readonly rawData?: SerializedData; + constructor( + fields: Omit & + Partial> + ) { + if (fields.id !== undefined) { + this.id = fields.id; + } + if (fields.type !== undefined) { + this.type = fields.type; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + } +} +export interface EnterpriseReferenceV2026R0Input { + /** + * The unique identifier for this enterprise. */ + readonly id: string; + /** + * The value will always be `enterprise`. */ + readonly type?: EnterpriseReferenceV2026R0TypeField; + readonly rawData?: SerializedData; +} +export function serializeEnterpriseReferenceV2026R0TypeField( + val: EnterpriseReferenceV2026R0TypeField +): SerializedData { + return val; +} +export function deserializeEnterpriseReferenceV2026R0TypeField( + val: SerializedData +): EnterpriseReferenceV2026R0TypeField { + if (val == 'enterprise') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize EnterpriseReferenceV2026R0TypeField", + }); +} +export function serializeEnterpriseReferenceV2026R0( + val: EnterpriseReferenceV2026R0 +): SerializedData { + return { + ['id']: val.id, + ['type']: serializeEnterpriseReferenceV2026R0TypeField(val.type), + }; +} +export function deserializeEnterpriseReferenceV2026R0( + val: SerializedData +): EnterpriseReferenceV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "EnterpriseReferenceV2026R0"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "EnterpriseReferenceV2026R0" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "EnterpriseReferenceV2026R0"', + }); + } + const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "EnterpriseReferenceV2026R0" to be defined', + }); + } + const type: EnterpriseReferenceV2026R0TypeField = + deserializeEnterpriseReferenceV2026R0TypeField(val.type); + return { id: id, type: type } satisfies EnterpriseReferenceV2026R0; +} +export function serializeEnterpriseReferenceV2026R0Input( + val: EnterpriseReferenceV2026R0Input +): SerializedData { + return { + ['id']: val.id, + ['type']: + val.type == void 0 + ? val.type + : serializeEnterpriseReferenceV2026R0TypeField(val.type), + }; +} +export function deserializeEnterpriseReferenceV2026R0Input( + val: SerializedData +): EnterpriseReferenceV2026R0Input { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "EnterpriseReferenceV2026R0Input"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "EnterpriseReferenceV2026R0Input" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "EnterpriseReferenceV2026R0Input"', + }); + } + const id: string = val.id; + const type: undefined | EnterpriseReferenceV2026R0TypeField = + val.type == void 0 + ? void 0 + : deserializeEnterpriseReferenceV2026R0TypeField(val.type); + return { id: id, type: type } satisfies EnterpriseReferenceV2026R0Input; +} diff --git a/src/sdk-gen/schemas/v2026R0/fileReferenceV2026R0.ts b/src/sdk-gen/schemas/v2026R0/fileReferenceV2026R0.ts new file mode 100644 index 00000000..c4e5bbc0 --- /dev/null +++ b/src/sdk-gen/schemas/v2026R0/fileReferenceV2026R0.ts @@ -0,0 +1,130 @@ +import { BoxSdkError } from '../../box/errors'; +import { SerializedData } from '../../serialization/json'; +import { sdIsEmpty } from '../../serialization/json'; +import { sdIsBoolean } from '../../serialization/json'; +import { sdIsNumber } from '../../serialization/json'; +import { sdIsString } from '../../serialization/json'; +import { sdIsList } from '../../serialization/json'; +import { sdIsMap } from '../../serialization/json'; +export type FileReferenceV2026R0TypeField = 'file'; +export class FileReferenceV2026R0 { + /** + * The value will always be `file`. */ + readonly type: FileReferenceV2026R0TypeField = + 'file' as FileReferenceV2026R0TypeField; + /** + * ID of the file. */ + readonly id!: string; + readonly rawData?: SerializedData; + constructor( + fields: Omit & + Partial> + ) { + if (fields.type !== undefined) { + this.type = fields.type; + } + if (fields.id !== undefined) { + this.id = fields.id; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + } +} +export interface FileReferenceV2026R0Input { + /** + * The value will always be `file`. */ + readonly type?: FileReferenceV2026R0TypeField; + /** + * ID of the file. */ + readonly id: string; + readonly rawData?: SerializedData; +} +export function serializeFileReferenceV2026R0TypeField( + val: FileReferenceV2026R0TypeField +): SerializedData { + return val; +} +export function deserializeFileReferenceV2026R0TypeField( + val: SerializedData +): FileReferenceV2026R0TypeField { + if (val == 'file') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize FileReferenceV2026R0TypeField", + }); +} +export function serializeFileReferenceV2026R0( + val: FileReferenceV2026R0 +): SerializedData { + return { + ['type']: serializeFileReferenceV2026R0TypeField(val.type), + ['id']: val.id, + }; +} +export function deserializeFileReferenceV2026R0( + val: SerializedData +): FileReferenceV2026R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileReferenceV2026R0"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: 'Expecting "type" of type "FileReferenceV2026R0" to be defined', + }); + } + const type: FileReferenceV2026R0TypeField = + deserializeFileReferenceV2026R0TypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "FileReferenceV2026R0" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileReferenceV2026R0"', + }); + } + const id: string = val.id; + return { type: type, id: id } satisfies FileReferenceV2026R0; +} +export function serializeFileReferenceV2026R0Input( + val: FileReferenceV2026R0Input +): SerializedData { + return { + ['type']: + val.type == void 0 + ? val.type + : serializeFileReferenceV2026R0TypeField(val.type), + ['id']: val.id, + }; +} +export function deserializeFileReferenceV2026R0Input( + val: SerializedData +): FileReferenceV2026R0Input { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "FileReferenceV2026R0Input"', + }); + } + const type: undefined | FileReferenceV2026R0TypeField = + val.type == void 0 + ? void 0 + : deserializeFileReferenceV2026R0TypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "FileReferenceV2026R0Input" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "FileReferenceV2026R0Input"', + }); + } + const id: string = val.id; + return { type: type, id: id } satisfies FileReferenceV2026R0Input; +} diff --git a/src/sdk-gen/schemas/v2026R0/index.ts b/src/sdk-gen/schemas/v2026R0/index.ts index feafb66c..e7e31853 100644 --- a/src/sdk-gen/schemas/v2026R0/index.ts +++ b/src/sdk-gen/schemas/v2026R0/index.ts @@ -1,6 +1,23 @@ export * from './automateWorkflowReferenceV2026R0'; export * from './automateWorkflowStartRequestV2026R0'; export * from './clientErrorV2026R0'; +export * from './documentFailuresV2026R0'; +export * from './documentSplitFailuresV2026R0'; +export * from './documentSplitCreateRequestSmartV2026R0'; +export * from './documentSplitCreateResponseV2026R0'; +export * from './documentSplitPageRangeV2026R0'; +export * from './documentSplitCreateRequestManualV2026R0'; +export * from './documentSplitPageSelectionPageRangeV2026R0'; +export * from './documentSplitPageSelectionSinglePageV2026R0'; +export * from './documentSplitPageSelectionSegmentV2026R0'; +export * from './documentSplitPageSelectionItemV2026R0'; +export * from './documentSplitPageSelectionV2026R0'; +export * from './documentSplitCreateRequestPageSelectionV2026R0'; +export * from './documentSplitCreateRequestTypeV2026R0'; +export * from './documentSplitCreateRequestV2026R0'; +export * from './enterpriseReferenceV2026R0'; +export * from './fileReferenceV2026R0'; +export * from './documentSplitOutputV2026R0'; export * from './folderReferenceV2026R0'; export * from './notesConvertRequestBodyV2026R0'; export * from './notesConvertResponseV2026R0'; @@ -17,5 +34,7 @@ export * from './queryResultEntryV2026R0'; export * from './queryResultsV2026R0'; export * from './userBaseV2026R0'; export * from './userMiniV2026R0'; +export * from './documentSplitV2026R0'; +export * from './documentSplitsV2026R0'; export * from './automateWorkflowActionV2026R0'; export * from './automateWorkflowsV2026R0'; diff --git a/src/sdk-gen/schemas/webLink.ts b/src/sdk-gen/schemas/webLink.ts index d3db771b..3324d51c 100644 --- a/src/sdk-gen/schemas/webLink.ts +++ b/src/sdk-gen/schemas/webLink.ts @@ -8,6 +8,8 @@ import { serializeFolderMini } from './folderMini'; import { deserializeFolderMini } from './folderMini'; import { serializeUserMini } from './userMini'; import { deserializeUserMini } from './userMini'; +import { serializeSharedLinkOtpAllowlistEntry } from './sharedLinkOtpAllowlistEntry'; +import { deserializeSharedLinkOtpAllowlistEntry } from './sharedLinkOtpAllowlistEntry'; import { serializeCollection } from './collection'; import { deserializeCollection } from './collection'; import { serializeDateTime } from '../internal/utils'; @@ -17,6 +19,7 @@ import { WebLinkBase } from './webLinkBase'; import { WebLinkMini } from './webLinkMini'; import { FolderMini } from './folderMini'; import { UserMini } from './userMini'; +import { SharedLinkOtpAllowlistEntry } from './sharedLinkOtpAllowlistEntry'; import { Collection } from './collection'; import { BoxSdkError } from '../box/errors'; import { DateTime } from '../internal/utils'; @@ -64,6 +67,35 @@ export interface WebLinkSharedLinkPermissionsField { readonly canEdit: boolean; readonly rawData?: SerializedData; } +export interface WebLinkSharedLinkOneTimePasscodeField { + /** + * The current OTP enforcement mode for the shared link. + * + * * `none` - OTP enforcement is turned off. The shared link is accessible + * without any one-time-passcode verification. + * * `open` - Any anonymous recipient can request a one-time-passcode to + * any email address and access the shared link after verifying it. + * Collaborators and registered Box users access the link without + * being prompted. + * * `allowlist` - Anonymous recipients can request a one-time-passcode + * only when they enter an email that matches an entry on the + * `allowlist`. */ + readonly mode: string; + /** + * The list of email and domain entries that are permitted to access the + * shared link when `mode` is `allowlist`. Anonymous users whose + * email matches an entry can request and verify a one-time-passcode. + * + * Because the entries carry recipient email addresses and the identity + * of the user who added them, this field is only returned to users + * with owner, co-owner, or editor access on the item. For viewer + * collaborators and below the field is omitted. + * + * An allowlist contains at most 1000 entries, matching the limit + * enforced when setting the allowlist on a shared link. */ + readonly allowlist?: readonly SharedLinkOtpAllowlistEntry[]; + readonly rawData?: SerializedData; +} export interface WebLinkSharedLinkField { /** * The URL that can be used to access the item on Box. @@ -129,6 +161,7 @@ export interface WebLinkSharedLinkField { /** * The number of times this item has been previewed. */ readonly previewCount: number; + readonly oneTimePasscode: WebLinkSharedLinkOneTimePasscodeField; readonly rawData?: SerializedData; } export type WebLinkItemStatusField = 'active' | 'trashed' | 'deleted' | string; @@ -385,6 +418,63 @@ export function deserializeWebLinkSharedLinkPermissionsField( canEdit: canEdit, } satisfies WebLinkSharedLinkPermissionsField; } +export function serializeWebLinkSharedLinkOneTimePasscodeField( + val: WebLinkSharedLinkOneTimePasscodeField +): SerializedData { + return { + ['mode']: val.mode, + ['allowlist']: + val.allowlist == void 0 + ? val.allowlist + : (val.allowlist.map(function ( + item: SharedLinkOtpAllowlistEntry + ): SerializedData { + return serializeSharedLinkOtpAllowlistEntry(item); + }) as readonly any[]), + }; +} +export function deserializeWebLinkSharedLinkOneTimePasscodeField( + val: SerializedData +): WebLinkSharedLinkOneTimePasscodeField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "WebLinkSharedLinkOneTimePasscodeField"', + }); + } + if (val.mode == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "mode" of type "WebLinkSharedLinkOneTimePasscodeField" to be defined', + }); + } + if (!sdIsString(val.mode)) { + throw new BoxSdkError({ + message: + 'Expecting string for "mode" of type "WebLinkSharedLinkOneTimePasscodeField"', + }); + } + const mode: string = val.mode; + if (!(val.allowlist == void 0) && !sdIsList(val.allowlist)) { + throw new BoxSdkError({ + message: + 'Expecting array for "allowlist" of type "WebLinkSharedLinkOneTimePasscodeField"', + }); + } + const allowlist: undefined | readonly SharedLinkOtpAllowlistEntry[] = + val.allowlist == void 0 + ? void 0 + : sdIsList(val.allowlist) + ? (val.allowlist.map(function ( + itm: SerializedData + ): SharedLinkOtpAllowlistEntry { + return deserializeSharedLinkOtpAllowlistEntry(itm); + }) as readonly any[]) + : []; + return { + mode: mode, + allowlist: allowlist, + } satisfies WebLinkSharedLinkOneTimePasscodeField; +} export function serializeWebLinkSharedLinkField( val: WebLinkSharedLinkField ): SerializedData { @@ -415,6 +505,9 @@ export function serializeWebLinkSharedLinkField( : serializeWebLinkSharedLinkPermissionsField(val.permissions), ['download_count']: val.downloadCount, ['preview_count']: val.previewCount, + ['one_time_passcode']: serializeWebLinkSharedLinkOneTimePasscodeField( + val.oneTimePasscode + ), }; } export function deserializeWebLinkSharedLinkField( @@ -533,6 +626,14 @@ export function deserializeWebLinkSharedLinkField( }); } const previewCount: number = val.preview_count; + if (val.one_time_passcode == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "one_time_passcode" of type "WebLinkSharedLinkField" to be defined', + }); + } + const oneTimePasscode: WebLinkSharedLinkOneTimePasscodeField = + deserializeWebLinkSharedLinkOneTimePasscodeField(val.one_time_passcode); return { url: url, downloadUrl: downloadUrl, @@ -546,6 +647,7 @@ export function deserializeWebLinkSharedLinkField( permissions: permissions, downloadCount: downloadCount, previewCount: previewCount, + oneTimePasscode: oneTimePasscode, } satisfies WebLinkSharedLinkField; } export function serializeWebLinkItemStatusField(