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

smartsheet / smartsheet-java-sdk / #41

24 Aug 2023 04:59PM UTC coverage: 50.458% (+0.01%) from 50.444%
#41

push

github-actions

web-flow
Fix Checkstyle Violations in "Impl" Classes (#53)

241 of 241 new or added lines in 32 files covered. (100.0%)

3417 of 6772 relevant lines covered (50.46%)

0.5 hits per line

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

7.14
/src/main/java/com/smartsheet/api/internal/SheetUpdateRequestResourcesImpl.java
1
package com.smartsheet.api.internal;
2

3
/*
4
 * #[license]
5
 * Smartsheet SDK for Java
6
 * %%
7
 * Copyright (C) 2023 Smartsheet
8
 * %%
9
 * Licensed under the Apache License, Version 2.0 (the "License");
10
 * you may not use this file except in compliance with the License.
11
 * You may obtain a copy of the License at
12
 *
13
 *      http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * Unless required by applicable law or agreed to in writing, software
16
 * distributed under the License is distributed on an "AS IS" BASIS,
17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
 * See the License for the specific language governing permissions and
19
 * limitations under the License.
20
 * %[license]
21
 */
22

23
import com.smartsheet.api.AuthorizationException;
24
import com.smartsheet.api.InvalidRequestException;
25
import com.smartsheet.api.ResourceNotFoundException;
26
import com.smartsheet.api.ServiceUnavailableException;
27
import com.smartsheet.api.SheetUpdateRequestResources;
28
import com.smartsheet.api.SmartsheetException;
29
import com.smartsheet.api.internal.util.QueryUtil;
30
import com.smartsheet.api.models.PagedResult;
31
import com.smartsheet.api.models.PaginationParameters;
32
import com.smartsheet.api.models.SentUpdateRequest;
33
import com.smartsheet.api.models.UpdateRequest;
34

35
import java.util.HashMap;
36
import java.util.Map;
37

38
public class SheetUpdateRequestResourcesImpl extends AbstractResources implements SheetUpdateRequestResources {
39
    private static final String SHEETS_PATH = "sheets/";
40
    private static final String UPDATE_REQUESTS = "updaterequests";
41

42
    /**
43
     * Constructor.
44
     * <p>
45
     * Exceptions: - IllegalArgumentException : if any argument is null
46
     *
47
     * @param smartsheet the smartsheet
48
     */
49
    public SheetUpdateRequestResourcesImpl(SmartsheetImpl smartsheet) {
50
        super(smartsheet);
1✔
51
    }
1✔
52

53
    /**
54
     * Gets a list of all Update Requests that have future schedules associated with the specified Sheet.
55
     * <p>
56
     * It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/updaterequests
57
     *
58
     * @param paging the object containing the pagination parameters
59
     * @return A list of all UpdateRequests (note that an empty list will be returned if there are none).
60
     * @throws IllegalArgumentException if any argument is null or empty string
61
     * @throws InvalidRequestException if there is any problem with the REST API request
62
     * @throws AuthorizationException if there is any problem with  the REST API authorization (access token)
63
     * @throws ResourceNotFoundException if the resource cannot be found
64
     * @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
65
     * @throws SmartsheetException if there is any other error during the operation
66
     */
67
    public PagedResult<UpdateRequest> listUpdateRequests(long sheetId, PaginationParameters paging) throws SmartsheetException {
68
        String path = SHEETS_PATH + sheetId + "/" + UPDATE_REQUESTS;
×
69

70
        Map<String, Object> parameters = new HashMap<>();
×
71
        if (paging != null) {
×
72
            parameters = paging.toHashMap();
×
73
        }
74
        path += QueryUtil.generateUrl(null, parameters);
×
75

76
        return this.listResourcesWithWrapper(path, UpdateRequest.class);
×
77
    }
78

79
    /**
80
     * Gets the specified Update Request for the Sheet that has a future schedule.
81
     * <p>
82
     * It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/updaterequests/{updateRequestId}
83
     *
84
     * @param sheetId the Id of the sheet
85
     * @param updateRequestId the update request Id
86
     * @return the update request resource (note that if there is no such resource, this method will throw
87
     *     ResourceNotFoundException rather than returning null).
88
     * @throws IllegalArgumentException if any argument is null or empty string
89
     * @throws InvalidRequestException if there is any problem with the REST API request
90
     * @throws AuthorizationException if there is any problem with  the REST API authorization (access token)
91
     * @throws ResourceNotFoundException if the resource cannot be found
92
     * @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
93
     * @throws SmartsheetException if there is any other error during the operation
94
     */
95
    public UpdateRequest getUpdateRequest(long sheetId, long updateRequestId) throws SmartsheetException {
96
        String path = SHEETS_PATH + sheetId + "/" + UPDATE_REQUESTS + "/" + updateRequestId;
×
97
        return this.getResource(path, UpdateRequest.class);
×
98
    }
99

100
    /**
101
     * Creates an Update Request for the specified Row(s) within the Sheet. An email notification
102
     * (containing a link to the update request) will be asynchronously sent to the specified recipient(s).
103
     * <p>
104
     * It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/updaterequests
105
     *
106
     * @param sheetId the Id of the sheet
107
     * @param updateRequest the update request object
108
     * @return the update request resource.
109
     * @throws IllegalArgumentException if any argument is null or empty string
110
     * @throws InvalidRequestException if there is any problem with the REST API request
111
     * @throws AuthorizationException if there is any problem with  the REST API authorization (access token)
112
     * @throws ResourceNotFoundException if the resource cannot be found
113
     * @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
114
     * @throws SmartsheetException if there is any other error during the operation
115
     */
116
    public UpdateRequest createUpdateRequest(long sheetId, UpdateRequest updateRequest) throws SmartsheetException {
117
        String path = SHEETS_PATH + sheetId + "/" + UPDATE_REQUESTS;
×
118
        return this.createResource(path, UpdateRequest.class, updateRequest);
×
119
    }
120

121
    /**
122
     * Terminates the future scheduled delivery of the Update Request specified in the URL.
123
     * <p>
124
     * It mirrors to the following Smartsheet REST API method: DELETE /sheets/{sheetId}/updaterequests/{updateRequestId}
125
     *
126
     * @param sheetId the Id of the sheet
127
     * @param updateRequestId the update request Id
128
     * @throws IllegalArgumentException if any argument is null or empty string
129
     * @throws InvalidRequestException if there is any problem with the REST API request
130
     * @throws AuthorizationException if there is any problem with  the REST API authorization (access token)
131
     * @throws ResourceNotFoundException if the resource cannot be found
132
     * @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
133
     * @throws SmartsheetException if there is any other error during the operation
134
     */
135
    public void deleteUpdateRequest(long sheetId, long updateRequestId) throws SmartsheetException {
136
        String path = SHEETS_PATH + sheetId + "/" + UPDATE_REQUESTS + "/" + updateRequestId;
×
137
        this.deleteResource(path, UpdateRequest.class);
×
138
    }
×
139

140
    /**
141
     * Changes the specified Update Request for the Sheet.
142
     * <p>
143
     * It mirrors to the following Smartsheet REST API method: PUT /sheets/{sheetId}/updaterequests/{updateRequestId}
144
     *
145
     * @param sheetId the Id of the sheet
146
     * @param updateRequest the update request object
147
     * @return the update request resource.
148
     * @throws IllegalArgumentException if any argument is null or empty string
149
     * @throws InvalidRequestException if there is any problem with the REST API request
150
     * @throws AuthorizationException if there is any problem with  the REST API authorization (access token)
151
     * @throws ResourceNotFoundException if the resource cannot be found
152
     * @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
153
     * @throws SmartsheetException if there is any other error during the operation
154
     */
155
    public UpdateRequest updateUpdateRequest(long sheetId, UpdateRequest updateRequest) throws SmartsheetException {
156
        String path = SHEETS_PATH + sheetId + "/" + UPDATE_REQUESTS + "/" + updateRequest.getId();
×
157
        return this.updateResource(path, UpdateRequest.class, updateRequest);
×
158
    }
159

160
    /**
161
     * Gets a list of all Sent Update Requests that have future schedules associated with the specified Sheet.
162
     * <p>
163
     * It mirrors To the following Smartsheet REST API method: GET /sheets/{sheetId}/sentupdaterequests
164
     *
165
     * @param sheetId the Id of the sheet
166
     * @param paging the object containing the pagination parameters
167
     * @return A list of all UpdateRequests (note that an empty list will be returned if there are none).
168
     * @throws IllegalArgumentException if any argument is null or empty string
169
     * @throws InvalidRequestException if there is any problem with the REST API request
170
     * @throws AuthorizationException if there is any problem with  the REST API authorization (access token)
171
     * @throws ResourceNotFoundException if the resource cannot be found
172
     * @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
173
     * @throws SmartsheetException if there is any other error during the operation
174
     */
175
    public PagedResult<SentUpdateRequest> listSentUpdateRequests(long sheetId, PaginationParameters paging) throws SmartsheetException {
176
        String path = SHEETS_PATH + sheetId + "/sentupdaterequests";
×
177

178
        Map<String, Object> parameters = new HashMap<>();
×
179
        if (paging != null) {
×
180
            parameters = paging.toHashMap();
×
181
        }
182
        path += QueryUtil.generateUrl(null, parameters);
×
183

184
        return this.listResourcesWithWrapper(path, SentUpdateRequest.class);
×
185
    }
186

187
    /**
188
     * Gets the specified sent update request on the Sheet.
189
     * <p>
190
     * It mirrors To the following Smartsheet REST API method: GET /sheets/{sheetId}/sentupdaterequests/{updateRequestId}
191
     *
192
     * @param sheetId the Id of the sheet
193
     * @param sentUpdateRequestId the sent update request Id
194
     * @return the sent update request resource (note that if there is no such resource, this method will throw
195
     *     ResourceNotFoundException rather than returning null).
196
     * @throws IllegalArgumentException if any argument is null or empty string
197
     * @throws InvalidRequestException if there is any problem with the REST API request
198
     * @throws AuthorizationException if there is any problem with  the REST API authorization (access token)
199
     * @throws ResourceNotFoundException if the resource cannot be found
200
     * @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
201
     * @throws SmartsheetException if there is any other error during the operation
202
     */
203
    public SentUpdateRequest getSentUpdateRequest(long sheetId, long sentUpdateRequestId) throws SmartsheetException {
204
        String path = SHEETS_PATH + sheetId + "/sentupdaterequests/" + sentUpdateRequestId;
×
205
        return this.getResource(path, SentUpdateRequest.class);
×
206
    }
207

208
    /**
209
     * Deletes the specified sent update request.
210
     * <p>
211
     * It mirrors To the following Smartsheet REST API method: DELETE /sheets/{sheetId}/sentupdaterequests/{sentUpdateRequestId}
212
     *
213
     * @param sheetId the Id of the sheet
214
     * @param sentUpdateRequestId the sent update request Id
215
     * @throws IllegalArgumentException if any argument is null or empty string
216
     * @throws InvalidRequestException if there is any problem with the REST API request
217
     * @throws AuthorizationException if there is any problem with  the REST API authorization (access token)
218
     * @throws ResourceNotFoundException if the resource cannot be found
219
     * @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
220
     * @throws SmartsheetException if there is any other error during the operation
221
     */
222
    public void deleteSentUpdateRequest(long sheetId, long sentUpdateRequestId) throws SmartsheetException {
223
        String path = SHEETS_PATH + sheetId + "/sentupdaterequests/" + sentUpdateRequestId;
×
224
        this.deleteResource(path, SentUpdateRequest.class);
×
225
    }
×
226
}
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

© 2026 Coveralls, Inc