diff --git a/.codegen.json b/.codegen.json index 953be76d..0cc8cdf2 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "a87c352", "specHash": "ded99bf", "version": "10.11.1" } +{ "engineHash": "a87c352", "specHash": "0ac3d31", "version": "10.11.1" } diff --git a/docs/userCollaborations.md b/docs/userCollaborations.md index a490851d..c2c92543 100644 --- a/docs/userCollaborations.md +++ b/docs/userCollaborations.md @@ -106,12 +106,10 @@ group IDs. If a collaboration is being created with a group, access to this endpoint is dependent on the group's ability to be invited. -If collaboration is in `pending` status, the following fields -are redacted: +If collaboration is in `pending` status, field `name` is redacted when: -- `login` and `name` are hidden if a collaboration was created - using `user_id`, -- `name` is hidden if a collaboration was created using `login`. +- a collaboration was created using `user_id`, +- a collaboration was created using `login`. This operation is performed by calling function `createCollaboration`. diff --git a/src/managers/userCollaborations.ts b/src/managers/userCollaborations.ts index 038f157c..dd5b1ab9 100644 --- a/src/managers/userCollaborations.ts +++ b/src/managers/userCollaborations.ts @@ -592,11 +592,9 @@ export class UserCollaborationsManager { * If a collaboration is being created with a group, access to * this endpoint is dependent on the group's ability to be invited. * - * If collaboration is in `pending` status, the following fields - * are redacted: - * - `login` and `name` are hidden if a collaboration was created - * using `user_id`, - * - `name` is hidden if a collaboration was created using `login`. + * If collaboration is in `pending` status, field `name` is redacted when: + * - a collaboration was created using `user_id`, + * - a collaboration was created using `login`. * @param {CreateCollaborationRequestBody} requestBody Request body of createCollaboration method * @param {CreateCollaborationOptionalsInput} optionalsInput * @returns {Promise} diff --git a/src/schemas/aiExtractFieldOption.ts b/src/schemas/aiExtractFieldOption.ts new file mode 100644 index 00000000..6583e9e3 --- /dev/null +++ b/src/schemas/aiExtractFieldOption.ts @@ -0,0 +1,40 @@ +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 AiExtractFieldOption { + /** + * A unique identifier for the option. */ + readonly key: string; + readonly rawData?: SerializedData; +} +export function serializeAiExtractFieldOption( + val: AiExtractFieldOption, +): SerializedData { + return { ['key']: val.key }; +} +export function deserializeAiExtractFieldOption( + val: SerializedData, +): AiExtractFieldOption { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AiExtractFieldOption"', + }); + } + if (val.key == void 0) { + throw new BoxSdkError({ + message: 'Expecting "key" of type "AiExtractFieldOption" to be defined', + }); + } + if (!sdIsString(val.key)) { + throw new BoxSdkError({ + message: 'Expecting string for "key" of type "AiExtractFieldOption"', + }); + } + const key: string = val.key; + return { key: key } satisfies AiExtractFieldOption; +} diff --git a/src/schemas/aiExtractStructured.ts b/src/schemas/aiExtractStructured.ts index 449fde28..7e4020ea 100644 --- a/src/schemas/aiExtractStructured.ts +++ b/src/schemas/aiExtractStructured.ts @@ -2,14 +2,29 @@ import { serializeAiAgentReference } from './aiAgentReference'; import { deserializeAiAgentReference } from './aiAgentReference'; import { serializeAiAgentExtractStructured } from './aiAgentExtractStructured'; import { deserializeAiAgentExtractStructured } from './aiAgentExtractStructured'; +import { serializeAiTaxonomyReference } from './aiTaxonomyReference'; +import { deserializeAiTaxonomyReference } from './aiTaxonomyReference'; +import { serializeAiTaxonomyFileReference } from './aiTaxonomyFileReference'; +import { deserializeAiTaxonomyFileReference } from './aiTaxonomyFileReference'; import { serializeAiItemBase } from './aiItemBase'; import { deserializeAiItemBase } from './aiItemBase'; +import { serializeAiExtractSubField } from './aiExtractSubField'; +import { deserializeAiExtractSubField } from './aiExtractSubField'; +import { serializeAiOptionsRules } from './aiOptionsRules'; +import { deserializeAiOptionsRules } from './aiOptionsRules'; import { serializeAiExtractStructuredAgent } from './aiExtractStructuredAgent'; import { deserializeAiExtractStructuredAgent } from './aiExtractStructuredAgent'; +import { serializeAiTaxonomySource } from './aiTaxonomySource'; +import { deserializeAiTaxonomySource } from './aiTaxonomySource'; import { AiAgentReference } from './aiAgentReference'; import { AiAgentExtractStructured } from './aiAgentExtractStructured'; +import { AiTaxonomyReference } from './aiTaxonomyReference'; +import { AiTaxonomyFileReference } from './aiTaxonomyFileReference'; import { AiItemBase } from './aiItemBase'; +import { AiExtractSubField } from './aiExtractSubField'; +import { AiOptionsRules } from './aiOptionsRules'; import { AiExtractStructuredAgent } from './aiExtractStructuredAgent'; +import { AiTaxonomySource } from './aiTaxonomySource'; import { BoxSdkError } from '../box/errors'; import { SerializedData } from '../serialization/json'; import { sdIsEmpty } from '../serialization/json'; @@ -56,11 +71,21 @@ export interface AiExtractStructuredFieldsField { * The context about the key that may include how to find and format it. */ readonly prompt?: string; /** - * The type of the field. It can include but is not limited to `string`, `float`, `date`, `enum`, and `multiSelect`. */ + * The type of the field. It can include but is not limited to `string`, `float`, `date`, `enum`, `multiSelect`,`taxonomy`, `struct`, and `table`. */ readonly type?: string; /** * A list of options for this field. This is most often used in combination with the `enum` and `multiSelect` field types. */ readonly options?: readonly AiExtractStructuredFieldsOptionsField[]; + /** + * The nested fields for this field. Used with `struct` and `table` field types to define the nested structure. */ + readonly fields?: readonly AiExtractSubField[]; + /** + * The identifier for a taxonomy, which corresponds to the `key` of the taxonomy source. Required if using `taxonomy` type field. */ + readonly taxonomyKey?: string; + /** + * The namespace of the taxonomy source. Required if using `taxonomy` type field from an existing taxonomy. */ + readonly namespace?: string; + readonly optionsRules?: AiOptionsRules; readonly rawData?: SerializedData; } export interface AiExtractStructured { @@ -82,6 +107,10 @@ export interface AiExtractStructured { /** * A flag to indicate whether references for every extracted field should be returned. */ readonly includeReference?: boolean; + /** + * The taxonomy sources to be used for the structured extraction. They can either be an existing file or a taxonomy. + * For your request to work, `fields` must also be provided. `taxonomy_sources` is not supported with `metadata_template`. */ + readonly taxonomySources?: readonly AiTaxonomySource[]; readonly rawData?: SerializedData; } export function serializeAiExtractStructuredMetadataTemplateTypeField( @@ -189,6 +218,18 @@ export function serializeAiExtractStructuredFieldsField( ): SerializedData { return serializeAiExtractStructuredFieldsOptionsField(item); }) as readonly any[]), + ['fields']: + val.fields == void 0 + ? val.fields + : (val.fields.map(function (item: AiExtractSubField): SerializedData { + return serializeAiExtractSubField(item); + }) as readonly any[]), + ['taxonomy_key']: val.taxonomyKey, + ['namespace']: val.namespace, + ['options_rules']: + val.optionsRules == void 0 + ? val.optionsRules + : serializeAiOptionsRules(val.optionsRules), }; } export function deserializeAiExtractStructuredFieldsField( @@ -258,6 +299,40 @@ export function deserializeAiExtractStructuredFieldsField( return deserializeAiExtractStructuredFieldsOptionsField(itm); }) as readonly any[]) : []; + if (!(val.fields == void 0) && !sdIsList(val.fields)) { + throw new BoxSdkError({ + message: + 'Expecting array for "fields" of type "AiExtractStructuredFieldsField"', + }); + } + const fields: undefined | readonly AiExtractSubField[] = + val.fields == void 0 + ? void 0 + : sdIsList(val.fields) + ? (val.fields.map(function (itm: SerializedData): AiExtractSubField { + return deserializeAiExtractSubField(itm); + }) as readonly any[]) + : []; + if (!(val.taxonomy_key == void 0) && !sdIsString(val.taxonomy_key)) { + throw new BoxSdkError({ + message: + 'Expecting string for "taxonomy_key" of type "AiExtractStructuredFieldsField"', + }); + } + const taxonomyKey: undefined | string = + val.taxonomy_key == void 0 ? void 0 : val.taxonomy_key; + if (!(val.namespace == void 0) && !sdIsString(val.namespace)) { + throw new BoxSdkError({ + message: + 'Expecting string for "namespace" of type "AiExtractStructuredFieldsField"', + }); + } + const namespace: undefined | string = + val.namespace == void 0 ? void 0 : val.namespace; + const optionsRules: undefined | AiOptionsRules = + val.options_rules == void 0 + ? void 0 + : deserializeAiOptionsRules(val.options_rules); return { key: key, description: description, @@ -265,6 +340,10 @@ export function deserializeAiExtractStructuredFieldsField( prompt: prompt, type: type, options: options, + fields: fields, + taxonomyKey: taxonomyKey, + namespace: namespace, + optionsRules: optionsRules, } satisfies AiExtractStructuredFieldsField; } export function serializeAiExtractStructured( @@ -294,6 +373,14 @@ export function serializeAiExtractStructured( : serializeAiExtractStructuredAgent(val.aiAgent), ['include_confidence_score']: val.includeConfidenceScore, ['include_reference']: val.includeReference, + ['taxonomy_sources']: + val.taxonomySources == void 0 + ? val.taxonomySources + : (val.taxonomySources.map(function ( + item: AiTaxonomySource, + ): SerializedData { + return serializeAiTaxonomySource(item); + }) as readonly any[]), }; } export function deserializeAiExtractStructured( @@ -368,6 +455,22 @@ export function deserializeAiExtractStructured( } const includeReference: undefined | boolean = val.include_reference == void 0 ? void 0 : val.include_reference; + if (!(val.taxonomy_sources == void 0) && !sdIsList(val.taxonomy_sources)) { + throw new BoxSdkError({ + message: + 'Expecting array for "taxonomy_sources" of type "AiExtractStructured"', + }); + } + const taxonomySources: undefined | readonly AiTaxonomySource[] = + val.taxonomy_sources == void 0 + ? void 0 + : sdIsList(val.taxonomy_sources) + ? (val.taxonomy_sources.map(function ( + itm: SerializedData, + ): AiTaxonomySource { + return deserializeAiTaxonomySource(itm); + }) as readonly any[]) + : []; return { items: items, metadataTemplate: metadataTemplate, @@ -375,5 +478,6 @@ export function deserializeAiExtractStructured( aiAgent: aiAgent, includeConfidenceScore: includeConfidenceScore, includeReference: includeReference, + taxonomySources: taxonomySources, } satisfies AiExtractStructured; } diff --git a/src/schemas/aiExtractSubField.ts b/src/schemas/aiExtractSubField.ts new file mode 100644 index 00000000..9952966f --- /dev/null +++ b/src/schemas/aiExtractSubField.ts @@ -0,0 +1,120 @@ +import { serializeAiExtractFieldOption } from './aiExtractFieldOption'; +import { deserializeAiExtractFieldOption } from './aiExtractFieldOption'; +import { AiExtractFieldOption } from './aiExtractFieldOption'; +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 AiExtractSubField { + /** + * A unique identifier for the nested field. */ + readonly key: string; + /** + * A description of the nested field. */ + readonly description?: string; + /** + * The display name of the nested field. */ + readonly displayName?: string; + /** + * Context about the nested field that may include how to find and how to format it. */ + readonly prompt?: string; + /** + * The type of the nested field. Allowed types include `string`, `float`, `date`, `number`, `text`, `boolean`, `enum` and `multiSelect`. */ + readonly type?: string; + /** + * A list of options for this nested field. Used with `enum` and `multiSelect` types. */ + readonly options?: readonly AiExtractFieldOption[]; + readonly rawData?: SerializedData; +} +export function serializeAiExtractSubField( + val: AiExtractSubField, +): SerializedData { + return { + ['key']: val.key, + ['description']: val.description, + ['displayName']: val.displayName, + ['prompt']: val.prompt, + ['type']: val.type, + ['options']: + val.options == void 0 + ? val.options + : (val.options.map(function ( + item: AiExtractFieldOption, + ): SerializedData { + return serializeAiExtractFieldOption(item); + }) as readonly any[]), + }; +} +export function deserializeAiExtractSubField( + val: SerializedData, +): AiExtractSubField { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AiExtractSubField"', + }); + } + if (val.key == void 0) { + throw new BoxSdkError({ + message: 'Expecting "key" of type "AiExtractSubField" to be defined', + }); + } + if (!sdIsString(val.key)) { + throw new BoxSdkError({ + message: 'Expecting string for "key" of type "AiExtractSubField"', + }); + } + const key: string = val.key; + if (!(val.description == void 0) && !sdIsString(val.description)) { + throw new BoxSdkError({ + message: 'Expecting string for "description" of type "AiExtractSubField"', + }); + } + const description: undefined | string = + val.description == void 0 ? void 0 : val.description; + if (!(val.displayName == void 0) && !sdIsString(val.displayName)) { + throw new BoxSdkError({ + message: 'Expecting string for "displayName" of type "AiExtractSubField"', + }); + } + const displayName: undefined | string = + val.displayName == void 0 ? void 0 : val.displayName; + if (!(val.prompt == void 0) && !sdIsString(val.prompt)) { + throw new BoxSdkError({ + message: 'Expecting string for "prompt" of type "AiExtractSubField"', + }); + } + const prompt: undefined | string = val.prompt == void 0 ? void 0 : val.prompt; + if (!(val.type == void 0) && !sdIsString(val.type)) { + throw new BoxSdkError({ + message: 'Expecting string for "type" of type "AiExtractSubField"', + }); + } + const type: undefined | string = val.type == void 0 ? void 0 : val.type; + if (!(val.options == void 0) && !sdIsList(val.options)) { + throw new BoxSdkError({ + message: 'Expecting array for "options" of type "AiExtractSubField"', + }); + } + const options: undefined | readonly AiExtractFieldOption[] = + val.options == void 0 + ? void 0 + : sdIsList(val.options) + ? (val.options.map(function ( + itm: SerializedData, + ): AiExtractFieldOption { + return deserializeAiExtractFieldOption(itm); + }) as readonly any[]) + : []; + return { + key: key, + description: description, + displayName: displayName, + prompt: prompt, + type: type, + options: options, + } satisfies AiExtractSubField; +} diff --git a/src/schemas/aiOptionsRules.ts b/src/schemas/aiOptionsRules.ts new file mode 100644 index 00000000..bbde0d9c --- /dev/null +++ b/src/schemas/aiOptionsRules.ts @@ -0,0 +1,65 @@ +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 AiOptionsRules { + /** + * Indicates whether the field is a multi-select field. + * If true, the field can have multiple values. */ + readonly multiSelect?: boolean; + /** + * The selectable levels for the field. + * This is used to limit the levels of the taxonomy that can be selected. */ + readonly selectableLevels?: readonly number[]; + readonly rawData?: SerializedData; +} +export function serializeAiOptionsRules(val: AiOptionsRules): SerializedData { + return { + ['multi_select']: val.multiSelect, + ['selectable_levels']: + val.selectableLevels == void 0 + ? val.selectableLevels + : (val.selectableLevels.map(function (item: number): SerializedData { + return item; + }) as readonly any[]), + }; +} +export function deserializeAiOptionsRules(val: SerializedData): AiOptionsRules { + if (!sdIsMap(val)) { + throw new BoxSdkError({ message: 'Expecting a map for "AiOptionsRules"' }); + } + if (!(val.multi_select == void 0) && !sdIsBoolean(val.multi_select)) { + throw new BoxSdkError({ + message: 'Expecting boolean for "multi_select" of type "AiOptionsRules"', + }); + } + const multiSelect: undefined | boolean = + val.multi_select == void 0 ? void 0 : val.multi_select; + if (!(val.selectable_levels == void 0) && !sdIsList(val.selectable_levels)) { + throw new BoxSdkError({ + message: + 'Expecting array for "selectable_levels" of type "AiOptionsRules"', + }); + } + const selectableLevels: undefined | readonly number[] = + val.selectable_levels == void 0 + ? void 0 + : sdIsList(val.selectable_levels) + ? (val.selectable_levels.map(function (itm: SerializedData): number { + if (!sdIsNumber(itm)) { + throw new BoxSdkError({ + message: 'Expecting number for "AiOptionsRules"', + }); + } + return itm; + }) as readonly any[]) + : []; + return { + multiSelect: multiSelect, + selectableLevels: selectableLevels, + } satisfies AiOptionsRules; +} diff --git a/src/schemas/aiTaxonomyFileReference.ts b/src/schemas/aiTaxonomyFileReference.ts new file mode 100644 index 00000000..c42862c6 --- /dev/null +++ b/src/schemas/aiTaxonomyFileReference.ts @@ -0,0 +1,80 @@ +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 AiTaxonomyFileReferenceTypeField = 'file'; +export interface AiTaxonomyFileReference { + /** + * The type of the taxonomy source. */ + readonly type?: AiTaxonomyFileReferenceTypeField; + /** + * The identifier for a taxonomy, which corresponds to the `taxonomy_key` of the taxonomy source. */ + readonly taxonomyKey?: string; + /** + * The ID of the taxonomy source. Required if the type is `file` and unsupported if the type is `taxonomy`. */ + readonly id?: string; + readonly rawData?: SerializedData; +} +export function serializeAiTaxonomyFileReferenceTypeField( + val: AiTaxonomyFileReferenceTypeField, +): SerializedData { + return val; +} +export function deserializeAiTaxonomyFileReferenceTypeField( + val: SerializedData, +): AiTaxonomyFileReferenceTypeField { + if (val == 'file') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize AiTaxonomyFileReferenceTypeField", + }); +} +export function serializeAiTaxonomyFileReference( + val: AiTaxonomyFileReference, +): SerializedData { + return { + ['type']: + val.type == void 0 + ? val.type + : serializeAiTaxonomyFileReferenceTypeField(val.type), + ['taxonomy_key']: val.taxonomyKey, + ['id']: val.id, + }; +} +export function deserializeAiTaxonomyFileReference( + val: SerializedData, +): AiTaxonomyFileReference { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AiTaxonomyFileReference"', + }); + } + const type: undefined | AiTaxonomyFileReferenceTypeField = + val.type == void 0 + ? void 0 + : deserializeAiTaxonomyFileReferenceTypeField(val.type); + if (!(val.taxonomy_key == void 0) && !sdIsString(val.taxonomy_key)) { + throw new BoxSdkError({ + message: + 'Expecting string for "taxonomy_key" of type "AiTaxonomyFileReference"', + }); + } + const taxonomyKey: undefined | string = + val.taxonomy_key == void 0 ? void 0 : val.taxonomy_key; + if (!(val.id == void 0) && !sdIsString(val.id)) { + throw new BoxSdkError({ + message: 'Expecting string for "id" of type "AiTaxonomyFileReference"', + }); + } + const id: undefined | string = val.id == void 0 ? void 0 : val.id; + return { + type: type, + taxonomyKey: taxonomyKey, + id: id, + } satisfies AiTaxonomyFileReference; +} diff --git a/src/schemas/aiTaxonomyReference.ts b/src/schemas/aiTaxonomyReference.ts new file mode 100644 index 00000000..dda6f7a6 --- /dev/null +++ b/src/schemas/aiTaxonomyReference.ts @@ -0,0 +1,81 @@ +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 AiTaxonomyReferenceTypeField = 'taxonomy'; +export interface AiTaxonomyReference { + /** + * The type of the taxonomy source. */ + readonly type?: AiTaxonomyReferenceTypeField; + /** + * The identifier for a taxonomy, which corresponds to the `taxonomy_key` of the taxonomy source. */ + readonly taxonomyKey?: string; + /** + * The namespace of the taxonomy source. */ + readonly namespace?: string; + readonly rawData?: SerializedData; +} +export function serializeAiTaxonomyReferenceTypeField( + val: AiTaxonomyReferenceTypeField, +): SerializedData { + return val; +} +export function deserializeAiTaxonomyReferenceTypeField( + val: SerializedData, +): AiTaxonomyReferenceTypeField { + if (val == 'taxonomy') { + return val; + } + throw new BoxSdkError({ + message: "Can't deserialize AiTaxonomyReferenceTypeField", + }); +} +export function serializeAiTaxonomyReference( + val: AiTaxonomyReference, +): SerializedData { + return { + ['type']: + val.type == void 0 + ? val.type + : serializeAiTaxonomyReferenceTypeField(val.type), + ['taxonomy_key']: val.taxonomyKey, + ['namespace']: val.namespace, + }; +} +export function deserializeAiTaxonomyReference( + val: SerializedData, +): AiTaxonomyReference { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AiTaxonomyReference"', + }); + } + const type: undefined | AiTaxonomyReferenceTypeField = + val.type == void 0 + ? void 0 + : deserializeAiTaxonomyReferenceTypeField(val.type); + if (!(val.taxonomy_key == void 0) && !sdIsString(val.taxonomy_key)) { + throw new BoxSdkError({ + message: + 'Expecting string for "taxonomy_key" of type "AiTaxonomyReference"', + }); + } + const taxonomyKey: undefined | string = + val.taxonomy_key == void 0 ? void 0 : val.taxonomy_key; + if (!(val.namespace == void 0) && !sdIsString(val.namespace)) { + throw new BoxSdkError({ + message: 'Expecting string for "namespace" of type "AiTaxonomyReference"', + }); + } + const namespace: undefined | string = + val.namespace == void 0 ? void 0 : val.namespace; + return { + type: type, + taxonomyKey: taxonomyKey, + namespace: namespace, + } satisfies AiTaxonomyReference; +} diff --git a/src/schemas/aiTaxonomySource.ts b/src/schemas/aiTaxonomySource.ts new file mode 100644 index 00000000..9e071937 --- /dev/null +++ b/src/schemas/aiTaxonomySource.ts @@ -0,0 +1,40 @@ +import { serializeAiTaxonomyReference } from './aiTaxonomyReference'; +import { deserializeAiTaxonomyReference } from './aiTaxonomyReference'; +import { serializeAiTaxonomyFileReference } from './aiTaxonomyFileReference'; +import { deserializeAiTaxonomyFileReference } from './aiTaxonomyFileReference'; +import { AiTaxonomyReference } from './aiTaxonomyReference'; +import { AiTaxonomyFileReference } from './aiTaxonomyFileReference'; +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 AiTaxonomySource = AiTaxonomyReference | AiTaxonomyFileReference; +export function serializeAiTaxonomySource(val: any): SerializedData { + if (val.type == 'taxonomy') { + return serializeAiTaxonomyReference(val); + } + if (val.type == 'file') { + return serializeAiTaxonomyFileReference(val); + } + throw new BoxSdkError({ message: 'unknown type' }); +} +export function deserializeAiTaxonomySource( + val: SerializedData, +): AiTaxonomySource { + if (!sdIsMap(val)) { + throw new BoxSdkError({ + message: 'Expecting a map for "AiTaxonomySource"', + }); + } + if (val.type == 'taxonomy') { + return deserializeAiTaxonomyReference(val); + } + if (val.type == 'file') { + return deserializeAiTaxonomyFileReference(val); + } + throw new BoxSdkError({ message: "Can't deserialize AiTaxonomySource" }); +} diff --git a/src/schemas/collaboration.ts b/src/schemas/collaboration.ts index 9c601811..28c9f9e1 100644 --- a/src/schemas/collaboration.ts +++ b/src/schemas/collaboration.ts @@ -123,7 +123,7 @@ export class Collaboration { readonly isAccessOnly?: boolean; /** * The status of the collaboration invitation. If the status - * is `pending`, `login` and `name` return an empty string. */ + * is `pending`, `name` returns an empty string. */ readonly status?: CollaborationStatusField; /** * When the `status` of the collaboration object changed to @@ -221,7 +221,7 @@ export interface CollaborationInput { readonly isAccessOnly?: boolean; /** * The status of the collaboration invitation. If the status - * is `pending`, `login` and `name` return an empty string. */ + * is `pending`, `name` returns an empty string. */ readonly status?: CollaborationStatusField; /** * When the `status` of the collaboration object changed to diff --git a/src/schemas/index.ts b/src/schemas/index.ts index d8f1260e..058f0ef5 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -4,6 +4,8 @@ export * from './aiAgentReference'; export * from './aiCitation'; export * from './aiResponseFull'; export * from './aiDialogueHistory'; +export * from './aiExtractFieldOption'; +export * from './aiExtractSubField'; export * from './aiExtractResponse'; export * from './aiExtractStructuredResponse'; export * from './aiItemBase'; @@ -39,7 +41,6 @@ export * from './aiStudioAgentExtract'; export * from './aiStudioAgentAsk'; export * from './aiAgentExtractStructured'; export * from './aiExtractStructuredAgent'; -export * from './aiExtractStructured'; export * from './aiAgentExtract'; export * from './aiExtractAgent'; export * from './aiExtract'; @@ -47,6 +48,11 @@ export * from './aiAgentAsk'; export * from './aiAskAgent'; export * from './aiAsk'; export * from './aiAgent'; +export * from './aiOptionsRules'; +export * from './aiTaxonomyFileReference'; +export * from './aiTaxonomyReference'; +export * from './aiTaxonomySource'; +export * from './aiExtractStructured'; export * from './appItem'; export * from './classification'; export * from './classificationTemplate';