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.0.0
20 */
21
22const MoneyValue = require('./MoneyValue.js').MoneyValue;
23const Category = require('./Category.js').Category;
24const Asset = require('./Asset.js').Asset;
25const Attribute = require('./Attribute.js').Attribute;
26
27class ProductVariant {
28
29 /**
30 * Constructs a ProductVariant based on its enclosed builder.
31 * @constructor
32 * @param {Builder} builder the ProductVariant builder
33 */
34 constructor(builder) {
35 /**
36 * The date-time when this object was created. The JSON representation must be in RFC339 / ISO8601 format
37 * @type {string}
38 */
39 this.createdAt = undefined;
40
41 /**
42 * The date-time when this object was last modified. The JSON representation must be in RFC339 / ISO8601 format
43 * @type {string}
44 */
45 this.lastModifiedAt = undefined;
46
47 /**
48 * The internal unique ID of the product in the commerce backend system.
49 * @type {string}
50 */
51 this.id = builder.id;
52
53 /**
54 * The name of the product.
55 * @type {string}
56 */
57 this.name = builder.name;
58
59 /**
60 * The description of the product.
61 * @type {string}
62 */
63 this.description = undefined;
64
65 /**
66 * The prices for this product.
67 * @type {MoneyValue[]}
68 */
69 this.prices = builder.prices;
70
71 /**
72 * The categories for this product.
73 * @type {Category[]}
74 */
75 this.categories = undefined;
76
77 /**
78 * The assets for this product.
79 * @type {Asset[]}
80 */
81 this.assets = undefined;
82
83 /**
84 * The attributes for this product.
85 * @type {Attribute[]}
86 */
87 this.attributes = undefined;
88
89 /**
90 * The unique SKU of the product variant assigned by the vendor or manufacturer.
91 * @type {string}
92 */
93 this.sku = builder.sku;
94
95 /**
96 * Indicates if the product is available or not in the inventory.
97 * @type {boolean}
98 */
99 this.available = builder.available;
100
101 }
102
103 /**
104 * Builds a ProductVariant based on API required properties.
105 */
106 static get Builder() {
107 class Builder {
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;