UNPKG

2.67 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 FacetValue = require('./FacetValue.js').FacetValue;
23
24class Facet {
25
26 /**
27 * Constructs a Facet based on its enclosed builder.
28 * @constructor
29 * @param {Builder} builder the Facet builder
30 */
31 constructor(builder) {
32 /**
33 * The id of the facet.
34 * @type {string}
35 */
36 this.id = builder.id;
37
38 /**
39 * The name of the facet.
40 * @type {string}
41 */
42 this.name = builder.name;
43
44 /**
45 * The number of missed items.
46 * @type {integer}
47 */
48 this.missed = undefined;
49
50 /**
51 * Indicates if the facet is multi selectable.
52 * @type {boolean}
53 */
54 this.multiSelect = undefined;
55
56 /**
57 * The type of the facet.
58 * @type {string}
59 */
60 this.type = builder.type;
61
62 /**
63 * List of facetValues calculated for this facet.
64 * @type {FacetValue[]}
65 */
66 this.values = builder.values;
67
68 }
69
70 /**
71 * Builds a Facet based on API required properties.
72 */
73 static get Builder() {
74 class Builder {
75 withId(id) {
76 this.id = id;
77 return this;
78 }
79
80 withName(name) {
81 this.name = name;
82 return this;
83 }
84
85 withType(type) {
86 this.type = type;
87 return this;
88 }
89
90 withValues(values) {
91 this.values = values;
92 return this;
93 }
94
95 build() {
96 return new Facet(this);
97 }
98 }
99 return Builder;
100 }
101}
102module.exports.Facet = Facet;