-
Notifications
You must be signed in to change notification settings - Fork 0
/
product-type.ts
821 lines (819 loc) · 26.2 KB
/
product-type.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
/**
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
* Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
*/
import { BaseResource, CreatedBy, LastModifiedBy, LocalizedString } from './common.js'
/**
* Specifies how an Attribute (or a set of Attributes) should be validated across all variants of a Product:
*
*/
export type AttributeConstraintEnum = 'CombinationUnique' | 'None' | 'SameForAll' | 'Unique' | string
export type AttributeConstraintEnumDraft = 'None' | string
/**
* Describes a Product Attribute and allows you to define meta-information associated with the Attribute (like whether it should be searchable, or its constraints).
*
*/
export interface AttributeDefinition {
/**
* Describes the Type of the Attribute.
*
*/
readonly type: AttributeType
/**
* User-defined name of the Attribute that is unique within the [Project](ctp:api:type:Project).
*
*
*/
readonly name: string
/**
* Human-readable label for the Attribute.
*
*/
readonly label: LocalizedString
/**
* If `true`, the Attribute must have a value on a [ProductVariant](ctp:api:type:ProductVariant).
*
*/
readonly isRequired: boolean
/**
* Specifies how Attributes are validated across all variants of a Product.
*
*
*/
readonly attributeConstraint: AttributeConstraintEnum
/**
* Provides additional Attribute information to aid content managers configure Product details.
*
*
*/
readonly inputTip?: LocalizedString
/**
* Provides a visual representation directive for values of this Attribute (only relevant for [AttributeTextType](ctp:api:type:AttributeTextType) and [AttributeLocalizableTextType](ctp:api:type:AttributeLocalizableTextType)).
*
*/
readonly inputHint: TextInputHint
/**
* If `true`, the Attribute's values are available for the [Product Projections Search API](/../api/projects/products-search) for use in full-text search queries, filters, and facets.
*
* Which exact features are available with this flag depends on the specific [AttributeType](ctp:api:type:AttributeType).
* The maximum size of a searchable field is **restricted** by the [Field content size limit](/../api/limits#field-content-size).
* This constraint is enforced at both [Product creation](/../api/projects/products#create-product) and [Product update](/../api/projects/products#update-product).
* If the length of the input exceeds the maximum size, an [InvalidField](ctp:api:type:InvalidFieldError) error is returned.
*
*/
readonly isSearchable: boolean
}
/**
* Specify the Attribute to be created with the [ProductTypeDraft](ctp:api:type:ProductTypeDraft).
*
*/
export interface AttributeDefinitionDraft {
/**
* Describes the Type of the Attribute.
*
* When the `type` is different for an AttributeDefinition using the same name in multiple ProductTypes, an [AttributeDefinitionTypeConflict](ctp:api:type:AttributeDefinitionTypeConflictError) error is returned.
*
*
*/
readonly type: AttributeType
/**
* User-defined name of the Attribute that is unique with the [Project](ctp:api:type:Project).
*
* When using the same `name` for an Attribute in multiple ProductTypes, all fields of the AttributeDefinition of this Attribute must be the same across the ProductTypes, else an [AttributeDefinitionAlreadyExists](ctp:api:type:AttributeDefinitionAlreadyExistsError) error is returned.
* An exception to this are the values of an `enum` or `lenum` Type and sets thereof.
*
*/
readonly name: string
/**
* Human-readable label for the Attribute.
*
*/
readonly label: LocalizedString
/**
* Set to `true` if the Attribute is required to have a value on a [ProductVariant](ctp:api:type:ProductVariant).
*
*
*/
readonly isRequired: boolean
/**
* Specifies how an Attribute or a combination of Attributes should be validated across all variants of a Product.
*
*
*/
readonly attributeConstraint?: AttributeConstraintEnum
/**
* Provides additional information about the Attribute that aids content managers when setting Product details.
*
*
*/
readonly inputTip?: LocalizedString
/**
* Provides a visual representation directive for values of this Attribute (only relevant for [AttributeTextType](ctp:api:type:AttributeTextType) and [AttributeLocalizableTextType](ctp:api:type:AttributeLocalizableTextType)).
*
*
*/
readonly inputHint?: TextInputHint
/**
* Set to `true` if the Attribute's values should be available in the [Product Projections Search API](/../api/projects/products-search) and can be used in full-text search queries, filters, and facets.
* Which exact features are available with this flag depends on the specific [AttributeType](ctp:api:type:AttributeType).
* The maximum size of a searchable field is **restricted** by the [Field content size limit](/../api/limits#field-content-size).
* This constraint is enforced at both Product creation and Product update.
* If the length of the input exceeds the maximum size, an InvalidField error is returned.
*
*/
readonly isSearchable?: boolean
}
/**
* A localized enum value must be unique within the enum, else a [DuplicateEnumValues](ctp:api:type:DuplicateEnumValuesError) error is returned.
*
*/
export interface AttributeLocalizedEnumValue {
/**
* Key of the value used as a programmatic identifier, for example in facets & filters.
*
*
*/
readonly key: string
/**
* Descriptive, localized label of the value.
*
*
*/
readonly label: LocalizedString
}
/**
* A plain enum value must be unique within the enum, else a [DuplicateEnumValues](ctp:api:types:DuplicateEnumValuesError) error is returned.
*
*/
export interface AttributePlainEnumValue {
/**
* Key of the value used as a programmatic identifier, for example in facets & filters.
*
*
*/
readonly key: string
/**
* Descriptive label of the value.
*
*
*/
readonly label: string
}
/**
* Name of the resource type that the value should reference. Supported resource type identifiers:
*
*/
export type AttributeReferenceTypeId =
| 'cart'
| 'category'
| 'channel'
| 'customer'
| 'key-value-document'
| 'order'
| 'product'
| 'product-type'
| 'review'
| 'shipping-method'
| 'state'
| 'zone'
| string
/**
* Umbrella type for specific attribute types discriminated by property `name`.
*/
export type AttributeType =
| AttributeBooleanType
| AttributeDateTimeType
| AttributeDateType
| AttributeEnumType
| AttributeLocalizableTextType
| AttributeLocalizedEnumType
| AttributeMoneyType
| AttributeNestedType
| AttributeNumberType
| AttributeReferenceType
| AttributeSetType
| AttributeTextType
| AttributeTimeType
/**
* Attribute type for Boolean values. Valid values for the Attribute are `true` and `false` (JSON Boolean).
*
*/
export interface AttributeBooleanType {
readonly name: 'boolean'
}
export interface AttributeDateTimeType {
readonly name: 'datetime'
}
export interface AttributeDateType {
readonly name: 'date'
}
/**
* Attribute type for plain enum values. Useful for predefined language-agnostic values selectable in drop downs when only one value should be selected. Use [AttributeSetType](ctp:api:type:AttributeSetType) of AttributeEnumType instead if multiple values can be selected from the list.
*
*/
export interface AttributeEnumType {
readonly name: 'enum'
/**
* Available values that can be assigned to Products.
*
*
*/
readonly values: AttributePlainEnumValue[]
}
/**
* Attribute type for [LocalizedString](ctp:api:type:LocalizedString) values.
*
*/
export interface AttributeLocalizableTextType {
readonly name: 'ltext'
}
/**
* Attribute type for localized enum values. Useful for predefined language-specific values selectable in drop-down menus if only one value can be selected. Use [AttributeSetType](ctp:api:type:AttributeSetType) of AttributeLocalizedEnumValue instead if multiple values can be selected.
*
*/
export interface AttributeLocalizedEnumType {
readonly name: 'lenum'
/**
* Available values that can be assigned to Products.
*
*
*/
readonly values: AttributeLocalizedEnumValue[]
}
export interface AttributeMoneyType {
readonly name: 'money'
}
/**
* Attribute type for nesting Attributes based on some existing ProductType. It does not support `isSearchable` and is not supported in queries. The only supported AttributeConstraint is `None`.
*
*/
export interface AttributeNestedType {
readonly name: 'nested'
/**
* Attributes that can be stored as nested Attributes of the current Attribute.
*
*
*/
readonly typeReference: ProductTypeReference
}
export interface AttributeNumberType {
readonly name: 'number'
}
export interface AttributeReferenceType {
readonly name: 'reference'
/**
* Name of the resource type that the value should reference.
*
*
*/
readonly referenceTypeId: AttributeReferenceTypeId
}
/**
* AttributeType that defines a set (without duplicate elements) with values of the given `elementType`. It does not support `isRequired`. Since this type itself is an AttributeType, it is possible to construct an AttributeSetType of an AttributeSetType of any AttributeType, and to continue with this iteration until terminating with any non-AttributeSetType. In case the AttributeSetType iteration terminates with an [AttributeNestedType](ctp:api:type:AttributeNestedType), the iteration can have 5 steps at maximum.
*
*/
export interface AttributeSetType {
readonly name: 'set'
/**
* Attribute type of the elements in the set.
*
*/
readonly elementType: AttributeType
}
/**
* Attribute type for plain text values.
*
*/
export interface AttributeTextType {
readonly name: 'text'
}
export interface AttributeTimeType {
readonly name: 'time'
}
export interface ProductType extends BaseResource {
/**
* Unique identifier of the ProductType.
*
*/
readonly id: string
/**
* Current version of the ProductType.
*
*
*/
readonly version: number
/**
* Date and time (UTC) the ProductType was initially created.
*
*
*/
readonly createdAt: string
/**
* Date and time (UTC) the ProductType was last updated.
*
*
*/
readonly lastModifiedAt: string
/**
* Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked).
*
*
*/
readonly lastModifiedBy?: LastModifiedBy
/**
* Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked).
*
*
*/
readonly createdBy?: CreatedBy
/**
* User-defined unique identifier of the ProductType.
*
*/
readonly key?: string
/**
* Name of the ProductType.
*
*
*/
readonly name: string
/**
* Description of the ProductType.
*
*
*/
readonly description: string
/**
* Attributes specified for the ProductType.
*
*
*/
readonly attributes?: AttributeDefinition[]
}
export interface ProductTypeDraft {
/**
* User-defined unique identifier for the ProductType.
*
*/
readonly key?: string
/**
* Name of the ProductType.
*
*
*/
readonly name: string
/**
* Description of the ProductType.
*
*
*/
readonly description: string
/**
* Attributes to specify for the ProductType. Products of this ProductType have these Attributes available on their [ProductVariants](ctp:api:type:ProductVariant).
*
*
*/
readonly attributes?: AttributeDefinitionDraft[]
}
/**
* [PagedQueryResult](/../api/general-concepts#pagedqueryresult) with results containing an array of [ProductType](ctp:api:type:ProductType).
*
*/
export interface ProductTypePagedQueryResponse {
/**
* Number of [results requested](/../api/general-concepts#limit).
*
*
*/
readonly limit: number
/**
* Number of [elements skipped](/../api/general-concepts#offset).
*
*
*/
readonly offset: number
/**
* Actual number of results returned.
*
*
*/
readonly count: number
/**
* Total number of results matching the query.
* This number is an estimation that is not [strongly consistent](/../api/general-concepts#strong-consistency).
* This field is returned by default.
* For improved performance, calculating this field can be deactivated by using the query parameter `withTotal=false`.
* When the results are filtered with a [Query Predicate](/../api/predicates/query), `total` is subject to a [limit](/../api/limits#queries).
*
*
*/
readonly total?: number
/**
* [ProductTypes](ctp:api:type:ProductType) matching the query.
*
*
*/
readonly results: ProductType[]
}
/**
* [Reference](ctp:api:type:Reference) to a [ProductType](ctp:api:type:ProductType).
*
*/
export interface ProductTypeReference {
readonly typeId: 'product-type'
/**
* Unique identifier of the referenced [ProductType](ctp:api:type:ProductType).
*
*
*/
readonly id: string
/**
* Contains the representation of the expanded ProductType. Only present in responses to requests with [Reference Expansion](/../api/general-concepts#reference-expansion) for ProductTypes.
*
*
*/
readonly obj?: ProductType
}
/**
* [ResourceIdentifier](ctp:api:type:ResourceIdentifier) to a [ProductType](ctp:api:type:ProductType).
*
*/
export interface ProductTypeResourceIdentifier {
readonly typeId: 'product-type'
/**
* Unique identifier of the referenced [ProductType](ctp:api:type:ProductType). Either `id` or `key` is required.
*
*
*/
readonly id?: string
/**
* User-defined unique identifier of the referenced [ProductType](ctp:api:type:ProductType). Either `id` or `key` is required.
*
*
*/
readonly key?: string
}
export interface ProductTypeUpdate {
/**
* Expected version of the ProductType on which the changes should be applied. If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned.
*
*
*/
readonly version: number
/**
* Update actions to be performed on the ProductType.
*
*
*/
readonly actions: ProductTypeUpdateAction[]
}
export type ProductTypeUpdateAction =
| ProductTypeAddAttributeDefinitionAction
| ProductTypeAddLocalizedEnumValueAction
| ProductTypeAddPlainEnumValueAction
| ProductTypeChangeAttributeConstraintAction
| ProductTypeChangeAttributeNameAction
| ProductTypeChangeAttributeOrderByNameAction
| ProductTypeChangeDescriptionAction
| ProductTypeChangeEnumKeyAction
| ProductTypeChangeInputHintAction
| ProductTypeChangeIsSearchableAction
| ProductTypeChangeLabelAction
| ProductTypeChangeLocalizedEnumValueLabelAction
| ProductTypeChangeLocalizedEnumValueOrderAction
| ProductTypeChangeNameAction
| ProductTypeChangePlainEnumValueLabelAction
| ProductTypeChangePlainEnumValueOrderAction
| ProductTypeRemoveAttributeDefinitionAction
| ProductTypeRemoveEnumValuesAction
| ProductTypeSetInputTipAction
| ProductTypeSetKeyAction
/**
* A text input hint is a string with one of the following values:
*
*/
export type TextInputHint = 'MultiLine' | 'SingleLine' | string
export interface ProductTypeAddAttributeDefinitionAction {
readonly action: 'addAttributeDefinition'
/**
* Value to append to `attributes`.
*
*/
readonly attribute: AttributeDefinitionDraft
}
/**
* Adds a localizable enum to the values of [AttributeLocalizedEnumType](ctp:api:type:AttributeLocalizedEnumType). It can update an AttributeLocalizedEnumType AttributeDefinition or an [AttributeSetType](ctp:api:type:AttributeSetType) of AttributeLocalizedEnumType AttributeDefinition.
*
*/
export interface ProductTypeAddLocalizedEnumValueAction {
readonly action: 'addLocalizedEnumValue'
/**
* Name of the AttributeDefinition to update.
*
*
*/
readonly attributeName: string
/**
* Value to append to the array.
*
*
*/
readonly value: AttributeLocalizedEnumValue
}
/**
* Adds an enum to the values of [AttributeEnumType](ctp:api:type:AttributeEnumType) AttributeDefinition, or [AttributeSetType](ctp:api:type:AttributeSetType) of AttributeEnumType AttributeDefinition.
*
*/
export interface ProductTypeAddPlainEnumValueAction {
readonly action: 'addPlainEnumValue'
/**
* Name of the AttributeDefinition to update.
*
*
*/
readonly attributeName: string
/**
* Value to append to the array.
*
*
*/
readonly value: AttributePlainEnumValue
}
/**
* Updates the `attributeConstraint` of an [AttributeDefinition](ctp:api:type:AttributeDefinition). For now only following changes are supported: `SameForAll` to `None` and `Unique` to `None`.
*
*/
export interface ProductTypeChangeAttributeConstraintAction {
readonly action: 'changeAttributeConstraint'
/**
* Name of the AttributeDefinition to update.
*
*
*/
readonly attributeName: string
/**
* `None`
*
*
*/
readonly newValue: AttributeConstraintEnumDraft
}
/**
* Renames an AttributeDefinition and also renames all corresponding Attributes on all [Products](/projects/products) with this ProductType. The renaming of the Attributes is [eventually consistent](/general-concepts#eventual-consistency).
*
* If the AttributeDefinition name to be changed does not exist, an [AttributeNameDoesNotExist](ctp:api:type:AttributeNameDoesNotExistError) error is returned.
*
*/
export interface ProductTypeChangeAttributeNameAction {
readonly action: 'changeAttributeName'
/**
* Name of the AttributeDefinition to update.
*
*/
readonly attributeName: string
/**
* New user-defined name of the Attribute that is unique with the [Project](ctp:api:type:Project).
*
* When using the same `name` for an Attribute in two or more ProductTypes, all fields of the AttributeDefinition of this Attribute must be the same across the ProductTypes. If not, an [AttributeDefinitionAlreadyExists](ctp:api:type:AttributeDefinitionAlreadyExistsError) error is returned.
* An exception to this are the values of an `enum` or `lenum` type and sets thereof.
*
*/
readonly newAttributeName: string
}
export interface ProductTypeChangeAttributeOrderByNameAction {
readonly action: 'changeAttributeOrderByName'
/**
* Names of Attributes to reorder. This array must include all Attributes currently present on a ProductType in a different order.
*
*
*/
readonly attributeNames: string[]
}
export interface ProductTypeChangeDescriptionAction {
readonly action: 'changeDescription'
/**
* New value to set.
*
*/
readonly description: string
}
/**
* Updates the key of a single enum `value` in an [AttributeEnumType](ctp:api:type:AttributeEnumType) AttributeDefinition, [AttributeLocalizedEnumType](ctp:api:type:AttributeLocalizedEnumType) AttributeDefinition, [AttributeSetType](ctp:api:type:AttributeSetType) of AttributeEnumType AttributeDefinition, or AttributeSetType of AttributeLocalizedEnumType AttributeDefinition.
*
* If the AttributeDefinition does not contain an enum with the referenced key, a [EnumKeyDoesNotExist](ctp:api:type:EnumKeyDoesNotExistError) error is returned.
*
* All Products will be updated to the new key in an [eventually consistent](/general-concepts#eventual-consistency) way.
*
*/
export interface ProductTypeChangeEnumKeyAction {
readonly action: 'changeEnumKey'
/**
* Name of the AttributeDefinition to update.
*
*/
readonly attributeName: string
/**
* Existing key to be changed.
*
*
*/
readonly key: string
/**
* New key to be set.
*
*
*/
readonly newKey: string
}
/**
* Updates the `inputHint` of an [AttributeDefinition](ctp:api:type:AttributeDefinition).
*
*/
export interface ProductTypeChangeInputHintAction {
readonly action: 'changeInputHint'
/**
* Name of the AttributeDefinition to update.
*
*/
readonly attributeName: string
/**
* `SingleLine` or `MultiLine`
*
*
*/
readonly newValue: TextInputHint
}
/**
* Following this update the Products are reindexed asynchronously to reflect this change on the search endpoint. When enabling search on an existing Attribute type definition, the constraint regarding the maximum size of a searchable Attribute will not be enforced. Instead, Product AttributeDefinitions exceeding this limit will be treated as not searchable and will not be available for full-text search.
*
*/
export interface ProductTypeChangeIsSearchableAction {
readonly action: 'changeIsSearchable'
/**
* Name of the AttributeDefinition to update.
*
*
*/
readonly attributeName: string
/**
* Determines whether the Attribute's values can be used in full-text search queries, filters, and facets. See [AttributeDefinition](ctp:api:type:AttributeDefinition) for details.
*
*
*/
readonly isSearchable: boolean
}
export interface ProductTypeChangeLabelAction {
readonly action: 'changeLabel'
/**
* Name of the AttributeDefinition to update.
*
*/
readonly attributeName: string
/**
* New value to set. Must not be empty.
*
*/
readonly label: LocalizedString
}
/**
* Updates the label of a single enum `value` in an [AttributeLocalizedEnumType](ctp:api:type:AttributeLocalizedEnumType) AttributeDefinition, or [AttributeSetType](ctp:api:type:AttributeSetType) of AttributeLocalizedEnumType AttributeDefinition.
*
* All Products will be updated to the new label in an [eventually consistent](/general-concepts#eventual-consistency) way.
*
*/
export interface ProductTypeChangeLocalizedEnumValueLabelAction {
readonly action: 'changeLocalizedEnumValueLabel'
/**
* Name of the AttributeDefinition to update.
*
*/
readonly attributeName: string
/**
* New value to set. Must be different from the existing value.
*
*
*/
readonly newValue: AttributeLocalizedEnumValue
}
/**
* Updates the order of localized enum `values` in an [AttributeLocalizedEnumType](ctp:api:type:AttributeLocalizedEnumType) AttributeDefinition. It can update an AttributeLocalizedEnumType AttributeDefinition or an [AttributeSetType](ctp:api:type:AttributeSetType) of AttributeLocalizedEnumType AttributeDefinition.
*
*/
export interface ProductTypeChangeLocalizedEnumValueOrderAction {
readonly action: 'changeLocalizedEnumValueOrder'
/**
* Name of the AttributeDefinition to update.
*
*/
readonly attributeName: string
/**
* Values must be equal to the values of the Attribute enum values (except for the order). If not, an [EnumValuesMustMatch](ctp:api:type:EnumValuesMustMatchError) error is returned.
*
*
*/
readonly values: AttributeLocalizedEnumValue[]
}
export interface ProductTypeChangeNameAction {
readonly action: 'changeName'
/**
* New value to set.
*
*/
readonly name: string
}
/**
* Updates the label of a single enum `value` in an [AttributeEnumType](ctp:api:type:AttributeEnumType) AttributeDefinition, or [AttributeSetType](ctp:api:type:AttributeSetType) of AttributeEnumType AttributeDefinition.
*
* All Products will be updated to the new label in an [eventually consistent](/general-concepts#eventual-consistency) way.
*
*/
export interface ProductTypeChangePlainEnumValueLabelAction {
readonly action: 'changePlainEnumValueLabel'
/**
* Name of the AttributeDefinition to update.
*
*/
readonly attributeName: string
/**
* New value to set. Must be different from the existing value.
*
*
*/
readonly newValue: AttributePlainEnumValue
}
/**
* Updates the order of enum `values` in an [AttributeEnumType](ctp:api:type:AttributeEnumType) AttributeDefinition. It can update an AttributeEnumType AttributeDefinition or an [AttributeSetType](ctp:api:type:AttributeSetType) of AttributeEnumType AttributeDefinition.
*
*/
export interface ProductTypeChangePlainEnumValueOrderAction {
readonly action: 'changePlainEnumValueOrder'
/**
* Name of the AttributeDefinition to update.
*
*/
readonly attributeName: string
/**
* Values must be equal to the values of the Attribute enum values (except for the order). If not, an [EnumValuesMustMatch](ctp:api:type:EnumValuesMustMatchError) error is returned.
*
*
*/
readonly values: AttributePlainEnumValue[]
}
/**
* Removes an AttributeDefinition and also deletes all corresponding Attributes on all [Products](/projects/products) with this ProductType. The removal of the Attributes is [eventually consistent](/general-concepts#eventual-consistency).
*
* The `CombinationUnique` constraint is not checked when an Attribute is removed, and uniqueness violations may occur when you remove an Attribute with a `CombinationUnique` constraint.
*
*/
export interface ProductTypeRemoveAttributeDefinitionAction {
readonly action: 'removeAttributeDefinition'
/**
* Name of the Attribute to remove.
*
*/
readonly name: string
}
/**
* Removes enum values from an AttributeDefinition of [AttributeEnumType](ctp:api:type:AttributeEnumType), [AttributeLocalizedEnumType](ctp:api:type:AttributeLocalizedEnumType), [AttributeSetType](ctp:api:type:AttributeSetType) of AttributeEnumType, or AttributeSetType of AttributeLocalizedEnumType.
*
* If the Attribute is **not** required, the Attributes of all Products using those enum keys will also be removed in an [eventually consistent](/general-concepts#eventual-consistency) way. If the Attribute is required, the operation returns an [EnumValueIsUsed](ctp:api:type:EnumValueIsUsedError) error.
*
*/
export interface ProductTypeRemoveEnumValuesAction {
readonly action: 'removeEnumValues'
/**
* Name of the AttributeDefinition to update.
*
*/
readonly attributeName: string
/**
* Keys of [AttributeEnumType](ctp:api:type:AttributeEnumType) or [AttributeLocalizedEnumType](ctp:api:type:AttributeLocalizedEnumType) to remove.
*
*
*/
readonly keys: string[]
}
export interface ProductTypeSetInputTipAction {
readonly action: 'setInputTip'
/**
* Name of the AttributeDefinition to update.
*
*
*/
readonly attributeName: string
/**
* Value to set. If empty, any existing value will be removed.
*
*
*/
readonly inputTip?: LocalizedString
}
export interface ProductTypeSetKeyAction {
readonly action: 'setKey'
/**
* Value to set. If empty, any existing value will be removed.
*
*/
readonly key?: string
}