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": "c571efa", "specHash": "65c9c57", "version": "10.8.0" }
{ "engineHash": "c571efa", "specHash": "fa39a3f", "version": "10.8.0" }
16 changes: 15 additions & 1 deletion src/managers/metadataTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export interface CreateMetadataTemplateRequestBodyFieldsField {
* date-time picker.
*
* Additionally, metadata templates support an `enum` field for a basic list
* of items, and ` multiSelect` field for a similar list of items where the
* of items, and `multiSelect` field for a similar list of items where the
* user can select more than one value.
*
* Metadata taxonomies are also supported as a `taxonomy` field type
Expand Down Expand Up @@ -484,6 +484,10 @@ export interface CreateMetadataTemplateRequestBodyFieldsField {
* The unique key of the metadata taxonomy to use for this taxonomy field.
* This property is required when the field `type` is set to `taxonomy`. */
readonly taxonomyKey?: string;
/**
* The unique ID of the metadata taxonomy to use for this taxonomy field.
* This property is required when the field `type` is set to `taxonomy`. */
readonly taxonomyId?: string;
/**
* The namespace of the metadata taxonomy to use for this taxonomy field.
* This property is required when the field `type` is set to `taxonomy`. */
Expand Down Expand Up @@ -1416,6 +1420,7 @@ export function serializeCreateMetadataTemplateRequestBodyFieldsField(
);
}) as readonly any[]),
['taxonomyKey']: val.taxonomyKey,
['taxonomyId']: val.taxonomyId,
['namespace']: val.namespace,
['optionsRules']:
val.optionsRules == void 0
Expand Down Expand Up @@ -1512,6 +1517,14 @@ export function deserializeCreateMetadataTemplateRequestBodyFieldsField(
}
const taxonomyKey: undefined | string =
val.taxonomyKey == void 0 ? void 0 : val.taxonomyKey;
if (!(val.taxonomyId == void 0) && !sdIsString(val.taxonomyId)) {
throw new BoxSdkError({
message:
'Expecting string for "taxonomyId" of type "CreateMetadataTemplateRequestBodyFieldsField"',
});
}
const taxonomyId: undefined | string =
val.taxonomyId == void 0 ? void 0 : val.taxonomyId;
if (!(val.namespace == void 0) && !sdIsString(val.namespace)) {
throw new BoxSdkError({
message:
Expand All @@ -1536,6 +1549,7 @@ export function deserializeCreateMetadataTemplateRequestBodyFieldsField(
hidden: hidden,
options: options,
taxonomyKey: taxonomyKey,
taxonomyId: taxonomyId,
namespace: namespace,
optionsRules: optionsRules,
} satisfies CreateMetadataTemplateRequestBodyFieldsField;
Expand Down
132 changes: 127 additions & 5 deletions src/schemas/metadataTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export type MetadataTemplateFieldsTypeField =
| 'date'
| 'enum'
| 'multiSelect'
| 'integer'
| 'taxonomy';
| 'taxonomy'
| 'integer';
export interface MetadataTemplateFieldsOptionsField {
/**
* The text value of the option. This represents both the display name of the
Expand All @@ -25,16 +25,29 @@ export interface MetadataTemplateFieldsOptionsField {
readonly id?: string;
readonly rawData?: SerializedData;
}
export interface MetadataTemplateFieldsOptionsRulesField {
/**
* Whether to allow users to select multiple values. */
readonly multiSelect?: boolean;
/**
* An array of integers defining which levels of the taxonomy are
* selectable by users. */
readonly selectableLevels?: readonly number[];
readonly rawData?: SerializedData;
}
export interface MetadataTemplateFieldsField {
/**
* The type of field. The basic fields are a `string` field for text, a
* `float` field for numbers, and a `date` fields to present the user with a
* date-time picker.
*
* Additionally, metadata templates support an `enum` field for a basic list
* of items, and ` multiSelect` field for a similar list of items where the
* of items, and `multiSelect` field for a similar list of items where the
* user can select more than one value.
*
* Metadata taxonomies are also supported as a `taxonomy` field type
* with a specific set of additional properties, which describe its structure.
*
* **Note**: The `integer` value is deprecated.
* It is still present in the response,
* but cannot be used in the POST request. */
Expand All @@ -58,6 +71,22 @@ export interface MetadataTemplateFieldsField {
* A list of options for this field. This is used in combination
* with the `enum` and `multiSelect` field types. */
readonly options?: readonly MetadataTemplateFieldsOptionsField[];
/**
* The unique key of the metadata taxonomy to use for this taxonomy field.
* This property is required when the field `type` is set to `taxonomy`. */
readonly taxonomyKey?: string;
/**
* The unique ID of the metadata taxonomy to use for this taxonomy field.
* This property is required when the field `type` is set to `taxonomy`. */
readonly taxonomyId?: string;
/**
* The namespace of the metadata taxonomy to use for this taxonomy field.
* This property is required when the field `type` is set to `taxonomy`. */
readonly namespace?: string;
/**
* An object defining additional rules for the options of the taxonomy field.
* This property is required when the field `type` is set to `taxonomy`. */
readonly optionsRules?: MetadataTemplateFieldsOptionsRulesField;
/**
* The unique ID of the metadata template field. */
readonly id?: string;
Expand Down Expand Up @@ -208,10 +237,10 @@ export function deserializeMetadataTemplateFieldsTypeField(
if (val == 'multiSelect') {
return val;
}
if (val == 'integer') {
if (val == 'taxonomy') {
return val;
}
if (val == 'taxonomy') {
if (val == 'integer') {
return val;
}
throw new BoxSdkError({
Expand Down Expand Up @@ -253,6 +282,60 @@ export function deserializeMetadataTemplateFieldsOptionsField(
const id: undefined | string = val.id == void 0 ? void 0 : val.id;
return { key: key, id: id } satisfies MetadataTemplateFieldsOptionsField;
}
export function serializeMetadataTemplateFieldsOptionsRulesField(
val: MetadataTemplateFieldsOptionsRulesField,
): SerializedData {
return {
['multiSelect']: val.multiSelect,
['selectableLevels']:
val.selectableLevels == void 0
? val.selectableLevels
: (val.selectableLevels.map(function (item: number): SerializedData {
return item;
}) as readonly any[]),
};
}
export function deserializeMetadataTemplateFieldsOptionsRulesField(
val: SerializedData,
): MetadataTemplateFieldsOptionsRulesField {
if (!sdIsMap(val)) {
throw new BoxSdkError({
message: 'Expecting a map for "MetadataTemplateFieldsOptionsRulesField"',
});
}
if (!(val.multiSelect == void 0) && !sdIsBoolean(val.multiSelect)) {
throw new BoxSdkError({
message:
'Expecting boolean for "multiSelect" of type "MetadataTemplateFieldsOptionsRulesField"',
});
}
const multiSelect: undefined | boolean =
val.multiSelect == void 0 ? void 0 : val.multiSelect;
if (!(val.selectableLevels == void 0) && !sdIsList(val.selectableLevels)) {
throw new BoxSdkError({
message:
'Expecting array for "selectableLevels" of type "MetadataTemplateFieldsOptionsRulesField"',
});
}
const selectableLevels: undefined | readonly number[] =
val.selectableLevels == void 0
? void 0
: sdIsList(val.selectableLevels)
? (val.selectableLevels.map(function (itm: SerializedData): number {
if (!sdIsNumber(itm)) {
throw new BoxSdkError({
message:
'Expecting number for "MetadataTemplateFieldsOptionsRulesField"',
});
}
return itm;
}) as readonly any[])
: [];
return {
multiSelect: multiSelect,
selectableLevels: selectableLevels,
} satisfies MetadataTemplateFieldsOptionsRulesField;
}
export function serializeMetadataTemplateFieldsField(
val: MetadataTemplateFieldsField,
): SerializedData {
Expand All @@ -270,6 +353,13 @@ export function serializeMetadataTemplateFieldsField(
): SerializedData {
return serializeMetadataTemplateFieldsOptionsField(item);
}) as readonly any[]),
['taxonomyKey']: val.taxonomyKey,
['taxonomyId']: val.taxonomyId,
['namespace']: val.namespace,
['optionsRules']:
val.optionsRules == void 0
? val.optionsRules
: serializeMetadataTemplateFieldsOptionsRulesField(val.optionsRules),
['id']: val.id,
};
}
Expand Down Expand Up @@ -347,6 +437,34 @@ export function deserializeMetadataTemplateFieldsField(
return deserializeMetadataTemplateFieldsOptionsField(itm);
}) as readonly any[])
: [];
if (!(val.taxonomyKey == void 0) && !sdIsString(val.taxonomyKey)) {
throw new BoxSdkError({
message:
'Expecting string for "taxonomyKey" of type "MetadataTemplateFieldsField"',
});
}
const taxonomyKey: undefined | string =
val.taxonomyKey == void 0 ? void 0 : val.taxonomyKey;
if (!(val.taxonomyId == void 0) && !sdIsString(val.taxonomyId)) {
throw new BoxSdkError({
message:
'Expecting string for "taxonomyId" of type "MetadataTemplateFieldsField"',
});
}
const taxonomyId: undefined | string =
val.taxonomyId == void 0 ? void 0 : val.taxonomyId;
if (!(val.namespace == void 0) && !sdIsString(val.namespace)) {
throw new BoxSdkError({
message:
'Expecting string for "namespace" of type "MetadataTemplateFieldsField"',
});
}
const namespace: undefined | string =
val.namespace == void 0 ? void 0 : val.namespace;
const optionsRules: undefined | MetadataTemplateFieldsOptionsRulesField =
val.optionsRules == void 0
? void 0
: deserializeMetadataTemplateFieldsOptionsRulesField(val.optionsRules);
if (!(val.id == void 0) && !sdIsString(val.id)) {
throw new BoxSdkError({
message:
Expand All @@ -361,6 +479,10 @@ export function deserializeMetadataTemplateFieldsField(
description: description,
hidden: hidden,
options: options,
taxonomyKey: taxonomyKey,
taxonomyId: taxonomyId,
namespace: namespace,
optionsRules: optionsRules,
id: id,
} satisfies MetadataTemplateFieldsField;
}
Expand Down
Loading