From 0798d0b85d386559155cab0dbe5348c4e2726c23 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Tue, 31 Mar 2026 02:49:17 -0700 Subject: [PATCH 1/3] feat: Enable new hubs endpoints (box/box-codegen#930) --- .codegen.json | 2 +- docs/README.md | 1 + docs/hubDocument.md | 68 ++++ package-lock.json | 254 +++++++------- src/client.ts | 7 + src/managers/hubDocument.ts | 330 ++++++++++++++++++ src/managers/index.ts | 1 + .../v2025R0/hubCalloutBoxTextBlockV2025R0.ts | 133 +++++++ src/schemas/v2025R0/hubDividerBlockV2025R0.ts | 108 ++++++ .../v2025R0/hubDocumentBlockEntryV2025R0.ts | 76 ++++ .../v2025R0/hubDocumentBlockV2025R0.ts | 51 +++ .../v2025R0/hubDocumentBlocksV2025R0.ts | 238 +++++++++++++ src/schemas/v2025R0/hubDocumentPageV2025R0.ts | 92 +++++ .../v2025R0/hubDocumentPagesV2025R0.ts | 218 ++++++++++++ .../v2025R0/hubItemListBlockV2025R0.ts | 108 ++++++ .../v2025R0/hubParagraphTextBlockV2025R0.ts | 133 +++++++ .../hubSectionTitleTextBlockV2025R0.ts | 133 +++++++ src/schemas/v2025R0/index.ts | 10 + src/test/hubDocument.test.ts | 91 +++++ 19 files changed, 1926 insertions(+), 128 deletions(-) create mode 100644 docs/hubDocument.md create mode 100644 src/managers/hubDocument.ts create mode 100644 src/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.ts create mode 100644 src/schemas/v2025R0/hubDividerBlockV2025R0.ts create mode 100644 src/schemas/v2025R0/hubDocumentBlockEntryV2025R0.ts create mode 100644 src/schemas/v2025R0/hubDocumentBlockV2025R0.ts create mode 100644 src/schemas/v2025R0/hubDocumentBlocksV2025R0.ts create mode 100644 src/schemas/v2025R0/hubDocumentPageV2025R0.ts create mode 100644 src/schemas/v2025R0/hubDocumentPagesV2025R0.ts create mode 100644 src/schemas/v2025R0/hubItemListBlockV2025R0.ts create mode 100644 src/schemas/v2025R0/hubParagraphTextBlockV2025R0.ts create mode 100644 src/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.ts create mode 100644 src/test/hubDocument.test.ts diff --git a/.codegen.json b/.codegen.json index 4cb098394..168441c6b 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "02fdae4", "specHash": "c8e3a85", "version": "10.5.0" } +{ "engineHash": "e77f966", "specHash": "c8e3a85", "version": "10.5.0" } diff --git a/docs/README.md b/docs/README.md index afdf05a95..fc80c7fa6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -48,6 +48,7 @@ the SDK are available by topic: - [Folders](folders.md) - [Groups](groups.md) - [Hub collaborations](hubCollaborations.md) +- [Hub document](hubDocument.md) - [Hub items](hubItems.md) - [Hubs](hubs.md) - [Integration mappings](integrationMappings.md) diff --git a/docs/hubDocument.md b/docs/hubDocument.md new file mode 100644 index 000000000..ca8fa1a26 --- /dev/null +++ b/docs/hubDocument.md @@ -0,0 +1,68 @@ +# HubDocumentManager + +- [List Hub Document Pages](#list-hub-document-pages) +- [List Hub Document blocks for page](#list-hub-document-blocks-for-page) + +## List Hub Document Pages + +Retrieves a list of Hub Document Pages for the specified hub. +Includes both root-level pages and sub pages. + +This operation is performed by calling function `getHubDocumentPagesV2025R0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2025.0/get-hub-document-pages/). + + + +```ts +await client.hubDocument.getHubDocumentPagesV2025R0({ + hubId: hubId, +} satisfies GetHubDocumentPagesV2025R0QueryParams); +``` + +### Arguments + +- queryParams `GetHubDocumentPagesV2025R0QueryParams` + - Query parameters of getHubDocumentPagesV2025R0 method +- optionalsInput `GetHubDocumentPagesV2025R0OptionalsInput` + +### Returns + +This function returns a value of type `HubDocumentPagesV2025R0`. + +Returns a Hub Document Pages response whose `entries` array contains root-level pages and sub pages. Includes pagination when more results are available. + +## List Hub Document blocks for page + +Retrieves a sorted list of all Hub Document Blocks on a specified page in the hub document, excluding items. +Blocks are hierarchically organized by their `parent_id`. +Blocks are sorted in order based on user specification in the user interface. +The response will only include content blocks that belong to the specified page. This will not include sub pages or sub page content blocks. + +This operation is performed by calling function `getHubDocumentBlocksV2025R0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2025.0/get-hub-document-blocks/). + + + +```ts +await client.hubDocument.getHubDocumentBlocksV2025R0({ + hubId: hubId, + pageId: pageId, +} satisfies GetHubDocumentBlocksV2025R0QueryParams); +``` + +### Arguments + +- queryParams `GetHubDocumentBlocksV2025R0QueryParams` + - Query parameters of getHubDocumentBlocksV2025R0 method +- optionalsInput `GetHubDocumentBlocksV2025R0OptionalsInput` + +### Returns + +This function returns a value of type `HubDocumentBlocksV2025R0`. + +Returns a Hub Document Blocks response whose `entries` array contains all content blocks of the specified page, except for items. +To retrieve items, use the `GET /hub_items` endpoint. diff --git a/package-lock.json b/package-lock.json index 36f7624cf..6b1e305a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -749,9 +749,9 @@ } }, "node_modules/@jest/reporters/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", + "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", "dev": true, "license": "MIT", "dependencies": { @@ -1122,9 +1122,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.0.tgz", - "integrity": "sha512-WOhNW9K8bR3kf4zLxbfg6Pxu2ybOUbB2AjMDHSQx86LIF4rH4Ft7vmMwNt0loO0eonglSNy4cpD3MKXXKQu0/A==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.1.tgz", + "integrity": "sha512-d6FinEBLdIiK+1uACUttJKfgZREXrF0Qc2SmLII7W2AD8FfiZ9Wjd+rD/iRuf5s5dWrr1GgwXCvPqOuDquOowA==", "cpu": [ "arm" ], @@ -1136,9 +1136,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.60.0.tgz", - "integrity": "sha512-u6JHLll5QKRvjciE78bQXDmqRqNs5M/3GVqZeMwvmjaNODJih/WIrJlFVEihvV0MiYFmd+ZyPr9wxOVbPAG2Iw==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.60.1.tgz", + "integrity": "sha512-YjG/EwIDvvYI1YvYbHvDz/BYHtkY4ygUIXHnTdLhG+hKIQFBiosfWiACWortsKPKU/+dUwQQCKQM3qrDe8c9BA==", "cpu": [ "arm64" ], @@ -1150,9 +1150,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.60.0.tgz", - "integrity": "sha512-qEF7CsKKzSRc20Ciu2Zw1wRrBz4g56F7r/vRwY430UPp/nt1x21Q/fpJ9N5l47WWvJlkNCPJz3QRVw008fi7yA==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.60.1.tgz", + "integrity": "sha512-mjCpF7GmkRtSJwon+Rq1N8+pI+8l7w5g9Z3vWj4T7abguC4Czwi3Yu/pFaLvA3TTeMVjnu3ctigusqWUfjZzvw==", "cpu": [ "arm64" ], @@ -1164,9 +1164,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.60.0.tgz", - "integrity": "sha512-WADYozJ4QCnXCH4wPB+3FuGmDPoFseVCUrANmA5LWwGmC6FL14BWC7pcq+FstOZv3baGX65tZ378uT6WG8ynTw==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.60.1.tgz", + "integrity": "sha512-haZ7hJ1JT4e9hqkoT9R/19XW2QKqjfJVv+i5AGg57S+nLk9lQnJ1F/eZloRO3o9Scy9CM3wQ9l+dkXtcBgN5Ew==", "cpu": [ "x64" ], @@ -1178,9 +1178,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.60.0.tgz", - "integrity": "sha512-6b8wGHJlDrGeSE3aH5mGNHBjA0TTkxdoNHik5EkvPHCt351XnigA4pS7Wsj/Eo9Y8RBU6f35cjN9SYmCFBtzxw==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.60.1.tgz", + "integrity": "sha512-czw90wpQq3ZsAVBlinZjAYTKduOjTywlG7fEeWKUA7oCmpA8xdTkxZZlwNJKWqILlq0wehoZcJYfBvOyhPTQ6w==", "cpu": [ "arm64" ], @@ -1192,9 +1192,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.60.0.tgz", - "integrity": "sha512-h25Ga0t4jaylMB8M/JKAyrvvfxGRjnPQIR8lnCayyzEjEOx2EJIlIiMbhpWxDRKGKF8jbNH01NnN663dH638mA==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.60.1.tgz", + "integrity": "sha512-KVB2rqsxTHuBtfOeySEyzEOB7ltlB/ux38iu2rBQzkjbwRVlkhAGIEDiiYnO2kFOkJp+Z7pUXKyrRRFuFUKt+g==", "cpu": [ "x64" ], @@ -1206,9 +1206,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.60.0.tgz", - "integrity": "sha512-RzeBwv0B3qtVBWtcuABtSuCzToo2IEAIQrcyB/b2zMvBWVbjo8bZDjACUpnaafaxhTw2W+imQbP2BD1usasK4g==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.60.1.tgz", + "integrity": "sha512-L+34Qqil+v5uC0zEubW7uByo78WOCIrBvci69E7sFASRl0X7b/MB6Cqd1lky/CtcSVTydWa2WZwFuWexjS5o6g==", "cpu": [ "arm" ], @@ -1220,9 +1220,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.60.0.tgz", - "integrity": "sha512-Sf7zusNI2CIU1HLzuu9Tc5YGAHEZs5Lu7N1ssJG4Tkw6e0MEsN7NdjUDDfGNHy2IU+ENyWT+L2obgWiguWibWQ==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.60.1.tgz", + "integrity": "sha512-n83O8rt4v34hgFzlkb1ycniJh7IR5RCIqt6mz1VRJD6pmhRi0CXdmfnLu9dIUS6buzh60IvACM842Ffb3xd6Gg==", "cpu": [ "arm" ], @@ -1234,9 +1234,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.60.0.tgz", - "integrity": "sha512-DX2x7CMcrJzsE91q7/O02IJQ5/aLkVtYFryqCjduJhUfGKG6yJV8hxaw8pZa93lLEpPTP/ohdN4wFz7yp/ry9A==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.60.1.tgz", + "integrity": "sha512-Nql7sTeAzhTAja3QXeAI48+/+GjBJ+QmAH13snn0AJSNL50JsDqotyudHyMbO2RbJkskbMbFJfIJKWA6R1LCJQ==", "cpu": [ "arm64" ], @@ -1248,9 +1248,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.60.0.tgz", - "integrity": "sha512-09EL+yFVbJZlhcQfShpswwRZ0Rg+z/CsSELFCnPt3iK+iqwGsI4zht3secj5vLEs957QvFFXnzAT0FFPIxSrkQ==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.60.1.tgz", + "integrity": "sha512-+pUymDhd0ys9GcKZPPWlFiZ67sTWV5UU6zOJat02M1+PiuSGDziyRuI/pPue3hoUwm2uGfxdL+trT6Z9rxnlMA==", "cpu": [ "arm64" ], @@ -1262,9 +1262,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.60.0.tgz", - "integrity": "sha512-i9IcCMPr3EXm8EQg5jnja0Zyc1iFxJjZWlb4wr7U2Wx/GrddOuEafxRdMPRYVaXjgbhvqalp6np07hN1w9kAKw==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.60.1.tgz", + "integrity": "sha512-VSvgvQeIcsEvY4bKDHEDWcpW4Yw7BtlKG1GUT4FzBUlEKQK0rWHYBqQt6Fm2taXS+1bXvJT6kICu5ZwqKCnvlQ==", "cpu": [ "loong64" ], @@ -1276,9 +1276,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.60.0.tgz", - "integrity": "sha512-DGzdJK9kyJ+B78MCkWeGnpXJ91tK/iKA6HwHxF4TAlPIY7GXEvMe8hBFRgdrR9Ly4qebR/7gfUs9y2IoaVEyog==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.60.1.tgz", + "integrity": "sha512-4LqhUomJqwe641gsPp6xLfhqWMbQV04KtPp7/dIp0nzPxAkNY1AbwL5W0MQpcalLYk07vaW9Kp1PBhdpZYYcEw==", "cpu": [ "loong64" ], @@ -1290,9 +1290,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.60.0.tgz", - "integrity": "sha512-RwpnLsqC8qbS8z1H1AxBA1H6qknR4YpPR9w2XX0vo2Sz10miu57PkNcnHVaZkbqyw/kUWfKMI73jhmfi9BRMUQ==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.60.1.tgz", + "integrity": "sha512-tLQQ9aPvkBxOc/EUT6j3pyeMD6Hb8QF2BTBnCQWP/uu1lhc9AIrIjKnLYMEroIz/JvtGYgI9dF3AxHZNaEH0rw==", "cpu": [ "ppc64" ], @@ -1304,9 +1304,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.60.0.tgz", - "integrity": "sha512-Z8pPf54Ly3aqtdWC3G4rFigZgNvd+qJlOE52fmko3KST9SoGfAdSRCwyoyG05q1HrrAblLbk1/PSIV+80/pxLg==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.60.1.tgz", + "integrity": "sha512-RMxFhJwc9fSXP6PqmAz4cbv3kAyvD1etJFjTx4ONqFP9DkTkXsAMU4v3Vyc5BgzC+anz7nS/9tp4obsKfqkDHg==", "cpu": [ "ppc64" ], @@ -1318,9 +1318,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.60.0.tgz", - "integrity": "sha512-3a3qQustp3COCGvnP4SvrMHnPQ9d1vzCakQVRTliaz8cIp/wULGjiGpbcqrkv0WrHTEp8bQD/B3HBjzujVWLOA==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.60.1.tgz", + "integrity": "sha512-QKgFl+Yc1eEk6MmOBfRHYF6lTxiiiV3/z/BRrbSiW2I7AFTXoBFvdMEyglohPj//2mZS4hDOqeB0H1ACh3sBbg==", "cpu": [ "riscv64" ], @@ -1332,9 +1332,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.60.0.tgz", - "integrity": "sha512-pjZDsVH/1VsghMJ2/kAaxt6dL0psT6ZexQVrijczOf+PeP2BUqTHYejk3l6TlPRydggINOeNRhvpLa0AYpCWSQ==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.60.1.tgz", + "integrity": "sha512-RAjXjP/8c6ZtzatZcA1RaQr6O1TRhzC+adn8YZDnChliZHviqIjmvFwHcxi4JKPSDAt6Uhf/7vqcBzQJy0PDJg==", "cpu": [ "riscv64" ], @@ -1346,9 +1346,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.60.0.tgz", - "integrity": "sha512-3ObQs0BhvPgiUVZrN7gqCSvmFuMWvWvsjG5ayJ3Lraqv+2KhOsp+pUbigqbeWqueGIsnn+09HBw27rJ+gYK4VQ==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.60.1.tgz", + "integrity": "sha512-wcuocpaOlaL1COBYiA89O6yfjlp3RwKDeTIA0hM7OpmhR1Bjo9j31G1uQVpDlTvwxGn2nQs65fBFL5UFd76FcQ==", "cpu": [ "s390x" ], @@ -1360,9 +1360,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.60.0.tgz", - "integrity": "sha512-EtylprDtQPdS5rXvAayrNDYoJhIz1/vzN2fEubo3yLE7tfAw+948dO0g4M0vkTVFhKojnF+n6C8bDNe+gDRdTg==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.60.1.tgz", + "integrity": "sha512-77PpsFQUCOiZR9+LQEFg9GClyfkNXj1MP6wRnzYs0EeWbPcHs02AXu4xuUbM1zhwn3wqaizle3AEYg5aeoohhg==", "cpu": [ "x64" ], @@ -1374,9 +1374,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.60.0.tgz", - "integrity": "sha512-k09oiRCi/bHU9UVFqD17r3eJR9bn03TyKraCrlz5ULFJGdJGi7VOmm9jl44vOJvRJ6P7WuBi/s2A97LxxHGIdw==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.60.1.tgz", + "integrity": "sha512-5cIATbk5vynAjqqmyBjlciMJl1+R/CwX9oLk/EyiFXDWd95KpHdrOJT//rnUl4cUcskrd0jCCw3wpZnhIHdD9w==", "cpu": [ "x64" ], @@ -1388,9 +1388,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.60.0.tgz", - "integrity": "sha512-1o/0/pIhozoSaDJoDcec+IVLbnRtQmHwPV730+AOD29lHEEo4F5BEUB24H0OBdhbBBDwIOSuf7vgg0Ywxdfiiw==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.60.1.tgz", + "integrity": "sha512-cl0w09WsCi17mcmWqqglez9Gk8isgeWvoUZ3WiJFYSR3zjBQc2J5/ihSjpl+VLjPqjQ/1hJRcqBfLjssREQILw==", "cpu": [ "x64" ], @@ -1402,9 +1402,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.60.0.tgz", - "integrity": "sha512-pESDkos/PDzYwtyzB5p/UoNU/8fJo68vcXM9ZW2V0kjYayj1KaaUfi1NmTUTUpMn4UhU4gTuK8gIaFO4UGuMbA==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.60.1.tgz", + "integrity": "sha512-4Cv23ZrONRbNtbZa37mLSueXUCtN7MXccChtKpUnQNgF010rjrjfHx3QxkS2PI7LqGT5xXyYs1a7LbzAwT0iCA==", "cpu": [ "arm64" ], @@ -1416,9 +1416,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.60.0.tgz", - "integrity": "sha512-hj1wFStD7B1YBeYmvY+lWXZ7ey73YGPcViMShYikqKT1GtstIKQAtfUI6yrzPjAy/O7pO0VLXGmUVWXQMaYgTQ==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.60.1.tgz", + "integrity": "sha512-i1okWYkA4FJICtr7KpYzFpRTHgy5jdDbZiWfvny21iIKky5YExiDXP+zbXzm3dUcFpkEeYNHgQ5fuG236JPq0g==", "cpu": [ "arm64" ], @@ -1430,9 +1430,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.60.0.tgz", - "integrity": "sha512-SyaIPFoxmUPlNDq5EHkTbiKzmSEmq/gOYFI/3HHJ8iS/v1mbugVa7dXUzcJGQfoytp9DJFLhHH4U3/eTy2Bq4w==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.60.1.tgz", + "integrity": "sha512-u09m3CuwLzShA0EYKMNiFgcjjzwqtUMLmuCJLeZWjjOYA3IT2Di09KaxGBTP9xVztWyIWjVdsB2E9goMjZvTQg==", "cpu": [ "ia32" ], @@ -1444,9 +1444,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.60.0.tgz", - "integrity": "sha512-RdcryEfzZr+lAr5kRm2ucN9aVlCCa2QNq4hXelZxb8GG0NJSazq44Z3PCCc8wISRuCVnGs0lQJVX5Vp6fKA+IA==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.60.1.tgz", + "integrity": "sha512-k+600V9Zl1CM7eZxJgMyTUzmrmhB/0XZnF4pRypKAlAgxmedUA+1v9R+XOFv56W4SlHEzfeMtzujLJD22Uz5zg==", "cpu": [ "x64" ], @@ -1458,9 +1458,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.60.0.tgz", - "integrity": "sha512-PrsWNQ8BuE00O3Xsx3ALh2Df8fAj9+cvvX9AIA6o4KpATR98c9mud4XtDWVvsEuyia5U4tVSTKygawyJkjm60w==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.60.1.tgz", + "integrity": "sha512-lWMnixq/QzxyhTV6NjQJ4SFo1J6PvOX8vUx5Wb4bBPsEb+8xZ89Bz6kOXpfXj9ak9AHTQVQzlgzBEc1SyM27xQ==", "cpu": [ "x64" ], @@ -2226,9 +2226,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.10.10", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.10.tgz", - "integrity": "sha512-sUoJ3IMxx4AyRqO4MLeHlnGDkyXRoUG0/AI9fjK+vS72ekpV0yWVY7O0BVjmBcRtkNcsAO2QDZ4tdKKGoI6YaQ==", + "version": "2.10.12", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.12.tgz", + "integrity": "sha512-qyq26DxfY4awP2gIRXhhLWfwzwI+N5Nxk6iQi8EFizIaWIjqicQTE4sLnZZVdeKPRcVNoJOkkpfzoIYuvCKaIQ==", "dev": true, "license": "Apache-2.0", "bin": { @@ -2261,9 +2261,9 @@ } }, "node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.3.tgz", + "integrity": "sha512-MCV/fYJEbqx68aE58kv2cA/kiky1G8vux3OR6/jbS+jIMe/6fJWa0DTzJU7dqijOWYwHi1t29FlfYI9uytqlpA==", "dev": true, "license": "MIT", "dependencies": { @@ -2405,9 +2405,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001781", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001781.tgz", - "integrity": "sha512-RdwNCyMsNBftLjW6w01z8bKEvT6e/5tpPVEgtn22TiLGlstHOVecsX2KHFkD5e/vRnIE4EGzpuIODb3mtswtkw==", + "version": "1.0.30001782", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001782.tgz", + "integrity": "sha512-dZcaJLJeDMh4rELYFw1tvSn1bhZWYFOt468FcbHHxx/Z/dFidd1I6ciyFdi3iwfQCyOjqo9upF6lGQYtMiJWxw==", "dev": true, "funding": [ { @@ -2766,9 +2766,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.325", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.325.tgz", - "integrity": "sha512-PwfIw7WQSt3xX7yOf5OE/unLzsK9CaN2f/FvV3WjPR1Knoc1T9vePRVV4W1EM301JzzysK51K7FNKcusCr0zYA==", + "version": "1.5.329", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.329.tgz", + "integrity": "sha512-/4t+AS1l4S3ZC0Ja7PHFIWeBIxGA3QGqV8/yKsP36v7NcyUCl+bIcmw6s5zVuMIECWwBrAK/6QLzTmbJChBboQ==", "dev": true, "license": "ISC" }, @@ -3955,9 +3955,9 @@ } }, "node_modules/jest-config/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", + "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", "dev": true, "license": "MIT", "dependencies": { @@ -4297,9 +4297,9 @@ } }, "node_modules/jest-runtime/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", + "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", "dev": true, "license": "MIT", "dependencies": { @@ -5396,9 +5396,9 @@ } }, "node_modules/rollup": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.0.tgz", - "integrity": "sha512-yqjxruMGBQJ2gG4HtjZtAfXArHomazDHoFwFFmZZl0r7Pdo7qCIXKqKHZc8yeoMgzJJ+pO6pEEHa+V7uzWlrAQ==", + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.1.tgz", + "integrity": "sha512-VmtB2rFU/GroZ4oL8+ZqXgSA38O6GR8KSIvWmEFv63pQ0G6KaBH9s07PO8XTXP4vI+3UJUEypOfjkGfmSBBR0w==", "dev": true, "license": "MIT", "dependencies": { @@ -5412,31 +5412,31 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.60.0", - "@rollup/rollup-android-arm64": "4.60.0", - "@rollup/rollup-darwin-arm64": "4.60.0", - "@rollup/rollup-darwin-x64": "4.60.0", - "@rollup/rollup-freebsd-arm64": "4.60.0", - "@rollup/rollup-freebsd-x64": "4.60.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.60.0", - "@rollup/rollup-linux-arm-musleabihf": "4.60.0", - "@rollup/rollup-linux-arm64-gnu": "4.60.0", - "@rollup/rollup-linux-arm64-musl": "4.60.0", - "@rollup/rollup-linux-loong64-gnu": "4.60.0", - "@rollup/rollup-linux-loong64-musl": "4.60.0", - "@rollup/rollup-linux-ppc64-gnu": "4.60.0", - "@rollup/rollup-linux-ppc64-musl": "4.60.0", - "@rollup/rollup-linux-riscv64-gnu": "4.60.0", - "@rollup/rollup-linux-riscv64-musl": "4.60.0", - "@rollup/rollup-linux-s390x-gnu": "4.60.0", - "@rollup/rollup-linux-x64-gnu": "4.60.0", - "@rollup/rollup-linux-x64-musl": "4.60.0", - "@rollup/rollup-openbsd-x64": "4.60.0", - "@rollup/rollup-openharmony-arm64": "4.60.0", - "@rollup/rollup-win32-arm64-msvc": "4.60.0", - "@rollup/rollup-win32-ia32-msvc": "4.60.0", - "@rollup/rollup-win32-x64-gnu": "4.60.0", - "@rollup/rollup-win32-x64-msvc": "4.60.0", + "@rollup/rollup-android-arm-eabi": "4.60.1", + "@rollup/rollup-android-arm64": "4.60.1", + "@rollup/rollup-darwin-arm64": "4.60.1", + "@rollup/rollup-darwin-x64": "4.60.1", + "@rollup/rollup-freebsd-arm64": "4.60.1", + "@rollup/rollup-freebsd-x64": "4.60.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.60.1", + "@rollup/rollup-linux-arm-musleabihf": "4.60.1", + "@rollup/rollup-linux-arm64-gnu": "4.60.1", + "@rollup/rollup-linux-arm64-musl": "4.60.1", + "@rollup/rollup-linux-loong64-gnu": "4.60.1", + "@rollup/rollup-linux-loong64-musl": "4.60.1", + "@rollup/rollup-linux-ppc64-gnu": "4.60.1", + "@rollup/rollup-linux-ppc64-musl": "4.60.1", + "@rollup/rollup-linux-riscv64-gnu": "4.60.1", + "@rollup/rollup-linux-riscv64-musl": "4.60.1", + "@rollup/rollup-linux-s390x-gnu": "4.60.1", + "@rollup/rollup-linux-x64-gnu": "4.60.1", + "@rollup/rollup-linux-x64-musl": "4.60.1", + "@rollup/rollup-openbsd-x64": "4.60.1", + "@rollup/rollup-openharmony-arm64": "4.60.1", + "@rollup/rollup-win32-arm64-msvc": "4.60.1", + "@rollup/rollup-win32-ia32-msvc": "4.60.1", + "@rollup/rollup-win32-x64-gnu": "4.60.1", + "@rollup/rollup-win32-x64-msvc": "4.60.1", "fsevents": "~2.3.2" } }, @@ -5860,9 +5860,9 @@ } }, "node_modules/test-exclude/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", + "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", "dev": true, "license": "MIT", "dependencies": { diff --git a/src/client.ts b/src/client.ts index 38719f207..4ad1a608b 100644 --- a/src/client.ts +++ b/src/client.ts @@ -81,6 +81,7 @@ import { EnterpriseConfigurationsManager } from './managers/enterpriseConfigurat import { HubsManager } from './managers/hubs'; import { HubCollaborationsManager } from './managers/hubCollaborations'; import { HubItemsManager } from './managers/hubItems'; +import { HubDocumentManager } from './managers/hubDocument'; import { ShieldListsManager } from './managers/shieldLists'; import { ArchivesManager } from './managers/archives'; import { ExternalUsersManager } from './managers/externalUsers'; @@ -185,6 +186,7 @@ export class BoxClient { readonly hubs: HubsManager; readonly hubCollaborations: HubCollaborationsManager; readonly hubItems: HubItemsManager; + readonly hubDocument: HubDocumentManager; readonly shieldLists: ShieldListsManager; readonly archives: ArchivesManager; readonly externalUsers: ExternalUsersManager; @@ -270,6 +272,7 @@ export class BoxClient { | 'hubs' | 'hubCollaborations' | 'hubItems' + | 'hubDocument' | 'shieldLists' | 'archives' | 'externalUsers' @@ -614,6 +617,10 @@ export class BoxClient { auth: this.auth, networkSession: this.networkSession, }); + this.hubDocument = new HubDocumentManager({ + auth: this.auth, + networkSession: this.networkSession, + }); this.shieldLists = new ShieldListsManager({ auth: this.auth, networkSession: this.networkSession, diff --git a/src/managers/hubDocument.ts b/src/managers/hubDocument.ts new file mode 100644 index 000000000..db044bec0 --- /dev/null +++ b/src/managers/hubDocument.ts @@ -0,0 +1,330 @@ +import { serializeHubDocumentPagesV2025R0 } from '../schemas/v2025R0/hubDocumentPagesV2025R0'; +import { deserializeHubDocumentPagesV2025R0 } from '../schemas/v2025R0/hubDocumentPagesV2025R0'; +import { serializeClientErrorV2025R0 } from '../schemas/v2025R0/clientErrorV2025R0'; +import { deserializeClientErrorV2025R0 } from '../schemas/v2025R0/clientErrorV2025R0'; +import { serializeBoxVersionHeaderV2025R0 } from '../parameters/v2025R0/boxVersionHeaderV2025R0'; +import { deserializeBoxVersionHeaderV2025R0 } from '../parameters/v2025R0/boxVersionHeaderV2025R0'; +import { serializeHubDocumentBlocksV2025R0 } from '../schemas/v2025R0/hubDocumentBlocksV2025R0'; +import { deserializeHubDocumentBlocksV2025R0 } from '../schemas/v2025R0/hubDocumentBlocksV2025R0'; +import { ResponseFormat } from '../networking/fetchOptions'; +import { HubDocumentPagesV2025R0 } from '../schemas/v2025R0/hubDocumentPagesV2025R0'; +import { ClientErrorV2025R0 } from '../schemas/v2025R0/clientErrorV2025R0'; +import { BoxVersionHeaderV2025R0 } from '../parameters/v2025R0/boxVersionHeaderV2025R0'; +import { HubDocumentBlocksV2025R0 } from '../schemas/v2025R0/hubDocumentBlocksV2025R0'; +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 GetHubDocumentPagesV2025R0Optionals { + readonly headers: GetHubDocumentPagesV2025R0Headers = + new GetHubDocumentPagesV2025R0Headers({}); + readonly cancellationToken?: CancellationToken = void 0; + constructor( + fields: Omit< + GetHubDocumentPagesV2025R0Optionals, + 'headers' | 'cancellationToken' + > & + Partial< + Pick< + GetHubDocumentPagesV2025R0Optionals, + 'headers' | 'cancellationToken' + > + >, + ) { + if (fields.headers !== undefined) { + this.headers = fields.headers; + } + if (fields.cancellationToken !== undefined) { + this.cancellationToken = fields.cancellationToken; + } + } +} +export interface GetHubDocumentPagesV2025R0OptionalsInput { + readonly headers?: GetHubDocumentPagesV2025R0Headers; + readonly cancellationToken?: CancellationToken; +} +export class GetHubDocumentBlocksV2025R0Optionals { + readonly headers: GetHubDocumentBlocksV2025R0Headers = + new GetHubDocumentBlocksV2025R0Headers({}); + readonly cancellationToken?: CancellationToken = void 0; + constructor( + fields: Omit< + GetHubDocumentBlocksV2025R0Optionals, + 'headers' | 'cancellationToken' + > & + Partial< + Pick< + GetHubDocumentBlocksV2025R0Optionals, + 'headers' | 'cancellationToken' + > + >, + ) { + if (fields.headers !== undefined) { + this.headers = fields.headers; + } + if (fields.cancellationToken !== undefined) { + this.cancellationToken = fields.cancellationToken; + } + } +} +export interface GetHubDocumentBlocksV2025R0OptionalsInput { + readonly headers?: GetHubDocumentBlocksV2025R0Headers; + readonly cancellationToken?: CancellationToken; +} +export interface GetHubDocumentPagesV2025R0QueryParams { + /** + * The unique identifier that represent a hub. + * + * The ID for any hub can be determined + * by visiting this hub in the web application + * and copying the ID from the URL. For example, + * for the URL `https://*.app.box.com/hubs/123` + * the `hub_id` is `123`. */ + readonly hubId: string; + /** + * Defines the position marker at which to begin returning results. This is + * used when paginating using marker-based pagination. */ + readonly marker?: string; + /** + * The maximum number of items to return per page. */ + readonly limit?: number; +} +export class GetHubDocumentPagesV2025R0Headers { + /** + * Version header. */ + readonly boxVersion: BoxVersionHeaderV2025R0 = + '2025.0' as BoxVersionHeaderV2025R0; + /** + * Extra headers that will be included in the HTTP request. */ + readonly extraHeaders?: { + readonly [key: string]: undefined | string; + } = {}; + constructor( + fields: Omit< + GetHubDocumentPagesV2025R0Headers, + 'boxVersion' | 'extraHeaders' + > & + Partial< + Pick + >, + ) { + if (fields.boxVersion !== undefined) { + this.boxVersion = fields.boxVersion; + } + if (fields.extraHeaders !== undefined) { + this.extraHeaders = fields.extraHeaders; + } + } +} +export interface GetHubDocumentPagesV2025R0HeadersInput { + /** + * Version header. */ + readonly boxVersion?: BoxVersionHeaderV2025R0; + /** + * Extra headers that will be included in the HTTP request. */ + readonly extraHeaders?: { + readonly [key: string]: undefined | string; + }; +} +export interface GetHubDocumentBlocksV2025R0QueryParams { + /** + * The unique identifier that represent a hub. + * + * The ID for any hub can be determined + * by visiting this hub in the web application + * and copying the ID from the URL. For example, + * for the URL `https://*.app.box.com/hubs/123` + * the `hub_id` is `123`. */ + readonly hubId: string; + /** + * The unique identifier of a page within the Box Hub. */ + readonly pageId: string; + /** + * Defines the position marker at which to begin returning results. This is + * used when paginating using marker-based pagination. */ + readonly marker?: string; + /** + * The maximum number of items to return per page. */ + readonly limit?: number; +} +export class GetHubDocumentBlocksV2025R0Headers { + /** + * Version header. */ + readonly boxVersion: BoxVersionHeaderV2025R0 = + '2025.0' as BoxVersionHeaderV2025R0; + /** + * Extra headers that will be included in the HTTP request. */ + readonly extraHeaders?: { + readonly [key: string]: undefined | string; + } = {}; + constructor( + fields: Omit< + GetHubDocumentBlocksV2025R0Headers, + 'boxVersion' | 'extraHeaders' + > & + Partial< + Pick + >, + ) { + if (fields.boxVersion !== undefined) { + this.boxVersion = fields.boxVersion; + } + if (fields.extraHeaders !== undefined) { + this.extraHeaders = fields.extraHeaders; + } + } +} +export interface GetHubDocumentBlocksV2025R0HeadersInput { + /** + * Version header. */ + readonly boxVersion?: BoxVersionHeaderV2025R0; + /** + * Extra headers that will be included in the HTTP request. */ + readonly extraHeaders?: { + readonly [key: string]: undefined | string; + }; +} +export class HubDocumentManager { + readonly auth?: Authentication; + readonly networkSession: NetworkSession = new NetworkSession({}); + constructor( + fields: Omit< + HubDocumentManager, + | 'networkSession' + | 'getHubDocumentPagesV2025R0' + | 'getHubDocumentBlocksV2025R0' + > & + Partial>, + ) { + if (fields.auth !== undefined) { + this.auth = fields.auth; + } + if (fields.networkSession !== undefined) { + this.networkSession = fields.networkSession; + } + } + /** + * Retrieves a list of Hub Document Pages for the specified hub. + * Includes both root-level pages and sub pages. + * @param {GetHubDocumentPagesV2025R0QueryParams} queryParams Query parameters of getHubDocumentPagesV2025R0 method + * @param {GetHubDocumentPagesV2025R0OptionalsInput} optionalsInput + * @returns {Promise} + */ + async getHubDocumentPagesV2025R0( + queryParams: GetHubDocumentPagesV2025R0QueryParams, + optionalsInput: GetHubDocumentPagesV2025R0OptionalsInput = {}, + ): Promise { + const optionals: GetHubDocumentPagesV2025R0Optionals = + new GetHubDocumentPagesV2025R0Optionals({ + headers: optionalsInput.headers, + cancellationToken: optionalsInput.cancellationToken, + }); + const headers: any = optionals.headers; + const cancellationToken: any = optionals.cancellationToken; + const queryParamsMap: { + readonly [key: string]: string; + } = prepareParams({ + ['hub_id']: toString(queryParams.hubId) as string, + ['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/hub_document_pages', + ) as string, + method: 'GET', + params: queryParamsMap, + headers: headersMap, + responseFormat: 'json' as ResponseFormat, + auth: this.auth, + networkSession: this.networkSession, + cancellationToken: cancellationToken, + }), + ); + return { + ...deserializeHubDocumentPagesV2025R0(response.data!), + rawData: response.data!, + }; + } + /** + * Retrieves a sorted list of all Hub Document Blocks on a specified page in the hub document, excluding items. + * Blocks are hierarchically organized by their `parent_id`. + * Blocks are sorted in order based on user specification in the user interface. + * The response will only include content blocks that belong to the specified page. This will not include sub pages or sub page content blocks. + * @param {GetHubDocumentBlocksV2025R0QueryParams} queryParams Query parameters of getHubDocumentBlocksV2025R0 method + * @param {GetHubDocumentBlocksV2025R0OptionalsInput} optionalsInput + * @returns {Promise} + */ + async getHubDocumentBlocksV2025R0( + queryParams: GetHubDocumentBlocksV2025R0QueryParams, + optionalsInput: GetHubDocumentBlocksV2025R0OptionalsInput = {}, + ): Promise { + const optionals: GetHubDocumentBlocksV2025R0Optionals = + new GetHubDocumentBlocksV2025R0Optionals({ + headers: optionalsInput.headers, + cancellationToken: optionalsInput.cancellationToken, + }); + const headers: any = optionals.headers; + const cancellationToken: any = optionals.cancellationToken; + const queryParamsMap: { + readonly [key: string]: string; + } = prepareParams({ + ['hub_id']: toString(queryParams.hubId) as string, + ['page_id']: toString(queryParams.pageId) as string, + ['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/hub_document_blocks', + ) as string, + method: 'GET', + params: queryParamsMap, + headers: headersMap, + responseFormat: 'json' as ResponseFormat, + auth: this.auth, + networkSession: this.networkSession, + cancellationToken: cancellationToken, + }), + ); + return { + ...deserializeHubDocumentBlocksV2025R0(response.data!), + rawData: response.data!, + }; + } +} +export interface HubDocumentManagerInput { + readonly auth?: Authentication; + readonly networkSession?: NetworkSession; +} diff --git a/src/managers/index.ts b/src/managers/index.ts index 391de29b7..5eed9cd09 100644 --- a/src/managers/index.ts +++ b/src/managers/index.ts @@ -77,6 +77,7 @@ export * from './enterpriseConfigurations'; export * from './hubs'; export * from './hubCollaborations'; export * from './hubItems'; +export * from './hubDocument'; export * from './shieldLists'; export * from './archives'; export * from './externalUsers'; diff --git a/src/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.ts b/src/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.ts new file mode 100644 index 000000000..fde00ead4 --- /dev/null +++ b/src/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.ts @@ -0,0 +1,133 @@ +import { serializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +import { deserializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +import { HubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +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 HubCalloutBoxTextBlockV2025R0TypeField = 'callout_box'; +export class HubCalloutBoxTextBlockV2025R0 implements HubDocumentBlockV2025R0 { + readonly id!: string; + readonly parentId?: string | null; + readonly rawData?: SerializedData; + /** + * The type of this block. The value is always `callout_box`. */ + readonly type: HubCalloutBoxTextBlockV2025R0TypeField = + 'callout_box' as HubCalloutBoxTextBlockV2025R0TypeField; + /** + * Text content of the block. Includes rich text formatting. */ + readonly fragment!: string; + constructor( + fields: Omit & + Partial>, + ) { + if (fields.id !== undefined) { + this.id = fields.id; + } + if (fields.parentId !== undefined) { + this.parentId = fields.parentId; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + if (fields.type !== undefined) { + this.type = fields.type; + } + if (fields.fragment !== undefined) { + this.fragment = fields.fragment; + } + } +} +export function serializeHubCalloutBoxTextBlockV2025R0TypeField( + val: HubCalloutBoxTextBlockV2025R0TypeField, +): SerializedData { + return val; +} +export function deserializeHubCalloutBoxTextBlockV2025R0TypeField( + val: SerializedData, +): HubCalloutBoxTextBlockV2025R0TypeField { + if (val == 'callout_box') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize HubCalloutBoxTextBlockV2025R0TypeField", + }); +} +export function serializeHubCalloutBoxTextBlockV2025R0( + val: HubCalloutBoxTextBlockV2025R0, +): SerializedData { + const base: any = serializeHubDocumentBlockV2025R0(val); + if (!sdIsMap(base)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubCalloutBoxTextBlockV2025R0"', + }); + } + return { + ...base, + ...{ + ['type']: serializeHubCalloutBoxTextBlockV2025R0TypeField(val.type), + ['fragment']: val.fragment, + }, + }; +} +export function deserializeHubCalloutBoxTextBlockV2025R0( + val: SerializedData, +): HubCalloutBoxTextBlockV2025R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubCalloutBoxTextBlockV2025R0"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "HubCalloutBoxTextBlockV2025R0" to be defined', + }); + } + const type: HubCalloutBoxTextBlockV2025R0TypeField = + deserializeHubCalloutBoxTextBlockV2025R0TypeField(val.type); + if (val.fragment == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "fragment" of type "HubCalloutBoxTextBlockV2025R0" to be defined', + }); + } + if (!sdIsString(val.fragment)) { + throw new BoxSdkError({ + message: + 'Expecting string for "fragment" of type "HubCalloutBoxTextBlockV2025R0"', + }); + } + const fragment: string = val.fragment; + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "HubCalloutBoxTextBlockV2025R0" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "HubCalloutBoxTextBlockV2025R0"', + }); + } + const id: string = val.id; + if (!(val.parent_id == void 0) && !sdIsString(val.parent_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "parent_id" of type "HubCalloutBoxTextBlockV2025R0"', + }); + } + const parentId: undefined | string = + val.parent_id == void 0 ? void 0 : val.parent_id; + return { + type: type, + fragment: fragment, + id: id, + parentId: parentId, + } satisfies HubCalloutBoxTextBlockV2025R0; +} diff --git a/src/schemas/v2025R0/hubDividerBlockV2025R0.ts b/src/schemas/v2025R0/hubDividerBlockV2025R0.ts new file mode 100644 index 000000000..75ce83dee --- /dev/null +++ b/src/schemas/v2025R0/hubDividerBlockV2025R0.ts @@ -0,0 +1,108 @@ +import { serializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +import { deserializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +import { HubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +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 HubDividerBlockV2025R0TypeField = 'divider'; +export class HubDividerBlockV2025R0 implements HubDocumentBlockV2025R0 { + readonly id!: string; + readonly parentId?: string | null; + readonly rawData?: SerializedData; + /** + * The type of this block. The value is always `divider`. */ + readonly type: HubDividerBlockV2025R0TypeField = + 'divider' as HubDividerBlockV2025R0TypeField; + constructor( + fields: Omit & + Partial>, + ) { + if (fields.id !== undefined) { + this.id = fields.id; + } + if (fields.parentId !== undefined) { + this.parentId = fields.parentId; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + if (fields.type !== undefined) { + this.type = fields.type; + } + } +} +export function serializeHubDividerBlockV2025R0TypeField( + val: HubDividerBlockV2025R0TypeField, +): SerializedData { + return val; +} +export function deserializeHubDividerBlockV2025R0TypeField( + val: SerializedData, +): HubDividerBlockV2025R0TypeField { + if (val == 'divider') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize HubDividerBlockV2025R0TypeField", + }); +} +export function serializeHubDividerBlockV2025R0( + val: HubDividerBlockV2025R0, +): SerializedData { + const base: any = serializeHubDocumentBlockV2025R0(val); + if (!sdIsMap(base)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubDividerBlockV2025R0"', + }); + } + return { + ...base, + ...{ ['type']: serializeHubDividerBlockV2025R0TypeField(val.type) }, + }; +} +export function deserializeHubDividerBlockV2025R0( + val: SerializedData, +): HubDividerBlockV2025R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubDividerBlockV2025R0"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "HubDividerBlockV2025R0" to be defined', + }); + } + const type: HubDividerBlockV2025R0TypeField = + deserializeHubDividerBlockV2025R0TypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "HubDividerBlockV2025R0" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "HubDividerBlockV2025R0"', + }); + } + const id: string = val.id; + if (!(val.parent_id == void 0) && !sdIsString(val.parent_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "parent_id" of type "HubDividerBlockV2025R0"', + }); + } + const parentId: undefined | string = + val.parent_id == void 0 ? void 0 : val.parent_id; + return { + type: type, + id: id, + parentId: parentId, + } satisfies HubDividerBlockV2025R0; +} diff --git a/src/schemas/v2025R0/hubDocumentBlockEntryV2025R0.ts b/src/schemas/v2025R0/hubDocumentBlockEntryV2025R0.ts new file mode 100644 index 000000000..289840ac0 --- /dev/null +++ b/src/schemas/v2025R0/hubDocumentBlockEntryV2025R0.ts @@ -0,0 +1,76 @@ +import { serializeHubParagraphTextBlockV2025R0 } from './hubParagraphTextBlockV2025R0'; +import { deserializeHubParagraphTextBlockV2025R0 } from './hubParagraphTextBlockV2025R0'; +import { serializeHubSectionTitleTextBlockV2025R0 } from './hubSectionTitleTextBlockV2025R0'; +import { deserializeHubSectionTitleTextBlockV2025R0 } from './hubSectionTitleTextBlockV2025R0'; +import { serializeHubCalloutBoxTextBlockV2025R0 } from './hubCalloutBoxTextBlockV2025R0'; +import { deserializeHubCalloutBoxTextBlockV2025R0 } from './hubCalloutBoxTextBlockV2025R0'; +import { serializeHubItemListBlockV2025R0 } from './hubItemListBlockV2025R0'; +import { deserializeHubItemListBlockV2025R0 } from './hubItemListBlockV2025R0'; +import { serializeHubDividerBlockV2025R0 } from './hubDividerBlockV2025R0'; +import { deserializeHubDividerBlockV2025R0 } from './hubDividerBlockV2025R0'; +import { HubParagraphTextBlockV2025R0 } from './hubParagraphTextBlockV2025R0'; +import { HubSectionTitleTextBlockV2025R0 } from './hubSectionTitleTextBlockV2025R0'; +import { HubCalloutBoxTextBlockV2025R0 } from './hubCalloutBoxTextBlockV2025R0'; +import { HubItemListBlockV2025R0 } from './hubItemListBlockV2025R0'; +import { HubDividerBlockV2025R0 } from './hubDividerBlockV2025R0'; +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 HubDocumentBlockEntryV2025R0 = + | HubParagraphTextBlockV2025R0 + | HubSectionTitleTextBlockV2025R0 + | HubCalloutBoxTextBlockV2025R0 + | HubItemListBlockV2025R0 + | HubDividerBlockV2025R0; +export function serializeHubDocumentBlockEntryV2025R0( + val: any, +): SerializedData { + if (val.type == 'paragraph') { + return serializeHubParagraphTextBlockV2025R0(val); + } + if (val.type == 'section_title') { + return serializeHubSectionTitleTextBlockV2025R0(val); + } + if (val.type == 'callout_box') { + return serializeHubCalloutBoxTextBlockV2025R0(val); + } + if (val.type == 'item_list') { + return serializeHubItemListBlockV2025R0(val); + } + if (val.type == 'divider') { + return serializeHubDividerBlockV2025R0(val); + } + throw new BoxSdkError({ message: 'unknown type' }); +} +export function deserializeHubDocumentBlockEntryV2025R0( + val: SerializedData, +): HubDocumentBlockEntryV2025R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubDocumentBlockEntryV2025R0"', + }); + } + if (val.type == 'paragraph') { + return deserializeHubParagraphTextBlockV2025R0(val); + } + if (val.type == 'section_title') { + return deserializeHubSectionTitleTextBlockV2025R0(val); + } + if (val.type == 'callout_box') { + return deserializeHubCalloutBoxTextBlockV2025R0(val); + } + if (val.type == 'item_list') { + return deserializeHubItemListBlockV2025R0(val); + } + if (val.type == 'divider') { + return deserializeHubDividerBlockV2025R0(val); + } + throw new BoxSdkError({ + message: "Can't deserialize HubDocumentBlockEntryV2025R0", + }); +} diff --git a/src/schemas/v2025R0/hubDocumentBlockV2025R0.ts b/src/schemas/v2025R0/hubDocumentBlockV2025R0.ts new file mode 100644 index 000000000..8873781a9 --- /dev/null +++ b/src/schemas/v2025R0/hubDocumentBlockV2025R0.ts @@ -0,0 +1,51 @@ +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 HubDocumentBlockV2025R0 { + /** + * The unique identifier for this block. */ + readonly id: string; + /** + * The unique identifier of the parent block. Null for direct children of the page. */ + readonly parentId?: string | null; + readonly rawData?: SerializedData; +} +export function serializeHubDocumentBlockV2025R0( + val: HubDocumentBlockV2025R0, +): SerializedData { + return { ['id']: val.id, ['parent_id']: val.parentId }; +} +export function deserializeHubDocumentBlockV2025R0( + val: SerializedData, +): HubDocumentBlockV2025R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubDocumentBlockV2025R0"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "HubDocumentBlockV2025R0" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "HubDocumentBlockV2025R0"', + }); + } + const id: string = val.id; + if (!(val.parent_id == void 0) && !sdIsString(val.parent_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "parent_id" of type "HubDocumentBlockV2025R0"', + }); + } + const parentId: undefined | string = + val.parent_id == void 0 ? void 0 : val.parent_id; + return { id: id, parentId: parentId } satisfies HubDocumentBlockV2025R0; +} diff --git a/src/schemas/v2025R0/hubDocumentBlocksV2025R0.ts b/src/schemas/v2025R0/hubDocumentBlocksV2025R0.ts new file mode 100644 index 000000000..2bd5bb4b8 --- /dev/null +++ b/src/schemas/v2025R0/hubDocumentBlocksV2025R0.ts @@ -0,0 +1,238 @@ +import { serializeHubParagraphTextBlockV2025R0 } from './hubParagraphTextBlockV2025R0'; +import { deserializeHubParagraphTextBlockV2025R0 } from './hubParagraphTextBlockV2025R0'; +import { serializeHubSectionTitleTextBlockV2025R0 } from './hubSectionTitleTextBlockV2025R0'; +import { deserializeHubSectionTitleTextBlockV2025R0 } from './hubSectionTitleTextBlockV2025R0'; +import { serializeHubCalloutBoxTextBlockV2025R0 } from './hubCalloutBoxTextBlockV2025R0'; +import { deserializeHubCalloutBoxTextBlockV2025R0 } from './hubCalloutBoxTextBlockV2025R0'; +import { serializeHubItemListBlockV2025R0 } from './hubItemListBlockV2025R0'; +import { deserializeHubItemListBlockV2025R0 } from './hubItemListBlockV2025R0'; +import { serializeHubDividerBlockV2025R0 } from './hubDividerBlockV2025R0'; +import { deserializeHubDividerBlockV2025R0 } from './hubDividerBlockV2025R0'; +import { serializeHubDocumentBlockEntryV2025R0 } from './hubDocumentBlockEntryV2025R0'; +import { deserializeHubDocumentBlockEntryV2025R0 } from './hubDocumentBlockEntryV2025R0'; +import { HubParagraphTextBlockV2025R0 } from './hubParagraphTextBlockV2025R0'; +import { HubSectionTitleTextBlockV2025R0 } from './hubSectionTitleTextBlockV2025R0'; +import { HubCalloutBoxTextBlockV2025R0 } from './hubCalloutBoxTextBlockV2025R0'; +import { HubItemListBlockV2025R0 } from './hubItemListBlockV2025R0'; +import { HubDividerBlockV2025R0 } from './hubDividerBlockV2025R0'; +import { HubDocumentBlockEntryV2025R0 } from './hubDocumentBlockEntryV2025R0'; +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 HubDocumentBlocksV2025R0TypeField = 'document_blocks'; +export class HubDocumentBlocksV2025R0 { + /** + * Ordered list of blocks. */ + readonly entries!: readonly HubDocumentBlockEntryV2025R0[]; + /** + * The value will always be `document_blocks`. */ + readonly type: HubDocumentBlocksV2025R0TypeField = + 'document_blocks' as HubDocumentBlocksV2025R0TypeField; + /** + * 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; + constructor( + fields: Omit & + Partial>, + ) { + if (fields.entries !== undefined) { + this.entries = fields.entries; + } + if (fields.type !== undefined) { + this.type = fields.type; + } + if (fields.limit !== undefined) { + this.limit = fields.limit; + } + if (fields.nextMarker !== undefined) { + this.nextMarker = fields.nextMarker; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + } +} +export interface HubDocumentBlocksV2025R0Input { + /** + * Ordered list of blocks. */ + readonly entries: readonly HubDocumentBlockEntryV2025R0[]; + /** + * The value will always be `document_blocks`. */ + readonly type?: HubDocumentBlocksV2025R0TypeField; + /** + * 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 serializeHubDocumentBlocksV2025R0TypeField( + val: HubDocumentBlocksV2025R0TypeField, +): SerializedData { + return val; +} +export function deserializeHubDocumentBlocksV2025R0TypeField( + val: SerializedData, +): HubDocumentBlocksV2025R0TypeField { + if (val == 'document_blocks') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize HubDocumentBlocksV2025R0TypeField", + }); +} +export function serializeHubDocumentBlocksV2025R0( + val: HubDocumentBlocksV2025R0, +): SerializedData { + return { + ['entries']: val.entries.map(function ( + item: HubDocumentBlockEntryV2025R0, + ): SerializedData { + return serializeHubDocumentBlockEntryV2025R0(item); + }) as readonly any[], + ['type']: serializeHubDocumentBlocksV2025R0TypeField(val.type), + ['limit']: val.limit, + ['next_marker']: val.nextMarker, + }; +} +export function deserializeHubDocumentBlocksV2025R0( + val: SerializedData, +): HubDocumentBlocksV2025R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubDocumentBlocksV2025R0"', + }); + } + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "HubDocumentBlocksV2025R0" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "HubDocumentBlocksV2025R0"', + }); + } + const entries: readonly HubDocumentBlockEntryV2025R0[] = sdIsList(val.entries) + ? (val.entries.map(function ( + itm: SerializedData, + ): HubDocumentBlockEntryV2025R0 { + return deserializeHubDocumentBlockEntryV2025R0(itm); + }) as readonly any[]) + : []; + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "HubDocumentBlocksV2025R0" to be defined', + }); + } + const type: HubDocumentBlocksV2025R0TypeField = + deserializeHubDocumentBlocksV2025R0TypeField(val.type); + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "HubDocumentBlocksV2025R0"', + }); + } + 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 "HubDocumentBlocksV2025R0"', + }); + } + const nextMarker: undefined | string = + val.next_marker == void 0 ? void 0 : val.next_marker; + return { + entries: entries, + type: type, + limit: limit, + nextMarker: nextMarker, + } satisfies HubDocumentBlocksV2025R0; +} +export function serializeHubDocumentBlocksV2025R0Input( + val: HubDocumentBlocksV2025R0Input, +): SerializedData { + return { + ['entries']: val.entries.map(function ( + item: HubDocumentBlockEntryV2025R0, + ): SerializedData { + return serializeHubDocumentBlockEntryV2025R0(item); + }) as readonly any[], + ['type']: + val.type == void 0 + ? val.type + : serializeHubDocumentBlocksV2025R0TypeField(val.type), + ['limit']: val.limit, + ['next_marker']: val.nextMarker, + }; +} +export function deserializeHubDocumentBlocksV2025R0Input( + val: SerializedData, +): HubDocumentBlocksV2025R0Input { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubDocumentBlocksV2025R0Input"', + }); + } + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "HubDocumentBlocksV2025R0Input" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "HubDocumentBlocksV2025R0Input"', + }); + } + const entries: readonly HubDocumentBlockEntryV2025R0[] = sdIsList(val.entries) + ? (val.entries.map(function ( + itm: SerializedData, + ): HubDocumentBlockEntryV2025R0 { + return deserializeHubDocumentBlockEntryV2025R0(itm); + }) as readonly any[]) + : []; + const type: undefined | HubDocumentBlocksV2025R0TypeField = + val.type == void 0 + ? void 0 + : deserializeHubDocumentBlocksV2025R0TypeField(val.type); + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "HubDocumentBlocksV2025R0Input"', + }); + } + 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 "HubDocumentBlocksV2025R0Input"', + }); + } + const nextMarker: undefined | string = + val.next_marker == void 0 ? void 0 : val.next_marker; + return { + entries: entries, + type: type, + limit: limit, + nextMarker: nextMarker, + } satisfies HubDocumentBlocksV2025R0Input; +} diff --git a/src/schemas/v2025R0/hubDocumentPageV2025R0.ts b/src/schemas/v2025R0/hubDocumentPageV2025R0.ts new file mode 100644 index 000000000..7750e0adb --- /dev/null +++ b/src/schemas/v2025R0/hubDocumentPageV2025R0.ts @@ -0,0 +1,92 @@ +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 HubDocumentPageV2025R0 { + /** + * The unique identifier for this page. */ + readonly id: string; + /** + * The type of this resource. The value is always `page`. */ + readonly type: string; + /** + * The unique identifier of the parent page. Null for root-level pages. */ + readonly parentId?: string | null; + /** + * The title text of the page. Includes rich text formatting. */ + readonly titleFragment: string; + readonly rawData?: SerializedData; +} +export function serializeHubDocumentPageV2025R0( + val: HubDocumentPageV2025R0, +): SerializedData { + return { + ['id']: val.id, + ['type']: val.type, + ['parent_id']: val.parentId, + ['title_fragment']: val.titleFragment, + }; +} +export function deserializeHubDocumentPageV2025R0( + val: SerializedData, +): HubDocumentPageV2025R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubDocumentPageV2025R0"', + }); + } + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "HubDocumentPageV2025R0" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "HubDocumentPageV2025R0"', + }); + } + const id: string = val.id; + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "HubDocumentPageV2025R0" to be defined', + }); + } + if (!sdIsString(val.type)) { + throw new BoxSdkError({ + message: 'Expecting string for "type" of type "HubDocumentPageV2025R0"', + }); + } + const type: string = val.type; + if (!(val.parent_id == void 0) && !sdIsString(val.parent_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "parent_id" of type "HubDocumentPageV2025R0"', + }); + } + const parentId: undefined | string = + val.parent_id == void 0 ? void 0 : val.parent_id; + if (val.title_fragment == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "title_fragment" of type "HubDocumentPageV2025R0" to be defined', + }); + } + if (!sdIsString(val.title_fragment)) { + throw new BoxSdkError({ + message: + 'Expecting string for "title_fragment" of type "HubDocumentPageV2025R0"', + }); + } + const titleFragment: string = val.title_fragment; + return { + id: id, + type: type, + parentId: parentId, + titleFragment: titleFragment, + } satisfies HubDocumentPageV2025R0; +} diff --git a/src/schemas/v2025R0/hubDocumentPagesV2025R0.ts b/src/schemas/v2025R0/hubDocumentPagesV2025R0.ts new file mode 100644 index 000000000..184ae81c1 --- /dev/null +++ b/src/schemas/v2025R0/hubDocumentPagesV2025R0.ts @@ -0,0 +1,218 @@ +import { serializeHubDocumentPageV2025R0 } from './hubDocumentPageV2025R0'; +import { deserializeHubDocumentPageV2025R0 } from './hubDocumentPageV2025R0'; +import { HubDocumentPageV2025R0 } from './hubDocumentPageV2025R0'; +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 HubDocumentPagesV2025R0TypeField = 'document_pages'; +export class HubDocumentPagesV2025R0 { + /** + * Ordered list of pages. */ + readonly entries!: readonly HubDocumentPageV2025R0[]; + /** + * The value will always be `document_pages`. */ + readonly type: HubDocumentPagesV2025R0TypeField = + 'document_pages' as HubDocumentPagesV2025R0TypeField; + /** + * 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; + constructor( + fields: Omit & + Partial>, + ) { + if (fields.entries !== undefined) { + this.entries = fields.entries; + } + if (fields.type !== undefined) { + this.type = fields.type; + } + if (fields.limit !== undefined) { + this.limit = fields.limit; + } + if (fields.nextMarker !== undefined) { + this.nextMarker = fields.nextMarker; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + } +} +export interface HubDocumentPagesV2025R0Input { + /** + * Ordered list of pages. */ + readonly entries: readonly HubDocumentPageV2025R0[]; + /** + * The value will always be `document_pages`. */ + readonly type?: HubDocumentPagesV2025R0TypeField; + /** + * 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 serializeHubDocumentPagesV2025R0TypeField( + val: HubDocumentPagesV2025R0TypeField, +): SerializedData { + return val; +} +export function deserializeHubDocumentPagesV2025R0TypeField( + val: SerializedData, +): HubDocumentPagesV2025R0TypeField { + if (val == 'document_pages') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize HubDocumentPagesV2025R0TypeField", + }); +} +export function serializeHubDocumentPagesV2025R0( + val: HubDocumentPagesV2025R0, +): SerializedData { + return { + ['entries']: val.entries.map(function ( + item: HubDocumentPageV2025R0, + ): SerializedData { + return serializeHubDocumentPageV2025R0(item); + }) as readonly any[], + ['type']: serializeHubDocumentPagesV2025R0TypeField(val.type), + ['limit']: val.limit, + ['next_marker']: val.nextMarker, + }; +} +export function deserializeHubDocumentPagesV2025R0( + val: SerializedData, +): HubDocumentPagesV2025R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubDocumentPagesV2025R0"', + }); + } + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "HubDocumentPagesV2025R0" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "HubDocumentPagesV2025R0"', + }); + } + const entries: readonly HubDocumentPageV2025R0[] = sdIsList(val.entries) + ? (val.entries.map(function (itm: SerializedData): HubDocumentPageV2025R0 { + return deserializeHubDocumentPageV2025R0(itm); + }) as readonly any[]) + : []; + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "HubDocumentPagesV2025R0" to be defined', + }); + } + const type: HubDocumentPagesV2025R0TypeField = + deserializeHubDocumentPagesV2025R0TypeField(val.type); + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: 'Expecting number for "limit" of type "HubDocumentPagesV2025R0"', + }); + } + 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 "HubDocumentPagesV2025R0"', + }); + } + const nextMarker: undefined | string = + val.next_marker == void 0 ? void 0 : val.next_marker; + return { + entries: entries, + type: type, + limit: limit, + nextMarker: nextMarker, + } satisfies HubDocumentPagesV2025R0; +} +export function serializeHubDocumentPagesV2025R0Input( + val: HubDocumentPagesV2025R0Input, +): SerializedData { + return { + ['entries']: val.entries.map(function ( + item: HubDocumentPageV2025R0, + ): SerializedData { + return serializeHubDocumentPageV2025R0(item); + }) as readonly any[], + ['type']: + val.type == void 0 + ? val.type + : serializeHubDocumentPagesV2025R0TypeField(val.type), + ['limit']: val.limit, + ['next_marker']: val.nextMarker, + }; +} +export function deserializeHubDocumentPagesV2025R0Input( + val: SerializedData, +): HubDocumentPagesV2025R0Input { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubDocumentPagesV2025R0Input"', + }); + } + if (val.entries == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "entries" of type "HubDocumentPagesV2025R0Input" to be defined', + }); + } + if (!sdIsList(val.entries)) { + throw new BoxSdkError({ + message: + 'Expecting array for "entries" of type "HubDocumentPagesV2025R0Input"', + }); + } + const entries: readonly HubDocumentPageV2025R0[] = sdIsList(val.entries) + ? (val.entries.map(function (itm: SerializedData): HubDocumentPageV2025R0 { + return deserializeHubDocumentPageV2025R0(itm); + }) as readonly any[]) + : []; + const type: undefined | HubDocumentPagesV2025R0TypeField = + val.type == void 0 + ? void 0 + : deserializeHubDocumentPagesV2025R0TypeField(val.type); + if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { + throw new BoxSdkError({ + message: + 'Expecting number for "limit" of type "HubDocumentPagesV2025R0Input"', + }); + } + 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 "HubDocumentPagesV2025R0Input"', + }); + } + const nextMarker: undefined | string = + val.next_marker == void 0 ? void 0 : val.next_marker; + return { + entries: entries, + type: type, + limit: limit, + nextMarker: nextMarker, + } satisfies HubDocumentPagesV2025R0Input; +} diff --git a/src/schemas/v2025R0/hubItemListBlockV2025R0.ts b/src/schemas/v2025R0/hubItemListBlockV2025R0.ts new file mode 100644 index 000000000..0cbf0ab33 --- /dev/null +++ b/src/schemas/v2025R0/hubItemListBlockV2025R0.ts @@ -0,0 +1,108 @@ +import { serializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +import { deserializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +import { HubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +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 HubItemListBlockV2025R0TypeField = 'item_list'; +export class HubItemListBlockV2025R0 implements HubDocumentBlockV2025R0 { + readonly id!: string; + readonly parentId?: string | null; + readonly rawData?: SerializedData; + /** + * The type of this block. The value is always `item_list`. */ + readonly type: HubItemListBlockV2025R0TypeField = + 'item_list' as HubItemListBlockV2025R0TypeField; + constructor( + fields: Omit & + Partial>, + ) { + if (fields.id !== undefined) { + this.id = fields.id; + } + if (fields.parentId !== undefined) { + this.parentId = fields.parentId; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + if (fields.type !== undefined) { + this.type = fields.type; + } + } +} +export function serializeHubItemListBlockV2025R0TypeField( + val: HubItemListBlockV2025R0TypeField, +): SerializedData { + return val; +} +export function deserializeHubItemListBlockV2025R0TypeField( + val: SerializedData, +): HubItemListBlockV2025R0TypeField { + if (val == 'item_list') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize HubItemListBlockV2025R0TypeField", + }); +} +export function serializeHubItemListBlockV2025R0( + val: HubItemListBlockV2025R0, +): SerializedData { + const base: any = serializeHubDocumentBlockV2025R0(val); + if (!sdIsMap(base)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubItemListBlockV2025R0"', + }); + } + return { + ...base, + ...{ ['type']: serializeHubItemListBlockV2025R0TypeField(val.type) }, + }; +} +export function deserializeHubItemListBlockV2025R0( + val: SerializedData, +): HubItemListBlockV2025R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubItemListBlockV2025R0"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "HubItemListBlockV2025R0" to be defined', + }); + } + const type: HubItemListBlockV2025R0TypeField = + deserializeHubItemListBlockV2025R0TypeField(val.type); + if (val.id == void 0) { + throw new BoxSdkError({ + message: 'Expecting "id" of type "HubItemListBlockV2025R0" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "HubItemListBlockV2025R0"', + }); + } + const id: string = val.id; + if (!(val.parent_id == void 0) && !sdIsString(val.parent_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "parent_id" of type "HubItemListBlockV2025R0"', + }); + } + const parentId: undefined | string = + val.parent_id == void 0 ? void 0 : val.parent_id; + return { + type: type, + id: id, + parentId: parentId, + } satisfies HubItemListBlockV2025R0; +} diff --git a/src/schemas/v2025R0/hubParagraphTextBlockV2025R0.ts b/src/schemas/v2025R0/hubParagraphTextBlockV2025R0.ts new file mode 100644 index 000000000..6e7b3953d --- /dev/null +++ b/src/schemas/v2025R0/hubParagraphTextBlockV2025R0.ts @@ -0,0 +1,133 @@ +import { serializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +import { deserializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +import { HubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +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 HubParagraphTextBlockV2025R0TypeField = 'paragraph'; +export class HubParagraphTextBlockV2025R0 implements HubDocumentBlockV2025R0 { + readonly id!: string; + readonly parentId?: string | null; + readonly rawData?: SerializedData; + /** + * The type of this block. The value is always `paragraph`. */ + readonly type: HubParagraphTextBlockV2025R0TypeField = + 'paragraph' as HubParagraphTextBlockV2025R0TypeField; + /** + * Text content of the block. Includes rich text formatting. */ + readonly fragment!: string; + constructor( + fields: Omit & + Partial>, + ) { + if (fields.id !== undefined) { + this.id = fields.id; + } + if (fields.parentId !== undefined) { + this.parentId = fields.parentId; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + if (fields.type !== undefined) { + this.type = fields.type; + } + if (fields.fragment !== undefined) { + this.fragment = fields.fragment; + } + } +} +export function serializeHubParagraphTextBlockV2025R0TypeField( + val: HubParagraphTextBlockV2025R0TypeField, +): SerializedData { + return val; +} +export function deserializeHubParagraphTextBlockV2025R0TypeField( + val: SerializedData, +): HubParagraphTextBlockV2025R0TypeField { + if (val == 'paragraph') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize HubParagraphTextBlockV2025R0TypeField", + }); +} +export function serializeHubParagraphTextBlockV2025R0( + val: HubParagraphTextBlockV2025R0, +): SerializedData { + const base: any = serializeHubDocumentBlockV2025R0(val); + if (!sdIsMap(base)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubParagraphTextBlockV2025R0"', + }); + } + return { + ...base, + ...{ + ['type']: serializeHubParagraphTextBlockV2025R0TypeField(val.type), + ['fragment']: val.fragment, + }, + }; +} +export function deserializeHubParagraphTextBlockV2025R0( + val: SerializedData, +): HubParagraphTextBlockV2025R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubParagraphTextBlockV2025R0"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "HubParagraphTextBlockV2025R0" to be defined', + }); + } + const type: HubParagraphTextBlockV2025R0TypeField = + deserializeHubParagraphTextBlockV2025R0TypeField(val.type); + if (val.fragment == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "fragment" of type "HubParagraphTextBlockV2025R0" to be defined', + }); + } + if (!sdIsString(val.fragment)) { + throw new BoxSdkError({ + message: + 'Expecting string for "fragment" of type "HubParagraphTextBlockV2025R0"', + }); + } + const fragment: string = val.fragment; + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "HubParagraphTextBlockV2025R0" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "HubParagraphTextBlockV2025R0"', + }); + } + const id: string = val.id; + if (!(val.parent_id == void 0) && !sdIsString(val.parent_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "parent_id" of type "HubParagraphTextBlockV2025R0"', + }); + } + const parentId: undefined | string = + val.parent_id == void 0 ? void 0 : val.parent_id; + return { + type: type, + fragment: fragment, + id: id, + parentId: parentId, + } satisfies HubParagraphTextBlockV2025R0; +} diff --git a/src/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.ts b/src/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.ts new file mode 100644 index 000000000..b63ec9fc5 --- /dev/null +++ b/src/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.ts @@ -0,0 +1,133 @@ +import { serializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +import { deserializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +import { HubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0'; +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 HubSectionTitleTextBlockV2025R0TypeField = 'section_title'; +export class HubSectionTitleTextBlockV2025R0 implements HubDocumentBlockV2025R0 { + readonly id!: string; + readonly parentId?: string | null; + readonly rawData?: SerializedData; + /** + * The type of this block. The value is always `section_title`. */ + readonly type: HubSectionTitleTextBlockV2025R0TypeField = + 'section_title' as HubSectionTitleTextBlockV2025R0TypeField; + /** + * Text content of the block. Includes rich text formatting. */ + readonly fragment!: string; + constructor( + fields: Omit & + Partial>, + ) { + if (fields.id !== undefined) { + this.id = fields.id; + } + if (fields.parentId !== undefined) { + this.parentId = fields.parentId; + } + if (fields.rawData !== undefined) { + this.rawData = fields.rawData; + } + if (fields.type !== undefined) { + this.type = fields.type; + } + if (fields.fragment !== undefined) { + this.fragment = fields.fragment; + } + } +} +export function serializeHubSectionTitleTextBlockV2025R0TypeField( + val: HubSectionTitleTextBlockV2025R0TypeField, +): SerializedData { + return val; +} +export function deserializeHubSectionTitleTextBlockV2025R0TypeField( + val: SerializedData, +): HubSectionTitleTextBlockV2025R0TypeField { + if (val == 'section_title') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize HubSectionTitleTextBlockV2025R0TypeField", + }); +} +export function serializeHubSectionTitleTextBlockV2025R0( + val: HubSectionTitleTextBlockV2025R0, +): SerializedData { + const base: any = serializeHubDocumentBlockV2025R0(val); + if (!sdIsMap(base)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubSectionTitleTextBlockV2025R0"', + }); + } + return { + ...base, + ...{ + ['type']: serializeHubSectionTitleTextBlockV2025R0TypeField(val.type), + ['fragment']: val.fragment, + }, + }; +} +export function deserializeHubSectionTitleTextBlockV2025R0( + val: SerializedData, +): HubSectionTitleTextBlockV2025R0 { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "HubSectionTitleTextBlockV2025R0"', + }); + } + if (val.type == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "type" of type "HubSectionTitleTextBlockV2025R0" to be defined', + }); + } + const type: HubSectionTitleTextBlockV2025R0TypeField = + deserializeHubSectionTitleTextBlockV2025R0TypeField(val.type); + if (val.fragment == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "fragment" of type "HubSectionTitleTextBlockV2025R0" to be defined', + }); + } + if (!sdIsString(val.fragment)) { + throw new BoxSdkError({ + message: + 'Expecting string for "fragment" of type "HubSectionTitleTextBlockV2025R0"', + }); + } + const fragment: string = val.fragment; + if (val.id == void 0) { + throw new BoxSdkError({ + message: + 'Expecting "id" of type "HubSectionTitleTextBlockV2025R0" to be defined', + }); + } + if (!sdIsString(val.id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "id" of type "HubSectionTitleTextBlockV2025R0"', + }); + } + const id: string = val.id; + if (!(val.parent_id == void 0) && !sdIsString(val.parent_id)) { + throw new BoxSdkError({ + message: + 'Expecting string for "parent_id" of type "HubSectionTitleTextBlockV2025R0"', + }); + } + const parentId: undefined | string = + val.parent_id == void 0 ? void 0 : val.parent_id; + return { + type: type, + fragment: fragment, + id: id, + parentId: parentId, + } satisfies HubSectionTitleTextBlockV2025R0; +} diff --git a/src/schemas/v2025R0/index.ts b/src/schemas/v2025R0/index.ts index c38fb782f..8675f75a4 100644 --- a/src/schemas/v2025R0/index.ts +++ b/src/schemas/v2025R0/index.ts @@ -34,6 +34,16 @@ export * from './hubCollaborationCreateRequestV2025R0'; export * from './hubCollaborationUpdateRequestV2025R0'; export * from './hubCopyRequestV2025R0'; export * from './hubCreateRequestV2025R0'; +export * from './hubDocumentBlockV2025R0'; +export * from './hubSectionTitleTextBlockV2025R0'; +export * from './hubParagraphTextBlockV2025R0'; +export * from './hubItemListBlockV2025R0'; +export * from './hubDividerBlockV2025R0'; +export * from './hubCalloutBoxTextBlockV2025R0'; +export * from './hubDocumentBlockEntryV2025R0'; +export * from './hubDocumentBlocksV2025R0'; +export * from './hubDocumentPageV2025R0'; +export * from './hubDocumentPagesV2025R0'; export * from './hubItemV2025R0'; export * from './hubItemsV2025R0'; export * from './hubUpdateRequestV2025R0'; diff --git a/src/test/hubDocument.test.ts b/src/test/hubDocument.test.ts new file mode 100644 index 000000000..92bd78c77 --- /dev/null +++ b/src/test/hubDocument.test.ts @@ -0,0 +1,91 @@ +import { serializeHubV2025R0 } from '@/schemas/v2025R0/hubV2025R0'; +import { deserializeHubV2025R0 } from '@/schemas/v2025R0/hubV2025R0'; +import { serializeHubCreateRequestV2025R0 } from '@/schemas/v2025R0/hubCreateRequestV2025R0'; +import { deserializeHubCreateRequestV2025R0 } from '@/schemas/v2025R0/hubCreateRequestV2025R0'; +import { serializeHubDocumentPagesV2025R0 } from '@/schemas/v2025R0/hubDocumentPagesV2025R0'; +import { deserializeHubDocumentPagesV2025R0 } from '@/schemas/v2025R0/hubDocumentPagesV2025R0'; +import { serializeHubDocumentPageV2025R0 } from '@/schemas/v2025R0/hubDocumentPageV2025R0'; +import { deserializeHubDocumentPageV2025R0 } from '@/schemas/v2025R0/hubDocumentPageV2025R0'; +import { serializeHubDocumentBlocksV2025R0 } from '@/schemas/v2025R0/hubDocumentBlocksV2025R0'; +import { deserializeHubDocumentBlocksV2025R0 } from '@/schemas/v2025R0/hubDocumentBlocksV2025R0'; +import { serializeHubParagraphTextBlockV2025R0 } from '@/schemas/v2025R0/hubParagraphTextBlockV2025R0'; +import { deserializeHubParagraphTextBlockV2025R0 } from '@/schemas/v2025R0/hubParagraphTextBlockV2025R0'; +import { serializeHubSectionTitleTextBlockV2025R0 } from '@/schemas/v2025R0/hubSectionTitleTextBlockV2025R0'; +import { deserializeHubSectionTitleTextBlockV2025R0 } from '@/schemas/v2025R0/hubSectionTitleTextBlockV2025R0'; +import { serializeHubCalloutBoxTextBlockV2025R0 } from '@/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0'; +import { deserializeHubCalloutBoxTextBlockV2025R0 } from '@/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0'; +import { serializeHubItemListBlockV2025R0 } from '@/schemas/v2025R0/hubItemListBlockV2025R0'; +import { deserializeHubItemListBlockV2025R0 } from '@/schemas/v2025R0/hubItemListBlockV2025R0'; +import { serializeHubDividerBlockV2025R0 } from '@/schemas/v2025R0/hubDividerBlockV2025R0'; +import { deserializeHubDividerBlockV2025R0 } from '@/schemas/v2025R0/hubDividerBlockV2025R0'; +import { serializeHubDocumentBlockEntryV2025R0 } from '@/schemas/v2025R0/hubDocumentBlockEntryV2025R0'; +import { deserializeHubDocumentBlockEntryV2025R0 } from '@/schemas/v2025R0/hubDocumentBlockEntryV2025R0'; +import { BoxClient } from '@/client'; +import { HubV2025R0 } from '@/schemas/v2025R0/hubV2025R0'; +import { HubCreateRequestV2025R0 } from '@/schemas/v2025R0/hubCreateRequestV2025R0'; +import { HubDocumentPagesV2025R0 } from '@/schemas/v2025R0/hubDocumentPagesV2025R0'; +import { GetHubDocumentPagesV2025R0QueryParams } from '@/managers/hubDocument'; +import { HubDocumentPageV2025R0 } from '@/schemas/v2025R0/hubDocumentPageV2025R0'; +import { HubDocumentBlocksV2025R0 } from '@/schemas/v2025R0/hubDocumentBlocksV2025R0'; +import { GetHubDocumentBlocksV2025R0QueryParams } from '@/managers/hubDocument'; +import { HubParagraphTextBlockV2025R0 } from '@/schemas/v2025R0/hubParagraphTextBlockV2025R0'; +import { HubSectionTitleTextBlockV2025R0 } from '@/schemas/v2025R0/hubSectionTitleTextBlockV2025R0'; +import { HubCalloutBoxTextBlockV2025R0 } from '@/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0'; +import { HubItemListBlockV2025R0 } from '@/schemas/v2025R0/hubItemListBlockV2025R0'; +import { HubDividerBlockV2025R0 } from '@/schemas/v2025R0/hubDividerBlockV2025R0'; +import { HubDocumentBlockEntryV2025R0 } from '@/schemas/v2025R0/hubDocumentBlockEntryV2025R0'; +import { getDefaultClientWithUserSubject } from './commons'; +import { getEnvVar } from '@/internal/utils'; +import { getUuid } from '@/internal/utils'; +import { toString } 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 const client: BoxClient = getDefaultClientWithUserSubject( + getEnvVar('USER_ID'), +); +test('testGetHubDocumentPagesAndBlocks', async function testGetHubDocumentPagesAndBlocks(): Promise { + const hubTitle: string = getUuid(); + const createdHub: HubV2025R0 = await client.hubs.createHubV2025R0({ + title: hubTitle, + } satisfies HubCreateRequestV2025R0); + const hubId: string = createdHub.id; + const pages: HubDocumentPagesV2025R0 = + await client.hubDocument.getHubDocumentPagesV2025R0({ + hubId: hubId, + } satisfies GetHubDocumentPagesV2025R0QueryParams); + if (!(pages.entries.length > 0)) { + throw new Error('Assertion failed'); + } + if (!((toString(pages.type) as string) == 'document_pages')) { + throw new Error('Assertion failed'); + } + const firstPage: HubDocumentPageV2025R0 = pages.entries[0]; + if (!((toString(firstPage.type) as string) == 'page')) { + throw new Error('Assertion failed'); + } + const pageId: string = firstPage.id; + const blocks: HubDocumentBlocksV2025R0 = + await client.hubDocument.getHubDocumentBlocksV2025R0({ + hubId: hubId, + pageId: pageId, + } satisfies GetHubDocumentBlocksV2025R0QueryParams); + if (!((toString(blocks.type) as string) == 'document_blocks')) { + throw new Error('Assertion failed'); + } + if (!(blocks.entries.length > 0)) { + throw new Error('Assertion failed'); + } + const firstBlock: HubDocumentBlockEntryV2025R0 = blocks + .entries![0] as HubDocumentBlockEntryV2025R0; + if (!((toString(firstBlock.type!) as string) == 'item_list')) { + throw new Error('Assertion failed'); + } + await client.hubs.deleteHubByIdV2025R0(hubId); +}); +export {}; From 50c708ba661e59fdcda0fe344a0932c613750b66 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Tue, 31 Mar 2026 02:52:03 -0700 Subject: [PATCH 2/3] chore: Update `.codegen.json` with commit hash of `codegen` and `openapi` spec [skip ci] --- .codegen.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codegen.json b/.codegen.json index 168441c6b..9995cc1ee 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "e77f966", "specHash": "c8e3a85", "version": "10.5.0" } +{ "engineHash": "e77f966", "specHash": "f8e0d99", "version": "10.5.0" } From bc69f1874cb60ef90a1974dc2fe6a6ff6d100366 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Tue, 31 Mar 2026 07:51:13 -0700 Subject: [PATCH 3/3] fix: Fix enums and nullability in OneOfs for dotnet (box/box-codegen#933) --- .codegen.json | 2 +- package-lock.json | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.codegen.json b/.codegen.json index 9995cc1ee..c0e4fff09 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "e77f966", "specHash": "f8e0d99", "version": "10.5.0" } +{ "engineHash": "49170d4", "specHash": "f8e0d99", "version": "10.5.0" } diff --git a/package-lock.json b/package-lock.json index 6b1e305a7..dad879f56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2284,9 +2284,9 @@ } }, "node_modules/browserslist": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", - "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==", + "version": "4.28.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", + "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", "dev": true, "funding": [ { @@ -2304,11 +2304,11 @@ ], "license": "MIT", "dependencies": { - "baseline-browser-mapping": "^2.9.0", - "caniuse-lite": "^1.0.30001759", - "electron-to-chromium": "^1.5.263", - "node-releases": "^2.0.27", - "update-browserslist-db": "^1.2.0" + "baseline-browser-mapping": "^2.10.12", + "caniuse-lite": "^1.0.30001782", + "electron-to-chromium": "^1.5.328", + "node-releases": "^2.0.36", + "update-browserslist-db": "^1.2.3" }, "bin": { "browserslist": "cli.js"