Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "a87c352", "specHash": "ded99bf", "version": "10.11.1" }
{ "engineHash": "a87c352", "specHash": "0ac3d31", "version": "10.11.1" }
8 changes: 3 additions & 5 deletions docs/userCollaborations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
8 changes: 3 additions & 5 deletions src/managers/userCollaborations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Collaboration>}
Expand Down
40 changes: 40 additions & 0 deletions src/schemas/aiExtractFieldOption.ts
Original file line number Diff line number Diff line change
@@ -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;
}
106 changes: 105 additions & 1 deletion src/schemas/aiExtractStructured.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 {
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -258,13 +299,51 @@ 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,
displayName: displayName,
prompt: prompt,
type: type,
options: options,
fields: fields,
taxonomyKey: taxonomyKey,
namespace: namespace,
optionsRules: optionsRules,
} satisfies AiExtractStructuredFieldsField;
}
export function serializeAiExtractStructured(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -368,12 +455,29 @@ 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,
fields: fields,
aiAgent: aiAgent,
includeConfidenceScore: includeConfidenceScore,
includeReference: includeReference,
taxonomySources: taxonomySources,
} satisfies AiExtractStructured;
}
120 changes: 120 additions & 0 deletions src/schemas/aiExtractSubField.ts
Original file line number Diff line number Diff line change
@@ -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;
}
Loading
Loading