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

smartsheet / smartsheet-java-sdk / #61

04 Dec 2025 01:00PM UTC coverage: 60.098% (-0.06%) from 60.156%
#61

push

github

web-flow
Merge pull request #155 from smartsheet/add-user-reactivate-deactivate-endpoints-support

Add user reactivate deactivate endpoints support

0 of 4 new or added lines in 1 file covered. (0.0%)

93 existing lines in 4 files now uncovered.

4395 of 7313 relevant lines covered (60.1%)

0.6 hits per line

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

17.78
/src/main/java/com/smartsheet/api/models/User.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 java.time.ZonedDateTime;
20
import com.smartsheet.api.models.enums.SeatType;
21

22
/**
23
 * Represents the User object.
24
 *
25
 * @see <a href="http://help.smartsheet.com/customer/portal/articles/795920-managing-users-team-enterprise-only-">Help
26
 * Managing Users</a>
27
 * @see <a href="http://help.smartsheet.com/customer/portal/articles/520100-user-types">User Types Help</a>
28
 */
29
public class User extends UserModelWithName {
1✔
30

31
    /**
32
     * Seat type support fields
33
     */
34
    private Long planId;
35
    private SeatType seatType;
36
    private ZonedDateTime seatTypeLastChangedAt;
37
    private Boolean isInternal;
38
    private ZonedDateTime provisionalExpirationDate;
39

40
    public Long getPlanId() {
41
        return planId;
1✔
42
    }
43

44
    public void setPlanId(Long planId) {
45
        this.planId = planId;
1✔
46
    }
1✔
47

48
    public SeatType getSeatType() {
49
        return seatType;
1✔
50
    }
51

52
    public void setSeatType(SeatType seatType) {
53
        this.seatType = seatType;
1✔
54
    }
1✔
55

56
    public ZonedDateTime getSeatTypeLastChangedAt() {
57
        return seatTypeLastChangedAt;
1✔
58
    }
59

60
    public void setSeatTypeLastChangedAt(ZonedDateTime seatTypeLastChangedAt) {
61
        this.seatTypeLastChangedAt = seatTypeLastChangedAt;
1✔
62
    }
1✔
63

64
    public ZonedDateTime getProvisionalExpirationDate() {
65
        return provisionalExpirationDate;
1✔
66
    }
67

68
    public void setProvisionalExpirationDate(ZonedDateTime provisionalExpirationDate) {
69
        this.provisionalExpirationDate = provisionalExpirationDate;
1✔
70
    }
1✔
71

72
    public Boolean getIsInternal() {
73
        return isInternal;
1✔
74
    }
75

76
    public void setIsInternal(Boolean isInternal) {
77
        this.isInternal = isInternal;
1✔
78
    }
1✔
79

80
    /**
81
     * A convenience class for making a {@link User} object with the appropriate fields for adding the user.
82
     */
83

UNCOV
84
    public static class AddUserBuilder {
×
85
        private Boolean admin;
86
        private String emailAddress;
87
        private Boolean licensedSheetCreator;
88
        private Boolean groupAdmin;
89
        private Boolean resourceViewer;
90
        private String firstName;
91
        private String lastName;
92

93
        /**
94
         * Sets the admin flag which allows managing users and accounts.
95
         *
96
         * @param admin the admin
97
         * @return the adds the user builder
98
         */
99
        public AddUserBuilder setAdmin(Boolean admin) {
UNCOV
100
            this.admin = admin;
×
UNCOV
101
            return this;
×
102
        }
103

104
        /**
105
         * Sets the licensed sheet creator flag that allows creating and owning sheets.
106
         *
107
         * @param licensedSheetCreator the licensed sheet creator
108
         * @return the adds the user builder
109
         */
110
        public AddUserBuilder setLicensedSheetCreator(Boolean licensedSheetCreator) {
UNCOV
111
            this.licensedSheetCreator = licensedSheetCreator;
×
UNCOV
112
            return this;
×
113
        }
114

115
        /**
116
         * Sets the email for the user.
117
         *
118
         * @param email the email
119
         * @return the adds the user builder
120
         */
121
        public AddUserBuilder setEmail(String email) {
UNCOV
122
            this.emailAddress = email;
×
UNCOV
123
            return this;
×
124
        }
125

126
        /**
127
         * Gets the admin.
128
         *
129
         * @return the admin
130
         */
131
        public Boolean getAdmin() {
UNCOV
132
            return admin;
×
133
        }
134

135
        /**
136
         * Gets the licensed sheet creator.
137
         *
138
         * @return the licensed sheet creator
139
         */
140
        public Boolean getLicensedSheetCreator() {
UNCOV
141
            return licensedSheetCreator;
×
142
        }
143

144
        /**
145
         * @return the firstName
146
         */
147
        public String getFirstName() {
UNCOV
148
            return firstName;
×
149
        }
150

151
        /**
152
         * @param firstName the firstName to set
153
         * @return the builder
154
         */
155
        public AddUserBuilder setFirstName(String firstName) {
UNCOV
156
            this.firstName = firstName;
×
UNCOV
157
            return this;
×
158
        }
159

160
        /**
161
         * @return the lastName
162
         */
163
        public String getLastName() {
UNCOV
164
            return lastName;
×
165
        }
166

167
        /**
168
         * @param lastName the lastName to set
169
         * @return the builder
170
         */
171
        public AddUserBuilder setLastName(String lastName) {
UNCOV
172
            this.lastName = lastName;
×
UNCOV
173
            return this;
×
174
        }
175

176
        /**
177
         * @return the groupAdmin
178
         */
179
        public Boolean getGroupAdmin() {
UNCOV
180
            return groupAdmin;
×
181
        }
182

183
        /**
184
         * @param groupAdmin the groupAdmin to set
185
         * @return the builder
186
         */
187
        public AddUserBuilder setGroupAdmin(Boolean groupAdmin) {
UNCOV
188
            this.groupAdmin = groupAdmin;
×
UNCOV
189
            return this;
×
190
        }
191

192
        /**
193
         * @return the resourceViewer
194
         */
195
        public Boolean getResourceViewer() {
UNCOV
196
            return resourceViewer;
×
197
        }
198

199
        /**
200
         * @param resourceViewer the resourceViewer to set
201
         * @return the builder
202
         */
203
        public AddUserBuilder setResourceViewer(Boolean resourceViewer) {
UNCOV
204
            this.resourceViewer = resourceViewer;
×
UNCOV
205
            return this;
×
206
        }
207

208
        /**
209
         * Builds the {@link User} object using the required fields.
210
         *
211
         * @return the user
212
         */
213
        public User build() {
UNCOV
214
            if (admin == null || emailAddress == null || licensedSheetCreator == null) {
×
UNCOV
215
                throw new InstantiationError();
×
216
            }
217

218
            User user = new User();
×
219
            user.setAdmin(admin);
×
220
            user.setLicensedSheetCreator(licensedSheetCreator);
×
221
            user.setGroupAdmin(groupAdmin);
×
222
            user.setResourceViewer(resourceViewer);
×
223
            user.setFirstName(firstName);
×
UNCOV
224
            user.setLastName(lastName);
×
225
            user.setEmail(emailAddress);
×
226

UNCOV
227
            return user;
×
228
        }
229

230
    }
231

232
    /**
233
     * A convenience class for making a {@link User} object with the appropriate fields for updating a user.
234
     */
UNCOV
235
    public static class UpdateUserBuilder {
×
236
        private Boolean admin;
237
        private Boolean licensedSheetCreator;
238
        private Boolean groupAdmin;
239
        private Boolean resourceViewer;
240
        private String firstName;
241
        private String lastName;
242
        private Long id;
243

244
        /**
245
         * Get the id of the user
246
         *
247
         * @return the id
248
         */
249
        public Long getUserId() {
UNCOV
250
            return id;
×
251
        }
252

253
        /**
254
         * Set the user id
255
         *
256
         * @param userId the user id
257
         * @return the updateSheetBuilder object
258
         */
259
        public UpdateUserBuilder setUserId(Long userId) {
UNCOV
260
            this.id = userId;
×
UNCOV
261
            return this;
×
262
        }
263

264
        /**
265
         * Sets the admin flag which allows managing users and accounts.
266
         *
267
         * @param admin the admin
268
         * @return the update user builder
269
         */
270
        public UpdateUserBuilder setAdmin(Boolean admin) {
UNCOV
271
            this.admin = admin;
×
UNCOV
272
            return this;
×
273
        }
274

275
        /**
276
         * Licensed sheet creator.
277
         *
278
         * @param licensedSheetCreator the licensed sheet creator
279
         * @return the update user builder
280
         */
281
        public UpdateUserBuilder setLicensedSheetCreator(Boolean licensedSheetCreator) {
UNCOV
282
            this.licensedSheetCreator = licensedSheetCreator;
×
UNCOV
283
            return this;
×
284
        }
285

286
        /**
287
         * Gets the admin.
288
         *
289
         * @return the admin
290
         */
291
        public Boolean getAdmin() {
UNCOV
292
            return admin;
×
293
        }
294

295
        /**
296
         * Gets the licensed sheet creator.
297
         *
298
         * @return the licensed sheet creator
299
         */
300
        public Boolean getLicensedSheetCreator() {
UNCOV
301
            return licensedSheetCreator;
×
302
        }
303

304
        /**
305
         * @return the firstName
306
         */
307
        public String getFirstName() {
UNCOV
308
            return firstName;
×
309
        }
310

311
        /**
312
         * @param firstName the firstName to set
313
         * @return the builder
314
         */
315
        public UpdateUserBuilder setFirstName(String firstName) {
UNCOV
316
            this.firstName = firstName;
×
UNCOV
317
            return this;
×
318
        }
319

320
        /**
321
         * @return the lastName
322
         */
323
        public String getLastName() {
UNCOV
324
            return lastName;
×
325
        }
326

327
        /**
328
         * @param lastName the lastName to set
329
         * @return the builder
330
         */
331
        public UpdateUserBuilder setLastName(String lastName) {
UNCOV
332
            this.lastName = lastName;
×
UNCOV
333
            return this;
×
334
        }
335

336
        /**
337
         * @return the groupAdmin
338
         */
339
        public Boolean getGroupAdmin() {
UNCOV
340
            return groupAdmin;
×
341
        }
342

343
        /**
344
         * @param groupAdmin the groupAdmin to set
345
         * @return the builder
346
         */
347
        public UpdateUserBuilder setGroupAdmin(Boolean groupAdmin) {
UNCOV
348
            this.groupAdmin = groupAdmin;
×
UNCOV
349
            return this;
×
350
        }
351

352
        /**
353
         * @return the resourceViewer
354
         */
355
        public Boolean getResourceViewer() {
UNCOV
356
            return resourceViewer;
×
357
        }
358

359
        /**
360
         * @param resourceViewer the resourceViewer to set
361
         * @return the builder
362
         */
363
        public UpdateUserBuilder setResourceViewer(Boolean resourceViewer) {
UNCOV
364
            this.resourceViewer = resourceViewer;
×
UNCOV
365
            return this;
×
366
        }
367

368
        /**
369
         * Builds the {@link User}.
370
         *
371
         * @return the user
372
         */
373
        public User build() {
UNCOV
374
            if (admin == null || licensedSheetCreator == null || id == null) {
×
UNCOV
375
                throw new InstantiationError("An admin, licensed sheet creator and user Id must be set");
×
376
            }
377

378
            User user = new User();
×
379
            user.setFirstName(firstName);
×
380
            user.setLastName(lastName);
×
381
            user.setAdmin(admin);
×
382
            user.setLicensedSheetCreator(licensedSheetCreator);
×
383
            user.setGroupAdmin(groupAdmin);
×
384
            user.setResourceViewer(resourceViewer);
×
UNCOV
385
            user.setId(id);
×
UNCOV
386
            return user;
×
387
        }
388
    }
389

390
    /**
391
     * A convenience class for making a GroupMember object with the appropriate fields for adding to a {@link Group}.
392
     */
UNCOV
393
    public static class NewGroupMemberBuilder {
×
394
        private String email;
395

396
        /**
397
         * Get the email of the user
398
         *
399
         * @return email the email
400
         */
401
        public String getEmail() {
UNCOV
402
            return email;
×
403
        }
404

405
        /**
406
         * Set the email id of the user
407
         *
408
         * @param email the email
409
         * @return the builder
410
         */
411
        public NewGroupMemberBuilder setEmail(String email) {
UNCOV
412
            this.email = email;
×
UNCOV
413
            return this;
×
414
        }
415

416
        /**
417
         * Build a User
418
         */
419
        public User build() {
UNCOV
420
            if (email == null) {
×
UNCOV
421
                throw new InstantiationError("An email address must be set.");
×
422
            }
423

424
            User user = new User();
×
UNCOV
425
            user.setEmail(email);
×
UNCOV
426
            return user;
×
427
        }
428
    }
429
}
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