Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http-client-java, support (non-nested) continuationToken for unbranded #6143

Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8f04696
fix interface
weidongxu-microsoft Feb 14, 2025
25e05d0
test code and initial interface of PageableContinuationToken
weidongxu-microsoft Feb 14, 2025
f7a0c45
handle PagedResponse
weidongxu-microsoft Feb 18, 2025
224703c
handle query/header
weidongxu-microsoft Feb 18, 2025
03d005c
hack for test
weidongxu-microsoft Feb 19, 2025
928ab36
Merge branch 'main' into http-client-java_continuation-token
weidongxu-microsoft Feb 20, 2025
32137b1
refactor to use ModelPropertySegment, instead of itemName/itemSeriali…
weidongxu-microsoft Feb 20, 2025
3785ba3
hide continuationToken parameter from API
weidongxu-microsoft Feb 20, 2025
d2c8831
add throw calls on not support items in PagingOptions
weidongxu-microsoft Feb 20, 2025
18f8ae0
Merge branch 'main' into http-client-java_continuation-token
weidongxu-microsoft Feb 25, 2025
feb1c68
use tcgc for continuationToken
weidongxu-microsoft Feb 25, 2025
a6cb649
Merge branch 'main' into http-client-java_continuation-token
weidongxu-microsoft Feb 25, 2025
c168edd
enable for unbranded
weidongxu-microsoft Feb 25, 2025
0cd5416
fix
weidongxu-microsoft Feb 25, 2025
9ce5472
bump http-specs and regen
weidongxu-microsoft Feb 25, 2025
905abfe
update test
weidongxu-microsoft Feb 25, 2025
d9924ae
test
weidongxu-microsoft Feb 25, 2025
c85e84d
fix
weidongxu-microsoft Feb 25, 2025
c6b7a2c
comment
weidongxu-microsoft Feb 25, 2025
59e1d38
add test for page2
weidongxu-microsoft Feb 25, 2025
c6d3eb3
revert Main
weidongxu-microsoft Feb 25, 2025
4aa4b0f
bump jar
weidongxu-microsoft Feb 25, 2025
6af2a02
bump version
weidongxu-microsoft Feb 25, 2025
9d81f37
test for throws if non-supported param is set
weidongxu-microsoft Feb 25, 2025
e15b44e
fix test package ref
weidongxu-microsoft Feb 25, 2025
df60efe
Merge branch 'main' into http-client-java_continuation-token
weidongxu-microsoft Feb 27, 2025
77b4d3c
0.1.12
weidongxu-microsoft Feb 27, 2025
cbf31a6
review feedback
weidongxu-microsoft Feb 28, 2025
87491a1
simplify paged op logic, do early return
weidongxu-microsoft Feb 28, 2025
77234d1
Merge branch 'main' into http-client-java_continuation-token
weidongxu-microsoft Feb 28, 2025
34f4cb6
Fix typo in comment: "mutally" to "mutually"
weidongxu-microsoft Mar 4, 2025
89b3638
Merge branch 'main' into http-client-java_continuation-token
weidongxu-microsoft Mar 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bump http-specs and regen
  • Loading branch information
weidongxu-microsoft committed Feb 25, 2025
commit 9ce547261721b2e748d93d752f51a32b9815e84c
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
"spector-stop": "tsp-spector server stop"
},
"dependencies": {
"@typespec/http-specs": "0.1.0-alpha.9",
"@typespec/http-specs": "0.1.0-alpha.10",
"@typespec/http-client-java": "file:../../typespec-http-client-java-0.1.10.tgz",
"@typespec/http-client-java-tests": "file:"
},
Original file line number Diff line number Diff line change
@@ -29,7 +29,8 @@
/**
* A builder for creating a new instance of the PageableClient type.
*/
@ServiceClientBuilder(serviceClients = { PageableClient.class })
@ServiceClientBuilder(
serviceClients = { ServerDrivenPaginationClient.class, ServerDrivenPaginationContinuationTokenClient.class })
public final class PageableClientBuilder implements HttpTrait<PageableClientBuilder>, ProxyTrait<PageableClientBuilder>,
ConfigurationTrait<PageableClientBuilder>, EndpointTrait<PageableClientBuilder> {
@Metadata(generated = true)
@@ -229,13 +230,24 @@ private HttpPipeline createHttpPipeline() {
}

/**
* Builds an instance of PageableClient class.
* Builds an instance of ServerDrivenPaginationClient class.
*
* @return an instance of PageableClient.
* @return an instance of ServerDrivenPaginationClient.
*/
@Metadata(generated = true)
public PageableClient buildPageableClient() {
return new PageableClient(buildInnerClient().getServerDrivenPaginations());
public ServerDrivenPaginationClient buildServerDrivenPaginationClient() {
return new ServerDrivenPaginationClient(buildInnerClient().getServerDrivenPaginations());
}

/**
* Builds an instance of ServerDrivenPaginationContinuationTokenClient class.
*
* @return an instance of ServerDrivenPaginationContinuationTokenClient.
*/
@Metadata(generated = true)
public ServerDrivenPaginationContinuationTokenClient buildServerDrivenPaginationContinuationTokenClient() {
return new ServerDrivenPaginationContinuationTokenClient(
buildInnerClient().getServerDrivenPaginationContinuationTokens());
}

private static final ClientLogger LOGGER = new ClientLogger(PageableClientBuilder.class);
Original file line number Diff line number Diff line change
@@ -15,17 +15,17 @@
* Initializes a new instance of the synchronous PageableClient type.
*/
@ServiceClient(builder = PageableClientBuilder.class)
public final class PageableClient {
public final class ServerDrivenPaginationClient {
@Metadata(generated = true)
private final ServerDrivenPaginationsImpl serviceClient;

/**
* Initializes an instance of PageableClient class.
* Initializes an instance of ServerDrivenPaginationClient class.
*
* @param serviceClient the service client implementation.
*/
@Metadata(generated = true)
PageableClient(ServerDrivenPaginationsImpl serviceClient) {
ServerDrivenPaginationClient(ServerDrivenPaginationsImpl serviceClient) {
this.serviceClient = serviceClient;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
// Code generated by Microsoft (R) TypeSpec Code Generator.

package payload.pageable;

import io.clientcore.core.annotations.Metadata;
import io.clientcore.core.annotations.ReturnType;
import io.clientcore.core.annotations.ServiceClient;
import io.clientcore.core.annotations.ServiceMethod;
import io.clientcore.core.http.exceptions.HttpResponseException;
import io.clientcore.core.http.models.PagedIterable;
import io.clientcore.core.http.models.RequestOptions;
import payload.pageable.implementation.ServerDrivenPaginationContinuationTokensImpl;

/**
* Initializes a new instance of the synchronous PageableClient type.
*/
@ServiceClient(builder = PageableClientBuilder.class)
public final class ServerDrivenPaginationContinuationTokenClient {
@Metadata(generated = true)
private final ServerDrivenPaginationContinuationTokensImpl serviceClient;

/**
* Initializes an instance of ServerDrivenPaginationContinuationTokenClient class.
*
* @param serviceClient the service client implementation.
*/
@Metadata(generated = true)
ServerDrivenPaginationContinuationTokenClient(ServerDrivenPaginationContinuationTokensImpl serviceClient) {
this.serviceClient = serviceClient;
}

/**
* The requestQueryResponseBody operation.
* <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>token</td><td>String</td><td>No</td><td>The token parameter</td></tr>
* </table>
* You can add these to a request with {@link RequestOptions#addQueryParam}
* <p><strong>Response Body Schema</strong></p>
*
* <pre>
* {@code
* {
* pets (Required): [
* (Required){
* id: String (Required)
* name: String (Required)
* }
* ]
* nextToken: String (Optional)
* }
* }
* </pre>
*
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the service returns an error.
* @return the response.
*/
@Metadata(generated = true)
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<Pet> requestQueryResponseBody(RequestOptions requestOptions) {
return this.serviceClient.requestQueryResponseBody(requestOptions);
}

/**
* The requestHeaderResponseBody operation.
* <p><strong>Header Parameters</strong></p>
* <table border="1">
* <caption>Header Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>token</td><td>String</td><td>No</td><td>The token parameter</td></tr>
* </table>
* You can add these to a request with {@link RequestOptions#addHeader}
* <p><strong>Response Body Schema</strong></p>
*
* <pre>
* {@code
* {
* pets (Required): [
* (Required){
* id: String (Required)
* name: String (Required)
* }
* ]
* nextToken: String (Optional)
* }
* }
* </pre>
*
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the service returns an error.
* @return the response.
*/
@Metadata(generated = true)
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<Pet> requestHeaderResponseBody(RequestOptions requestOptions) {
return this.serviceClient.requestHeaderResponseBody(requestOptions);
}

/**
* The requestQueryResponseHeader operation.
* <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>token</td><td>String</td><td>No</td><td>The token parameter</td></tr>
* </table>
* You can add these to a request with {@link RequestOptions#addQueryParam}
* <p><strong>Response Body Schema</strong></p>
*
* <pre>
* {@code
* {
* pets (Required): [
* (Required){
* id: String (Required)
* name: String (Required)
* }
* ]
* }
* }
* </pre>
*
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the service returns an error.
* @return the response.
*/
@Metadata(generated = true)
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<Pet> requestQueryResponseHeader(RequestOptions requestOptions) {
return this.serviceClient.requestQueryResponseHeader(requestOptions);
}

/**
* The requestHeaderResponseHeader operation.
* <p><strong>Header Parameters</strong></p>
* <table border="1">
* <caption>Header Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>token</td><td>String</td><td>No</td><td>The token parameter</td></tr>
* </table>
* You can add these to a request with {@link RequestOptions#addHeader}
* <p><strong>Response Body Schema</strong></p>
*
* <pre>
* {@code
* {
* pets (Required): [
* (Required){
* id: String (Required)
* name: String (Required)
* }
* ]
* }
* }
* </pre>
*
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the service returns an error.
* @return the response.
*/
@Metadata(generated = true)
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<Pet> requestHeaderResponseHeader(RequestOptions requestOptions) {
return this.serviceClient.requestHeaderResponseHeader(requestOptions);
}

/**
* The requestQueryResponseBody operation.
*
* @throws HttpResponseException thrown if the service returns an error.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@Metadata(generated = true)
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<Pet> requestQueryResponseBody() {
// Generated convenience method for requestQueryResponseBody
RequestOptions requestOptions = new RequestOptions();
return serviceClient.requestQueryResponseBody(requestOptions);
}

/**
* The requestHeaderResponseBody operation.
*
* @throws HttpResponseException thrown if the service returns an error.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@Metadata(generated = true)
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<Pet> requestHeaderResponseBody() {
// Generated convenience method for requestHeaderResponseBody
RequestOptions requestOptions = new RequestOptions();
return serviceClient.requestHeaderResponseBody(requestOptions);
}

/**
* The requestQueryResponseHeader operation.
*
* @throws HttpResponseException thrown if the service returns an error.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@Metadata(generated = true)
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<Pet> requestQueryResponseHeader() {
// Generated convenience method for requestQueryResponseHeader
RequestOptions requestOptions = new RequestOptions();
return serviceClient.requestQueryResponseHeader(requestOptions);
}

/**
* The requestHeaderResponseHeader operation.
*
* @throws HttpResponseException thrown if the service returns an error.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@Metadata(generated = true)
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<Pet> requestHeaderResponseHeader() {
// Generated convenience method for requestHeaderResponseHeader
RequestOptions requestOptions = new RequestOptions();
return serviceClient.requestHeaderResponseHeader(requestOptions);
}
}
Original file line number Diff line number Diff line change
@@ -50,6 +50,20 @@ public ServerDrivenPaginationsImpl getServerDrivenPaginations() {
return this.serverDrivenPaginations;
}

/**
* The ServerDrivenPaginationContinuationTokensImpl object to access its operations.
*/
private final ServerDrivenPaginationContinuationTokensImpl serverDrivenPaginationContinuationTokens;

/**
* Gets the ServerDrivenPaginationContinuationTokensImpl object to access its operations.
*
* @return the ServerDrivenPaginationContinuationTokensImpl object.
*/
public ServerDrivenPaginationContinuationTokensImpl getServerDrivenPaginationContinuationTokens() {
return this.serverDrivenPaginationContinuationTokens;
}

/**
* Initializes an instance of PageableClient client.
*
@@ -60,5 +74,6 @@ public PageableClientImpl(HttpPipeline httpPipeline, String endpoint) {
this.httpPipeline = httpPipeline;
this.endpoint = endpoint;
this.serverDrivenPaginations = new ServerDrivenPaginationsImpl(this);
this.serverDrivenPaginationContinuationTokens = new ServerDrivenPaginationContinuationTokensImpl(this);
}
}
Loading