Skip to content

Commit a5a555f

Browse files
feat: add AI agents warnings; allow for more types of metadata value (box/box-openapi#520) (#600)
1 parent 979ff2c commit a5a555f

15 files changed

+1462
-170
lines changed

.codegen.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "42b7a5b", "specHash": "f737b7b", "version": "1.15.1" }
1+
{ "engineHash": "c2a365c", "specHash": "6a332e7", "version": "1.15.1" }

docs/folders.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ Not all available fields are returned by default. Use the
9292
[fields](#param-fields) query parameter to explicitly request
9393
any specific fields.
9494

95-
This call will return synchronously. This holds true even when
96-
moving folders with a large a large number of items in all of its
97-
descendants. For very large folders, this means the call could
98-
take minutes or hours to return.
95+
If the user is moving folders with a large number of items in all of
96+
their descendants, the call will be run asynchronously. If the
97+
operation is not completed within 10 minutes, the user will receive
98+
a 200 OK response, and the operation will continue running.
9999

100100
## Delete folder
101101

docs/transfer.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ during the operation. Please note that while collaborations at the individual
1717
file-level are transferred during the operation, the collaborations are
1818
deleted when the original user is deleted.
1919

20-
This call will be performed synchronously which might lead to a slow response
21-
when the source user has a large number of items in all of its folders.
20+
If the user has a large number of items across all folders, the call will
21+
be run asynchronously. If the operation is not completed within 10 minutes,
22+
the user will receive a 200 OK response, and the operation will continue running.
2223

2324
If the destination path has a metadata cascade policy attached to any of
2425
the parent folders, a metadata cascade operation will be kicked off

package-lock.json

+102-102
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/managers/fileMetadata.generated.ts

+10-19
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ import { serializeClientError } from '../schemas/clientError.generated.js';
44
import { deserializeClientError } from '../schemas/clientError.generated.js';
55
import { serializeMetadataFull } from '../schemas/metadataFull.generated.js';
66
import { deserializeMetadataFull } from '../schemas/metadataFull.generated.js';
7+
import { serializeMetadataInstanceValue } from '../schemas/metadataInstanceValue.generated.js';
8+
import { deserializeMetadataInstanceValue } from '../schemas/metadataInstanceValue.generated.js';
79
import { ResponseFormat } from '../networking/fetchOptions.generated.js';
810
import { Metadatas } from '../schemas/metadatas.generated.js';
911
import { ClientError } from '../schemas/clientError.generated.js';
1012
import { MetadataFull } from '../schemas/metadataFull.generated.js';
13+
import { MetadataInstanceValue } from '../schemas/metadataInstanceValue.generated.js';
1114
import { BoxSdkError } from '../box/errors.js';
1215
import { Authentication } from '../networking/auth.generated.js';
1316
import { NetworkSession } from '../networking/network.generated.js';
@@ -245,17 +248,7 @@ export interface UpdateFileMetadataByIdRequestBody {
245248
* of the template. The characters `~` and `/` are reserved
246249
* characters and must be escaped in the key. */
247250
readonly path?: string;
248-
/**
249-
* The value to be set or tested.
250-
*
251-
* Required for `add`, `replace`, and `test` operations. For `add`,
252-
* if the value exists already the previous value will be overwritten
253-
* by the new value. For `replace`, the value must exist before
254-
* replacing.
255-
*
256-
* For `test`, the existing value at the `path` location must match
257-
* the specified value. */
258-
readonly value?: string;
251+
readonly value?: MetadataInstanceValue;
259252
/**
260253
* The location in the metadata JSON object to move or copy a value
261254
* from. Required for `move` or `copy` operations and must be in the
@@ -773,7 +766,10 @@ export function serializeUpdateFileMetadataByIdRequestBody(
773766
? val.op
774767
: serializeUpdateFileMetadataByIdRequestBodyOpField(val.op),
775768
['path']: val.path,
776-
['value']: val.value,
769+
['value']:
770+
val.value == void 0
771+
? val.value
772+
: serializeMetadataInstanceValue(val.value),
777773
['from']: val.from,
778774
};
779775
}
@@ -796,13 +792,8 @@ export function deserializeUpdateFileMetadataByIdRequestBody(
796792
});
797793
}
798794
const path: undefined | string = val.path == void 0 ? void 0 : val.path;
799-
if (!(val.value == void 0) && !sdIsString(val.value)) {
800-
throw new BoxSdkError({
801-
message:
802-
'Expecting string for "value" of type "UpdateFileMetadataByIdRequestBody"',
803-
});
804-
}
805-
const value: undefined | string = val.value == void 0 ? void 0 : val.value;
795+
const value: undefined | MetadataInstanceValue =
796+
val.value == void 0 ? void 0 : deserializeMetadataInstanceValue(val.value);
806797
if (!(val.from == void 0) && !sdIsString(val.from)) {
807798
throw new BoxSdkError({
808799
message:

src/managers/folderMetadata.generated.ts

+10-19
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ import { serializeClientError } from '../schemas/clientError.generated.js';
44
import { deserializeClientError } from '../schemas/clientError.generated.js';
55
import { serializeMetadataFull } from '../schemas/metadataFull.generated.js';
66
import { deserializeMetadataFull } from '../schemas/metadataFull.generated.js';
7+
import { serializeMetadataInstanceValue } from '../schemas/metadataInstanceValue.generated.js';
8+
import { deserializeMetadataInstanceValue } from '../schemas/metadataInstanceValue.generated.js';
79
import { ResponseFormat } from '../networking/fetchOptions.generated.js';
810
import { Metadatas } from '../schemas/metadatas.generated.js';
911
import { ClientError } from '../schemas/clientError.generated.js';
1012
import { MetadataFull } from '../schemas/metadataFull.generated.js';
13+
import { MetadataInstanceValue } from '../schemas/metadataInstanceValue.generated.js';
1114
import { BoxSdkError } from '../box/errors.js';
1215
import { Authentication } from '../networking/auth.generated.js';
1316
import { NetworkSession } from '../networking/network.generated.js';
@@ -246,17 +249,7 @@ export interface UpdateFolderMetadataByIdRequestBody {
246249
* of the template. The characters `~` and `/` are reserved
247250
* characters and must be escaped in the key. */
248251
readonly path?: string;
249-
/**
250-
* The value to be set or tested.
251-
*
252-
* Required for `add`, `replace`, and `test` operations. For `add`,
253-
* if the value exists already the previous value will be overwritten
254-
* by the new value. For `replace`, the value must exist before
255-
* replacing.
256-
*
257-
* For `test`, the existing value at the `path` location must match
258-
* the specified value. */
259-
readonly value?: string;
252+
readonly value?: MetadataInstanceValue;
260253
/**
261254
* The location in the metadata JSON object to move or copy a value
262255
* from. Required for `move` or `copy` operations and must be in the
@@ -795,7 +788,10 @@ export function serializeUpdateFolderMetadataByIdRequestBody(
795788
? val.op
796789
: serializeUpdateFolderMetadataByIdRequestBodyOpField(val.op),
797790
['path']: val.path,
798-
['value']: val.value,
791+
['value']:
792+
val.value == void 0
793+
? val.value
794+
: serializeMetadataInstanceValue(val.value),
799795
['from']: val.from,
800796
};
801797
}
@@ -818,13 +814,8 @@ export function deserializeUpdateFolderMetadataByIdRequestBody(
818814
});
819815
}
820816
const path: undefined | string = val.path == void 0 ? void 0 : val.path;
821-
if (!(val.value == void 0) && !sdIsString(val.value)) {
822-
throw new BoxSdkError({
823-
message:
824-
'Expecting string for "value" of type "UpdateFolderMetadataByIdRequestBody"',
825-
});
826-
}
827-
const value: undefined | string = val.value == void 0 ? void 0 : val.value;
817+
const value: undefined | MetadataInstanceValue =
818+
val.value == void 0 ? void 0 : deserializeMetadataInstanceValue(val.value);
828819
if (!(val.from == void 0) && !sdIsString(val.from)) {
829820
throw new BoxSdkError({
830821
message:

src/managers/transfer.generated.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ export class TransferManager {
139139
* file-level are transferred during the operation, the collaborations are
140140
* deleted when the original user is deleted.
141141
*
142-
* This call will be performed synchronously which might lead to a slow response
143-
* when the source user has a large number of items in all of its folders.
142+
* If the user has a large number of items across all folders, the call will
143+
* be run asynchronously. If the operation is not completed within 10 minutes,
144+
* the user will receive a 200 OK response, and the operation will continue running.
144145
*
145146
* If the destination path has a metadata cascade policy attached to any of
146147
* the parent folders, a metadata cascade operation will be kicked off

src/schemas/aiSingleAgentResponseFull.generated.ts

+24-21
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ import { serializeAiAgentAllowedEntity } from './aiAgentAllowedEntity.generated.
88
import { deserializeAiAgentAllowedEntity } from './aiAgentAllowedEntity.generated.js';
99
import { serializeAiSingleAgentResponse } from './aiSingleAgentResponse.generated.js';
1010
import { deserializeAiSingleAgentResponse } from './aiSingleAgentResponse.generated.js';
11-
import { serializeAiStudioAgentAsk } from './aiStudioAgentAsk.generated.js';
12-
import { deserializeAiStudioAgentAsk } from './aiStudioAgentAsk.generated.js';
13-
import { serializeAiStudioAgentTextGen } from './aiStudioAgentTextGen.generated.js';
14-
import { deserializeAiStudioAgentTextGen } from './aiStudioAgentTextGen.generated.js';
15-
import { serializeAiStudioAgentExtract } from './aiStudioAgentExtract.generated.js';
16-
import { deserializeAiStudioAgentExtract } from './aiStudioAgentExtract.generated.js';
11+
import { serializeAiStudioAgentAskResponse } from './aiStudioAgentAskResponse.generated.js';
12+
import { deserializeAiStudioAgentAskResponse } from './aiStudioAgentAskResponse.generated.js';
13+
import { serializeAiStudioAgentTextGenResponse } from './aiStudioAgentTextGenResponse.generated.js';
14+
import { deserializeAiStudioAgentTextGenResponse } from './aiStudioAgentTextGenResponse.generated.js';
15+
import { serializeAiStudioAgentExtractResponse } from './aiStudioAgentExtractResponse.generated.js';
16+
import { deserializeAiStudioAgentExtractResponse } from './aiStudioAgentExtractResponse.generated.js';
1717
import { AiSingleAgentResponseTypeField } from './aiSingleAgentResponse.generated.js';
1818
import { UserBase } from './userBase.generated.js';
1919
import { DateTime } from '../internal/utils.js';
2020
import { AiAgentAllowedEntity } from './aiAgentAllowedEntity.generated.js';
2121
import { AiSingleAgentResponse } from './aiSingleAgentResponse.generated.js';
22-
import { AiStudioAgentAsk } from './aiStudioAgentAsk.generated.js';
23-
import { AiStudioAgentTextGen } from './aiStudioAgentTextGen.generated.js';
24-
import { AiStudioAgentExtract } from './aiStudioAgentExtract.generated.js';
22+
import { AiStudioAgentAskResponse } from './aiStudioAgentAskResponse.generated.js';
23+
import { AiStudioAgentTextGenResponse } from './aiStudioAgentTextGenResponse.generated.js';
24+
import { AiStudioAgentExtractResponse } from './aiStudioAgentExtractResponse.generated.js';
2525
import { BoxSdkError } from '../box/errors.js';
2626
import { SerializedData } from '../serialization/json.js';
2727
import { sdIsEmpty } from '../serialization/json.js';
@@ -31,9 +31,9 @@ import { sdIsString } from '../serialization/json.js';
3131
import { sdIsList } from '../serialization/json.js';
3232
import { sdIsMap } from '../serialization/json.js';
3333
export type AiSingleAgentResponseFull = AiSingleAgentResponse & {
34-
readonly ask?: AiStudioAgentAsk;
35-
readonly textGen?: AiStudioAgentTextGen;
36-
readonly extract?: AiStudioAgentExtract;
34+
readonly ask?: AiStudioAgentAskResponse;
35+
readonly textGen?: AiStudioAgentTextGenResponse;
36+
readonly extract?: AiStudioAgentExtractResponse;
3737
};
3838
export function serializeAiSingleAgentResponseFull(
3939
val: AiSingleAgentResponseFull,
@@ -47,15 +47,18 @@ export function serializeAiSingleAgentResponseFull(
4747
return {
4848
...base,
4949
...{
50-
['ask']: val.ask == void 0 ? val.ask : serializeAiStudioAgentAsk(val.ask),
50+
['ask']:
51+
val.ask == void 0
52+
? val.ask
53+
: serializeAiStudioAgentAskResponse(val.ask),
5154
['text_gen']:
5255
val.textGen == void 0
5356
? val.textGen
54-
: serializeAiStudioAgentTextGen(val.textGen),
57+
: serializeAiStudioAgentTextGenResponse(val.textGen),
5558
['extract']:
5659
val.extract == void 0
5760
? val.extract
58-
: serializeAiStudioAgentExtract(val.extract),
61+
: serializeAiStudioAgentExtractResponse(val.extract),
5962
},
6063
};
6164
}
@@ -67,16 +70,16 @@ export function deserializeAiSingleAgentResponseFull(
6770
message: 'Expecting a map for "AiSingleAgentResponseFull"',
6871
});
6972
}
70-
const ask: undefined | AiStudioAgentAsk =
71-
val.ask == void 0 ? void 0 : deserializeAiStudioAgentAsk(val.ask);
72-
const textGen: undefined | AiStudioAgentTextGen =
73+
const ask: undefined | AiStudioAgentAskResponse =
74+
val.ask == void 0 ? void 0 : deserializeAiStudioAgentAskResponse(val.ask);
75+
const textGen: undefined | AiStudioAgentTextGenResponse =
7376
val.text_gen == void 0
7477
? void 0
75-
: deserializeAiStudioAgentTextGen(val.text_gen);
76-
const extract: undefined | AiStudioAgentExtract =
78+
: deserializeAiStudioAgentTextGenResponse(val.text_gen);
79+
const extract: undefined | AiStudioAgentExtractResponse =
7780
val.extract == void 0
7881
? void 0
79-
: deserializeAiStudioAgentExtract(val.extract);
82+
: deserializeAiStudioAgentExtractResponse(val.extract);
8083
if (val.id == void 0) {
8184
throw new BoxSdkError({
8285
message:

0 commit comments

Comments
 (0)