UNPKG

3.94 kBJavaScriptView Raw
1/*******************************************************************************
2 *
3 * Copyright 2018 Adobe. All rights reserved.
4 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. You may obtain a copy
6 * of the License at http://www.apache.org/licenses/LICENSE-2.0
7 *
8 * Unless required by applicable law or agreed to in writing, software distributed under
9 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
10 * OF ANY KIND, either express or implied. See the License for the specific language
11 * governing permissions and limitations under the License.
12 *
13 ******************************************************************************/
14
15/**
16 * Auto generated code based on Swagger definition.
17 * Dot not edit manually. Manual changes will be overridden.
18 *
19 * @version 1.1.2
20 */
21const MoneyValue = require('./MoneyValue.js').MoneyValue;
22const Category = require('./Category.js').Category;
23const Asset = require('./Asset.js').Asset;
24const Attribute = require('./Attribute.js').Attribute;
25
26class ProductVariant {
27
28 /**
29 * Constructs a ProductVariant based on its enclosed builder.
30 * @constructor
31 * @param {Builder} builder the ProductVariant builder
32 */
33 constructor(builder) {
34
35 /**
36 * The assets for this product.
37 * @type {Asset[]}
38 */
39 this.assets = undefined;
40
41 /**
42 * The attributes for this product.
43 * @type {Attribute[]}
44 */
45 this.attributes = undefined;
46
47 /**
48 * Indicates if the product is available or not in the inventory.
49 * @type {boolean}
50 */
51 this.available = builder.available;
52
53 /**
54 * The categories for this product.
55 * @type {Category[]}
56 */
57 this.categories = undefined;
58
59 /**
60 * The date-time when this object was created. The JSON representation must be in RFC339 / ISO8601 format
61 * @type {string}
62 */
63 this.createdAt = undefined;
64
65 /**
66 * The description of the product.
67 * @type {string}
68 */
69 this.description = undefined;
70
71 /**
72 * The internal unique ID of the product in the commerce backend system.
73 * @type {string}
74 */
75 this.id = builder.id;
76
77 /**
78 * The date-time when this object was last modified. The JSON representation must be in RFC339 / ISO8601 format
79 * @type {string}
80 */
81 this.lastModifiedAt = undefined;
82
83 /**
84 * The name of the product.
85 * @type {string}
86 */
87 this.name = builder.name;
88
89 /**
90 * The prices for this product.
91 * @type {MoneyValue[]}
92 */
93 this.prices = builder.prices;
94
95 /**
96 * The unique SKU of the product variant assigned by the vendor or manufacturer.
97 * @type {string}
98 */
99 this.sku = builder.sku;
100 }
101
102 /**
103 * Builds a ProductVariant based on API required properties.
104 */
105 static get Builder() {
106 class Builder {
107
108 withAvailable(available) {
109 this.available = available;
110 return this;
111 }
112
113 withId(id) {
114 this.id = id;
115 return this;
116 }
117
118 withName(name) {
119 this.name = name;
120 return this;
121 }
122
123 withPrices(prices) {
124 this.prices = prices;
125 return this;
126 }
127
128 withSku(sku) {
129 this.sku = sku;
130 return this;
131 }
132
133 build() {
134 return new ProductVariant(this);
135 }
136 }
137 return Builder;
138 }
139}
140module.exports.ProductVariant = ProductVariant;