Skip to content

Commit 42d64bd

Browse files
committed
fix: feat: Add Hub Document API (part 2) (box/box-openapi#588)
1 parent a6b067b commit 42d64bd

File tree

5 files changed

+86
-2
lines changed

5 files changed

+86
-2
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "65f6eab", "specHash": "57b3004", "version": "10.5.0" }
1+
{ "engineHash": "65f6eab", "specHash": "ca63e5e", "version": "10.5.0" }

src/managers/hubItems.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ export interface GetHubItemsV2025R0QueryParams {
8989
* for the URL `https://*.app.box.com/hubs/123`
9090
* the `hub_id` is `123`. */
9191
readonly hubId: string;
92+
/**
93+
* The unique identifier of an item list block within the Box Hub.
94+
*
95+
* When provided, the response will only include items that belong
96+
* to the specified item list, allowing you to filter results to
97+
* items on a specific page or section. */
98+
readonly parentId?: string;
9299
/**
93100
* Defines the position marker at which to begin returning results. This is
94101
* used when paginating using marker-based pagination.
@@ -203,6 +210,7 @@ export class HubItemsManager {
203210
readonly [key: string]: string;
204211
} = prepareParams({
205212
['hub_id']: toString(queryParams.hubId) as string,
213+
['parent_id']: toString(queryParams.parentId) as string,
206214
['marker']: toString(queryParams.marker) as string,
207215
['limit']: toString(queryParams.limit) as string,
208216
});

src/schemas/aiExtractStructured.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ export interface AiExtractStructured {
7878
/**
7979
* A flag to indicate whether confidence scores for every extracted field should be returned. */
8080
readonly includeConfidenceScore?: boolean;
81+
/**
82+
* A flag to indicate whether references for every extracted field should be returned. */
83+
readonly includeReference?: boolean;
8184
readonly aiAgent?: AiExtractStructuredAgent;
8285
readonly rawData?: SerializedData;
8386
}
@@ -286,6 +289,7 @@ export function serializeAiExtractStructured(
286289
return serializeAiExtractStructuredFieldsField(item);
287290
}) as readonly any[]),
288291
['include_confidence_score']: val.includeConfidenceScore,
292+
['include_reference']: val.includeReference,
289293
['ai_agent']:
290294
val.aiAgent == void 0
291295
? val.aiAgent
@@ -349,6 +353,17 @@ export function deserializeAiExtractStructured(
349353
val.include_confidence_score == void 0
350354
? void 0
351355
: val.include_confidence_score;
356+
if (
357+
!(val.include_reference == void 0) &&
358+
!sdIsBoolean(val.include_reference)
359+
) {
360+
throw new BoxSdkError({
361+
message:
362+
'Expecting boolean for "include_reference" of type "AiExtractStructured"',
363+
});
364+
}
365+
const includeReference: undefined | boolean =
366+
val.include_reference == void 0 ? void 0 : val.include_reference;
352367
const aiAgent: undefined | AiExtractStructuredAgent =
353368
val.ai_agent == void 0
354369
? void 0
@@ -358,6 +373,7 @@ export function deserializeAiExtractStructured(
358373
metadataTemplate: metadataTemplate,
359374
fields: fields,
360375
includeConfidenceScore: includeConfidenceScore,
376+
includeReference: includeReference,
361377
aiAgent: aiAgent,
362378
} satisfies AiExtractStructured;
363379
}

src/schemas/aiExtractStructuredResponse.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export interface AiExtractStructuredResponse {
2828
readonly confidenceScore?: {
2929
readonly [key: string]: any;
3030
};
31+
/**
32+
* The reference for each extracted field as a JSON dictionary. This can be empty if no field could be extracted. */
33+
readonly reference?: {
34+
readonly [key: string]: any;
35+
};
3136
readonly aiAgentInfo?: AiAgentInfo;
3237
readonly rawData?: SerializedData;
3338
}
@@ -51,6 +56,19 @@ export function serializeAiExtractStructuredResponse(
5156
) as {
5257
readonly [key: string]: any;
5358
}),
59+
['reference']:
60+
val.reference == void 0
61+
? val.reference
62+
: (Object.fromEntries(
63+
Object.entries(val.reference).map(([k, v]: [string, any]) => [
64+
k,
65+
(function (v: any): any {
66+
return v;
67+
})(v),
68+
]),
69+
) as {
70+
readonly [key: string]: any;
71+
}),
5472
['ai_agent_info']:
5573
val.aiAgentInfo == void 0
5674
? val.aiAgentInfo
@@ -123,6 +141,31 @@ export function deserializeAiExtractStructuredResponse(
123141
readonly [key: string]: any;
124142
})
125143
: {};
144+
if (!(val.reference == void 0) && !sdIsMap(val.reference)) {
145+
throw new BoxSdkError({
146+
message:
147+
'Expecting object for "reference" of type "AiExtractStructuredResponse"',
148+
});
149+
}
150+
const reference:
151+
| undefined
152+
| {
153+
readonly [key: string]: any;
154+
} =
155+
val.reference == void 0
156+
? void 0
157+
: sdIsMap(val.reference)
158+
? (Object.fromEntries(
159+
Object.entries(val.reference).map(([k, v]: [string, any]) => [
160+
k,
161+
(function (v: any): any {
162+
return v;
163+
})(v),
164+
]),
165+
) as {
166+
readonly [key: string]: any;
167+
})
168+
: {};
126169
const aiAgentInfo: undefined | AiAgentInfo =
127170
val.ai_agent_info == void 0
128171
? void 0
@@ -132,6 +175,7 @@ export function deserializeAiExtractStructuredResponse(
132175
createdAt: createdAt,
133176
completionReason: completionReason,
134177
confidenceScore: confidenceScore,
178+
reference: reference,
135179
aiAgentInfo: aiAgentInfo,
136180
} satisfies AiExtractStructuredResponse;
137181
}

src/schemas/v2025R0/hubItemOperationV2025R0.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ export interface HubItemOperationV2025R0 {
2424
* The action to perform on a Box Hub item. */
2525
readonly action: HubItemOperationV2025R0ActionField;
2626
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;
2730
readonly rawData?: SerializedData;
2831
}
2932
export function serializeHubItemOperationV2025R0ActionField(
@@ -53,6 +56,7 @@ export function serializeHubItemOperationV2025R0(
5356
return {
5457
['action']: serializeHubItemOperationV2025R0ActionField(val.action),
5558
['item']: serializeHubItemReferenceV2025R0(val.item),
59+
['parent_id']: val.parentId,
5660
};
5761
}
5862
export function deserializeHubItemOperationV2025R0(
@@ -80,5 +84,17 @@ export function deserializeHubItemOperationV2025R0(
8084
const item: HubItemReferenceV2025R0 = deserializeHubItemReferenceV2025R0(
8185
val.item,
8286
);
83-
return { action: action, item: item } satisfies HubItemOperationV2025R0;
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;
84100
}

0 commit comments

Comments
 (0)