|
14 | 14 | import com.microsoft.rest.v2.RestResponse; |
15 | 15 | import com.microsoft.rest.v2.ServiceCallback; |
16 | 16 | import com.microsoft.rest.v2.ServiceFuture; |
| 17 | +import com.microsoft.rest.v2.Validator; |
| 18 | +import com.microsoft.rest.v2.annotations.BodyParam; |
17 | 19 | import com.microsoft.rest.v2.annotations.ExpectedResponses; |
18 | 20 | import com.microsoft.rest.v2.annotations.GET; |
19 | 21 | import com.microsoft.rest.v2.annotations.Host; |
| 22 | +import com.microsoft.rest.v2.annotations.PUT; |
20 | 23 | import com.microsoft.rest.v2.annotations.UnexpectedResponseExceptionType; |
21 | 24 | import fixtures.xml.Xmls; |
22 | 25 | import fixtures.xml.models.AppleBarrel; |
@@ -65,10 +68,20 @@ private interface XmlsService { |
65 | 68 | @UnexpectedResponseExceptionType(ErrorException.class) |
66 | 69 | Single<RestResponse<Void, Slideshow>> getSimple(); |
67 | 70 |
|
| 71 | + @PUT("xml/simple") |
| 72 | + @ExpectedResponses({201}) |
| 73 | + @UnexpectedResponseExceptionType(ErrorException.class) |
| 74 | + Single<RestResponse<Void, Void>> putSimple(@BodyParam("application/xml; charset=utf-8") Slideshow wrappedLists); |
| 75 | + |
68 | 76 | @GET("xml/wrapped-lists") |
69 | 77 | @ExpectedResponses({200}) |
70 | 78 | Single<RestResponse<Void, AppleBarrel>> getWrappedLists(); |
71 | 79 |
|
| 80 | + @PUT("xml/wrapped-lists") |
| 81 | + @ExpectedResponses({201}) |
| 82 | + @UnexpectedResponseExceptionType(ErrorException.class) |
| 83 | + Single<RestResponse<Void, Void>> putWrappedLists(@BodyParam("application/xml; charset=utf-8") AppleBarrel wrappedLists); |
| 84 | + |
72 | 85 | @GET("xml/headers") |
73 | 86 | @ExpectedResponses({200}) |
74 | 87 | Single<RestResponse<XmlGetHeadersHeaders, Void>> getHeaders(); |
@@ -123,6 +136,57 @@ public Maybe<Slideshow> apply(RestResponse<Void, Slideshow> restResponse) { |
123 | 136 | }); |
124 | 137 | } |
125 | 138 |
|
| 139 | + /** |
| 140 | + * Put a simple XML document. |
| 141 | + * |
| 142 | + * @param wrappedLists the Slideshow value. |
| 143 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 144 | + * @throws ErrorException thrown if the request is rejected by server. |
| 145 | + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. |
| 146 | + */ |
| 147 | + public void putSimple(@NonNull Slideshow wrappedLists) { |
| 148 | + putSimpleAsync(wrappedLists).blockingAwait(); |
| 149 | + } |
| 150 | + |
| 151 | + /** |
| 152 | + * Put a simple XML document. |
| 153 | + * |
| 154 | + * @param wrappedLists the Slideshow value. |
| 155 | + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. |
| 156 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 157 | + * @return the {@link ServiceFuture<Void>} object. |
| 158 | + */ |
| 159 | + public ServiceFuture<Void> putSimpleAsync(@NonNull Slideshow wrappedLists, @NonNull ServiceCallback<Void> serviceCallback) { |
| 160 | + return ServiceFuture.fromBody(putSimpleAsync(wrappedLists), serviceCallback); |
| 161 | + } |
| 162 | + |
| 163 | + /** |
| 164 | + * Put a simple XML document. |
| 165 | + * |
| 166 | + * @param wrappedLists the Slideshow value. |
| 167 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 168 | + * @return the {@link Single<RestResponse<Void, Void>>} object if successful. |
| 169 | + */ |
| 170 | + public Single<RestResponse<Void, Void>> putSimpleWithRestResponseAsync(@NonNull Slideshow wrappedLists) { |
| 171 | + if (wrappedLists == null) { |
| 172 | + throw new IllegalArgumentException("Parameter wrappedLists is required and cannot be null."); |
| 173 | + } |
| 174 | + Validator.validate(wrappedLists); |
| 175 | + return service.putSimple(wrappedLists); |
| 176 | + } |
| 177 | + |
| 178 | + /** |
| 179 | + * Put a simple XML document. |
| 180 | + * |
| 181 | + * @param wrappedLists the Slideshow value. |
| 182 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 183 | + * @return the {@link Completable} object if successful. |
| 184 | + */ |
| 185 | + public Completable putSimpleAsync(@NonNull Slideshow wrappedLists) { |
| 186 | + return putSimpleWithRestResponseAsync(wrappedLists) |
| 187 | + .toCompletable(); |
| 188 | + } |
| 189 | + |
126 | 190 | /** |
127 | 191 | * Get an XML document with multiple wrapped lists. |
128 | 192 | * |
@@ -171,6 +235,57 @@ public Maybe<AppleBarrel> apply(RestResponse<Void, AppleBarrel> restResponse) { |
171 | 235 | }); |
172 | 236 | } |
173 | 237 |
|
| 238 | + /** |
| 239 | + * Put an XML document with multiple wrapped lists. |
| 240 | + * |
| 241 | + * @param wrappedLists the AppleBarrel value. |
| 242 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 243 | + * @throws ErrorException thrown if the request is rejected by server. |
| 244 | + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. |
| 245 | + */ |
| 246 | + public void putWrappedLists(@NonNull AppleBarrel wrappedLists) { |
| 247 | + putWrappedListsAsync(wrappedLists).blockingAwait(); |
| 248 | + } |
| 249 | + |
| 250 | + /** |
| 251 | + * Put an XML document with multiple wrapped lists. |
| 252 | + * |
| 253 | + * @param wrappedLists the AppleBarrel value. |
| 254 | + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. |
| 255 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 256 | + * @return the {@link ServiceFuture<Void>} object. |
| 257 | + */ |
| 258 | + public ServiceFuture<Void> putWrappedListsAsync(@NonNull AppleBarrel wrappedLists, @NonNull ServiceCallback<Void> serviceCallback) { |
| 259 | + return ServiceFuture.fromBody(putWrappedListsAsync(wrappedLists), serviceCallback); |
| 260 | + } |
| 261 | + |
| 262 | + /** |
| 263 | + * Put an XML document with multiple wrapped lists. |
| 264 | + * |
| 265 | + * @param wrappedLists the AppleBarrel value. |
| 266 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 267 | + * @return the {@link Single<RestResponse<Void, Void>>} object if successful. |
| 268 | + */ |
| 269 | + public Single<RestResponse<Void, Void>> putWrappedListsWithRestResponseAsync(@NonNull AppleBarrel wrappedLists) { |
| 270 | + if (wrappedLists == null) { |
| 271 | + throw new IllegalArgumentException("Parameter wrappedLists is required and cannot be null."); |
| 272 | + } |
| 273 | + Validator.validate(wrappedLists); |
| 274 | + return service.putWrappedLists(wrappedLists); |
| 275 | + } |
| 276 | + |
| 277 | + /** |
| 278 | + * Put an XML document with multiple wrapped lists. |
| 279 | + * |
| 280 | + * @param wrappedLists the AppleBarrel value. |
| 281 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 282 | + * @return the {@link Completable} object if successful. |
| 283 | + */ |
| 284 | + public Completable putWrappedListsAsync(@NonNull AppleBarrel wrappedLists) { |
| 285 | + return putWrappedListsWithRestResponseAsync(wrappedLists) |
| 286 | + .toCompletable(); |
| 287 | + } |
| 288 | + |
174 | 289 | /** |
175 | 290 | * Get strongly-typed response headers. |
176 | 291 | * |
|
0 commit comments