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

smartsheet / smartsheet-java-sdk / #55

02 Oct 2024 07:40PM UTC coverage: 60.548% (+0.7%) from 59.836%
#55

push

github

web-flow
Release prep for 3.2.1 (#103)

4156 of 6864 relevant lines covered (60.55%)

0.61 hits per line

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

62.07
/src/main/java/com/smartsheet/api/models/Attachment.java
1
/*
2
 * Copyright (C) 2024 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.models.enums.AttachmentParentType;
20
import com.smartsheet.api.models.enums.AttachmentSubType;
21
import com.smartsheet.api.models.enums.AttachmentType;
22

23
import java.util.Date;
24

25
/**
26
 * Represents the Attachment object.
27
 *
28
 * @see <a href="http://help.smartsheet.com/customer/portal/articles/518408-uploading-attachments">Help Uploading
29
 * Attachments</a>
30
 */
31
public class Attachment extends NamedModel<Long> {
1✔
32

33
    /**
34
     * Represents the URL.
35
     */
36
    private String url;
37

38
    /**
39
     * Represents the URL expiration time.
40
     */
41
    private Long urlExpiresInMillis;
42

43
    /**
44
     * Represents the attachment type.
45
     */
46
    private AttachmentType attachmentType;
47

48
    /**
49
     * Represents the attachment sub type.
50
     */
51
    private AttachmentSubType attachmentSubType;
52

53
    /**
54
     * Represents the creation timestamp.
55
     */
56
    private Date createdAt;
57

58
    /**
59
     * Represents the MIME type.
60
     */
61
    private String mimeType;
62

63
    /**
64
     * Represents the parent type.
65
     */
66
    private AttachmentParentType parentType;
67

68
    /**
69
     * Represents the parent ID.
70
     */
71
    private Long parentId;
72

73
    /**
74
     * Represents the attachment size.
75
     */
76
    private Long sizeInKb;
77

78
    /**
79
     * The user who created the attachment.
80
     */
81
    private User createdBy;
82

83
    /**
84
     * Represents the attachment description
85
     */
86
    private String description;
87

88
    /**
89
     * Provide an 'override' of setName (returns Attachment not NamedModel)
90
     *
91
     * @param name the new name
92
     */
93
    public Attachment setName(String name) {
94
        super.setName(name);
1✔
95
        return this;
1✔
96
    }
97

98
    /**
99
     * Gets the URL.
100
     *
101
     * @return The url.
102
     */
103
    public String getUrl() {
104
        return url;
1✔
105
    }
106

107
    /**
108
     * Sets the URL.
109
     *
110
     * @param url the new url
111
     */
112
    public Attachment setUrl(String url) {
113
        this.url = url;
1✔
114
        return this;
1✔
115
    }
116

117
    /**
118
     * Gets the url expires in millis.
119
     *
120
     * @return the url expires in millis
121
     */
122
    public Long getUrlExpiresInMillis() {
123
        return urlExpiresInMillis;
1✔
124
    }
125

126
    /**
127
     * Sets the url expires in millis.
128
     *
129
     * @param urlExpiresInMillis the new url expires in millis
130
     */
131
    public Attachment setUrlExpiresInMillis(Long urlExpiresInMillis) {
132
        this.urlExpiresInMillis = urlExpiresInMillis;
1✔
133
        return this;
1✔
134
    }
135

136
    /**
137
     * Gets the attachment type.
138
     *
139
     * @return the attachment type
140
     */
141
    public AttachmentType getAttachmentType() {
142
        return attachmentType;
1✔
143
    }
144

145
    /**
146
     * Sets the attachment type.
147
     *
148
     * @param attachmentType the new attachment type
149
     */
150
    public Attachment setAttachmentType(AttachmentType attachmentType) {
151
        this.attachmentType = attachmentType;
1✔
152
        return this;
1✔
153
    }
154

155
    /**
156
     * Gets the attachment sub type.
157
     *
158
     * @return the attachment sub type
159
     */
160
    public AttachmentSubType getAttachmentSubType() {
161
        return attachmentSubType;
1✔
162
    }
163

164
    /**
165
     * Sets the attachment sub type.
166
     *
167
     * @param attachmentSubType the new attachment sub type
168
     */
169
    public Attachment setAttachmentSubType(AttachmentSubType attachmentSubType) {
170
        this.attachmentSubType = attachmentSubType;
1✔
171
        return this;
1✔
172
    }
173

174
    /**
175
     * Gets the created at.
176
     *
177
     * @return the created at
178
     */
179
    public Date getCreatedAt() {
180
        return createdAt;
1✔
181
    }
182

183
    /**
184
     * Sets the created at.
185
     *
186
     * @param createdAt the new created at
187
     */
188
    public Attachment setCreatedAt(Date createdAt) {
189
        this.createdAt = createdAt;
1✔
190
        return this;
1✔
191
    }
192

193
    /**
194
     * Gets the mime type.
195
     *
196
     * @return the mime type
197
     */
198
    public String getMimeType() {
199
        return mimeType;
1✔
200
    }
201

202
    /**
203
     * Sets the mime type.
204
     *
205
     * @param mimeType the new mime type
206
     */
207
    public Attachment setMimeType(String mimeType) {
208
        this.mimeType = mimeType;
1✔
209
        return this;
1✔
210
    }
211

212
    /**
213
     * Gets the parent type.
214
     *
215
     * @return the parent type
216
     */
217
    public AttachmentParentType getParentType() {
218
        return parentType;
1✔
219
    }
220

221
    /**
222
     * Sets the parent type.
223
     *
224
     * @param parentType the new parent type
225
     */
226
    public Attachment setParentType(AttachmentParentType parentType) {
227
        this.parentType = parentType;
1✔
228
        return this;
1✔
229
    }
230

231
    /**
232
     * Gets the parent id.
233
     *
234
     * @return the parent id
235
     */
236
    public Long getParentId() {
237
        return parentId;
1✔
238
    }
239

240
    /**
241
     * Sets the parent id.
242
     *
243
     * @param parentId the new parent id
244
     */
245
    public Attachment setParentId(Long parentId) {
246
        this.parentId = parentId;
1✔
247
        return this;
1✔
248
    }
249

250
    /**
251
     * Gets the size in kb.
252
     *
253
     * @return the size in kb
254
     */
255
    public Long getSizeInKb() {
256
        return sizeInKb;
1✔
257
    }
258

259
    /**
260
     * Sets the size in kb.
261
     *
262
     * @param sizeInKb the new size in kb
263
     */
264
    public Attachment setSizeInKb(Long sizeInKb) {
265
        this.sizeInKb = sizeInKb;
1✔
266
        return this;
1✔
267
    }
268

269
    /**
270
     * @return the createdBy
271
     */
272
    public User getCreatedBy() {
273
        return createdBy;
1✔
274
    }
275

276
    /**
277
     * @param createdBy the createdBy to set
278
     */
279
    public Attachment setCreatedBy(User createdBy) {
280
        this.createdBy = createdBy;
1✔
281
        return this;
1✔
282
    }
283

284
    /**
285
     * Gets the attachment description.
286
     *
287
     * @return the attachment description.
288
     */
289
    public String getDescription() {
290
        return description;
1✔
291
    }
292

293
    /**
294
     * Sets the attachment description.
295
     *
296
     * @param description the description
297
     */
298
    public Attachment setDescription(String description) {
299
        this.description = description;
1✔
300
        return this;
1✔
301
    }
302

303
    /**
304
     * A convenience class for quickly creating a List of cells to update.
305
     */
306
    public static class CreateAttachmentBuilder {
×
307

308
        /**
309
         * Represents the URL.
310
         */
311
        private String url;
312

313
        /**
314
         * Represents the attachment type.
315
         */
316
        private AttachmentType attachmentType;
317

318
        /**
319
         * Represents the attachment sub type.
320
         */
321
        private AttachmentSubType attachmentSubType;
322

323
        /**
324
         * Represents the attachment description
325
         */
326
        private String description;
327

328
        /**
329
         * Represents the attachment name
330
         */
331
        private String name;
332

333
        /**
334
         * Gets the name.
335
         *
336
         * @return The name.
337
         */
338
        public String getName() {
339
            return name;
×
340
        }
341

342
        /**
343
         * Sets the name.
344
         *
345
         * @param name the new name
346
         * @return the builder object
347
         */
348
        public CreateAttachmentBuilder setName(String name) {
349
            this.name = name;
×
350
            return this;
×
351
        }
352

353
        /**
354
         * Gets the URL.
355
         *
356
         * @return The url.
357
         */
358
        public String getUrl() {
359
            return url;
×
360
        }
361

362
        /**
363
         * Sets the URL.
364
         *
365
         * @param url the new url
366
         * @return the builder object
367
         */
368
        public CreateAttachmentBuilder setUrl(String url) {
369
            this.url = url;
×
370
            return this;
×
371
        }
372

373
        /**
374
         * Gets the attachment type.
375
         *
376
         * @return the attachment type
377
         */
378
        public AttachmentType getAttachmentType() {
379
            return attachmentType;
×
380
        }
381

382
        /**
383
         * Sets the attachment type.
384
         *
385
         * @param attachmentType the new attachment type
386
         * @return the builder object
387
         */
388
        public CreateAttachmentBuilder setAttachmentType(AttachmentType attachmentType) {
389
            this.attachmentType = attachmentType;
×
390
            return this;
×
391
        }
392

393
        /**
394
         * Gets the attachment sub type.
395
         *
396
         * @return the attachment sub type
397
         */
398
        public AttachmentSubType getAttachmentSubType() {
399
            return attachmentSubType;
×
400
        }
401

402
        /**
403
         * Sets the attachment sub type.
404
         *
405
         * @param attachmentSubType the new attachment sub type
406
         * @return the builder object
407
         */
408
        public CreateAttachmentBuilder setAttachmentSubType(AttachmentSubType attachmentSubType) {
409
            this.attachmentSubType = attachmentSubType;
×
410
            return this;
×
411
        }
412

413
        /**
414
         * Gets the attachment description.
415
         *
416
         * @return the attachment description.
417
         */
418
        public String getDescription() {
419
            return description;
×
420
        }
421

422
        /**
423
         * Sets the attachment description.
424
         *
425
         * @param description the description
426
         * @return the builder object
427
         */
428
        public CreateAttachmentBuilder setDescription(String description) {
429
            this.description = description;
×
430
            return this;
×
431
        }
432

433
        /**
434
         * Returns the list of cells.
435
         *
436
         * @return the list
437
         */
438
        public Attachment build() {
439
            Attachment attachment = new Attachment();
×
440
            attachment.attachmentSubType = attachmentSubType;
×
441
            attachment.attachmentType = attachmentType;
×
442
            attachment.description = description;
×
443
            attachment.url = url;
×
444
            return attachment;
×
445
        }
446
    }
447
}
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