box-node-sdk 10.4.0 → 10.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bundle.js +771 -16
- package/lib/bundle.js.map +1 -1
- package/lib/client.d.ts +10 -1
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +16 -0
- package/lib/client.js.map +1 -1
- package/lib/managers/archives.d.ts +4 -0
- package/lib/managers/archives.d.ts.map +1 -1
- package/lib/managers/archives.js +4 -0
- package/lib/managers/archives.js.map +1 -1
- package/lib/managers/hubDocument.d.ts +133 -0
- package/lib/managers/hubDocument.d.ts.map +1 -0
- package/lib/managers/hubDocument.js +162 -0
- package/lib/managers/hubDocument.js.map +1 -0
- package/lib/managers/hubItems.d.ts +7 -0
- package/lib/managers/hubItems.d.ts.map +1 -1
- package/lib/managers/hubItems.js +1 -0
- package/lib/managers/hubItems.js.map +1 -1
- package/lib/managers/index.d.ts +1 -0
- package/lib/managers/index.d.ts.map +1 -1
- package/lib/managers/index.js +1 -0
- package/lib/managers/index.js.map +1 -1
- package/lib/managers/search.d.ts +1 -1
- package/lib/managers/search.d.ts.map +1 -1
- package/lib/managers/search.js +1 -1
- package/lib/managers/search.js.map +1 -1
- package/lib/managers/trashedItems.d.ts +2 -0
- package/lib/managers/trashedItems.d.ts.map +1 -1
- package/lib/managers/trashedItems.js +2 -0
- package/lib/managers/trashedItems.js.map +1 -1
- package/lib/networking/boxNetworkClient.d.ts.map +1 -1
- package/lib/networking/boxNetworkClient.js +61 -6
- package/lib/networking/boxNetworkClient.js.map +1 -1
- package/lib/networking/network.d.ts +10 -1
- package/lib/networking/network.d.ts.map +1 -1
- package/lib/networking/network.js +29 -0
- package/lib/networking/network.js.map +1 -1
- package/lib/networking/timeoutConfig.d.ts +4 -0
- package/lib/networking/timeoutConfig.d.ts.map +1 -0
- package/lib/networking/timeoutConfig.js +3 -0
- package/lib/networking/timeoutConfig.js.map +1 -0
- package/lib/networking/version.d.ts +1 -1
- package/lib/networking/version.js +1 -1
- package/lib/schemas/aiAgentBasicTextToolBase.d.ts +1 -1
- package/lib/schemas/aiAgentBasicTextToolBase.d.ts.map +1 -1
- package/lib/schemas/aiAgentSpreadsheetTool.d.ts +1 -1
- package/lib/schemas/aiAgentSpreadsheetTool.d.ts.map +1 -1
- package/lib/schemas/aiExtractStructured.d.ts +3 -0
- package/lib/schemas/aiExtractStructured.d.ts.map +1 -1
- package/lib/schemas/aiExtractStructured.js +9 -0
- package/lib/schemas/aiExtractStructured.js.map +1 -1
- package/lib/schemas/aiExtractStructuredResponse.d.ts +5 -0
- package/lib/schemas/aiExtractStructuredResponse.d.ts.map +1 -1
- package/lib/schemas/aiExtractStructuredResponse.js +24 -0
- package/lib/schemas/aiExtractStructuredResponse.js.map +1 -1
- package/lib/schemas/index.d.ts +9 -9
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +9 -9
- package/lib/schemas/index.js.map +1 -1
- package/lib/schemas/legalHoldPolicyAssignedItem.d.ts +13 -5
- package/lib/schemas/legalHoldPolicyAssignedItem.d.ts.map +1 -1
- package/lib/schemas/legalHoldPolicyAssignedItem.js +47 -24
- package/lib/schemas/legalHoldPolicyAssignedItem.js.map +1 -1
- package/lib/schemas/legalHoldPolicyAssignment.d.ts.map +1 -1
- package/lib/schemas/legalHoldPolicyAssignment.js.map +1 -1
- package/lib/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.d.ts +20 -0
- package/lib/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.js +105 -0
- package/lib/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubDividerBlockV2025R0.d.ts +17 -0
- package/lib/schemas/v2025R0/hubDividerBlockV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubDividerBlockV2025R0.js +87 -0
- package/lib/schemas/v2025R0/hubDividerBlockV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentBlockEntryV2025R0.d.ts +10 -0
- package/lib/schemas/v2025R0/hubDocumentBlockEntryV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentBlockEntryV2025R0.js +60 -0
- package/lib/schemas/v2025R0/hubDocumentBlockEntryV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentBlockV2025R0.d.ts +13 -0
- package/lib/schemas/v2025R0/hubDocumentBlockV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentBlockV2025R0.js +36 -0
- package/lib/schemas/v2025R0/hubDocumentBlockV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentBlocksV2025R0.d.ts +45 -0
- package/lib/schemas/v2025R0/hubDocumentBlocksV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentBlocksV2025R0.js +162 -0
- package/lib/schemas/v2025R0/hubDocumentBlocksV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentPageV2025R0.d.ts +19 -0
- package/lib/schemas/v2025R0/hubDocumentPageV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentPageV2025R0.js +68 -0
- package/lib/schemas/v2025R0/hubDocumentPageV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentPagesV2025R0.d.ts +45 -0
- package/lib/schemas/v2025R0/hubDocumentPagesV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentPagesV2025R0.js +162 -0
- package/lib/schemas/v2025R0/hubDocumentPagesV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubItemListBlockV2025R0.d.ts +17 -0
- package/lib/schemas/v2025R0/hubItemListBlockV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubItemListBlockV2025R0.js +87 -0
- package/lib/schemas/v2025R0/hubItemListBlockV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubItemOperationResultV2025R0.d.ts +3 -0
- package/lib/schemas/v2025R0/hubItemOperationResultV2025R0.d.ts.map +1 -1
- package/lib/schemas/v2025R0/hubItemOperationResultV2025R0.js +8 -0
- package/lib/schemas/v2025R0/hubItemOperationResultV2025R0.js.map +1 -1
- package/lib/schemas/v2025R0/hubItemOperationV2025R0.d.ts +3 -0
- package/lib/schemas/v2025R0/hubItemOperationV2025R0.d.ts.map +1 -1
- package/lib/schemas/v2025R0/hubItemOperationV2025R0.js +12 -1
- package/lib/schemas/v2025R0/hubItemOperationV2025R0.js.map +1 -1
- package/lib/schemas/v2025R0/hubParagraphTextBlockV2025R0.d.ts +20 -0
- package/lib/schemas/v2025R0/hubParagraphTextBlockV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubParagraphTextBlockV2025R0.js +105 -0
- package/lib/schemas/v2025R0/hubParagraphTextBlockV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.d.ts +20 -0
- package/lib/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.js +105 -0
- package/lib/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubUpdateRequestV2025R0.d.ts +3 -0
- package/lib/schemas/v2025R0/hubUpdateRequestV2025R0.d.ts.map +1 -1
- package/lib/schemas/v2025R0/hubUpdateRequestV2025R0.js +11 -0
- package/lib/schemas/v2025R0/hubUpdateRequestV2025R0.js.map +1 -1
- package/lib/schemas/v2025R0/hubV2025R0.d.ts +1 -0
- package/lib/schemas/v2025R0/hubV2025R0.d.ts.map +1 -1
- package/lib/schemas/v2025R0/hubV2025R0.js +14 -0
- package/lib/schemas/v2025R0/hubV2025R0.js.map +1 -1
- package/lib/schemas/v2025R0/index.d.ts +10 -0
- package/lib/schemas/v2025R0/index.d.ts.map +1 -1
- package/lib/schemas/v2025R0/index.js +10 -0
- package/lib/schemas/v2025R0/index.js.map +1 -1
- package/lib-esm/client.d.ts +10 -1
- package/lib-esm/client.js +17 -0
- package/lib-esm/client.js.map +1 -1
- package/lib-esm/managers/archives.d.ts +4 -0
- package/lib-esm/managers/archives.js +4 -0
- package/lib-esm/managers/archives.js.map +1 -1
- package/lib-esm/managers/hubDocument.d.ts +132 -0
- package/lib-esm/managers/hubDocument.js +154 -0
- package/lib-esm/managers/hubDocument.js.map +1 -0
- package/lib-esm/managers/hubItems.d.ts +7 -0
- package/lib-esm/managers/hubItems.js +1 -0
- package/lib-esm/managers/hubItems.js.map +1 -1
- package/lib-esm/managers/index.d.ts +1 -0
- package/lib-esm/managers/index.js +1 -0
- package/lib-esm/managers/index.js.map +1 -1
- package/lib-esm/managers/search.d.ts +1 -1
- package/lib-esm/managers/search.js +1 -1
- package/lib-esm/managers/search.js.map +1 -1
- package/lib-esm/managers/trashedItems.d.ts +2 -0
- package/lib-esm/managers/trashedItems.js +2 -0
- package/lib-esm/managers/trashedItems.js.map +1 -1
- package/lib-esm/networking/boxNetworkClient.js +67 -6
- package/lib-esm/networking/boxNetworkClient.js.map +1 -1
- package/lib-esm/networking/network.d.ts +10 -1
- package/lib-esm/networking/network.js +30 -0
- package/lib-esm/networking/network.js.map +1 -1
- package/lib-esm/networking/timeoutConfig.d.ts +3 -0
- package/lib-esm/networking/timeoutConfig.js +2 -0
- package/lib-esm/networking/timeoutConfig.js.map +1 -0
- package/lib-esm/networking/version.d.ts +1 -1
- package/lib-esm/networking/version.js +1 -1
- package/lib-esm/schemas/aiAgentBasicTextToolBase.d.ts +1 -1
- package/lib-esm/schemas/aiAgentSpreadsheetTool.d.ts +1 -1
- package/lib-esm/schemas/aiExtractStructured.d.ts +3 -0
- package/lib-esm/schemas/aiExtractStructured.js +9 -0
- package/lib-esm/schemas/aiExtractStructured.js.map +1 -1
- package/lib-esm/schemas/aiExtractStructuredResponse.d.ts +5 -0
- package/lib-esm/schemas/aiExtractStructuredResponse.js +24 -0
- package/lib-esm/schemas/aiExtractStructuredResponse.js.map +1 -1
- package/lib-esm/schemas/index.d.ts +9 -9
- package/lib-esm/schemas/index.js +9 -9
- package/lib-esm/schemas/index.js.map +1 -1
- package/lib-esm/schemas/legalHoldPolicyAssignedItem.d.ts +13 -5
- package/lib-esm/schemas/legalHoldPolicyAssignedItem.js +44 -23
- package/lib-esm/schemas/legalHoldPolicyAssignedItem.js.map +1 -1
- package/lib-esm/schemas/legalHoldPolicyAssignment.js.map +1 -1
- package/lib-esm/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.d.ts +19 -0
- package/lib-esm/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.js +106 -0
- package/lib-esm/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubDividerBlockV2025R0.d.ts +16 -0
- package/lib-esm/schemas/v2025R0/hubDividerBlockV2025R0.js +85 -0
- package/lib-esm/schemas/v2025R0/hubDividerBlockV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlockEntryV2025R0.d.ts +9 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlockEntryV2025R0.js +56 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlockEntryV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlockV2025R0.d.ts +12 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlockV2025R0.js +32 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlockV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlocksV2025R0.d.ts +44 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlocksV2025R0.js +164 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlocksV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubDocumentPageV2025R0.d.ts +18 -0
- package/lib-esm/schemas/v2025R0/hubDocumentPageV2025R0.js +64 -0
- package/lib-esm/schemas/v2025R0/hubDocumentPageV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubDocumentPagesV2025R0.d.ts +44 -0
- package/lib-esm/schemas/v2025R0/hubDocumentPagesV2025R0.js +164 -0
- package/lib-esm/schemas/v2025R0/hubDocumentPagesV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubItemListBlockV2025R0.d.ts +16 -0
- package/lib-esm/schemas/v2025R0/hubItemListBlockV2025R0.js +85 -0
- package/lib-esm/schemas/v2025R0/hubItemListBlockV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubItemOperationResultV2025R0.d.ts +3 -0
- package/lib-esm/schemas/v2025R0/hubItemOperationResultV2025R0.js +8 -0
- package/lib-esm/schemas/v2025R0/hubItemOperationResultV2025R0.js.map +1 -1
- package/lib-esm/schemas/v2025R0/hubItemOperationV2025R0.d.ts +3 -0
- package/lib-esm/schemas/v2025R0/hubItemOperationV2025R0.js +12 -1
- package/lib-esm/schemas/v2025R0/hubItemOperationV2025R0.js.map +1 -1
- package/lib-esm/schemas/v2025R0/hubParagraphTextBlockV2025R0.d.ts +19 -0
- package/lib-esm/schemas/v2025R0/hubParagraphTextBlockV2025R0.js +106 -0
- package/lib-esm/schemas/v2025R0/hubParagraphTextBlockV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.d.ts +19 -0
- package/lib-esm/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.js +106 -0
- package/lib-esm/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubUpdateRequestV2025R0.d.ts +3 -0
- package/lib-esm/schemas/v2025R0/hubUpdateRequestV2025R0.js +11 -0
- package/lib-esm/schemas/v2025R0/hubUpdateRequestV2025R0.js.map +1 -1
- package/lib-esm/schemas/v2025R0/hubV2025R0.d.ts +1 -0
- package/lib-esm/schemas/v2025R0/hubV2025R0.js +15 -0
- package/lib-esm/schemas/v2025R0/hubV2025R0.js.map +1 -1
- package/lib-esm/schemas/v2025R0/index.d.ts +10 -0
- package/lib-esm/schemas/v2025R0/index.js +10 -0
- package/lib-esm/schemas/v2025R0/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +20 -0
- package/src/managers/archives.ts +4 -0
- package/src/managers/hubDocument.ts +330 -0
- package/src/managers/hubItems.ts +8 -0
- package/src/managers/index.ts +1 -0
- package/src/managers/search.ts +2 -2
- package/src/managers/trashedItems.ts +2 -0
- package/src/networking/boxNetworkClient.ts +82 -13
- package/src/networking/network.ts +33 -0
- package/src/networking/timeoutConfig.ts +3 -0
- package/src/networking/version.ts +1 -1
- package/src/schemas/aiAgentBasicTextToolBase.ts +1 -1
- package/src/schemas/aiAgentSpreadsheetTool.ts +1 -1
- package/src/schemas/aiExtractStructured.ts +16 -0
- package/src/schemas/aiExtractStructuredResponse.ts +44 -0
- package/src/schemas/index.ts +9 -9
- package/src/schemas/legalHoldPolicyAssignedItem.ts +69 -27
- package/src/schemas/legalHoldPolicyAssignment.ts +0 -9
- package/src/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.ts +133 -0
- package/src/schemas/v2025R0/hubDividerBlockV2025R0.ts +108 -0
- package/src/schemas/v2025R0/hubDocumentBlockEntryV2025R0.ts +76 -0
- package/src/schemas/v2025R0/hubDocumentBlockV2025R0.ts +51 -0
- package/src/schemas/v2025R0/hubDocumentBlocksV2025R0.ts +238 -0
- package/src/schemas/v2025R0/hubDocumentPageV2025R0.ts +92 -0
- package/src/schemas/v2025R0/hubDocumentPagesV2025R0.ts +218 -0
- package/src/schemas/v2025R0/hubItemListBlockV2025R0.ts +108 -0
- package/src/schemas/v2025R0/hubItemOperationResultV2025R0.ts +13 -0
- package/src/schemas/v2025R0/hubItemOperationV2025R0.ts +17 -1
- package/src/schemas/v2025R0/hubParagraphTextBlockV2025R0.ts +133 -0
- package/src/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.ts +133 -0
- package/src/schemas/v2025R0/hubUpdateRequestV2025R0.ts +18 -0
- package/src/schemas/v2025R0/hubV2025R0.ts +19 -0
- package/src/schemas/v2025R0/index.ts +10 -0
- package/src/test/archives.test.ts +0 -1
- package/src/test/client.test.ts +17 -0
- package/src/test/hubDocument.test.ts +91 -0
|
@@ -24,6 +24,9 @@ export interface HubItemOperationV2025R0 {
|
|
|
24
24
|
* The action to perform on a Box Hub item. */
|
|
25
25
|
readonly action: HubItemOperationV2025R0ActionField;
|
|
26
26
|
readonly item: HubItemReferenceV2025R0;
|
|
27
|
+
/**
|
|
28
|
+
* The ID of the parent block to add the item to. Must be an Item List block. If not provided, the item will be added to the first page's first Item List block. */
|
|
29
|
+
readonly parentId?: string;
|
|
27
30
|
readonly rawData?: SerializedData;
|
|
28
31
|
}
|
|
29
32
|
export function serializeHubItemOperationV2025R0ActionField(
|
|
@@ -53,6 +56,7 @@ export function serializeHubItemOperationV2025R0(
|
|
|
53
56
|
return {
|
|
54
57
|
['action']: serializeHubItemOperationV2025R0ActionField(val.action),
|
|
55
58
|
['item']: serializeHubItemReferenceV2025R0(val.item),
|
|
59
|
+
['parent_id']: val.parentId,
|
|
56
60
|
};
|
|
57
61
|
}
|
|
58
62
|
export function deserializeHubItemOperationV2025R0(
|
|
@@ -80,5 +84,17 @@ export function deserializeHubItemOperationV2025R0(
|
|
|
80
84
|
const item: HubItemReferenceV2025R0 = deserializeHubItemReferenceV2025R0(
|
|
81
85
|
val.item,
|
|
82
86
|
);
|
|
83
|
-
|
|
87
|
+
if (!(val.parent_id == void 0) && !sdIsString(val.parent_id)) {
|
|
88
|
+
throw new BoxSdkError({
|
|
89
|
+
message:
|
|
90
|
+
'Expecting string for "parent_id" of type "HubItemOperationV2025R0"',
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const parentId: undefined | string =
|
|
94
|
+
val.parent_id == void 0 ? void 0 : val.parent_id;
|
|
95
|
+
return {
|
|
96
|
+
action: action,
|
|
97
|
+
item: item,
|
|
98
|
+
parentId: parentId,
|
|
99
|
+
} satisfies HubItemOperationV2025R0;
|
|
84
100
|
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { serializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0';
|
|
2
|
+
import { deserializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0';
|
|
3
|
+
import { HubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0';
|
|
4
|
+
import { BoxSdkError } from '../../box/errors';
|
|
5
|
+
import { SerializedData } from '../../serialization/json';
|
|
6
|
+
import { sdIsEmpty } from '../../serialization/json';
|
|
7
|
+
import { sdIsBoolean } from '../../serialization/json';
|
|
8
|
+
import { sdIsNumber } from '../../serialization/json';
|
|
9
|
+
import { sdIsString } from '../../serialization/json';
|
|
10
|
+
import { sdIsList } from '../../serialization/json';
|
|
11
|
+
import { sdIsMap } from '../../serialization/json';
|
|
12
|
+
export type HubParagraphTextBlockV2025R0TypeField = 'paragraph';
|
|
13
|
+
export class HubParagraphTextBlockV2025R0 implements HubDocumentBlockV2025R0 {
|
|
14
|
+
readonly id!: string;
|
|
15
|
+
readonly parentId?: string | null;
|
|
16
|
+
readonly rawData?: SerializedData;
|
|
17
|
+
/**
|
|
18
|
+
* The type of this block. The value is always `paragraph`. */
|
|
19
|
+
readonly type: HubParagraphTextBlockV2025R0TypeField =
|
|
20
|
+
'paragraph' as HubParagraphTextBlockV2025R0TypeField;
|
|
21
|
+
/**
|
|
22
|
+
* Text content of the block. Includes rich text formatting. */
|
|
23
|
+
readonly fragment!: string;
|
|
24
|
+
constructor(
|
|
25
|
+
fields: Omit<HubParagraphTextBlockV2025R0, 'type'> &
|
|
26
|
+
Partial<Pick<HubParagraphTextBlockV2025R0, 'type'>>,
|
|
27
|
+
) {
|
|
28
|
+
if (fields.id !== undefined) {
|
|
29
|
+
this.id = fields.id;
|
|
30
|
+
}
|
|
31
|
+
if (fields.parentId !== undefined) {
|
|
32
|
+
this.parentId = fields.parentId;
|
|
33
|
+
}
|
|
34
|
+
if (fields.rawData !== undefined) {
|
|
35
|
+
this.rawData = fields.rawData;
|
|
36
|
+
}
|
|
37
|
+
if (fields.type !== undefined) {
|
|
38
|
+
this.type = fields.type;
|
|
39
|
+
}
|
|
40
|
+
if (fields.fragment !== undefined) {
|
|
41
|
+
this.fragment = fields.fragment;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export function serializeHubParagraphTextBlockV2025R0TypeField(
|
|
46
|
+
val: HubParagraphTextBlockV2025R0TypeField,
|
|
47
|
+
): SerializedData {
|
|
48
|
+
return val;
|
|
49
|
+
}
|
|
50
|
+
export function deserializeHubParagraphTextBlockV2025R0TypeField(
|
|
51
|
+
val: SerializedData,
|
|
52
|
+
): HubParagraphTextBlockV2025R0TypeField {
|
|
53
|
+
if (val == 'paragraph') {
|
|
54
|
+
return val;
|
|
55
|
+
}
|
|
56
|
+
throw new BoxSdkError({
|
|
57
|
+
message: "Can't deserialize HubParagraphTextBlockV2025R0TypeField",
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export function serializeHubParagraphTextBlockV2025R0(
|
|
61
|
+
val: HubParagraphTextBlockV2025R0,
|
|
62
|
+
): SerializedData {
|
|
63
|
+
const base: any = serializeHubDocumentBlockV2025R0(val);
|
|
64
|
+
if (!sdIsMap(base)) {
|
|
65
|
+
throw new BoxSdkError({
|
|
66
|
+
message: 'Expecting a map for "HubParagraphTextBlockV2025R0"',
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
...base,
|
|
71
|
+
...{
|
|
72
|
+
['type']: serializeHubParagraphTextBlockV2025R0TypeField(val.type),
|
|
73
|
+
['fragment']: val.fragment,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export function deserializeHubParagraphTextBlockV2025R0(
|
|
78
|
+
val: SerializedData,
|
|
79
|
+
): HubParagraphTextBlockV2025R0 {
|
|
80
|
+
if (!sdIsMap(val)) {
|
|
81
|
+
throw new BoxSdkError({
|
|
82
|
+
message: 'Expecting a map for "HubParagraphTextBlockV2025R0"',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (val.type == void 0) {
|
|
86
|
+
throw new BoxSdkError({
|
|
87
|
+
message:
|
|
88
|
+
'Expecting "type" of type "HubParagraphTextBlockV2025R0" to be defined',
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const type: HubParagraphTextBlockV2025R0TypeField =
|
|
92
|
+
deserializeHubParagraphTextBlockV2025R0TypeField(val.type);
|
|
93
|
+
if (val.fragment == void 0) {
|
|
94
|
+
throw new BoxSdkError({
|
|
95
|
+
message:
|
|
96
|
+
'Expecting "fragment" of type "HubParagraphTextBlockV2025R0" to be defined',
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (!sdIsString(val.fragment)) {
|
|
100
|
+
throw new BoxSdkError({
|
|
101
|
+
message:
|
|
102
|
+
'Expecting string for "fragment" of type "HubParagraphTextBlockV2025R0"',
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const fragment: string = val.fragment;
|
|
106
|
+
if (val.id == void 0) {
|
|
107
|
+
throw new BoxSdkError({
|
|
108
|
+
message:
|
|
109
|
+
'Expecting "id" of type "HubParagraphTextBlockV2025R0" to be defined',
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (!sdIsString(val.id)) {
|
|
113
|
+
throw new BoxSdkError({
|
|
114
|
+
message:
|
|
115
|
+
'Expecting string for "id" of type "HubParagraphTextBlockV2025R0"',
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
const id: string = val.id;
|
|
119
|
+
if (!(val.parent_id == void 0) && !sdIsString(val.parent_id)) {
|
|
120
|
+
throw new BoxSdkError({
|
|
121
|
+
message:
|
|
122
|
+
'Expecting string for "parent_id" of type "HubParagraphTextBlockV2025R0"',
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
const parentId: undefined | string =
|
|
126
|
+
val.parent_id == void 0 ? void 0 : val.parent_id;
|
|
127
|
+
return {
|
|
128
|
+
type: type,
|
|
129
|
+
fragment: fragment,
|
|
130
|
+
id: id,
|
|
131
|
+
parentId: parentId,
|
|
132
|
+
} satisfies HubParagraphTextBlockV2025R0;
|
|
133
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { serializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0';
|
|
2
|
+
import { deserializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0';
|
|
3
|
+
import { HubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0';
|
|
4
|
+
import { BoxSdkError } from '../../box/errors';
|
|
5
|
+
import { SerializedData } from '../../serialization/json';
|
|
6
|
+
import { sdIsEmpty } from '../../serialization/json';
|
|
7
|
+
import { sdIsBoolean } from '../../serialization/json';
|
|
8
|
+
import { sdIsNumber } from '../../serialization/json';
|
|
9
|
+
import { sdIsString } from '../../serialization/json';
|
|
10
|
+
import { sdIsList } from '../../serialization/json';
|
|
11
|
+
import { sdIsMap } from '../../serialization/json';
|
|
12
|
+
export type HubSectionTitleTextBlockV2025R0TypeField = 'section_title';
|
|
13
|
+
export class HubSectionTitleTextBlockV2025R0 implements HubDocumentBlockV2025R0 {
|
|
14
|
+
readonly id!: string;
|
|
15
|
+
readonly parentId?: string | null;
|
|
16
|
+
readonly rawData?: SerializedData;
|
|
17
|
+
/**
|
|
18
|
+
* The type of this block. The value is always `section_title`. */
|
|
19
|
+
readonly type: HubSectionTitleTextBlockV2025R0TypeField =
|
|
20
|
+
'section_title' as HubSectionTitleTextBlockV2025R0TypeField;
|
|
21
|
+
/**
|
|
22
|
+
* Text content of the block. Includes rich text formatting. */
|
|
23
|
+
readonly fragment!: string;
|
|
24
|
+
constructor(
|
|
25
|
+
fields: Omit<HubSectionTitleTextBlockV2025R0, 'type'> &
|
|
26
|
+
Partial<Pick<HubSectionTitleTextBlockV2025R0, 'type'>>,
|
|
27
|
+
) {
|
|
28
|
+
if (fields.id !== undefined) {
|
|
29
|
+
this.id = fields.id;
|
|
30
|
+
}
|
|
31
|
+
if (fields.parentId !== undefined) {
|
|
32
|
+
this.parentId = fields.parentId;
|
|
33
|
+
}
|
|
34
|
+
if (fields.rawData !== undefined) {
|
|
35
|
+
this.rawData = fields.rawData;
|
|
36
|
+
}
|
|
37
|
+
if (fields.type !== undefined) {
|
|
38
|
+
this.type = fields.type;
|
|
39
|
+
}
|
|
40
|
+
if (fields.fragment !== undefined) {
|
|
41
|
+
this.fragment = fields.fragment;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export function serializeHubSectionTitleTextBlockV2025R0TypeField(
|
|
46
|
+
val: HubSectionTitleTextBlockV2025R0TypeField,
|
|
47
|
+
): SerializedData {
|
|
48
|
+
return val;
|
|
49
|
+
}
|
|
50
|
+
export function deserializeHubSectionTitleTextBlockV2025R0TypeField(
|
|
51
|
+
val: SerializedData,
|
|
52
|
+
): HubSectionTitleTextBlockV2025R0TypeField {
|
|
53
|
+
if (val == 'section_title') {
|
|
54
|
+
return val;
|
|
55
|
+
}
|
|
56
|
+
throw new BoxSdkError({
|
|
57
|
+
message: "Can't deserialize HubSectionTitleTextBlockV2025R0TypeField",
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export function serializeHubSectionTitleTextBlockV2025R0(
|
|
61
|
+
val: HubSectionTitleTextBlockV2025R0,
|
|
62
|
+
): SerializedData {
|
|
63
|
+
const base: any = serializeHubDocumentBlockV2025R0(val);
|
|
64
|
+
if (!sdIsMap(base)) {
|
|
65
|
+
throw new BoxSdkError({
|
|
66
|
+
message: 'Expecting a map for "HubSectionTitleTextBlockV2025R0"',
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
...base,
|
|
71
|
+
...{
|
|
72
|
+
['type']: serializeHubSectionTitleTextBlockV2025R0TypeField(val.type),
|
|
73
|
+
['fragment']: val.fragment,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export function deserializeHubSectionTitleTextBlockV2025R0(
|
|
78
|
+
val: SerializedData,
|
|
79
|
+
): HubSectionTitleTextBlockV2025R0 {
|
|
80
|
+
if (!sdIsMap(val)) {
|
|
81
|
+
throw new BoxSdkError({
|
|
82
|
+
message: 'Expecting a map for "HubSectionTitleTextBlockV2025R0"',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (val.type == void 0) {
|
|
86
|
+
throw new BoxSdkError({
|
|
87
|
+
message:
|
|
88
|
+
'Expecting "type" of type "HubSectionTitleTextBlockV2025R0" to be defined',
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const type: HubSectionTitleTextBlockV2025R0TypeField =
|
|
92
|
+
deserializeHubSectionTitleTextBlockV2025R0TypeField(val.type);
|
|
93
|
+
if (val.fragment == void 0) {
|
|
94
|
+
throw new BoxSdkError({
|
|
95
|
+
message:
|
|
96
|
+
'Expecting "fragment" of type "HubSectionTitleTextBlockV2025R0" to be defined',
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (!sdIsString(val.fragment)) {
|
|
100
|
+
throw new BoxSdkError({
|
|
101
|
+
message:
|
|
102
|
+
'Expecting string for "fragment" of type "HubSectionTitleTextBlockV2025R0"',
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const fragment: string = val.fragment;
|
|
106
|
+
if (val.id == void 0) {
|
|
107
|
+
throw new BoxSdkError({
|
|
108
|
+
message:
|
|
109
|
+
'Expecting "id" of type "HubSectionTitleTextBlockV2025R0" to be defined',
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (!sdIsString(val.id)) {
|
|
113
|
+
throw new BoxSdkError({
|
|
114
|
+
message:
|
|
115
|
+
'Expecting string for "id" of type "HubSectionTitleTextBlockV2025R0"',
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
const id: string = val.id;
|
|
119
|
+
if (!(val.parent_id == void 0) && !sdIsString(val.parent_id)) {
|
|
120
|
+
throw new BoxSdkError({
|
|
121
|
+
message:
|
|
122
|
+
'Expecting string for "parent_id" of type "HubSectionTitleTextBlockV2025R0"',
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
const parentId: undefined | string =
|
|
126
|
+
val.parent_id == void 0 ? void 0 : val.parent_id;
|
|
127
|
+
return {
|
|
128
|
+
type: type,
|
|
129
|
+
fragment: fragment,
|
|
130
|
+
id: id,
|
|
131
|
+
parentId: parentId,
|
|
132
|
+
} satisfies HubSectionTitleTextBlockV2025R0;
|
|
133
|
+
}
|
|
@@ -25,6 +25,9 @@ export interface HubUpdateRequestV2025R0 {
|
|
|
25
25
|
/**
|
|
26
26
|
* Indicates if a shared link can be created for the Box Hub. */
|
|
27
27
|
readonly canSharedLinkBeCreated?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Indicates if a public shared link can be created for the Box Hub. */
|
|
30
|
+
readonly canPublicSharedLinkBeCreated?: boolean;
|
|
28
31
|
readonly rawData?: SerializedData;
|
|
29
32
|
}
|
|
30
33
|
export function serializeHubUpdateRequestV2025R0(
|
|
@@ -38,6 +41,7 @@ export function serializeHubUpdateRequestV2025R0(
|
|
|
38
41
|
val.isCollaborationRestrictedToEnterprise,
|
|
39
42
|
['can_non_owners_invite']: val.canNonOwnersInvite,
|
|
40
43
|
['can_shared_link_be_created']: val.canSharedLinkBeCreated,
|
|
44
|
+
['can_public_shared_link_be_created']: val.canPublicSharedLinkBeCreated,
|
|
41
45
|
};
|
|
42
46
|
}
|
|
43
47
|
export function deserializeHubUpdateRequestV2025R0(
|
|
@@ -107,6 +111,19 @@ export function deserializeHubUpdateRequestV2025R0(
|
|
|
107
111
|
val.can_shared_link_be_created == void 0
|
|
108
112
|
? void 0
|
|
109
113
|
: val.can_shared_link_be_created;
|
|
114
|
+
if (
|
|
115
|
+
!(val.can_public_shared_link_be_created == void 0) &&
|
|
116
|
+
!sdIsBoolean(val.can_public_shared_link_be_created)
|
|
117
|
+
) {
|
|
118
|
+
throw new BoxSdkError({
|
|
119
|
+
message:
|
|
120
|
+
'Expecting boolean for "can_public_shared_link_be_created" of type "HubUpdateRequestV2025R0"',
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const canPublicSharedLinkBeCreated: undefined | boolean =
|
|
124
|
+
val.can_public_shared_link_be_created == void 0
|
|
125
|
+
? void 0
|
|
126
|
+
: val.can_public_shared_link_be_created;
|
|
110
127
|
return {
|
|
111
128
|
title: title,
|
|
112
129
|
description: description,
|
|
@@ -115,5 +132,6 @@ export function deserializeHubUpdateRequestV2025R0(
|
|
|
115
132
|
isCollaborationRestrictedToEnterprise,
|
|
116
133
|
canNonOwnersInvite: canNonOwnersInvite,
|
|
117
134
|
canSharedLinkBeCreated: canSharedLinkBeCreated,
|
|
135
|
+
canPublicSharedLinkBeCreated: canPublicSharedLinkBeCreated,
|
|
118
136
|
} satisfies HubUpdateRequestV2025R0;
|
|
119
137
|
}
|
|
@@ -30,6 +30,7 @@ export class HubV2025R0 extends HubBaseV2025R0 {
|
|
|
30
30
|
readonly isCollaborationRestrictedToEnterprise?: boolean;
|
|
31
31
|
readonly canNonOwnersInvite?: boolean;
|
|
32
32
|
readonly canSharedLinkBeCreated?: boolean;
|
|
33
|
+
readonly canPublicSharedLinkBeCreated?: boolean;
|
|
33
34
|
constructor(fields: HubV2025R0) {
|
|
34
35
|
super(fields);
|
|
35
36
|
if (fields.title !== undefined) {
|
|
@@ -66,6 +67,9 @@ export class HubV2025R0 extends HubBaseV2025R0 {
|
|
|
66
67
|
if (fields.canSharedLinkBeCreated !== undefined) {
|
|
67
68
|
this.canSharedLinkBeCreated = fields.canSharedLinkBeCreated;
|
|
68
69
|
}
|
|
70
|
+
if (fields.canPublicSharedLinkBeCreated !== undefined) {
|
|
71
|
+
this.canPublicSharedLinkBeCreated = fields.canPublicSharedLinkBeCreated;
|
|
72
|
+
}
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
75
|
export function serializeHubV2025R0(val: HubV2025R0): SerializedData {
|
|
@@ -100,6 +104,7 @@ export function serializeHubV2025R0(val: HubV2025R0): SerializedData {
|
|
|
100
104
|
val.isCollaborationRestrictedToEnterprise,
|
|
101
105
|
['can_non_owners_invite']: val.canNonOwnersInvite,
|
|
102
106
|
['can_shared_link_be_created']: val.canSharedLinkBeCreated,
|
|
107
|
+
['can_public_shared_link_be_created']: val.canPublicSharedLinkBeCreated,
|
|
103
108
|
},
|
|
104
109
|
};
|
|
105
110
|
}
|
|
@@ -193,6 +198,19 @@ export function deserializeHubV2025R0(val: SerializedData): HubV2025R0 {
|
|
|
193
198
|
val.can_shared_link_be_created == void 0
|
|
194
199
|
? void 0
|
|
195
200
|
: val.can_shared_link_be_created;
|
|
201
|
+
if (
|
|
202
|
+
!(val.can_public_shared_link_be_created == void 0) &&
|
|
203
|
+
!sdIsBoolean(val.can_public_shared_link_be_created)
|
|
204
|
+
) {
|
|
205
|
+
throw new BoxSdkError({
|
|
206
|
+
message:
|
|
207
|
+
'Expecting boolean for "can_public_shared_link_be_created" of type "HubV2025R0"',
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
const canPublicSharedLinkBeCreated: undefined | boolean =
|
|
211
|
+
val.can_public_shared_link_be_created == void 0
|
|
212
|
+
? void 0
|
|
213
|
+
: val.can_public_shared_link_be_created;
|
|
196
214
|
if (val.id == void 0) {
|
|
197
215
|
throw new BoxSdkError({
|
|
198
216
|
message: 'Expecting "id" of type "HubV2025R0" to be defined',
|
|
@@ -225,6 +243,7 @@ export function deserializeHubV2025R0(val: SerializedData): HubV2025R0 {
|
|
|
225
243
|
isCollaborationRestrictedToEnterprise,
|
|
226
244
|
canNonOwnersInvite: canNonOwnersInvite,
|
|
227
245
|
canSharedLinkBeCreated: canSharedLinkBeCreated,
|
|
246
|
+
canPublicSharedLinkBeCreated: canPublicSharedLinkBeCreated,
|
|
228
247
|
id: id,
|
|
229
248
|
type: type,
|
|
230
249
|
} satisfies HubV2025R0;
|
|
@@ -34,6 +34,16 @@ export * from './hubCollaborationCreateRequestV2025R0';
|
|
|
34
34
|
export * from './hubCollaborationUpdateRequestV2025R0';
|
|
35
35
|
export * from './hubCopyRequestV2025R0';
|
|
36
36
|
export * from './hubCreateRequestV2025R0';
|
|
37
|
+
export * from './hubDocumentBlockV2025R0';
|
|
38
|
+
export * from './hubSectionTitleTextBlockV2025R0';
|
|
39
|
+
export * from './hubParagraphTextBlockV2025R0';
|
|
40
|
+
export * from './hubItemListBlockV2025R0';
|
|
41
|
+
export * from './hubDividerBlockV2025R0';
|
|
42
|
+
export * from './hubCalloutBoxTextBlockV2025R0';
|
|
43
|
+
export * from './hubDocumentBlockEntryV2025R0';
|
|
44
|
+
export * from './hubDocumentBlocksV2025R0';
|
|
45
|
+
export * from './hubDocumentPageV2025R0';
|
|
46
|
+
export * from './hubDocumentPagesV2025R0';
|
|
37
47
|
export * from './hubItemV2025R0';
|
|
38
48
|
export * from './hubItemsV2025R0';
|
|
39
49
|
export * from './hubUpdateRequestV2025R0';
|
|
@@ -65,7 +65,6 @@ test('testArchivesCreateListDelete', async function testArchivesCreateListDelete
|
|
|
65
65
|
if (!(archives.entries!.length > 0)) {
|
|
66
66
|
throw new Error('Assertion failed');
|
|
67
67
|
}
|
|
68
|
-
await client.archives.deleteArchiveByIdV2025R0(archive.id);
|
|
69
68
|
await expect(async () => {
|
|
70
69
|
await client.archives.deleteArchiveByIdV2025R0(archive.id);
|
|
71
70
|
}).rejects.toThrow();
|
package/src/test/client.test.ts
CHANGED
|
@@ -37,6 +37,7 @@ import { FileFull } from '@/schemas/fileFull';
|
|
|
37
37
|
import { ResponseFormat } from '@/networking/fetchOptions';
|
|
38
38
|
import { UserFull } from '@/schemas/userFull';
|
|
39
39
|
import { CreateUserRequestBody } from '@/managers/users';
|
|
40
|
+
import { TimeoutConfig } from '@/networking/timeoutConfig';
|
|
40
41
|
import { getUuid } from '@/internal/utils';
|
|
41
42
|
import { generateByteStream } from '@/internal/utils';
|
|
42
43
|
import { bufferEquals } from '@/internal/utils';
|
|
@@ -368,6 +369,22 @@ test('testWithCustomBaseUrls', async function testWithCustomBaseUrls(): Promise<
|
|
|
368
369
|
await customBaseClient.users.getUserMe();
|
|
369
370
|
}).rejects.toThrow();
|
|
370
371
|
});
|
|
372
|
+
test('testWithTimeoutWhenTimeoutOccurs', async function testWithTimeoutWhenTimeoutOccurs(): Promise<any> {
|
|
373
|
+
const timeoutMs: number = 1;
|
|
374
|
+
const clientWithTimeout: BoxClient = client.withTimeouts({
|
|
375
|
+
timeoutMs: timeoutMs,
|
|
376
|
+
} satisfies TimeoutConfig);
|
|
377
|
+
await expect(async () => {
|
|
378
|
+
await clientWithTimeout.users.getUserMe();
|
|
379
|
+
}).rejects.toThrow();
|
|
380
|
+
});
|
|
381
|
+
test('testWithTimeoutWhenTimeoutDoesNotOccur', async function testWithTimeoutWhenTimeoutDoesNotOccur(): Promise<any> {
|
|
382
|
+
const timeoutMs: number = 10000;
|
|
383
|
+
const clientWithTimeout: BoxClient = client.withTimeouts({
|
|
384
|
+
timeoutMs: timeoutMs,
|
|
385
|
+
} satisfies TimeoutConfig);
|
|
386
|
+
await clientWithTimeout.users.getUserMe();
|
|
387
|
+
});
|
|
371
388
|
test('testWithInterceptors', async function testWithInterceptors(): Promise<any> {
|
|
372
389
|
const user: UserFull = await client.users.getUserMe();
|
|
373
390
|
if (!(user.role == void 0)) {
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { serializeHubV2025R0 } from '@/schemas/v2025R0/hubV2025R0';
|
|
2
|
+
import { deserializeHubV2025R0 } from '@/schemas/v2025R0/hubV2025R0';
|
|
3
|
+
import { serializeHubCreateRequestV2025R0 } from '@/schemas/v2025R0/hubCreateRequestV2025R0';
|
|
4
|
+
import { deserializeHubCreateRequestV2025R0 } from '@/schemas/v2025R0/hubCreateRequestV2025R0';
|
|
5
|
+
import { serializeHubDocumentPagesV2025R0 } from '@/schemas/v2025R0/hubDocumentPagesV2025R0';
|
|
6
|
+
import { deserializeHubDocumentPagesV2025R0 } from '@/schemas/v2025R0/hubDocumentPagesV2025R0';
|
|
7
|
+
import { serializeHubDocumentPageV2025R0 } from '@/schemas/v2025R0/hubDocumentPageV2025R0';
|
|
8
|
+
import { deserializeHubDocumentPageV2025R0 } from '@/schemas/v2025R0/hubDocumentPageV2025R0';
|
|
9
|
+
import { serializeHubDocumentBlocksV2025R0 } from '@/schemas/v2025R0/hubDocumentBlocksV2025R0';
|
|
10
|
+
import { deserializeHubDocumentBlocksV2025R0 } from '@/schemas/v2025R0/hubDocumentBlocksV2025R0';
|
|
11
|
+
import { serializeHubParagraphTextBlockV2025R0 } from '@/schemas/v2025R0/hubParagraphTextBlockV2025R0';
|
|
12
|
+
import { deserializeHubParagraphTextBlockV2025R0 } from '@/schemas/v2025R0/hubParagraphTextBlockV2025R0';
|
|
13
|
+
import { serializeHubSectionTitleTextBlockV2025R0 } from '@/schemas/v2025R0/hubSectionTitleTextBlockV2025R0';
|
|
14
|
+
import { deserializeHubSectionTitleTextBlockV2025R0 } from '@/schemas/v2025R0/hubSectionTitleTextBlockV2025R0';
|
|
15
|
+
import { serializeHubCalloutBoxTextBlockV2025R0 } from '@/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0';
|
|
16
|
+
import { deserializeHubCalloutBoxTextBlockV2025R0 } from '@/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0';
|
|
17
|
+
import { serializeHubItemListBlockV2025R0 } from '@/schemas/v2025R0/hubItemListBlockV2025R0';
|
|
18
|
+
import { deserializeHubItemListBlockV2025R0 } from '@/schemas/v2025R0/hubItemListBlockV2025R0';
|
|
19
|
+
import { serializeHubDividerBlockV2025R0 } from '@/schemas/v2025R0/hubDividerBlockV2025R0';
|
|
20
|
+
import { deserializeHubDividerBlockV2025R0 } from '@/schemas/v2025R0/hubDividerBlockV2025R0';
|
|
21
|
+
import { serializeHubDocumentBlockEntryV2025R0 } from '@/schemas/v2025R0/hubDocumentBlockEntryV2025R0';
|
|
22
|
+
import { deserializeHubDocumentBlockEntryV2025R0 } from '@/schemas/v2025R0/hubDocumentBlockEntryV2025R0';
|
|
23
|
+
import { BoxClient } from '@/client';
|
|
24
|
+
import { HubV2025R0 } from '@/schemas/v2025R0/hubV2025R0';
|
|
25
|
+
import { HubCreateRequestV2025R0 } from '@/schemas/v2025R0/hubCreateRequestV2025R0';
|
|
26
|
+
import { HubDocumentPagesV2025R0 } from '@/schemas/v2025R0/hubDocumentPagesV2025R0';
|
|
27
|
+
import { GetHubDocumentPagesV2025R0QueryParams } from '@/managers/hubDocument';
|
|
28
|
+
import { HubDocumentPageV2025R0 } from '@/schemas/v2025R0/hubDocumentPageV2025R0';
|
|
29
|
+
import { HubDocumentBlocksV2025R0 } from '@/schemas/v2025R0/hubDocumentBlocksV2025R0';
|
|
30
|
+
import { GetHubDocumentBlocksV2025R0QueryParams } from '@/managers/hubDocument';
|
|
31
|
+
import { HubParagraphTextBlockV2025R0 } from '@/schemas/v2025R0/hubParagraphTextBlockV2025R0';
|
|
32
|
+
import { HubSectionTitleTextBlockV2025R0 } from '@/schemas/v2025R0/hubSectionTitleTextBlockV2025R0';
|
|
33
|
+
import { HubCalloutBoxTextBlockV2025R0 } from '@/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0';
|
|
34
|
+
import { HubItemListBlockV2025R0 } from '@/schemas/v2025R0/hubItemListBlockV2025R0';
|
|
35
|
+
import { HubDividerBlockV2025R0 } from '@/schemas/v2025R0/hubDividerBlockV2025R0';
|
|
36
|
+
import { HubDocumentBlockEntryV2025R0 } from '@/schemas/v2025R0/hubDocumentBlockEntryV2025R0';
|
|
37
|
+
import { getDefaultClientWithUserSubject } from './commons';
|
|
38
|
+
import { getEnvVar } from '@/internal/utils';
|
|
39
|
+
import { getUuid } from '@/internal/utils';
|
|
40
|
+
import { toString } from '@/internal/utils';
|
|
41
|
+
import { sdToJson } from '@/serialization/json';
|
|
42
|
+
import { SerializedData } from '@/serialization/json';
|
|
43
|
+
import { sdIsEmpty } from '@/serialization/json';
|
|
44
|
+
import { sdIsBoolean } from '@/serialization/json';
|
|
45
|
+
import { sdIsNumber } from '@/serialization/json';
|
|
46
|
+
import { sdIsString } from '@/serialization/json';
|
|
47
|
+
import { sdIsList } from '@/serialization/json';
|
|
48
|
+
import { sdIsMap } from '@/serialization/json';
|
|
49
|
+
export const client: BoxClient = getDefaultClientWithUserSubject(
|
|
50
|
+
getEnvVar('USER_ID'),
|
|
51
|
+
);
|
|
52
|
+
test('testGetHubDocumentPagesAndBlocks', async function testGetHubDocumentPagesAndBlocks(): Promise<any> {
|
|
53
|
+
const hubTitle: string = getUuid();
|
|
54
|
+
const createdHub: HubV2025R0 = await client.hubs.createHubV2025R0({
|
|
55
|
+
title: hubTitle,
|
|
56
|
+
} satisfies HubCreateRequestV2025R0);
|
|
57
|
+
const hubId: string = createdHub.id;
|
|
58
|
+
const pages: HubDocumentPagesV2025R0 =
|
|
59
|
+
await client.hubDocument.getHubDocumentPagesV2025R0({
|
|
60
|
+
hubId: hubId,
|
|
61
|
+
} satisfies GetHubDocumentPagesV2025R0QueryParams);
|
|
62
|
+
if (!(pages.entries.length > 0)) {
|
|
63
|
+
throw new Error('Assertion failed');
|
|
64
|
+
}
|
|
65
|
+
if (!((toString(pages.type) as string) == 'document_pages')) {
|
|
66
|
+
throw new Error('Assertion failed');
|
|
67
|
+
}
|
|
68
|
+
const firstPage: HubDocumentPageV2025R0 = pages.entries[0];
|
|
69
|
+
if (!((toString(firstPage.type) as string) == 'page')) {
|
|
70
|
+
throw new Error('Assertion failed');
|
|
71
|
+
}
|
|
72
|
+
const pageId: string = firstPage.id;
|
|
73
|
+
const blocks: HubDocumentBlocksV2025R0 =
|
|
74
|
+
await client.hubDocument.getHubDocumentBlocksV2025R0({
|
|
75
|
+
hubId: hubId,
|
|
76
|
+
pageId: pageId,
|
|
77
|
+
} satisfies GetHubDocumentBlocksV2025R0QueryParams);
|
|
78
|
+
if (!((toString(blocks.type) as string) == 'document_blocks')) {
|
|
79
|
+
throw new Error('Assertion failed');
|
|
80
|
+
}
|
|
81
|
+
if (!(blocks.entries.length > 0)) {
|
|
82
|
+
throw new Error('Assertion failed');
|
|
83
|
+
}
|
|
84
|
+
const firstBlock: HubDocumentBlockEntryV2025R0 = blocks
|
|
85
|
+
.entries![0] as HubDocumentBlockEntryV2025R0;
|
|
86
|
+
if (!((toString(firstBlock.type!) as string) == 'item_list')) {
|
|
87
|
+
throw new Error('Assertion failed');
|
|
88
|
+
}
|
|
89
|
+
await client.hubs.deleteHubByIdV2025R0(hubId);
|
|
90
|
+
});
|
|
91
|
+
export {};
|