-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http-client-java, migrate to http-specs (#5215)
as before, currently code is actually generated in azure mode (still waiting for the release of Java clientcore for unbranded) report upload is temporarily disabled `EnableCadlRanchReport: false` will re-enable after Azure/autorest.java#2986 test release (on test branch) is good
- Loading branch information
1 parent
cc6f41a
commit b1476de
Showing
67 changed files
with
4,713 additions
and
3,314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
.../http-client-generator-test/src/main/java/azure/payload/pageable/PageableAsyncClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// Code generated by Microsoft (R) TypeSpec Code Generator. | ||
|
||
package azure.payload.pageable; | ||
|
||
import azure.payload.pageable.implementation.PageableClientImpl; | ||
import azure.payload.pageable.models.User; | ||
import com.azure.core.annotation.Generated; | ||
import com.azure.core.annotation.ReturnType; | ||
import com.azure.core.annotation.ServiceClient; | ||
import com.azure.core.annotation.ServiceMethod; | ||
import com.azure.core.exception.ClientAuthenticationException; | ||
import com.azure.core.exception.HttpResponseException; | ||
import com.azure.core.exception.ResourceModifiedException; | ||
import com.azure.core.exception.ResourceNotFoundException; | ||
import com.azure.core.http.rest.PagedFlux; | ||
import com.azure.core.http.rest.PagedResponse; | ||
import com.azure.core.http.rest.PagedResponseBase; | ||
import com.azure.core.http.rest.RequestOptions; | ||
import com.azure.core.util.BinaryData; | ||
import java.util.stream.Collectors; | ||
import reactor.core.publisher.Flux; | ||
|
||
/** | ||
* Initializes a new instance of the asynchronous PageableClient type. | ||
*/ | ||
@ServiceClient(builder = PageableClientBuilder.class, isAsync = true) | ||
public final class PageableAsyncClient { | ||
@Generated | ||
private final PageableClientImpl serviceClient; | ||
|
||
/** | ||
* Initializes an instance of PageableAsyncClient class. | ||
* | ||
* @param serviceClient the service client implementation. | ||
*/ | ||
@Generated | ||
PageableAsyncClient(PageableClientImpl serviceClient) { | ||
this.serviceClient = serviceClient; | ||
} | ||
|
||
/** | ||
* List users. | ||
* <p><strong>Query Parameters</strong></p> | ||
* <table border="1"> | ||
* <caption>Query Parameters</caption> | ||
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr> | ||
* <tr><td>maxpagesize</td><td>Integer</td><td>No</td><td>The maximum number of result items per page.</td></tr> | ||
* </table> | ||
* You can add these to a request with {@link RequestOptions#addQueryParam} | ||
* <p><strong>Response Body Schema</strong></p> | ||
* | ||
* <pre> | ||
* {@code | ||
* { | ||
* name: String (Required) | ||
* } | ||
* } | ||
* </pre> | ||
* | ||
* @param requestOptions The options to configure the HTTP request before HTTP client sends it. | ||
* @throws HttpResponseException thrown if the request is rejected by server. | ||
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. | ||
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. | ||
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. | ||
* @return paged collection of User items as paginated response with {@link PagedFlux}. | ||
*/ | ||
@Generated | ||
@ServiceMethod(returns = ReturnType.COLLECTION) | ||
public PagedFlux<BinaryData> list(RequestOptions requestOptions) { | ||
return this.serviceClient.listAsync(requestOptions); | ||
} | ||
|
||
/** | ||
* List users. | ||
* | ||
* @throws HttpResponseException thrown if the request is rejected by server. | ||
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. | ||
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. | ||
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. | ||
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
* @return paged collection of User items as paginated response with {@link PagedFlux}. | ||
*/ | ||
@Generated | ||
@ServiceMethod(returns = ReturnType.COLLECTION) | ||
public PagedFlux<User> list() { | ||
// Generated convenience method for list | ||
RequestOptions requestOptions = new RequestOptions(); | ||
PagedFlux<BinaryData> pagedFluxResponse = list(requestOptions); | ||
return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { | ||
Flux<PagedResponse<BinaryData>> flux = (continuationTokenParam == null) | ||
? pagedFluxResponse.byPage().take(1) | ||
: pagedFluxResponse.byPage(continuationTokenParam).take(1); | ||
return flux.map(pagedResponse -> new PagedResponseBase<Void, User>(pagedResponse.getRequest(), | ||
pagedResponse.getStatusCode(), pagedResponse.getHeaders(), | ||
pagedResponse.getValue() | ||
.stream() | ||
.map(protocolMethodData -> protocolMethodData.toObject(User.class)) | ||
.collect(Collectors.toList()), | ||
pagedResponse.getContinuationToken(), null)); | ||
}); | ||
} | ||
} |
88 changes: 88 additions & 0 deletions
88
...rator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// Code generated by Microsoft (R) TypeSpec Code Generator. | ||
|
||
package azure.payload.pageable; | ||
|
||
import azure.payload.pageable.implementation.PageableClientImpl; | ||
import azure.payload.pageable.models.User; | ||
import com.azure.core.annotation.Generated; | ||
import com.azure.core.annotation.ReturnType; | ||
import com.azure.core.annotation.ServiceClient; | ||
import com.azure.core.annotation.ServiceMethod; | ||
import com.azure.core.exception.ClientAuthenticationException; | ||
import com.azure.core.exception.HttpResponseException; | ||
import com.azure.core.exception.ResourceModifiedException; | ||
import com.azure.core.exception.ResourceNotFoundException; | ||
import com.azure.core.http.rest.PagedIterable; | ||
import com.azure.core.http.rest.RequestOptions; | ||
import com.azure.core.util.BinaryData; | ||
|
||
/** | ||
* Initializes a new instance of the synchronous PageableClient type. | ||
*/ | ||
@ServiceClient(builder = PageableClientBuilder.class) | ||
public final class PageableClient { | ||
@Generated | ||
private final PageableClientImpl serviceClient; | ||
|
||
/** | ||
* Initializes an instance of PageableClient class. | ||
* | ||
* @param serviceClient the service client implementation. | ||
*/ | ||
@Generated | ||
PageableClient(PageableClientImpl serviceClient) { | ||
this.serviceClient = serviceClient; | ||
} | ||
|
||
/** | ||
* List users. | ||
* <p><strong>Query Parameters</strong></p> | ||
* <table border="1"> | ||
* <caption>Query Parameters</caption> | ||
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr> | ||
* <tr><td>maxpagesize</td><td>Integer</td><td>No</td><td>The maximum number of result items per page.</td></tr> | ||
* </table> | ||
* You can add these to a request with {@link RequestOptions#addQueryParam} | ||
* <p><strong>Response Body Schema</strong></p> | ||
* | ||
* <pre> | ||
* {@code | ||
* { | ||
* name: String (Required) | ||
* } | ||
* } | ||
* </pre> | ||
* | ||
* @param requestOptions The options to configure the HTTP request before HTTP client sends it. | ||
* @throws HttpResponseException thrown if the request is rejected by server. | ||
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. | ||
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. | ||
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. | ||
* @return paged collection of User items as paginated response with {@link PagedIterable}. | ||
*/ | ||
@Generated | ||
@ServiceMethod(returns = ReturnType.COLLECTION) | ||
public PagedIterable<BinaryData> list(RequestOptions requestOptions) { | ||
return this.serviceClient.list(requestOptions); | ||
} | ||
|
||
/** | ||
* List users. | ||
* | ||
* @throws HttpResponseException thrown if the request is rejected by server. | ||
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. | ||
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. | ||
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. | ||
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
* @return paged collection of User items as paginated response with {@link PagedIterable}. | ||
*/ | ||
@Generated | ||
@ServiceMethod(returns = ReturnType.COLLECTION) | ||
public PagedIterable<User> list() { | ||
// Generated convenience method for list | ||
RequestOptions requestOptions = new RequestOptions(); | ||
return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); | ||
} | ||
} |
Oops, something went wrong.