-
Notifications
You must be signed in to change notification settings - Fork 0
/
product.ts
2344 lines (2342 loc) · 58.6 KB
/
product.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
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* 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 { ProductPublishScope } from './cart.js'
import { CategoryReference, CategoryResourceIdentifier } from './category.js'
import {
Asset,
AssetDraft,
AssetSource,
BaseResource,
CreatedBy,
DiscountedPriceDraft,
Image,
LastModifiedBy,
LocalizedString,
Price,
PriceDraft,
ScopedPrice,
} from './common.js'
import { ProductTypeReference, ProductTypeResourceIdentifier } from './product-type.js'
import { ReviewRatingStatistics } from './review.js'
import { StateReference, StateResourceIdentifier } from './state.js'
import { TaxCategoryReference, TaxCategoryResourceIdentifier } from './tax-category.js'
import { FieldContainer, TypeResourceIdentifier } from './type.js'
export interface Attribute {
/**
* Name of the Attribute.
*
*
*/
readonly name: string
/**
* The [AttributeType](ctp:api:type:AttributeType) determines the format of the Attribute `value` to be provided:
*
* - For [Enum Type](ctp:api:type:AttributeEnumType) and [Localized Enum Type](ctp:api:type:AttributeLocalizedEnumType),
* use the `key` of the [Plain Enum Value](ctp:api:type:AttributePlainEnumValue) or [Localized Enum Value](ctp:api:type:AttributeLocalizedEnumValue) objects,
* or the complete objects as `value`.
* - For [Localizable Text Type](ctp:api:type:AttributeLocalizableTextType), use the [LocalizedString](ctp:api:type:LocalizedString) object as `value`.
* - For [Money Type](ctp:api:type:AttributeMoneyType) Attributes, use the [Money](ctp:api:type:Money) object as `value`.
* - For [Set Type](ctp:api:type:AttributeSetType) Attributes, use the entire `set` object as `value`.
* - For [Nested Type](ctp:api:type:AttributeNestedType) Attributes, use the list of values of all Attributes of the nested Product as `value`.
* - For [Reference Type](ctp:api:type:AttributeReferenceType) Attributes, use the [Reference](ctp:api:type:Reference) object as `value`.
*
*
*/
readonly value: any
}
/**
* JSON object where the key is a [Category](ctp:api:type:Category) `id` and the value is an order hint.
* Allows controlling the order of Products and how they appear in Categories. Products with no order hint have an order score below `0`. Order hints are non-unique.
* If a subset of Products have the same value for order hint in a specific category, the behavior is undetermined.
*/
export interface CategoryOrderHints {
[key: string]: string
}
export interface FacetRange {
/**
*
*/
readonly from: number
/**
*
*/
readonly fromStr: string
/**
*
*/
readonly to: number
/**
*
*/
readonly toStr: string
/**
*
*/
readonly count: number
/**
*
*/
readonly productCount?: number
/**
*
*/
readonly total: number
/**
*
*/
readonly min: number
/**
*
*/
readonly max: number
/**
*
*/
readonly mean: number
}
export type FacetResult = FilteredFacetResult | RangeFacetResult | TermFacetResult
export interface FacetResults {
[key: string]: FacetResult
}
export interface FacetTerm {
/**
*
*/
readonly term: any
/**
*
*/
readonly count: number
/**
*
*/
readonly productCount?: number
}
export type FacetTypes = 'filter' | 'range' | 'terms' | string
export interface FilteredFacetResult {
readonly type: 'filter'
/**
*
*/
readonly count: number
/**
*
*/
readonly productCount?: number
}
/**
* An abstract sellable good with a set of Attributes defined by a Product Type.
* Products themselves are not sellable. Instead, they act as a parent structure for Product Variants.
* Each Product must have at least one Product Variant, which is called the Master Variant.
* A single Product representation contains the _current_ and the _staged_ representation of its product data.
*
*/
export interface Product extends BaseResource {
/**
* Unique identifier of the Product.
*
*/
readonly id: string
/**
* Current version of the Product.
*
*
*/
readonly version: number
/**
* Date and time (UTC) the Product was initially created.
*
*
*/
readonly createdAt: string
/**
* Date and time (UTC) the Product was last updated.
*
*
*/
readonly lastModifiedAt: string
/**
* Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked).
*
*
*/
readonly lastModifiedBy?: LastModifiedBy
/**
* Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked).
*
*
*/
readonly createdBy?: CreatedBy
/**
* User-defined unique identifier of the Product.
*
* This is different from the `key` of a [ProductVariant](ctp:api:type:ProductVariant).
*
*
*/
readonly key?: string
/**
* The Product Type defining the Attributes of the Product. Cannot be changed.
*
*
*/
readonly productType: ProductTypeReference
/**
* Contains the current and the staged representation of the product information.
*
*
*/
readonly masterData: ProductCatalogData
/**
* The [TaxCategory](ctp:api:type:TaxCategory) of the Product.
*
*
*/
readonly taxCategory?: TaxCategoryReference
/**
* [State](ctp:api:type:State) of the Product.
*
*
*/
readonly state?: StateReference
/**
* Review statistics of the Product.
*
*
*/
readonly reviewRatingStatistics?: ReviewRatingStatistics
/**
* Type of Price to be used when looking up a price for the Product.
*
*
*/
readonly priceMode?: ProductPriceModeEnum
}
/**
* Contains the `current` and `staged` [ProductData](ctp:api:type:ProductData).
*
*/
export interface ProductCatalogData {
/**
* `true` if the Product is published.
*
*
*/
readonly published: boolean
/**
* Current (published) data of the Product.
*
*
*/
readonly current: ProductData
/**
* Staged (unpublished) data of the Product.
*
*
*/
readonly staged: ProductData
/**
* `true` if the `staged` data is different from the `current` data.
*
*
*/
readonly hasStagedChanges: boolean
}
/**
* Contains all the data of a Product and its Product Variants.
*
*/
export interface ProductData {
/**
* Name of the Product.
*
*
*/
readonly name: LocalizedString
/**
* [Categories](ctp:api:type:Category) assigned to the Product.
*
*
*/
readonly categories: CategoryReference[]
/**
* Numerical values to allow ordering of Products within a specified Category.
*
*
*/
readonly categoryOrderHints?: CategoryOrderHints
/**
* Description of the Product.
*
*
*/
readonly description?: LocalizedString
/**
* User-defined identifier used in a deep-link URL for the Product.
* Must be unique across a Project, but can be the same for Products in different [Locales](ctp:api:type:Locale).
* Matches the pattern `[a-zA-Z0-9_\\-]{2,256}`.
*
*
*/
readonly slug: LocalizedString
/**
* Title of the Product displayed in search results.
*
*
*/
readonly metaTitle?: LocalizedString
/**
* Description of the Product displayed in search results below the meta title.
*
*
*/
readonly metaDescription?: LocalizedString
/**
* Keywords that give additional information about the Product to search engines.
*
*
*/
readonly metaKeywords?: LocalizedString
/**
* The Master Variant of the Product.
*
*
*/
readonly masterVariant: ProductVariant
/**
* Additional Product Variants.
*
*
*/
readonly variants: ProductVariant[]
/**
* Used by [Product Suggestions](ctp:api:type:ProductSuggestions), but is also considered for a full text search.
*
*
*/
readonly searchKeywords: SearchKeywords
}
export interface ProductDraft {
/**
* The Product Type defining the Attributes for the Product. Cannot be changed later.
*
*
*/
readonly productType: ProductTypeResourceIdentifier
/**
* Name of the Product.
*
*
*/
readonly name: LocalizedString
/**
* User-defined identifier used in a deep-link URL for the Product.
* It must be unique across a Project, but a Product can have the same slug in different [Locales](ctp:api:type:Locale).
* It must match the pattern `[a-zA-Z0-9_\\-]{2,256}`.
*
*
*/
readonly slug: LocalizedString
/**
* User-defined unique identifier for the Product.
*
*
*/
readonly key?: string
/**
* Description of the Product.
*
*
*/
readonly description?: LocalizedString
/**
* Categories assigned to the Product.
*
*
*/
readonly categories?: CategoryResourceIdentifier[]
/**
* Numerical values to allow ordering of Products within a specified Category.
*
*
*/
readonly categoryOrderHints?: CategoryOrderHints
/**
* Title of the Product displayed in search results.
*
*
*/
readonly metaTitle?: LocalizedString
/**
* Description of the Product displayed in search results.
*
*
*/
readonly metaDescription?: LocalizedString
/**
* Keywords that give additional information about the Product to search engines.
*
*
*/
readonly metaKeywords?: LocalizedString
/**
* The Product Variant to be the Master Variant for the Product. Required if `variants` are provided also.
*
*
*/
readonly masterVariant?: ProductVariantDraft
/**
* The additional Product Variants for the Product.
*
*
*/
readonly variants?: ProductVariantDraft[]
/**
* The Tax Category to be assigned to the Product.
*
*
*/
readonly taxCategory?: TaxCategoryResourceIdentifier
/**
* Used by [Product Suggestions](ctp:api:type:ProductSuggestions), but is also considered for a [full text search](/projects/products-search#full-text-search).
*
*
*/
readonly searchKeywords?: SearchKeywords
/**
* State to be assigned to the Product.
*
*
*/
readonly state?: StateResourceIdentifier
/**
* If `true`, the Product is published immediately to the current projection.
*
*
*/
readonly publish?: boolean
/**
* Specifies the type of prices used when looking up a price for the Product.
*
*
*/
readonly priceMode?: ProductPriceModeEnum
}
/**
* [PagedQueryResult](/../api/general-concepts#pagedqueryresult) with `results` containing an array of [Product](ctp:api:type:Product).
*
*/
export interface ProductPagedQueryResponse {
/**
* 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](ctp:api:type:QueryPredicate), `total` is subject to a [limit](/../api/limits#queries).
*
*
*/
readonly total?: number
/**
* [Products](ctp:api:type:Product) matching the query.
*
*
*/
readonly results: Product[]
}
/**
* This mode determines the type of Prices used for [Product Price Selection](ctp:api:type:ProductPriceSelection) and for [LineItem Price selection](ctp:api:type:LineItemPriceSelection).
*
*/
export type ProductPriceModeEnum = 'Embedded' | 'Standalone' | string
export interface ProductProjection extends BaseResource {
/**
* Unique identifier of the [Product](ctp:api:type:Product).
*
*
*/
readonly id: string
/**
* Current version of the [Product](ctp:api:type:Product).
*
*
*/
readonly version: number
/**
* User-defined unique identifier of the [Product](ctp:api:type:Product).
*
*
*/
readonly key?: string
/**
* Date and time (UTC) the ProductProjection was initially created.
*
*
*/
readonly createdAt: string
/**
* Date and time (UTC) the ProductProjection was last updated.
*
*
*/
readonly lastModifiedAt: string
/**
* The [ProductType](ctp:api:type:ProductType) defining the Attributes of the [Product](ctp:api:type:Product).
*
*
*/
readonly productType: ProductTypeReference
/**
* Name of the [Product](ctp:api:type:Product).
*
*
*/
readonly name: LocalizedString
/**
* Description of the [Product](ctp:api:type:Product).
*
*
*/
readonly description?: LocalizedString
/**
* User-defined identifier used in a deep-link URL for the [Product](ctp:api:type:Product).
* Must be unique across a Project, but can be the same for Products in different locales.
* Matches the pattern `[a-zA-Z0-9_\-]{2,256}`.
* For [good performance](/../api/predicates/query#performance-considerations), indexes are provided for the first 15 `languages` set in the [Project](ctp:api:type:Project).
*
*
*/
readonly slug: LocalizedString
/**
* [Categories](ctp:api:type:Category) assigned to the [Product](ctp:api:type:Product).
*
*
*/
readonly categories: CategoryReference[]
/**
* Order of [Product](ctp:api:type:Product) in [Categories](ctp:api:type:Category).
*
*
*/
readonly categoryOrderHints?: CategoryOrderHints
/**
* Title of the [Product](ctp:api:type:Product) displayed in search results.
*
*
*/
readonly metaTitle?: LocalizedString
/**
* Description of the [Product](ctp:api:type:Product) displayed in search results below the meta title.
*
*
*/
readonly metaDescription?: LocalizedString
/**
* Keywords that give additional information about the [Product](ctp:api:type:Product) to search engines.
*
*
*/
readonly metaKeywords?: LocalizedString
/**
* Used by [Product Suggestions](/../api/projects/products-suggestions), but is also considered for a [full text search](ctp:api:type:FullTextSearch).
*
*
*/
readonly searchKeywords?: SearchKeywords
/**
* `true` if the staged data is different from the current data.
*
*
*/
readonly hasStagedChanges?: boolean
/**
* `true` if the [Product](ctp:api:type:Product) is [published](ctp:api:type:CurrentStaged).
*
*
*/
readonly published?: boolean
/**
* The Master Variant of the [Product](ctp:api:type:Product).
*
*
*/
readonly masterVariant: ProductVariant
/**
* Additional Product Variants.
*
*
*/
readonly variants: ProductVariant[]
/**
* The [TaxCategory](ctp:api:type:TaxCategory) of the [Product](ctp:api:type:Product).
*
*
*/
readonly taxCategory?: TaxCategoryReference
/**
* [State](ctp:api:type:State) of the [Product](ctp:api:type:Product).
*
*
*/
readonly state?: StateReference
/**
* Review statistics of the [Product](ctp:api:type:Product).
*
*
*/
readonly reviewRatingStatistics?: ReviewRatingStatistics
/**
* Indicates whether the Prices of the Product Projection are [embedded](ctp:api:type:Price) or [standalone](ctp:api:type:StandalonePrice). [Projecting Prices](#prices) only works with `Embedded`, there is currently no support for `Standalone`.
*
*
*/
readonly priceMode?: ProductPriceModeEnum
}
export interface ProductProjectionPagedQueryResponse {
/**
* Number of [results requested](/../api/general-concepts#limit).
*
*
*/
readonly limit: 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
/**
* Number of [elements skipped](/../api/general-concepts#offset).
*
*
*/
readonly offset: number
/**
* [ProductProjections](ctp:api:type:ProductProjection) matching the query.
*
*
*/
readonly results: ProductProjection[]
}
export interface ProductProjectionPagedSearchResponse {
/**
* Number of [results requested](/../api/general-concepts#limit).
*
*
*/
readonly limit: number
/**
*
*/
readonly count: number
/**
*
*/
readonly total?: number
/**
* Number of [elements skipped](/../api/general-concepts#offset).
*
*
*/
readonly offset: number
/**
*
*/
readonly results: ProductProjection[]
/**
*
*/
readonly facets: FacetResults
}
/**
* [Reference](ctp:api:type:Reference) to a [Product](ctp:api:type:Product).
*
*/
export interface ProductReference {
readonly typeId: 'product'
/**
* Unique identifier of the referenced [Product](ctp:api:type:Product).
*
*
*/
readonly id: string
/**
* Contains the representation of the expanded Product. Only present in responses to requests with [Reference Expansion](/../api/general-concepts#reference-expansion) for Products.
*
*
*/
readonly obj?: Product
}
/**
* [ResourceIdentifier](ctp:api:type:ResourceIdentifier) to a [Product](ctp:api:type:Product). Either `id` or `key` is required.
*
*/
export interface ProductResourceIdentifier {
readonly typeId: 'product'
/**
* Unique identifier of the referenced [Product](ctp:api:type:Product).
*
*
*/
readonly id?: string
/**
* User-defined unique identifier of the referenced [Product](ctp:api:type:Product).
*
*
*/
readonly key?: string
}
export interface ProductUpdate {
/**
* Expected version of the Product on which the changes should be applied. If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) will be returned.
*
*
*/
readonly version: number
/**
* Update actions to be performed on the Product.
*
*
*/
readonly actions: ProductUpdateAction[]
}
export type ProductUpdateAction =
| ProductAddAssetAction
| ProductAddExternalImageAction
| ProductAddPriceAction
| ProductAddToCategoryAction
| ProductAddVariantAction
| ProductChangeAssetNameAction
| ProductChangeAssetOrderAction
| ProductChangeMasterVariantAction
| ProductChangeNameAction
| ProductChangePriceAction
| ProductChangeSlugAction
| ProductLegacySetSkuAction
| ProductMoveImageToPositionAction
| ProductPublishAction
| ProductRemoveAssetAction
| ProductRemoveFromCategoryAction
| ProductRemoveImageAction
| ProductRemovePriceAction
| ProductRemoveVariantAction
| ProductRevertStagedChangesAction
| ProductRevertStagedVariantChangesAction
| ProductSetAssetCustomFieldAction
| ProductSetAssetCustomTypeAction
| ProductSetAssetDescriptionAction
| ProductSetAssetKeyAction
| ProductSetAssetSourcesAction
| ProductSetAssetTagsAction
| ProductSetAttributeAction
| ProductSetAttributeInAllVariantsAction
| ProductSetCategoryOrderHintAction
| ProductSetDescriptionAction
| ProductSetDiscountedPriceAction
| ProductSetImageLabelAction
| ProductSetKeyAction
| ProductSetMetaDescriptionAction
| ProductSetMetaKeywordsAction
| ProductSetMetaTitleAction
| ProductSetPriceKeyAction
| ProductSetPriceModeAction
| ProductSetPricesAction
| ProductSetProductPriceCustomFieldAction
| ProductSetProductPriceCustomTypeAction
| ProductSetProductVariantKeyAction
| ProductSetSearchKeywordsAction
| ProductSetSkuAction
| ProductSetTaxCategoryAction
| ProductTransitionStateAction
| ProductUnpublishAction
/**
* A concrete sellable good for which inventory can be tracked. Product Variants are generally mapped to specific SKUs.
*
*/
export interface ProductVariant {
/**
* A unique, sequential identifier of the Product Variant within the Product.
*
*
*/
readonly id: number
/**
* User-defined unique SKU of the Product Variant.
*
*
*/
readonly sku?: string
/**
* User-defined unique identifier of the ProductVariant.
*
* This is different from [Product](ctp:api:type:Product) `key`.
*
*
*/
readonly key?: string
/**
* The Embedded Prices of the Product Variant.
* Cannot contain two Prices of the same Price scope (with same currency, country, Customer Group, Channel, `validFrom` and `validUntil`).
*
*
*/
readonly prices?: Price[]
/**
* Attributes of the Product Variant.
*
*
*/
readonly attributes?: Attribute[]
/**
* Only available when [Price selection](#price-selection) is used.
* Cannot be used in a [Query Predicate](ctp:api:type:QueryPredicate).
*
*
*/
readonly price?: Price
/**
* Images of the Product Variant.
*
*
*/
readonly images?: Image[]
/**
* Media assets of the Product Variant.
*
*
*/
readonly assets?: Asset[]
/**
* Set if the Product Variant is tracked by [Inventory](ctp:api:type:InventoryEntry).
* Can be used as an optimization to reduce calls to the Inventory service.
* May not contain the latest Inventory State (it is [eventually consistent](/general-concepts#eventual-consistency)).
*
*
*/
readonly availability?: ProductVariantAvailability
/**
* `true` if the Product Variant matches the search query.
* Only available in response to a [Product Projection Search](ctp:api:type:ProductProjectionSearch) request.
*
*
*/
readonly isMatchingVariant?: boolean
/**
* Only available in response to a [Product Projection Search](ctp:api:type:ProductProjectionSearch) request
* with [price selection](ctp:api:type:ProductPriceSelection).
* Can be used to sort, [filter](ctp:api:type:ProductProjectionSearchFilterScopedPrice), and facet.
*
*
*/
readonly scopedPrice?: ScopedPrice
/**
* Only available in response to a [Product Projection Search](ctp:api:type:ProductProjectionSearchFilterScopedPrice) request
* with [price selection](ctp:api:type:ProductPriceSelection).
*
*
*/
readonly scopedPriceDiscounted?: boolean
}
/**
* The [InventoryEntry](ctp:api:type:InventoryEntry) information of the Product Variant. If there is a supply [Channel](ctp:api:type:Channel) for the InventoryEntry, then `channels` is returned. If not, then `isOnStock`, `restockableInDays`, and `quantityOnStock` are returned.
*
*/
export interface ProductVariantAvailability {
/**
* For each [InventoryEntry](ctp:api:type:InventoryEntry) with a supply Channel, an entry is added to `channels`.
*
*
*/
readonly channels?: ProductVariantChannelAvailabilityMap
/**
* Indicates whether a Product Variant is in stock.
*
*
*/
readonly isOnStock?: boolean
/**
* Number of days to restock a Product Variant once it is out of stock.
*
*
*/
readonly restockableInDays?: number
/**
* Number of items of the Product Variant that are in stock.
*
*
*/
readonly availableQuantity?: number
}
export interface ProductVariantChannelAvailability {
/**
* Indicates whether a Product Variant is in stock in a specified [Channel](ctp:api:type:Channel).
*
*
*/
readonly isOnStock?: boolean
/**
* Number of days to restock a Product Variant once it is out of stock in a specified [Channel](ctp:api:type:Channel).
*
*
*/
readonly restockableInDays?: number
/**
* Number of items of this Product Variant that are in stock in a specified [Channel](ctp:api:type:Channel).
*
*
*/
readonly availableQuantity?: number
/**
* Unique identifier of the [InventoryEntry](ctp:api:type:InventoryEntry).
*
*
*/
readonly id: string
/**
* Current version of the [InventoryEntry](ctp:api:type:InventoryEntry).
*
*
*/
readonly version: number
}
/**
* JSON object where the key is a supply [Channel](ctp:api:type:Channel) `id` and the value is the [ProductVariantChannelAvailability](ctp:api:type:ProductVariantChannelAvailability) of the [InventoryEntry](ctp:api:type:InventoryEntry).
*
*/
export interface ProductVariantChannelAvailabilityMap {
[key: string]: ProductVariantChannelAvailability
}
/**
* Creates a Product Variant when included in the `masterVariant` and `variants` fields of the [ProductDraft](ctp:api:type:ProductDraft).
*
*/
export interface ProductVariantDraft {
/**
* User-defined unique SKU of the Product Variant.
*
*
*/
readonly sku?: string
/**
* User-defined unique identifier for the ProductVariant.
*
*
*/
readonly key?: string
/**
* The Embedded Prices for the Product Variant.
* Each Price must have its unique Price scope (with same currency, country, Customer Group, Channel, `validFrom` and `validUntil`).
*
*
*/
readonly prices?: PriceDraft[]
/**
* Attributes according to the respective [AttributeDefinition](ctp:api:type:AttributeDefinition).
*
*
*/
readonly attributes?: Attribute[]
/**
* Images for the Product Variant.
*
*
*/
readonly images?: Image[]
/**
* Media assets for the Product Variant.
*
*
*/
readonly assets?: AssetDraft[]
}
export interface RangeFacetResult {
readonly type: 'range'
/**
*
*/
readonly ranges: FacetRange[]
}
export interface SearchKeyword {
/**
* Text to return in the result of a [suggest query](ctp:api:type:ProductSuggestionsSuggestQuery).
*
*
*/
readonly text: string
/**
* If no tokenizer is defined, the `text` is used as a single token.