• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

smartsheet / smartsheet-java-sdk / #58

23 Sep 2025 06:13PM UTC coverage: 59.737% (-1.1%) from 60.803%
#58

push

github

web-flow
Add user downgrade seat type endpoint (#131)

* Add support for upgrade user seat type route

* Change return type

* Add support for the user downgrade seat type endpoint

* Remove * imports, replace switch with if statement, remove overload

* Update changelog and build.gradle

* Add user downgrade and upgrade API calls

* Add user downgrade and upgrade API calls

* Add user downgrade and upgrade API calls

* Add user downgrade and upgrade API calls

---------

Co-authored-by: Velihan Zelev <velihan.zelev@smartsheet.com>

12 of 13 new or added lines in 2 files covered. (92.31%)

192 existing lines in 7 files now uncovered.

4310 of 7215 relevant lines covered (59.74%)

0.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.45
/src/main/java/com/smartsheet/api/models/PaginationParameters.java
1
/*
2
 * Copyright (C) 2025 Smartsheet
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.smartsheet.api.models;
18

19
import com.smartsheet.api.internal.util.QueryUtil;
20

21
import java.util.HashMap;
22
import java.util.Map;
23

24
public class PaginationParameters {
25
    /**
26
     * Represents the includeAll option
27
     */
28
    private boolean includeAll;
29

30
    /**
31
     * Represents the page size
32
     */
33
    private Integer pageSize;
34

35
    /**
36
     * Represents the page
37
     */
38
    private Integer page;
39

40
    /**
41
     * Represents the lastKey for token-based pagination
42
     */
43
    private String lastKey;
44

45
    /**
46
     * Represents the maxItems for token-based pagination
47
     */
48
    private Integer maxItems;
49

50
    /**
51
     * Represents the pagination type (e.g. "token")
52
     */
53
    private String paginationType;
54

55
    public PaginationParameters() {
1✔
56
    }
1✔
57

58
    /**
59
     * Constructor
60
     */
61
    public PaginationParameters(boolean includeAll, Integer pageSize, Integer page) {
1✔
62
        this.includeAll = includeAll;
1✔
63
        this.pageSize = pageSize;
1✔
64
        this.page = page;
1✔
65
    }
1✔
66

67
    /**
68
     * Constructor with token-based pagination parameters
69
     */
70
    public PaginationParameters(String paginationType, String lastKey, Integer maxItems) {
1✔
71
        this.paginationType = paginationType;
1✔
72
        this.lastKey = lastKey;
1✔
73
        this.maxItems = maxItems;
1✔
74
    }
1✔
75

76
    /**
77
     * Gets includeAll
78
     *
79
     * @return includeAll
80
     */
81
    public boolean isIncludeAll() {
82
        return includeAll;
1✔
83
    }
84

85
    /**
86
     * Sets includeAll
87
     *
88
     * @param includeAll include all parameter
89
     */
90
    public PaginationParameters setIncludeAll(boolean includeAll) {
91
        this.includeAll = includeAll;
1✔
92
        return this;
1✔
93
    }
94

95
    /**
96
     * Gets the page size
97
     *
98
     * @return page size
99
     */
100
    public Integer getPageSize() {
101
        return pageSize;
1✔
102
    }
103

104
    /**
105
     * Sets the page size
106
     *
107
     * @param pageSize the page size
108
     */
109
    public PaginationParameters setPageSize(Integer pageSize) {
110
        this.pageSize = pageSize;
1✔
111
        return this;
1✔
112
    }
113

114
    /**
115
     * Gets the page
116
     *
117
     * @return page the page number
118
     */
119
    public Integer getPage() {
120
        return page;
1✔
121
    }
122

123
    /**
124
     * Sets the page
125
     *
126
     * @param page the page number
127
     */
128
    public PaginationParameters setPage(Integer page) {
129
        this.page = page;
1✔
130
        return this;
1✔
131
    }
132

133
    /**
134
     * Gets the pagination type
135
     *
136
     * @return pagination type
137
     */
138
    public String getPaginationType() {
UNCOV
139
        return paginationType;
×
140
    }
141

142
    /**
143
     * Sets the pagination type
144
     *
145
     * @param paginationType the pagination type (e.g. "token")
146
     */
147
    public PaginationParameters setPaginationType(String paginationType) {
148
        this.paginationType = paginationType;
1✔
149
        return this;
1✔
150
    }
151

152
    /**
153
     * Gets the lastKey
154
     *
155
     * @return lastKey for token-based pagination
156
     */
157
    public String getLastKey() {
UNCOV
158
        return lastKey;
×
159
    }
160

161
    /**
162
     * Sets the lastKey
163
     *
164
     * @param lastKey the lastKey for token-based pagination
165
     */
166
    public PaginationParameters setLastKey(String lastKey) {
167
        this.lastKey = lastKey;
1✔
168
        return this;
1✔
169
    }
170

171
    /**
172
     * Gets the maxItems
173
     *
174
     * @return maxItems for token-based pagination
175
     */
176
    public Integer getMaxItems() {
UNCOV
177
        return maxItems;
×
178
    }
179

180
    /**
181
     * Sets the maxItems
182
     *
183
     * @param maxItems the maxItems for token-based pagination
184
     */
185
    public PaginationParameters setMaxItems(Integer maxItems) {
186
        this.maxItems = maxItems;
1✔
187
        return this;
1✔
188
    }
189

190
    /**
191
     * Convert to a query string
192
     */
193
    public String toQueryString() {
194
        Map<String, Object> parameters = toHashMap();
1✔
195
        return QueryUtil.generateUrl(null, parameters);
1✔
196
    }
197

198
    /**
199
     * Convert to a hash map
200
     */
201
    public Map<String, Object> toHashMap() {
202
        Map<String, Object> parameters = new HashMap<>();
1✔
203

204
        if (paginationType != null && "token".equals(paginationType)) {
1✔
205
            parameters.put("paginationType", paginationType);
1✔
206
            if (lastKey != null) {
1✔
207
                parameters.put("lastKey", lastKey);
1✔
208
            }
209
            if (maxItems != null) {
1✔
210
                parameters.put("maxItems", maxItems);
1✔
211
            }
212
            return parameters;
1✔
213
        }
214

215
        if (includeAll) {
1✔
216
            parameters.put("includeAll", Boolean.toString(includeAll));
1✔
217
            return parameters;
1✔
218
        }
219

220
        parameters.put("pageSize", pageSize);
1✔
221
        parameters.put("page", page);
1✔
222
        return parameters;
1✔
223

224
    }
225

226
    /**
227
     * A convenience class for creating a PaginationParameters object
228
     */
229
    public static class PaginationParametersBuilder {
1✔
230
        private boolean includeAll;
231
        private Integer pageSize;
232
        private Integer page;
233
        private String lastKey;
234
        private Integer maxItems;
235
        private String paginationType;
236

237
        /**
238
         * Gets the include all flag
239
         *
240
         * @return the include all flag
241
         */
242
        public boolean isIncludeAll() {
UNCOV
243
            return includeAll;
×
244
        }
245

246
        /**
247
         * Sets the include All Flag
248
         *
249
         * @param includeAll the include all flag
250
         * @return the builder
251
         */
252
        public PaginationParametersBuilder setIncludeAll(boolean includeAll) {
253
            this.includeAll = includeAll;
1✔
254
            return this;
1✔
255
        }
256

257
        /**
258
         * Gets the page
259
         *
260
         * @return the page
261
         */
262
        public Integer getPage() {
UNCOV
263
            return page;
×
264
        }
265

266
        /**
267
         * Sets the page
268
         *
269
         * @param page the page
270
         * @return the builder
271
         */
272
        public PaginationParametersBuilder setPage(Integer page) {
273
            this.page = page;
1✔
274
            return this;
1✔
275
        }
276

277
        /**
278
         * Gets the page size
279
         *
280
         * @return the page size
281
         */
282
        public Integer getPageSize() {
UNCOV
283
            return pageSize;
×
284
        }
285

286
        /**
287
         * Sets the page size
288
         *
289
         * @param pageSize the page size
290
         * @return the builder
291
         */
292
        public PaginationParametersBuilder setPageSize(Integer pageSize) {
293
            this.pageSize = pageSize;
1✔
294
            return this;
1✔
295
        }
296

297
        /**
298
         * Gets the pagination type
299
         *
300
         * @return the pagination type
301
         */
302
        public String getPaginationType() {
UNCOV
303
            return paginationType;
×
304
        }
305

306
        /**
307
         * Sets the pagination type
308
         *
309
         * @param paginationType the pagination type (e.g. "token")
310
         * @return the builder
311
         */
312
        public PaginationParametersBuilder setPaginationType(String paginationType) {
UNCOV
313
            this.paginationType = paginationType;
×
UNCOV
314
            return this;
×
315
        }
316

317
        /**
318
         * Gets the lastKey
319
         *
320
         * @return the lastKey
321
         */
322
        public String getLastKey() {
UNCOV
323
            return lastKey;
×
324
        }
325

326
        /**
327
         * Sets the lastKey
328
         *
329
         * @param lastKey the lastKey for token-based pagination
330
         * @return the builder
331
         */
332
        public PaginationParametersBuilder setLastKey(String lastKey) {
UNCOV
333
            this.lastKey = lastKey;
×
UNCOV
334
            return this;
×
335
        }
336

337
        /**
338
         * Gets the maxItems
339
         *
340
         * @return the maxItems
341
         */
342
        public Integer getMaxItems() {
UNCOV
343
            return maxItems;
×
344
        }
345

346
        /**
347
         * Sets the maxItems
348
         *
349
         * @param maxItems the maxItems for token-based pagination
350
         * @return the builder
351
         */
352
        public PaginationParametersBuilder setMaxItems(Integer maxItems) {
UNCOV
353
            this.maxItems = maxItems;
×
UNCOV
354
            return this;
×
355
        }
356

357
        /**
358
         * Builds the PaginationParameters object
359
         *
360
         * @return pagination parameter object
361
         */
362
        public PaginationParameters build() {
363
            PaginationParameters pagination = new PaginationParameters();
1✔
364
            pagination.setIncludeAll(includeAll);
1✔
365
            pagination.setPageSize(pageSize);
1✔
366
            pagination.setPage(page);
1✔
367
            pagination.setLastKey(lastKey);
1✔
368
            pagination.setMaxItems(maxItems);
1✔
369
            pagination.setPaginationType(paginationType);
1✔
370

371
            return pagination;
1✔
372
        }
373
    }
374
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc