UNPKG

2.72 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 Facet = require('./Facet.js').Facet;
22
23class PagedResponse {
24
25 /**
26 * Constructs a PagedResponse based on its enclosed builder.
27 * @constructor
28 * @param {Builder} builder the PagedResponse builder
29 */
30 constructor(builder) {
31
32 /**
33 * The actual number of results returned in results.
34 * @type {integer}
35 */
36 this.count = builder.count;
37
38 /**
39 * The list of facets for this response.
40 * @type {Facet[]}
41 */
42 this.facets = undefined;
43
44 /**
45 * The offset for this response, this is the number of elements skipped, not a page number.
46 * @type {integer}
47 */
48 this.offset = builder.offset;
49
50 /**
51 * The results for this response.
52 * @type {object[]}
53 */
54 this.results = builder.results;
55
56 /**
57 * The total number of results matching the query.
58 * @type {integer}
59 */
60 this.total = builder.total;
61 }
62
63 /**
64 * Builds a PagedResponse based on API required properties.
65 */
66 static get Builder() {
67 class Builder {
68
69 withCount(count) {
70 this.count = count;
71 return this;
72 }
73
74 withOffset(offset) {
75 this.offset = offset;
76 return this;
77 }
78
79 withResults(results) {
80 this.results = results;
81 return this;
82 }
83
84 withTotal(total) {
85 this.total = total;
86 return this;
87 }
88
89 build() {
90 return new PagedResponse(this);
91 }
92 }
93 return Builder;
94 }
95}
96module.exports.PagedResponse = PagedResponse;