From 2abc6b06c2ea73847fb0721ed6d46d14c19b37ce Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Tue, 25 Aug 2026 20:56:38 +0800 Subject: [PATCH 1/2] fix(http-client-java): reuse override parameter groups Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7234aa71-1588-45aa-9153-87c85896e245 --- ...ide-protocol-parameter-group-2026-08-25.md | 7 + .../core/mapper/ClientMethodMapper.java | 16 ++ .../ClientMethodParameterProcessor.java | 113 +++++++-- .../mapper/ClientMethodParametersDetails.java | 2 +- .../ParametersTransformationProcessor.java | 7 +- .../core/template/ClientMethodTemplate.java | 41 ++- .../ConvenienceMethodTemplateBase.java | 50 +++- .../MethodOverrideAsyncClient.java | 103 ++++++-- .../methodoverride/MethodOverrideClient.java | 99 ++++++-- .../MethodOverrideClientImpl.java | 233 +++++++++++++++++- .../models/GroupHeaderOptions.java | 77 ++++++ .../methodoverride/models/GroupQueryKind.java | 56 +++++ .../models/GroupQueryOptions.java | 28 +++ .../methodoverride/MethodOverrideTests.java | 117 +++++++++ .../tsp/method-override.tsp | 20 ++ 15 files changed, 883 insertions(+), 86 deletions(-) create mode 100644 .chronus/changes/fix-java-override-protocol-parameter-group-2026-08-25.md create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupHeaderOptions.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryKind.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/methodoverride/MethodOverrideTests.java diff --git a/.chronus/changes/fix-java-override-protocol-parameter-group-2026-08-25.md b/.chronus/changes/fix-java-override-protocol-parameter-group-2026-08-25.md new file mode 100644 index 00000000000..48d06852625 --- /dev/null +++ b/.chronus/changes/fix-java-override-protocol-parameter-group-2026-08-25.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@typespec/http-client-java" +--- + +Reuse override parameter groups containing query and header parameters in Java protocol methods. diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodMapper.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodMapper.java index 88c3f7ea0d7..56436b817c0 100644 --- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodMapper.java +++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodMapper.java @@ -151,6 +151,7 @@ private List createClientMethods(Operation operation, boolean isPr continue; } final ClientMethodParametersDetails paramsDetails = ClientMethodParameterProcessor.process(request, + getConvenienceRequest(operation, request, isProtocolMethod), proxyMethod.hasParameterOfType(ClassType.BINARY_DATA), isProtocolMethod); final ClientMethod baseMethod = builder.proxyMethod(proxyMethod) @@ -316,6 +317,21 @@ private static List getCodeModelRequests(Operation operation, boolean i } } + private static Request getConvenienceRequest(Operation operation, Request request, boolean isProtocolMethod) { + if (!isProtocolMethod + || operation.getConvenienceApi() == null + || operation.getConvenienceApi().getRequests() == null + || operation.getConvenienceApi().getRequests().isEmpty()) { + return null; + } + + int requestIndex = operation.getRequests().indexOf(request); + List convenienceRequests = operation.getConvenienceApi().getRequests(); + return requestIndex >= 0 && requestIndex < convenienceRequests.size() + ? convenienceRequests.get(requestIndex) + : convenienceRequests.get(0); + } + /** * Gets the visibility for the client methods when generator configured to generate the wrapper clients. *

diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodParameterProcessor.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodParameterProcessor.java index f200492b990..2e9ea3e1a09 100644 --- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodParameterProcessor.java +++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodParameterProcessor.java @@ -15,17 +15,25 @@ import com.microsoft.typespec.http.client.generator.core.util.MethodUtil; import java.util.ArrayList; import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; final class ClientMethodParameterProcessor { - static ClientMethodParametersDetails process(Request request, boolean mapFluxByteBufferToBinaryData, - boolean isProtocolMethod) { + static ClientMethodParametersDetails process(Request request, Request convenienceRequest, + boolean mapFluxByteBufferToBinaryData, boolean isProtocolMethod) { - final List codeModelParameters = getCodeModelParameters(request, isProtocolMethod); + final List protocolParameterGroups + = getProtocolParameterGroups(request, convenienceRequest, isProtocolMethod); + final List codeModelParameters + = getCodeModelParameters(request, protocolParameterGroups, isProtocolMethod); + final Set signatureParameters + = getSignatureParameters(request, protocolParameterGroups, isProtocolMethod); final List parametersTuples = new ArrayList<>(); final List requiredNullableParameterExpressions = new ArrayList<>(); final Map validateParameterExpressions = new LinkedHashMap<>(); @@ -37,7 +45,7 @@ static ClientMethodParametersDetails process(Request request, boolean mapFluxByt final ClientMethodParameter clientMethodParameter = toClientMethodParameter(codeModelParameter, isJsonPatch, mapFluxByteBufferToBinaryData, isProtocolMethod); final ParametersTuple tuple = new ParametersTuple(codeModelParameter, clientMethodParameter); - if (request.getSignatureParameters().contains(codeModelParameter)) { + if (signatureParameters.contains(codeModelParameter)) { parametersTuples.add(tuple); } transformationProcessor.addParameter(tuple); @@ -69,31 +77,106 @@ static ClientMethodParametersDetails process(Request request, boolean mapFluxByt validateParameterExpressions, parameterTransformations); } - private static List getCodeModelParameters(Request request, boolean isProtocolMethod) { + private static List getCodeModelParameters(Request request, List protocolParameterGroups, + boolean isProtocolMethod) { final Stream codeModelParameters; if (isProtocolMethod) { - // Required path, body, header and query parameters are allowed + // Required path, body, header and query parameters are allowed. Query and header parameters grouped by an + // override are also needed to transform the group back into the HTTP request. codeModelParameters = request.getParameters().stream().filter(p -> { - RequestParameterLocation location = p.getProtocol().getHttp().getIn(); - return p.isRequired() - && (location == RequestParameterLocation.PATH - || location == RequestParameterLocation.BODY - || location == RequestParameterLocation.HEADER - || location == RequestParameterLocation.QUERY); + RequestParameterLocation location = getRequestParameterLocation(p); + return isProtocolParameterLocation(location) + && (p.isRequired() || findProtocolParameterGroup(p, protocolParameterGroups) != null); }); } else { codeModelParameters = request.getParameters().stream().filter(p -> !p.isFlattened()); } - return codeModelParameters.collect(Collectors.toList()); + List parameters = codeModelParameters.collect(Collectors.toList()); + parameters.addAll(protocolParameterGroups); + return parameters; + } + + private static Set getSignatureParameters(Request request, List protocolParameterGroups, + boolean isProtocolMethod) { + if (!isProtocolMethod) { + return new LinkedHashSet<>(request.getSignatureParameters()); + } + + Set signatureParameters = new LinkedHashSet<>(); + for (Parameter parameter : request.getParameters()) { + Parameter groupParameter = findProtocolParameterGroup(parameter, protocolParameterGroups); + if (groupParameter != null) { + signatureParameters.add(groupParameter); + } else if (parameter.isRequired() + && !parameter.isConstant() + && parameter.getImplementation() != Parameter.ImplementationLocation.CLIENT + && isProtocolParameterLocation(getRequestParameterLocation(parameter))) { + signatureParameters.add(parameter); + } + } + return signatureParameters; + } + + private static List getProtocolParameterGroups(Request request, Request convenienceRequest, + boolean isProtocolMethod) { + if (!isProtocolMethod || convenienceRequest == null || convenienceRequest.getSignatureParameters() == null) { + return List.of(); + } + + return convenienceRequest.getSignatureParameters().stream().filter(groupParameter -> { + List groupedParameters = request.getParameters() + .stream() + .filter(parameter -> isSameParameterGroup(parameter.getGroupedBy(), groupParameter)) + .collect(Collectors.toList()); + return !groupedParameters.isEmpty() + && groupedParameters.stream().allMatch(ClientMethodParameterProcessor::isQueryOrHeaderParameter); + }).collect(Collectors.toList()); + } + + private static Parameter findProtocolParameterGroup(Parameter parameter, List protocolParameterGroups) { + return protocolParameterGroups.stream() + .filter(groupParameter -> isSameParameterGroup(parameter.getGroupedBy(), groupParameter)) + .findFirst() + .orElse(null); + } + + private static boolean isSameParameterGroup(Parameter left, Parameter right) { + return left != null + && right != null + && Objects.equals(left.getSchema().getLanguage().getJava().getName(), + right.getSchema().getLanguage().getJava().getName()) + && Objects.equals(left.getSchema().getLanguage().getJava().getNamespace(), + right.getSchema().getLanguage().getJava().getNamespace()) + && Objects.equals(left.getLanguage().getJava().getName(), right.getLanguage().getJava().getName()); + } + + private static boolean isQueryOrHeaderParameter(Parameter parameter) { + RequestParameterLocation location = getRequestParameterLocation(parameter); + return location == RequestParameterLocation.QUERY || location == RequestParameterLocation.HEADER; + } + + private static boolean isProtocolParameterLocation(RequestParameterLocation location) { + return location == RequestParameterLocation.PATH + || location == RequestParameterLocation.BODY + || location == RequestParameterLocation.HEADER + || location == RequestParameterLocation.QUERY; + } + + private static RequestParameterLocation getRequestParameterLocation(Parameter parameter) { + return parameter.getProtocol() == null || parameter.getProtocol().getHttp() == null + ? null + : parameter.getProtocol().getHttp().getIn(); } private static ClientMethodParameter toClientMethodParameter(Parameter parameter, boolean isJsonPatch, boolean mapFluxByteBufferToBinaryData, boolean isProtocolMethod) { final ClientMethodParameter clientMethodParameter; + boolean mapAsProtocolParameter + = isProtocolMethod && parameter.getGroupedBy() == null && getRequestParameterLocation(parameter) != null; if (isJsonPatch) { - clientMethodParameter = CustomClientParameterMapper.getInstance().map(parameter, isProtocolMethod); + clientMethodParameter = CustomClientParameterMapper.getInstance().map(parameter, mapAsProtocolParameter); } else { - clientMethodParameter = Mappers.getClientParameterMapper().map(parameter, isProtocolMethod); + clientMethodParameter = Mappers.getClientParameterMapper().map(parameter, mapAsProtocolParameter); } if (mapFluxByteBufferToBinaryData && clientMethodParameter.getClientType() == GenericType.FLUX_BYTE_BUFFER) { diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodParametersDetails.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodParametersDetails.java index c545245a2cd..ecd946d0c1d 100644 --- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodParametersDetails.java +++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodParametersDetails.java @@ -16,7 +16,7 @@ /** * Holds the details of the parameters for a {@link ClientMethod}, produced by - * {@link ClientMethodParameterProcessor#process(Request, boolean, boolean)}. + * {@link ClientMethodParameterProcessor#process(Request, Request, boolean, boolean)}. */ final class ClientMethodParametersDetails { /** diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ParametersTransformationProcessor.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ParametersTransformationProcessor.java index 1b813ea0d1a..f063dd979a6 100644 --- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ParametersTransformationProcessor.java +++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ParametersTransformationProcessor.java @@ -38,7 +38,8 @@ public ParametersTransformationProcessor(boolean isProtocolMethod) { */ void addParameter(ParametersTuple tuple) { final Parameter codeModelParameter = tuple.codeModelParameter; - if (isProtocolMethod || codeModelParameter.getSchema() instanceof ConstantSchema) { + if ((isProtocolMethod && codeModelParameter.getGroupedBy() == null) + || codeModelParameter.getSchema() instanceof ConstantSchema) { return; } if (codeModelParameter.getGroupedBy() == null && codeModelParameter.getOriginalParameter() == null) { @@ -180,6 +181,10 @@ private static OutMapping processOutputMapping(ClientMethodParameter clientMetho } private List flattenedParameters(Request request) { + if (isProtocolMethod) { + return List.of(); + } + // build a list of original-parameters those were already been accounted for by process(..) while // processing 'this.parameters'. final List originalParameters = parametersTuples.stream() diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ClientMethodTemplate.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ClientMethodTemplate.java index b4358d23a71..8cee94c8c5b 100644 --- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ClientMethodTemplate.java +++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ClientMethodTemplate.java @@ -43,6 +43,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.function.Consumer; @@ -656,6 +657,8 @@ private static boolean addSpecialHeadersToRequestOptions(JavaBlock function, Cli // logic only works for DPG, protocol API, on RequestOptions boolean requestOptionsLocal = false; + final List groupedOptionalParameters + = getGroupedOptionalRequestParameters(clientMethod); final boolean repeatabilityRequestHeaders = MethodUtil.isMethodIncludeRepeatableRequestHeaders(clientMethod.getProxyMethod()); @@ -680,7 +683,7 @@ private static boolean addSpecialHeadersToRequestOptions(JavaBlock function, Cli final boolean contentTypeRequestHeaders = bodyParameterOptional && singleContentType; // need a "final" variable for RequestOptions - if (repeatabilityRequestHeaders || contentTypeRequestHeaders) { + if (repeatabilityRequestHeaders || contentTypeRequestHeaders || !groupedOptionalParameters.isEmpty()) { requestOptionsLocal = true; function.line( "RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions;"); @@ -709,9 +712,45 @@ private static boolean addSpecialHeadersToRequestOptions(JavaBlock function, Cli function.line("});"); } + for (ConvenienceMethodTemplateBase.MethodParameter parameter : groupedOptionalParameters) { + RequestParameterLocation location = parameter.getProxyMethodParameter().getRequestParameterLocation(); + if (location == RequestParameterLocation.QUERY) { + ConvenienceSyncMethodTemplate.getInstance().writeQueryParam(parameter, function, "requestOptionsLocal"); + } else if (location == RequestParameterLocation.HEADER) { + ConvenienceMethodTemplateBase.writeHeader(parameter, function, "requestOptionsLocal"); + } + } + return requestOptionsLocal; } + private static List + getGroupedOptionalRequestParameters(ClientMethod clientMethod) { + List proxyMethodParameters = clientMethod.getProxyMethod().getParameters(); + List allProxyMethodParameters = clientMethod.getProxyMethod().getAllParameters(); + + return clientMethod.getParameterTransformations() + .asStream() + .filter(ParameterTransformation::isGroupBy) + .map(ParameterTransformation::getOutParameter) + .map(clientParameter -> { + ProxyMethodParameter proxyParameter = allProxyMethodParameters.stream() + .filter(parameter -> clientParameter.getName() + .equals(CodeNamer.getEscapedReservedClientMethodParameterName(parameter.getName()))) + .findFirst() + .orElse(null); + return proxyParameter == null || proxyMethodParameters.contains(proxyParameter) + ? null + : new ConvenienceMethodTemplateBase.MethodParameter(proxyParameter, clientParameter); + }) + .filter(Objects::nonNull) + .filter(parameter -> { + RequestParameterLocation location = parameter.getProxyMethodParameter().getRequestParameterLocation(); + return location == RequestParameterLocation.QUERY || location == RequestParameterLocation.HEADER; + }) + .collect(Collectors.toList()); + } + private static void requestOptionsSetHeaderIfAbsent(JavaBlock function, String expression, String headerName) { function.line("requestOptionsLocal.addRequestCallback(requestLocal -> {"); function.indent(() -> function.ifBlock( diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceMethodTemplateBase.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceMethodTemplateBase.java index d0eef3a0433..28e3035d20b 100644 --- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceMethodTemplateBase.java +++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceMethodTemplateBase.java @@ -372,7 +372,10 @@ protected void writeMethodImplementation(ClientMethod protocolMethod, ClientMeth return writeParameterConversionExpressionWithJsonMergePatchEnabled(methodBlock, rootParentModelType.toString(), parameterName, expression); } else { - return expression == null ? parameterName : expression; + if (expression != null) { + return expression; + } + return p.isRequired() || "requestOptions".equals(parameterName) ? parameterName : "null"; } }).collect(Collectors.joining(", ")); @@ -440,14 +443,19 @@ private static ClientMethodParameter writeParameterTransformation(ParameterTrans ClientMethodParameter requestBodyClientParameter = null; if (transformation.isGroupBy()) { + final ClientMethodParameter sourceParameter = transformation.getGroupByInParameter(); + if (protocolMethod.getMethodInputParameters() + .stream() + .anyMatch(parameter -> Objects.equals(parameter.getName(), sourceParameter.getName()))) { + return null; + } + // parameter grouping /* * sample code: * String id = options.getId(); * String header = options.getHeader(); */ - final ClientMethodParameter sourceParameter = transformation.getGroupByInParameter(); - boolean sourceParameterInMethod = false; for (MethodParameter parameter : parametersMap.keySet()) { if (parameter.clientMethodParameter != null @@ -753,9 +761,13 @@ private static String expressionConvertToBinaryData(String name, IType type, Str } } - private static void writeHeader(MethodParameter parameter, JavaBlock methodBlock) { + protected static void writeHeader(MethodParameter parameter, JavaBlock methodBlock) { + writeHeader(parameter, methodBlock, "requestOptions"); + } + + protected static void writeHeader(MethodParameter parameter, JavaBlock methodBlock, String requestOptionsName) { Consumer writeLine - = javaBlock -> javaBlock.line(String.format("requestOptions.setHeader(%1$s, %2$s);", + = javaBlock -> javaBlock.line(String.format("%1$s.setHeader(%2$s, %3$s);", requestOptionsName, ModelTemplateHeaderHelper.getHttpHeaderNameInstanceExpression(parameter.getSerializedName()), expressionConvertToString(parameter.getName(), parameter.getClientMethodParameter().getWireType(), parameter.getProxyMethodParameter()))); @@ -767,6 +779,10 @@ private static void writeHeader(MethodParameter parameter, JavaBlock methodBlock } protected void writeQueryParam(MethodParameter parameter, JavaBlock methodBlock) { + writeQueryParam(parameter, methodBlock, "requestOptions"); + } + + protected void writeQueryParam(MethodParameter parameter, JavaBlock methodBlock, String requestOptionsName) { Consumer writeLine; if (parameter.proxyMethodParameter.getExplode() && parameter.getClientMethodParameter().getWireType() instanceof IterableType) { @@ -775,7 +791,8 @@ protected void writeQueryParam(MethodParameter parameter, JavaBlock methodBlock) String elementTypeExpression = expressionConvertToString("paramItemValue", elementType, parameter.getProxyMethodParameter()); writeLine = javaBlock -> { - String addQueryParamLine = getAddQueryParamExpression(parameter, elementTypeExpression); + String addQueryParamLine + = getAddQueryParamExpression(parameter, elementTypeExpression, requestOptionsName); javaBlock.line(String.format("for (%1$s paramItemValue : %2$s) {", elementType, parameter.getName())); javaBlock.indent(() -> { @@ -788,9 +805,10 @@ protected void writeQueryParam(MethodParameter parameter, JavaBlock methodBlock) javaBlock.line("}"); }; } else { - writeLine = javaBlock -> javaBlock - .line(getAddQueryParamExpression(parameter, expressionConvertToString(parameter.getName(), - parameter.getClientMethodParameter().getWireType(), parameter.getProxyMethodParameter()))); + writeLine = javaBlock -> javaBlock.line(getAddQueryParamExpression( + parameter, expressionConvertToString(parameter.getName(), + parameter.getClientMethodParameter().getWireType(), parameter.getProxyMethodParameter()), + requestOptionsName)); } if (!parameter.getClientMethodParameter().isRequired()) { methodBlock.ifBlock(String.format("%s != null", parameter.getName()), writeLine); @@ -800,7 +818,11 @@ protected void writeQueryParam(MethodParameter parameter, JavaBlock methodBlock) } protected String getAddQueryParamExpression(MethodParameter parameter, String variable) { - return String.format("requestOptions.addQueryParam(%1$s, %2$s, %3$s);", + return getAddQueryParamExpression(parameter, variable, "requestOptions"); + } + + protected String getAddQueryParamExpression(MethodParameter parameter, String variable, String requestOptionsName) { + return String.format("%1$s.addQueryParam(%2$s, %3$s, %4$s);", requestOptionsName, ClassType.STRING.defaultValueExpression(parameter.getSerializedName()), variable, parameter.getProxyMethodParameter().getAlreadyEncoded()); } @@ -995,7 +1017,9 @@ private static boolean isMultipartModel(IType type) { .collect(Collectors.toMap(key -> key.getSerializedName() == null ? key.getName() : key.getSerializedName(), Function.identity())); for (MethodParameter convenienceParameter : convenienceParameters) { - String name = convenienceParameter.getSerializedName(); + String name = convenienceParameter.getSerializedName() == null + ? convenienceParameter.getName() + : convenienceParameter.getSerializedName(); parameterMap.put(convenienceParameter, clientParameters.get(name)); } if (convenienceMethod.isPageStreamingType()) { @@ -1010,7 +1034,9 @@ private static MethodParameter findProtocolMethodParameterForConvenienceMethod(M ClientMethod protocolMethod) { List protocolParameters = getParameters(protocolMethod, false); return protocolParameters.stream() - .filter(p -> Objects.equals(parameter.getSerializedName(), p.getSerializedName())) + .filter(p -> Objects.equals( + parameter.getSerializedName() == null ? parameter.getName() : parameter.getSerializedName(), + p.getSerializedName() == null ? p.getName() : p.getSerializedName())) .findFirst() .orElse(null); } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java index ad44bbc0867..cb37a42a414 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java @@ -28,6 +28,7 @@ import tsptest.methodoverride.implementation.models.GroupPartRequest; import tsptest.methodoverride.models.GroupAllOptions; import tsptest.methodoverride.models.GroupExcludeBodyModel; +import tsptest.methodoverride.models.GroupHeaderOptions; import tsptest.methodoverride.models.GroupPartETagOptions; import tsptest.methodoverride.models.GroupPartOptions; import tsptest.methodoverride.models.GroupQueryOptions; @@ -58,9 +59,36 @@ public final class MethodOverrideAsyncClient { * NameTypeRequiredDescription * fooStringNoThe foo parameter * barStringNoThe bar parameter + * kindStringNoThe kind parameter. Allowed values: "first", "second". * * You can add these to a request with {@link RequestOptions#addQueryParam} * + * @param options The options parameter. + * @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 the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupQueryWithResponse(GroupQueryOptions options, RequestOptions requestOptions) { + return this.serviceClient.groupQueryWithResponseAsync(options, requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
x-fooStringNoThe foo parameter
x-barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param options The options parameter. * @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. @@ -70,8 +98,8 @@ public final class MethodOverrideAsyncClient { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupQueryWithResponse(RequestOptions requestOptions) { - return this.serviceClient.groupQueryWithResponseAsync(requestOptions); + public Mono> groupHeaderWithResponse(GroupHeaderOptions options, RequestOptions requestOptions) { + return this.serviceClient.groupHeaderWithResponseAsync(options, requestOptions); } /** @@ -198,6 +226,7 @@ public Mono> groupPartETagWithResponse(BinaryData groupPartETagRe * NameTypeRequiredDescription * fooStringNoThe foo parameter * barStringNoThe bar parameter + * kindStringNoThe kind parameter. Allowed values: "first", "second". * * You can add these to a request with {@link RequestOptions#addQueryParam} *

Request Body Schema

@@ -212,6 +241,7 @@ public Mono> groupPartETagWithResponse(BinaryData groupPartETagRe * * * @param body The body parameter. + * @param options The options parameter. * @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. @@ -221,8 +251,9 @@ public Mono> groupPartETagWithResponse(BinaryData groupPartETagRe */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupExcludeBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.groupExcludeBodyWithResponseAsync(body, requestOptions); + public Mono> groupExcludeBodyWithResponse(BinaryData body, GroupQueryOptions options, + RequestOptions requestOptions) { + return this.serviceClient.groupExcludeBodyWithResponseAsync(body, options, requestOptions); } /** @@ -287,15 +318,7 @@ public Mono> groupNoneWithResponse(BinaryData groupNoneRequest, R public Mono groupQuery(GroupQueryOptions options) { // Generated convenience method for groupQueryWithResponse RequestOptions requestOptions = new RequestOptions(); - String foo = options == null ? null : options.getFoo(); - String bar = options == null ? null : options.getBar(); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.addQueryParam("bar", bar, false); - } - return groupQueryWithResponse(requestOptions).flatMap(FluxUtil::toMono); + return groupQueryWithResponse(options, requestOptions).flatMap(FluxUtil::toMono); } /** @@ -313,7 +336,45 @@ public Mono groupQuery(GroupQueryOptions options) { public Mono groupQuery() { // Generated convenience method for groupQueryWithResponse RequestOptions requestOptions = new RequestOptions(); - return groupQueryWithResponse(requestOptions).flatMap(FluxUtil::toMono); + return groupQueryWithResponse(null, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param options The options parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono groupHeader(GroupHeaderOptions options) { + // Generated convenience method for groupHeaderWithResponse + RequestOptions requestOptions = new RequestOptions(); + return groupHeaderWithResponse(options, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * A remote procedure call (RPC) operation. + * + * @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 A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono groupHeader() { + // Generated convenience method for groupHeaderWithResponse + RequestOptions requestOptions = new RequestOptions(); + return groupHeaderWithResponse(null, requestOptions).flatMap(FluxUtil::toMono); } /** @@ -490,15 +551,8 @@ public Mono groupPartETag(String prop1) { public Mono groupExcludeBody(GroupExcludeBodyModel body, GroupQueryOptions options) { // Generated convenience method for groupExcludeBodyWithResponse RequestOptions requestOptions = new RequestOptions(); - String foo = options == null ? null : options.getFoo(); - String bar = options == null ? null : options.getBar(); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.addQueryParam("bar", bar, false); - } - return groupExcludeBodyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + return groupExcludeBodyWithResponse(BinaryData.fromObject(body), options, requestOptions) + .flatMap(FluxUtil::toMono); } /** @@ -518,7 +572,8 @@ public Mono groupExcludeBody(GroupExcludeBodyModel body, GroupQueryOptions public Mono groupExcludeBody(GroupExcludeBodyModel body) { // Generated convenience method for groupExcludeBodyWithResponse RequestOptions requestOptions = new RequestOptions(); - return groupExcludeBodyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + return groupExcludeBodyWithResponse(BinaryData.fromObject(body), null, requestOptions) + .flatMap(FluxUtil::toMono); } /** diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClient.java index c7f2ca77e3b..b5884f6516e 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClient.java @@ -26,6 +26,7 @@ import tsptest.methodoverride.implementation.models.GroupPartRequest; import tsptest.methodoverride.models.GroupAllOptions; import tsptest.methodoverride.models.GroupExcludeBodyModel; +import tsptest.methodoverride.models.GroupHeaderOptions; import tsptest.methodoverride.models.GroupPartETagOptions; import tsptest.methodoverride.models.GroupPartOptions; import tsptest.methodoverride.models.GroupQueryOptions; @@ -56,9 +57,36 @@ public final class MethodOverrideClient { * NameTypeRequiredDescription * fooStringNoThe foo parameter * barStringNoThe bar parameter + * kindStringNoThe kind parameter. Allowed values: "first", "second". * * You can add these to a request with {@link RequestOptions#addQueryParam} * + * @param options The options parameter. + * @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 the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupQueryWithResponse(GroupQueryOptions options, RequestOptions requestOptions) { + return this.serviceClient.groupQueryWithResponse(options, requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
x-fooStringNoThe foo parameter
x-barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param options The options parameter. * @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. @@ -68,8 +96,8 @@ public final class MethodOverrideClient { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupQueryWithResponse(RequestOptions requestOptions) { - return this.serviceClient.groupQueryWithResponse(requestOptions); + public Response groupHeaderWithResponse(GroupHeaderOptions options, RequestOptions requestOptions) { + return this.serviceClient.groupHeaderWithResponse(options, requestOptions); } /** @@ -195,6 +223,7 @@ public Response groupPartETagWithResponse(BinaryData groupPartETagRequest, * NameTypeRequiredDescription * fooStringNoThe foo parameter * barStringNoThe bar parameter + * kindStringNoThe kind parameter. Allowed values: "first", "second". * * You can add these to a request with {@link RequestOptions#addQueryParam} *

Request Body Schema

@@ -209,6 +238,7 @@ public Response groupPartETagWithResponse(BinaryData groupPartETagRequest, * * * @param body The body parameter. + * @param options The options parameter. * @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. @@ -218,8 +248,9 @@ public Response groupPartETagWithResponse(BinaryData groupPartETagRequest, */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupExcludeBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.groupExcludeBodyWithResponse(body, requestOptions); + public Response groupExcludeBodyWithResponse(BinaryData body, GroupQueryOptions options, + RequestOptions requestOptions) { + return this.serviceClient.groupExcludeBodyWithResponse(body, options, requestOptions); } /** @@ -283,15 +314,7 @@ public Response groupNoneWithResponse(BinaryData groupNoneRequest, Request public void groupQuery(GroupQueryOptions options) { // Generated convenience method for groupQueryWithResponse RequestOptions requestOptions = new RequestOptions(); - String foo = options == null ? null : options.getFoo(); - String bar = options == null ? null : options.getBar(); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.addQueryParam("bar", bar, false); - } - groupQueryWithResponse(requestOptions).getValue(); + groupQueryWithResponse(options, requestOptions).getValue(); } /** @@ -308,7 +331,43 @@ public void groupQuery(GroupQueryOptions options) { public void groupQuery() { // Generated convenience method for groupQueryWithResponse RequestOptions requestOptions = new RequestOptions(); - groupQueryWithResponse(requestOptions).getValue(); + groupQueryWithResponse(null, requestOptions).getValue(); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param options The options parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void groupHeader(GroupHeaderOptions options) { + // Generated convenience method for groupHeaderWithResponse + RequestOptions requestOptions = new RequestOptions(); + groupHeaderWithResponse(options, requestOptions).getValue(); + } + + /** + * A remote procedure call (RPC) operation. + * + * @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. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void groupHeader() { + // Generated convenience method for groupHeaderWithResponse + RequestOptions requestOptions = new RequestOptions(); + groupHeaderWithResponse(null, requestOptions).getValue(); } /** @@ -479,15 +538,7 @@ public void groupPartETag(String prop1) { public void groupExcludeBody(GroupExcludeBodyModel body, GroupQueryOptions options) { // Generated convenience method for groupExcludeBodyWithResponse RequestOptions requestOptions = new RequestOptions(); - String foo = options == null ? null : options.getFoo(); - String bar = options == null ? null : options.getBar(); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.addQueryParam("bar", bar, false); - } - groupExcludeBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + groupExcludeBodyWithResponse(BinaryData.fromObject(body), options, requestOptions).getValue(); } /** @@ -506,7 +557,7 @@ public void groupExcludeBody(GroupExcludeBodyModel body, GroupQueryOptions optio public void groupExcludeBody(GroupExcludeBodyModel body) { // Generated convenience method for groupExcludeBodyWithResponse RequestOptions requestOptions = new RequestOptions(); - groupExcludeBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + groupExcludeBodyWithResponse(BinaryData.fromObject(body), null, requestOptions).getValue(); } /** diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java index 88a822d3760..8fa3522823e 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java @@ -20,6 +20,7 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.RetryPolicy; @@ -34,6 +35,9 @@ import com.azure.core.util.serializer.SerializerAdapter; import reactor.core.publisher.Mono; import tsptest.methodoverride.MethodOverrideServiceVersion; +import tsptest.methodoverride.models.GroupHeaderOptions; +import tsptest.methodoverride.models.GroupQueryKind; +import tsptest.methodoverride.models.GroupQueryOptions; /** * Initializes a new instance of the MethodOverrideClient type. @@ -166,6 +170,24 @@ Mono> groupQuery(@HostParam("endpoint") String endpoint, Response groupQuerySync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); + @Get("/group-header") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> groupHeader(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); + + @Get("/group-header") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response groupHeaderSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); + @Post("/group-all") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @@ -277,9 +299,11 @@ Response groupNoneSync(@HostParam("endpoint") String endpoint, * NameTypeRequiredDescription * fooStringNoThe foo parameter * barStringNoThe bar parameter + * kindStringNoThe kind parameter. Allowed values: "first", "second". * * You can add these to a request with {@link RequestOptions#addQueryParam} * + * @param options The options parameter. * @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. @@ -288,9 +312,34 @@ Response groupNoneSync(@HostParam("endpoint") String endpoint, * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupQueryWithResponseAsync(RequestOptions requestOptions) { + public Mono> groupQueryWithResponseAsync(GroupQueryOptions options, RequestOptions requestOptions) { + String fooInternal = null; + if (options != null) { + fooInternal = options.getFoo(); + } + String foo = fooInternal; + String barInternal = null; + if (options != null) { + barInternal = options.getBar(); + } + String bar = barInternal; + GroupQueryKind kindInternal = null; + if (options != null) { + kindInternal = options.getKind(); + } + GroupQueryKind kind = kindInternal; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (foo != null) { + requestOptionsLocal.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptionsLocal.addQueryParam("bar", bar, false); + } + if (kind != null) { + requestOptionsLocal.addQueryParam("kind", kind.toString(), false); + } return FluxUtil.withContext(context -> service.groupQuery(this.getEndpoint(), - this.getServiceVersion().getVersion(), requestOptions, context)); + this.getServiceVersion().getVersion(), requestOptionsLocal, context)); } /** @@ -301,9 +350,104 @@ public Mono> groupQueryWithResponseAsync(RequestOptions requestOp * NameTypeRequiredDescription * fooStringNoThe foo parameter * barStringNoThe bar parameter + * kindStringNoThe kind parameter. Allowed values: "first", "second". * * You can add these to a request with {@link RequestOptions#addQueryParam} * + * @param options The options parameter. + * @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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupQueryWithResponse(GroupQueryOptions options, RequestOptions requestOptions) { + String fooInternal = null; + if (options != null) { + fooInternal = options.getFoo(); + } + String foo = fooInternal; + String barInternal = null; + if (options != null) { + barInternal = options.getBar(); + } + String bar = barInternal; + GroupQueryKind kindInternal = null; + if (options != null) { + kindInternal = options.getKind(); + } + GroupQueryKind kind = kindInternal; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (foo != null) { + requestOptionsLocal.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptionsLocal.addQueryParam("bar", bar, false); + } + if (kind != null) { + requestOptionsLocal.addQueryParam("kind", kind.toString(), false); + } + return service.groupQuerySync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptionsLocal, + Context.NONE); + } + + /** + * A remote procedure call (RPC) operation. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
x-fooStringNoThe foo parameter
x-barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param options The options parameter. + * @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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupHeaderWithResponseAsync(GroupHeaderOptions options, + RequestOptions requestOptions) { + String fooInternal = null; + if (options != null) { + fooInternal = options.getFoo(); + } + String foo = fooInternal; + String barInternal = null; + if (options != null) { + barInternal = options.getBar(); + } + String bar = barInternal; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (foo != null) { + requestOptionsLocal.setHeader(HttpHeaderName.fromString("x-foo"), foo); + } + if (bar != null) { + requestOptionsLocal.setHeader(HttpHeaderName.fromString("x-bar"), bar); + } + return FluxUtil.withContext(context -> service.groupHeader(this.getEndpoint(), + this.getServiceVersion().getVersion(), requestOptionsLocal, context)); + } + + /** + * A remote procedure call (RPC) operation. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
x-fooStringNoThe foo parameter
x-barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param options The options parameter. * @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. @@ -312,8 +456,25 @@ public Mono> groupQueryWithResponseAsync(RequestOptions requestOp * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupQueryWithResponse(RequestOptions requestOptions) { - return service.groupQuerySync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, + public Response groupHeaderWithResponse(GroupHeaderOptions options, RequestOptions requestOptions) { + String fooInternal = null; + if (options != null) { + fooInternal = options.getFoo(); + } + String foo = fooInternal; + String barInternal = null; + if (options != null) { + barInternal = options.getBar(); + } + String bar = barInternal; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (foo != null) { + requestOptionsLocal.setHeader(HttpHeaderName.fromString("x-foo"), foo); + } + if (bar != null) { + requestOptionsLocal.setHeader(HttpHeaderName.fromString("x-bar"), bar); + } + return service.groupHeaderSync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptionsLocal, Context.NONE); } @@ -562,6 +723,7 @@ public Response groupPartETagWithResponse(BinaryData groupPartETagRequest, * NameTypeRequiredDescription * fooStringNoThe foo parameter * barStringNoThe bar parameter + * kindStringNoThe kind parameter. Allowed values: "first", "second". * * You can add these to a request with {@link RequestOptions#addQueryParam} *

Request Body Schema

@@ -576,6 +738,7 @@ public Response groupPartETagWithResponse(BinaryData groupPartETagRequest, * * * @param body The body parameter. + * @param options The options parameter. * @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. @@ -584,10 +747,36 @@ public Response groupPartETagWithResponse(BinaryData groupPartETagRequest, * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupExcludeBodyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + public Mono> groupExcludeBodyWithResponseAsync(BinaryData body, GroupQueryOptions options, + RequestOptions requestOptions) { final String contentType = "application/json"; + String fooInternal = null; + if (options != null) { + fooInternal = options.getFoo(); + } + String foo = fooInternal; + String barInternal = null; + if (options != null) { + barInternal = options.getBar(); + } + String bar = barInternal; + GroupQueryKind kindInternal = null; + if (options != null) { + kindInternal = options.getKind(); + } + GroupQueryKind kind = kindInternal; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (foo != null) { + requestOptionsLocal.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptionsLocal.addQueryParam("bar", bar, false); + } + if (kind != null) { + requestOptionsLocal.addQueryParam("kind", kind.toString(), false); + } return FluxUtil.withContext(context -> service.groupExcludeBody(this.getEndpoint(), - this.getServiceVersion().getVersion(), contentType, body, requestOptions, context)); + this.getServiceVersion().getVersion(), contentType, body, requestOptionsLocal, context)); } /** @@ -598,6 +787,7 @@ public Mono> groupExcludeBodyWithResponseAsync(BinaryData body, R * NameTypeRequiredDescription * fooStringNoThe foo parameter * barStringNoThe bar parameter + * kindStringNoThe kind parameter. Allowed values: "first", "second". * * You can add these to a request with {@link RequestOptions#addQueryParam} *

Request Body Schema

@@ -612,6 +802,7 @@ public Mono> groupExcludeBodyWithResponseAsync(BinaryData body, R * * * @param body The body parameter. + * @param options The options parameter. * @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. @@ -620,10 +811,36 @@ public Mono> groupExcludeBodyWithResponseAsync(BinaryData body, R * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupExcludeBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + public Response groupExcludeBodyWithResponse(BinaryData body, GroupQueryOptions options, + RequestOptions requestOptions) { final String contentType = "application/json"; + String fooInternal = null; + if (options != null) { + fooInternal = options.getFoo(); + } + String foo = fooInternal; + String barInternal = null; + if (options != null) { + barInternal = options.getBar(); + } + String bar = barInternal; + GroupQueryKind kindInternal = null; + if (options != null) { + kindInternal = options.getKind(); + } + GroupQueryKind kind = kindInternal; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (foo != null) { + requestOptionsLocal.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptionsLocal.addQueryParam("bar", bar, false); + } + if (kind != null) { + requestOptionsLocal.addQueryParam("kind", kind.toString(), false); + } return service.groupExcludeBodySync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, - body, requestOptions, Context.NONE); + body, requestOptionsLocal, Context.NONE); } /** diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupHeaderOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupHeaderOptions.java new file mode 100644 index 00000000000..1152830ec82 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupHeaderOptions.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; + +/** + * The GroupHeaderOptions model. + */ +@Fluent +public final class GroupHeaderOptions { + /* + * The x-foo property. + */ + @Generated + private String foo; + + /* + * The x-bar property. + */ + @Generated + private String bar; + + /** + * Creates an instance of GroupHeaderOptions class. + */ + @Generated + public GroupHeaderOptions() { + } + + /** + * Get the foo property: The x-foo property. + * + * @return the foo value. + */ + @Generated + public String getFoo() { + return this.foo; + } + + /** + * Set the foo property: The x-foo property. + * + * @param foo the foo value to set. + * @return the GroupHeaderOptions object itself. + */ + @Generated + public GroupHeaderOptions setFoo(String foo) { + this.foo = foo; + return this; + } + + /** + * Get the bar property: The x-bar property. + * + * @return the bar value. + */ + @Generated + public String getBar() { + return this.bar; + } + + /** + * Set the bar property: The x-bar property. + * + * @param bar the bar value to set. + * @return the GroupHeaderOptions object itself. + */ + @Generated + public GroupHeaderOptions setBar(String bar) { + this.bar = bar; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryKind.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryKind.java new file mode 100644 index 00000000000..2ca47235122 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryKind.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride.models; + +/** + * Defines values for GroupQueryKind. + */ +public enum GroupQueryKind { + /** + * Enum value first. + */ + FIRST("first"), + + /** + * Enum value second. + */ + SECOND("second"); + + /** + * The actual serialized value for a GroupQueryKind instance. + */ + private final String value; + + GroupQueryKind(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a GroupQueryKind instance. + * + * @param value the serialized value to parse. + * @return the parsed GroupQueryKind object, or null if unable to parse. + */ + public static GroupQueryKind fromString(String value) { + if (value == null) { + return null; + } + GroupQueryKind[] items = GroupQueryKind.values(); + for (GroupQueryKind item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java index 394f1fb5147..1f5b89b6f8a 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java @@ -24,6 +24,12 @@ public final class GroupQueryOptions { @Generated private String bar; + /* + * The kind property. + */ + @Generated + private GroupQueryKind kind; + /** * Creates an instance of GroupQueryOptions class. */ @@ -74,4 +80,26 @@ public GroupQueryOptions setBar(String bar) { this.bar = bar; return this; } + + /** + * Get the kind property: The kind property. + * + * @return the kind value. + */ + @Generated + public GroupQueryKind getKind() { + return this.kind; + } + + /** + * Set the kind property: The kind property. + * + * @param kind the kind value to set. + * @return the GroupQueryOptions object itself. + */ + @Generated + public GroupQueryOptions setKind(GroupQueryKind kind) { + this.kind = kind; + return this; + } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/methodoverride/MethodOverrideTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/methodoverride/MethodOverrideTests.java new file mode 100644 index 00000000000..b030ec3e952 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/methodoverride/MethodOverrideTests.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.methodoverride; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.core.util.BinaryData; +import java.util.concurrent.atomic.AtomicReference; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; +import tsptest.methodoverride.implementation.MethodOverrideClientImpl; +import tsptest.methodoverride.models.GroupAllOptions; +import tsptest.methodoverride.models.GroupHeaderOptions; +import tsptest.methodoverride.models.GroupQueryKind; +import tsptest.methodoverride.models.GroupQueryOptions; + +public class MethodOverrideTests { + + @Test + public void protocolMethodsReuseQueryParameterGroup() { + assertProtocolSignatures(MethodOverrideClient.class); + assertProtocolSignatures(MethodOverrideAsyncClient.class); + } + + @Test + public void protocolMethodAddsGroupedQueryParameters() { + AtomicReference queryCaptor = new AtomicReference<>(); + HttpPipeline pipeline = new HttpPipelineBuilder().httpClient(request -> { + queryCaptor.set(request.getUrl().getQuery()); + return Mono.just(new MockHttpResponse(request, 200)); + }).build(); + MethodOverrideClientImpl implementation = new MethodOverrideClientImpl(pipeline, "https://localhost", + MethodOverrideServiceVersion.V2022_12_01_PREVIEW); + MethodOverrideClient client = new MethodOverrideClient(implementation); + + GroupQueryOptions options + = new GroupQueryOptions().setFoo("foo-value").setBar("bar-value").setKind(GroupQueryKind.SECOND); + client.groupQueryWithResponse(options, new RequestOptions()); + + Assertions.assertTrue(queryCaptor.get().contains("foo=foo-value")); + Assertions.assertTrue(queryCaptor.get().contains("bar=bar-value")); + Assertions.assertTrue(queryCaptor.get().contains("kind=second")); + Assertions.assertEquals(1, countOccurrences(queryCaptor.get(), "foo=foo-value")); + Assertions.assertEquals(1, countOccurrences(queryCaptor.get(), "bar=bar-value")); + Assertions.assertEquals(1, countOccurrences(queryCaptor.get(), "kind=second")); + } + + @Test + public void convenienceMethodsForwardQueryParameterGroup() { + AtomicReference queryCaptor = new AtomicReference<>(); + HttpPipeline pipeline = new HttpPipelineBuilder().httpClient(request -> { + queryCaptor.set(request.getUrl().getQuery()); + return Mono.just(new MockHttpResponse(request, 200)); + }).build(); + MethodOverrideClientImpl implementation = new MethodOverrideClientImpl(pipeline, "https://localhost", + MethodOverrideServiceVersion.V2022_12_01_PREVIEW); + GroupQueryOptions options + = new GroupQueryOptions().setFoo("foo-value").setBar("bar-value").setKind(GroupQueryKind.SECOND); + + new MethodOverrideClient(implementation).groupQuery(options); + assertGroupedQuery(queryCaptor.get()); + + new MethodOverrideAsyncClient(implementation).groupQuery(options).block(); + assertGroupedQuery(queryCaptor.get()); + + new MethodOverrideClient(implementation).groupAll(new GroupAllOptions("prop1").setFoo("foo-value")); + Assertions.assertTrue(queryCaptor.get().contains("foo=foo-value")); + } + + @Test + public void protocolAndConvenienceMethodsAddGroupedHeaders() { + AtomicReference fooHeaderCaptor = new AtomicReference<>(); + AtomicReference barHeaderCaptor = new AtomicReference<>(); + HttpPipeline pipeline = new HttpPipelineBuilder().httpClient(request -> { + fooHeaderCaptor.set(request.getHeaders().getValue("x-foo")); + barHeaderCaptor.set(request.getHeaders().getValue("x-bar")); + return Mono.just(new MockHttpResponse(request, 200)); + }).build(); + MethodOverrideClientImpl implementation = new MethodOverrideClientImpl(pipeline, "https://localhost", + MethodOverrideServiceVersion.V2022_12_01_PREVIEW); + GroupHeaderOptions options = new GroupHeaderOptions().setFoo("foo-value").setBar("bar-value"); + + new MethodOverrideClient(implementation).groupHeaderWithResponse(options, new RequestOptions()); + Assertions.assertEquals("foo-value", fooHeaderCaptor.get()); + Assertions.assertEquals("bar-value", barHeaderCaptor.get()); + + new MethodOverrideAsyncClient(implementation).groupHeader(options).block(); + Assertions.assertEquals("foo-value", fooHeaderCaptor.get()); + Assertions.assertEquals("bar-value", barHeaderCaptor.get()); + } + + private static void assertProtocolSignatures(Class clientClass) { + Assertions.assertDoesNotThrow( + () -> clientClass.getMethod("groupQueryWithResponse", GroupQueryOptions.class, RequestOptions.class)); + Assertions.assertDoesNotThrow(() -> clientClass.getMethod("groupExcludeBodyWithResponse", BinaryData.class, + GroupQueryOptions.class, RequestOptions.class)); + Assertions.assertDoesNotThrow( + () -> clientClass.getMethod("groupHeaderWithResponse", GroupHeaderOptions.class, RequestOptions.class)); + } + + private static int countOccurrences(String value, String search) { + return (value.length() - value.replace(search, "").length()) / search.length(); + } + + private static void assertGroupedQuery(String query) { + Assertions.assertTrue(query.contains("foo=foo-value")); + Assertions.assertTrue(query.contains("bar=bar-value")); + Assertions.assertTrue(query.contains("kind=second")); + Assertions.assertEquals(1, countOccurrences(query, "foo=foo-value")); + Assertions.assertEquals(1, countOccurrences(query, "bar=bar-value")); + Assertions.assertEquals(1, countOccurrences(query, "kind=second")); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/tsp/method-override.tsp b/packages/http-client-java/generator/http-client-generator-test/tsp/method-override.tsp index 2b86adb76f1..c96ac5b95c7 100644 --- a/packages/http-client-java/generator/http-client-generator-test/tsp/method-override.tsp +++ b/packages/http-client-java/generator/http-client-generator-test/tsp/method-override.tsp @@ -16,15 +16,30 @@ namespace TspTest.MethodOverride { v2022_12_01_preview: "2022-12-01-preview", } + enum GroupQueryKind { + first, + second, + } + model GroupQueryOptions { @query foo?: string; @query bar?: string; + @query kind?: GroupQueryKind; } @get @route("/group-query") op groupQuery is global.Azure.Core.RpcOperation; + model GroupHeaderOptions { + @header("x-foo") foo?: string; + @header("x-bar") bar?: string; + } + + @get + @route("/group-header") + op groupHeader is global.Azure.Core.RpcOperation; + model GroupAllOptions { @query foo?: string; @query bar?: string; @@ -108,6 +123,10 @@ namespace Customization { options?: TspTest.MethodOverride.GroupQueryOptions, ...ApiVersionParameter, ): void; + op groupHeaderCustomization( + options?: TspTest.MethodOverride.GroupHeaderOptions, + ...ApiVersionParameter, + ): void; op groupAllCustomization( options: TspTest.MethodOverride.GroupAllOptions, ...ApiVersionParameter, @@ -133,6 +152,7 @@ namespace Customization { ): void; @@override(TspTest.MethodOverride.groupQuery, Customization.groupQueryCustomization); + @@override(TspTest.MethodOverride.groupHeader, Customization.groupHeaderCustomization); @@override(TspTest.MethodOverride.groupAll, Customization.groupAllCustomization); @@override(TspTest.MethodOverride.groupPart, Customization.groupPartCustomization); @@override(TspTest.MethodOverride.groupPartETag, Customization.groupPartETagCustomization); From aec93bfe707a03d73b45644f78833b78410da378 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Tue, 25 Aug 2026 21:32:57 +0800 Subject: [PATCH 2/2] fix(http-client-java): regenerate grouped protocol clients Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7234aa71-1588-45aa-9153-87c85896e245 --- .../ClientMethodParameterProcessor.java | 20 ++- .../core/template/ClientMethodTemplate.java | 1 + .../GroupParametersAsyncClient.java | 11 +- .../methodoverride/GroupParametersClient.java | 11 +- .../implementation/GroupParametersImpl.java | 15 +- .../azure/core/traits/TraitsAsyncClient.java | 31 +---- .../java/azure/core/traits/TraitsClient.java | 31 +---- .../implementation/TraitsClientImpl.java | 83 ++++++++++- .../EtagHeadersAsyncClient.java | 55 +++----- .../specialheaders/EtagHeadersClient.java | 49 ++----- .../EtagHeadersOptionalBodyAsyncClient.java | 29 +--- .../EtagHeadersOptionalBodyClient.java | 30 +--- .../implementation/EtagHeadersImpl.java | 129 ++++++++++++++++-- .../EtagHeadersOptionalBodiesImpl.java | 78 ++++++++++- .../tsptest-methodoverride_metadata.json | 2 +- 15 files changed, 362 insertions(+), 213 deletions(-) diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodParameterProcessor.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodParameterProcessor.java index 2e9ea3e1a09..a426306c0f4 100644 --- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodParameterProcessor.java +++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/mapper/ClientMethodParameterProcessor.java @@ -13,6 +13,7 @@ import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ParameterTransformations; import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ProxyMethodParameter; import com.microsoft.typespec.http.client.generator.core.util.MethodUtil; +import com.microsoft.typespec.http.client.generator.core.util.SchemaUtil; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -141,13 +142,22 @@ private static Parameter findProtocolParameterGroup(Parameter parameter, List !parameter.getProxyMethodParameter().isRequired()) .filter(parameter -> { RequestParameterLocation location = parameter.getProxyMethodParameter().getRequestParameterLocation(); return location == RequestParameterLocation.QUERY || location == RequestParameterLocation.HEADER; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersAsyncClient.java index c70d5799f04..30cee7c3038 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersAsyncClient.java @@ -40,8 +40,7 @@ public final class GroupParametersAsyncClient { /** * The group operation. * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. + * @param options The options parameter. * @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. @@ -51,8 +50,8 @@ public final class GroupParametersAsyncClient { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupWithResponse(String param1, String param2, RequestOptions requestOptions) { - return this.serviceClient.groupWithResponseAsync(param1, param2, requestOptions); + public Mono> groupWithResponse(GroupParametersOptions options, RequestOptions requestOptions) { + return this.serviceClient.groupWithResponseAsync(options, requestOptions); } /** @@ -72,8 +71,6 @@ public Mono> groupWithResponse(String param1, String param2, Requ public Mono group(GroupParametersOptions options) { // Generated convenience method for groupWithResponse RequestOptions requestOptions = new RequestOptions(); - String param1 = options.getParam1(); - String param2 = options.getParam2(); - return groupWithResponse(param1, param2, requestOptions).flatMap(FluxUtil::toMono); + return groupWithResponse(options, requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersClient.java index 66d1ae1fe96..541ae6ab3dd 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersClient.java @@ -38,8 +38,7 @@ public final class GroupParametersClient { /** * The group operation. * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. + * @param options The options parameter. * @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. @@ -49,8 +48,8 @@ public final class GroupParametersClient { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupWithResponse(String param1, String param2, RequestOptions requestOptions) { - return this.serviceClient.groupWithResponse(param1, param2, requestOptions); + public Response groupWithResponse(GroupParametersOptions options, RequestOptions requestOptions) { + return this.serviceClient.groupWithResponse(options, requestOptions); } /** @@ -69,8 +68,6 @@ public Response groupWithResponse(String param1, String param2, RequestOpt public void group(GroupParametersOptions options) { // Generated convenience method for groupWithResponse RequestOptions requestOptions = new RequestOptions(); - String param1 = options.getParam1(); - String param2 = options.getParam2(); - groupWithResponse(param1, param2, requestOptions).getValue(); + groupWithResponse(options, requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/GroupParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/GroupParametersImpl.java index f3a671c175e..1182e0e6c65 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/GroupParametersImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/GroupParametersImpl.java @@ -4,6 +4,7 @@ package azure.clientgenerator.core.methodoverride.implementation; +import azure.clientgenerator.core.methodoverride.models.GroupParametersOptions; import com.azure.core.annotation.ExpectedResponses; import com.azure.core.annotation.Get; import com.azure.core.annotation.Host; @@ -78,8 +79,7 @@ Response groupSync(@HostParam("endpoint") String endpoint, @QueryParam("pa /** * The group operation. * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. + * @param options The options parameter. * @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. @@ -88,7 +88,9 @@ Response groupSync(@HostParam("endpoint") String endpoint, @QueryParam("pa * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupWithResponseAsync(String param1, String param2, RequestOptions requestOptions) { + public Mono> groupWithResponseAsync(GroupParametersOptions options, RequestOptions requestOptions) { + String param1 = options.getParam1(); + String param2 = options.getParam2(); return FluxUtil .withContext(context -> service.group(this.client.getEndpoint(), param1, param2, requestOptions, context)); } @@ -96,8 +98,7 @@ public Mono> groupWithResponseAsync(String param1, String param2, /** * The group operation. * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. + * @param options The options parameter. * @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. @@ -106,7 +107,9 @@ public Mono> groupWithResponseAsync(String param1, String param2, * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupWithResponse(String param1, String param2, RequestOptions requestOptions) { + public Response groupWithResponse(GroupParametersOptions options, RequestOptions requestOptions) { + String param1 = options.getParam1(); + String param2 = options.getParam2(); return service.groupSync(this.client.getEndpoint(), param1, param2, requestOptions, Context.NONE); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsAsyncClient.java index 919d76bc449..f5af2605ee5 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsAsyncClient.java @@ -16,14 +16,11 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; import com.azure.core.http.RequestConditions; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; import com.azure.core.util.FluxUtil; -import java.time.OffsetDateTime; import reactor.core.publisher.Mono; /** @@ -83,6 +80,7 @@ public final class TraitsAsyncClient { * * @param id The user's id. * @param foo header in request. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. * @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. @@ -93,8 +91,9 @@ public final class TraitsAsyncClient { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> smokeTestWithResponse(int id, String foo, RequestOptions requestOptions) { - return this.serviceClient.smokeTestWithResponseAsync(id, foo, requestOptions); + public Mono> smokeTestWithResponse(int id, String foo, RequestConditions requestConditions, + RequestOptions requestOptions) { + return this.serviceClient.smokeTestWithResponseAsync(id, foo, requestConditions, requestOptions); } /** @@ -171,25 +170,7 @@ public Mono> repeatableActionWithResponse(int id, BinaryDat public Mono smokeTest(int id, String foo, RequestConditions requestConditions) { // Generated convenience method for smokeTestWithResponse RequestOptions requestOptions = new RequestOptions(); - String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); - String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); - OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); - OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - return smokeTestWithResponse(id, foo, requestOptions).flatMap(FluxUtil::toMono) + return smokeTestWithResponse(id, foo, requestConditions, requestOptions).flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(User.class)); } @@ -211,7 +192,7 @@ public Mono smokeTest(int id, String foo, RequestConditions requestConditi public Mono smokeTest(int id, String foo) { // Generated convenience method for smokeTestWithResponse RequestOptions requestOptions = new RequestOptions(); - return smokeTestWithResponse(id, foo, requestOptions).flatMap(FluxUtil::toMono) + return smokeTestWithResponse(id, foo, null, requestOptions).flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(User.class)); } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClient.java index df0c730eec8..f822d5811d9 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClient.java @@ -16,13 +16,10 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; import com.azure.core.http.RequestConditions; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; /** * Initializes a new instance of the synchronous TraitsClient type. @@ -81,6 +78,7 @@ public final class TraitsClient { * * @param id The user's id. * @param foo header in request. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. * @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. @@ -90,8 +88,9 @@ public final class TraitsClient { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response smokeTestWithResponse(int id, String foo, RequestOptions requestOptions) { - return this.serviceClient.smokeTestWithResponse(id, foo, requestOptions); + public Response smokeTestWithResponse(int id, String foo, RequestConditions requestConditions, + RequestOptions requestOptions) { + return this.serviceClient.smokeTestWithResponse(id, foo, requestConditions, requestOptions); } /** @@ -167,25 +166,7 @@ public Response repeatableActionWithResponse(int id, BinaryData body public User smokeTest(int id, String foo, RequestConditions requestConditions) { // Generated convenience method for smokeTestWithResponse RequestOptions requestOptions = new RequestOptions(); - String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); - String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); - OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); - OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - return smokeTestWithResponse(id, foo, requestOptions).getValue().toObject(User.class); + return smokeTestWithResponse(id, foo, requestConditions, requestOptions).getValue().toObject(User.class); } /** @@ -206,7 +187,7 @@ public User smokeTest(int id, String foo, RequestConditions requestConditions) { public User smokeTest(int id, String foo) { // Generated convenience method for smokeTestWithResponse RequestOptions requestOptions = new RequestOptions(); - return smokeTestWithResponse(id, foo, requestOptions).getValue().toObject(User.class); + return smokeTestWithResponse(id, foo, null, requestOptions).getValue().toObject(User.class); } /** diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/TraitsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/TraitsClientImpl.java index d9bf2fe243c..f13635df23d 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/TraitsClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/TraitsClientImpl.java @@ -25,6 +25,7 @@ import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.RequestConditions; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.http.rest.RequestOptions; @@ -232,6 +233,7 @@ Response repeatableActionSync(@HostParam("endpoint") String endpoint * * @param id The user's id. * @param foo header in request. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. * @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. @@ -241,10 +243,46 @@ Response repeatableActionSync(@HostParam("endpoint") String endpoint * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> smokeTestWithResponseAsync(int id, String foo, RequestOptions requestOptions) { + public Mono> smokeTestWithResponseAsync(int id, String foo, + RequestConditions requestConditions, RequestOptions requestOptions) { final String accept = "application/json"; + String ifMatchInternal = null; + if (requestConditions != null) { + ifMatchInternal = requestConditions.getIfMatch(); + } + String ifMatch = ifMatchInternal; + String ifNoneMatchInternal = null; + if (requestConditions != null) { + ifNoneMatchInternal = requestConditions.getIfNoneMatch(); + } + String ifNoneMatch = ifNoneMatchInternal; + OffsetDateTime ifUnmodifiedSinceInternal = null; + if (requestConditions != null) { + ifUnmodifiedSinceInternal = requestConditions.getIfUnmodifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = ifUnmodifiedSinceInternal; + OffsetDateTime ifModifiedSinceInternal = null; + if (requestConditions != null) { + ifModifiedSinceInternal = requestConditions.getIfModifiedSince(); + } + OffsetDateTime ifModifiedSince = ifModifiedSinceInternal; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (ifMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + if (ifUnmodifiedSince != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + if (ifModifiedSince != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } return FluxUtil.withContext(context -> service.smokeTest(this.getEndpoint(), - this.getServiceVersion().getVersion(), id, foo, accept, requestOptions, context)); + this.getServiceVersion().getVersion(), id, foo, accept, requestOptionsLocal, context)); } /** @@ -286,6 +324,7 @@ public Mono> smokeTestWithResponseAsync(int id, String foo, * * @param id The user's id. * @param foo header in request. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. * @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. @@ -294,10 +333,46 @@ public Mono> smokeTestWithResponseAsync(int id, String foo, * @return a resource, sending and receiving headers along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response smokeTestWithResponse(int id, String foo, RequestOptions requestOptions) { + public Response smokeTestWithResponse(int id, String foo, RequestConditions requestConditions, + RequestOptions requestOptions) { final String accept = "application/json"; + String ifMatchInternal = null; + if (requestConditions != null) { + ifMatchInternal = requestConditions.getIfMatch(); + } + String ifMatch = ifMatchInternal; + String ifNoneMatchInternal = null; + if (requestConditions != null) { + ifNoneMatchInternal = requestConditions.getIfNoneMatch(); + } + String ifNoneMatch = ifNoneMatchInternal; + OffsetDateTime ifUnmodifiedSinceInternal = null; + if (requestConditions != null) { + ifUnmodifiedSinceInternal = requestConditions.getIfUnmodifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = ifUnmodifiedSinceInternal; + OffsetDateTime ifModifiedSinceInternal = null; + if (requestConditions != null) { + ifModifiedSinceInternal = requestConditions.getIfModifiedSince(); + } + OffsetDateTime ifModifiedSince = ifModifiedSinceInternal; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (ifMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + if (ifUnmodifiedSince != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + if (ifModifiedSince != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } return service.smokeTestSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, foo, accept, - requestOptions, Context.NONE); + requestOptionsLocal, Context.NONE); } /** diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersAsyncClient.java index 1206ca51c9c..8619d85c8fd 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersAsyncClient.java @@ -12,7 +12,6 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; import com.azure.core.http.MatchConditions; import com.azure.core.http.RequestConditions; import com.azure.core.http.rest.PagedFlux; @@ -21,9 +20,7 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; import com.azure.core.util.FluxUtil; -import java.time.OffsetDateTime; import java.util.stream.Collectors; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -100,6 +97,7 @@ public final class EtagHeadersAsyncClient { * * @param name The name parameter. * @param resource The resource instance. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. * @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. @@ -110,8 +108,9 @@ public final class EtagHeadersAsyncClient { @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Mono> putWithRequestHeadersWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.putWithRequestHeadersWithResponseAsync(name, resource, requestOptions); + RequestConditions requestConditions, RequestOptions requestOptions) { + return this.serviceClient.putWithRequestHeadersWithResponseAsync(name, resource, requestConditions, + requestOptions); } /** @@ -161,6 +160,7 @@ public Mono> putWithRequestHeadersWithResponse(String name, * * @param name The name parameter. * @param resource The resource instance. + * @param matchConditions Specifies HTTP options for conditional requests. * @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. @@ -171,8 +171,9 @@ public Mono> putWithRequestHeadersWithResponse(String name, @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Mono> patchWithMatchHeadersWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.patchWithMatchHeadersWithResponseAsync(name, resource, requestOptions); + MatchConditions matchConditions, RequestOptions requestOptions) { + return this.serviceClient.patchWithMatchHeadersWithResponseAsync(name, resource, matchConditions, + requestOptions); } /** @@ -222,27 +223,9 @@ public PagedFlux listWithEtag(RequestOptions requestOptions) { public Mono putWithRequestHeaders(String name, Resource resource, RequestConditions requestConditions) { // Generated convenience method for putWithRequestHeadersWithResponse RequestOptions requestOptions = new RequestOptions(); - String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); - String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); - OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); - OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), requestOptions) - .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), requestConditions, + requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); } /** @@ -263,7 +246,7 @@ public Mono putWithRequestHeaders(String name, Resource resource, Requ public Mono putWithRequestHeaders(String name, Resource resource) { // Generated convenience method for putWithRequestHeadersWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), requestOptions) + return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), null, requestOptions) .flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); } @@ -287,20 +270,13 @@ public Mono putWithRequestHeaders(String name, Resource resource) { public Mono patchWithMatchHeaders(String name, Resource resource, MatchConditions matchConditions) { // Generated convenience method for patchWithMatchHeadersWithResponse RequestOptions requestOptions = new RequestOptions(); - String ifMatch = matchConditions == null ? null : matchConditions.getIfMatch(); - String ifNoneMatch = matchConditions == null ? null : matchConditions.getIfNoneMatch(); - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); BinaryData resourceInBinaryData = BinaryData.fromObject(resource); // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. resourceInBinaryData.getLength(); JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); - return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, matchConditions, requestOptions) + .flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); } @@ -327,7 +303,8 @@ public Mono patchWithMatchHeaders(String name, Resource resource) { // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. resourceInBinaryData.getLength(); JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); - return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, null, requestOptions) + .flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersClient.java index a5801eeb798..5afb2aa9327 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersClient.java @@ -12,15 +12,12 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; import com.azure.core.http.MatchConditions; import com.azure.core.http.RequestConditions; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; import tsptest.specialheaders.implementation.EtagHeadersImpl; import tsptest.specialheaders.implementation.JsonMergePatchHelper; import tsptest.specialheaders.models.Resource; @@ -94,6 +91,7 @@ public final class EtagHeadersClient { * * @param name The name parameter. * @param resource The resource instance. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. * @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. @@ -104,8 +102,8 @@ public final class EtagHeadersClient { @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Response putWithRequestHeadersWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.putWithRequestHeadersWithResponse(name, resource, requestOptions); + RequestConditions requestConditions, RequestOptions requestOptions) { + return this.serviceClient.putWithRequestHeadersWithResponse(name, resource, requestConditions, requestOptions); } /** @@ -155,6 +153,7 @@ public Response putWithRequestHeadersWithResponse(String name, Binar * * @param name The name parameter. * @param resource The resource instance. + * @param matchConditions Specifies HTTP options for conditional requests. * @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. @@ -165,8 +164,8 @@ public Response putWithRequestHeadersWithResponse(String name, Binar @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Response patchWithMatchHeadersWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.patchWithMatchHeadersWithResponse(name, resource, requestOptions); + MatchConditions matchConditions, RequestOptions requestOptions) { + return this.serviceClient.patchWithMatchHeadersWithResponse(name, resource, matchConditions, requestOptions); } /** @@ -216,26 +215,8 @@ public PagedIterable listWithEtag(RequestOptions requestOptions) { public Resource putWithRequestHeaders(String name, Resource resource, RequestConditions requestConditions) { // Generated convenience method for putWithRequestHeadersWithResponse RequestOptions requestOptions = new RequestOptions(); - String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); - String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); - OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); - OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), requestOptions).getValue() - .toObject(Resource.class); + return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), requestConditions, + requestOptions).getValue().toObject(Resource.class); } /** @@ -256,7 +237,7 @@ public Resource putWithRequestHeaders(String name, Resource resource, RequestCon public Resource putWithRequestHeaders(String name, Resource resource) { // Generated convenience method for putWithRequestHeadersWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), requestOptions).getValue() + return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), null, requestOptions).getValue() .toObject(Resource.class); } @@ -279,20 +260,12 @@ public Resource putWithRequestHeaders(String name, Resource resource) { public Resource patchWithMatchHeaders(String name, Resource resource, MatchConditions matchConditions) { // Generated convenience method for patchWithMatchHeadersWithResponse RequestOptions requestOptions = new RequestOptions(); - String ifMatch = matchConditions == null ? null : matchConditions.getIfMatch(); - String ifNoneMatch = matchConditions == null ? null : matchConditions.getIfNoneMatch(); - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); BinaryData resourceInBinaryData = BinaryData.fromObject(resource); // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. resourceInBinaryData.getLength(); JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); - return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, requestOptions).getValue() + return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, matchConditions, requestOptions).getValue() .toObject(Resource.class); } @@ -319,7 +292,7 @@ public Resource patchWithMatchHeaders(String name, Resource resource) { // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. resourceInBinaryData.getLength(); JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); - return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, requestOptions).getValue() + return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, null, requestOptions).getValue() .toObject(Resource.class); } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyAsyncClient.java index 642aeefc0ba..d6e394de437 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyAsyncClient.java @@ -17,7 +17,6 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; import com.azure.core.util.FluxUtil; import java.time.OffsetDateTime; import reactor.core.publisher.Mono; @@ -95,6 +94,7 @@ public final class EtagHeadersOptionalBodyAsyncClient { * * * @param format The format parameter. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. * @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. @@ -104,8 +104,9 @@ public final class EtagHeadersOptionalBodyAsyncClient { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithOptionalBodyWithResponse(String format, RequestOptions requestOptions) { - return this.serviceClient.putWithOptionalBodyWithResponseAsync(format, requestOptions); + public Mono> putWithOptionalBodyWithResponse(String format, + RequestConditions requestConditions, RequestOptions requestOptions) { + return this.serviceClient.putWithOptionalBodyWithResponseAsync(format, requestConditions, requestOptions); } /** @@ -130,10 +131,6 @@ public Mono putWithOptionalBody(String format, String filter, OffsetDa RequestConditions requestConditions) { // Generated convenience method for putWithOptionalBodyWithResponse RequestOptions requestOptions = new RequestOptions(); - String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); - String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); - OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); - OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); if (filter != null) { requestOptions.addQueryParam("filter", filter, false); } @@ -143,21 +140,7 @@ public Mono putWithOptionalBody(String format, String filter, OffsetDa if (body != null) { requestOptions.setBody(BinaryData.fromObject(body)); } - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - return putWithOptionalBodyWithResponse(format, requestOptions).flatMap(FluxUtil::toMono) + return putWithOptionalBodyWithResponse(format, requestConditions, requestOptions).flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); } @@ -178,7 +161,7 @@ public Mono putWithOptionalBody(String format, String filter, OffsetDa public Mono putWithOptionalBody(String format) { // Generated convenience method for putWithOptionalBodyWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithOptionalBodyWithResponse(format, requestOptions).flatMap(FluxUtil::toMono) + return putWithOptionalBodyWithResponse(format, null, requestOptions).flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyClient.java index 5b481b428f2..608159a4e69 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyClient.java @@ -17,7 +17,6 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; import java.time.OffsetDateTime; import tsptest.specialheaders.implementation.EtagHeadersOptionalBodiesImpl; import tsptest.specialheaders.models.Resource; @@ -93,6 +92,7 @@ public final class EtagHeadersOptionalBodyClient { * * * @param format The format parameter. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. * @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. @@ -102,8 +102,9 @@ public final class EtagHeadersOptionalBodyClient { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithOptionalBodyWithResponse(String format, RequestOptions requestOptions) { - return this.serviceClient.putWithOptionalBodyWithResponse(format, requestOptions); + public Response putWithOptionalBodyWithResponse(String format, RequestConditions requestConditions, + RequestOptions requestOptions) { + return this.serviceClient.putWithOptionalBodyWithResponse(format, requestConditions, requestOptions); } /** @@ -128,10 +129,6 @@ public Resource putWithOptionalBody(String format, String filter, OffsetDateTime RequestConditions requestConditions) { // Generated convenience method for putWithOptionalBodyWithResponse RequestOptions requestOptions = new RequestOptions(); - String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); - String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); - OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); - OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); if (filter != null) { requestOptions.addQueryParam("filter", filter, false); } @@ -141,21 +138,8 @@ public Resource putWithOptionalBody(String format, String filter, OffsetDateTime if (body != null) { requestOptions.setBody(BinaryData.fromObject(body)); } - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - return putWithOptionalBodyWithResponse(format, requestOptions).getValue().toObject(Resource.class); + return putWithOptionalBodyWithResponse(format, requestConditions, requestOptions).getValue() + .toObject(Resource.class); } /** @@ -175,6 +159,6 @@ public Resource putWithOptionalBody(String format, String filter, OffsetDateTime public Resource putWithOptionalBody(String format) { // Generated convenience method for putWithOptionalBodyWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithOptionalBodyWithResponse(format, requestOptions).getValue().toObject(Resource.class); + return putWithOptionalBodyWithResponse(format, null, requestOptions).getValue().toObject(Resource.class); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersImpl.java index 9cf0db4bbe7..c0794ce144d 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersImpl.java @@ -22,6 +22,9 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.MatchConditions; +import com.azure.core.http.RequestConditions; import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.PagedResponse; @@ -31,7 +34,9 @@ import com.azure.core.http.rest.RestProxy; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; +import com.azure.core.util.DateTimeRfc1123; import com.azure.core.util.FluxUtil; +import java.time.OffsetDateTime; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -217,6 +222,7 @@ Response listWithEtagNextSync(@PathParam(value = "nextLink", encoded * * @param name The name parameter. * @param resource The resource instance. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. * @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. @@ -226,11 +232,46 @@ Response listWithEtagNextSync(@PathParam(value = "nextLink", encoded */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> putWithRequestHeadersWithResponseAsync(String name, BinaryData resource, - RequestOptions requestOptions) { + RequestConditions requestConditions, RequestOptions requestOptions) { final String contentType = "application/json"; final String accept = "application/json"; + String ifMatchInternal = null; + if (requestConditions != null) { + ifMatchInternal = requestConditions.getIfMatch(); + } + String ifMatch = ifMatchInternal; + String ifNoneMatchInternal = null; + if (requestConditions != null) { + ifNoneMatchInternal = requestConditions.getIfNoneMatch(); + } + String ifNoneMatch = ifNoneMatchInternal; + OffsetDateTime ifUnmodifiedSinceInternal = null; + if (requestConditions != null) { + ifUnmodifiedSinceInternal = requestConditions.getIfUnmodifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = ifUnmodifiedSinceInternal; + OffsetDateTime ifModifiedSinceInternal = null; + if (requestConditions != null) { + ifModifiedSinceInternal = requestConditions.getIfModifiedSince(); + } + OffsetDateTime ifModifiedSince = ifModifiedSinceInternal; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (ifMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + if (ifUnmodifiedSince != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + if (ifModifiedSince != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } return FluxUtil.withContext(context -> service.putWithRequestHeaders(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, + this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptionsLocal, context)); } @@ -285,6 +326,7 @@ public Mono> putWithRequestHeadersWithResponseAsync(String * * @param name The name parameter. * @param resource The resource instance. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. * @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. @@ -294,11 +336,46 @@ public Mono> putWithRequestHeadersWithResponseAsync(String */ @ServiceMethod(returns = ReturnType.SINGLE) public Response putWithRequestHeadersWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { + RequestConditions requestConditions, RequestOptions requestOptions) { final String contentType = "application/json"; final String accept = "application/json"; + String ifMatchInternal = null; + if (requestConditions != null) { + ifMatchInternal = requestConditions.getIfMatch(); + } + String ifMatch = ifMatchInternal; + String ifNoneMatchInternal = null; + if (requestConditions != null) { + ifNoneMatchInternal = requestConditions.getIfNoneMatch(); + } + String ifNoneMatch = ifNoneMatchInternal; + OffsetDateTime ifUnmodifiedSinceInternal = null; + if (requestConditions != null) { + ifUnmodifiedSinceInternal = requestConditions.getIfUnmodifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = ifUnmodifiedSinceInternal; + OffsetDateTime ifModifiedSinceInternal = null; + if (requestConditions != null) { + ifModifiedSinceInternal = requestConditions.getIfModifiedSince(); + } + OffsetDateTime ifModifiedSince = ifModifiedSinceInternal; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (ifMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + if (ifUnmodifiedSince != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + if (ifModifiedSince != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } return service.putWithRequestHeadersSync(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, + this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptionsLocal, Context.NONE); } @@ -349,6 +426,7 @@ public Response putWithRequestHeadersWithResponse(String name, Binar * * @param name The name parameter. * @param resource The resource instance. + * @param matchConditions Specifies HTTP options for conditional requests. * @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. @@ -358,11 +436,28 @@ public Response putWithRequestHeadersWithResponse(String name, Binar */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> patchWithMatchHeadersWithResponseAsync(String name, BinaryData resource, - RequestOptions requestOptions) { + MatchConditions matchConditions, RequestOptions requestOptions) { final String contentType = "application/merge-patch+json"; final String accept = "application/json"; + String ifMatchInternal = null; + if (matchConditions != null) { + ifMatchInternal = matchConditions.getIfMatch(); + } + String ifMatch = ifMatchInternal; + String ifNoneMatchInternal = null; + if (matchConditions != null) { + ifNoneMatchInternal = matchConditions.getIfNoneMatch(); + } + String ifNoneMatch = ifNoneMatchInternal; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (ifMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } return FluxUtil.withContext(context -> service.patchWithMatchHeaders(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, + this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptionsLocal, context)); } @@ -413,6 +508,7 @@ public Mono> patchWithMatchHeadersWithResponseAsync(String * * @param name The name parameter. * @param resource The resource instance. + * @param matchConditions Specifies HTTP options for conditional requests. * @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. @@ -422,11 +518,28 @@ public Mono> patchWithMatchHeadersWithResponseAsync(String */ @ServiceMethod(returns = ReturnType.SINGLE) public Response patchWithMatchHeadersWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { + MatchConditions matchConditions, RequestOptions requestOptions) { final String contentType = "application/merge-patch+json"; final String accept = "application/json"; + String ifMatchInternal = null; + if (matchConditions != null) { + ifMatchInternal = matchConditions.getIfMatch(); + } + String ifMatch = ifMatchInternal; + String ifNoneMatchInternal = null; + if (matchConditions != null) { + ifNoneMatchInternal = matchConditions.getIfNoneMatch(); + } + String ifNoneMatch = ifNoneMatchInternal; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (ifMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } return service.patchWithMatchHeadersSync(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, + this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptionsLocal, Context.NONE); } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersOptionalBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersOptionalBodiesImpl.java index 479f4d90c6b..35fa2c8d6fa 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersOptionalBodiesImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersOptionalBodiesImpl.java @@ -19,12 +19,15 @@ import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.RequestConditions; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; +import com.azure.core.util.DateTimeRfc1123; import com.azure.core.util.FluxUtil; +import java.time.OffsetDateTime; import reactor.core.publisher.Mono; import tsptest.specialheaders.SpecialHeadersServiceVersion; @@ -143,6 +146,7 @@ Response putWithOptionalBodySync(@HostParam("endpoint") String endpo * * * @param format The format parameter. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. * @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. @@ -152,14 +156,48 @@ Response putWithOptionalBodySync(@HostParam("endpoint") String endpo */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> putWithOptionalBodyWithResponseAsync(String format, - RequestOptions requestOptions) { + RequestConditions requestConditions, RequestOptions requestOptions) { final String accept = "application/json"; + String ifMatchInternal = null; + if (requestConditions != null) { + ifMatchInternal = requestConditions.getIfMatch(); + } + String ifMatch = ifMatchInternal; + String ifNoneMatchInternal = null; + if (requestConditions != null) { + ifNoneMatchInternal = requestConditions.getIfNoneMatch(); + } + String ifNoneMatch = ifNoneMatchInternal; + OffsetDateTime ifUnmodifiedSinceInternal = null; + if (requestConditions != null) { + ifUnmodifiedSinceInternal = requestConditions.getIfUnmodifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = ifUnmodifiedSinceInternal; + OffsetDateTime ifModifiedSinceInternal = null; + if (requestConditions != null) { + ifModifiedSinceInternal = requestConditions.getIfModifiedSince(); + } + OffsetDateTime ifModifiedSince = ifModifiedSinceInternal; RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; requestOptionsLocal.addRequestCallback(requestLocal -> { if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); } }); + if (ifMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + if (ifUnmodifiedSince != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + if (ifModifiedSince != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } return FluxUtil.withContext(context -> service.putWithOptionalBody(this.client.getEndpoint(), format, accept, requestOptionsLocal, context)); } @@ -217,6 +255,7 @@ public Mono> putWithOptionalBodyWithResponseAsync(String fo * * * @param format The format parameter. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. * @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. @@ -225,14 +264,49 @@ public Mono> putWithOptionalBodyWithResponseAsync(String fo * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithOptionalBodyWithResponse(String format, RequestOptions requestOptions) { + public Response putWithOptionalBodyWithResponse(String format, RequestConditions requestConditions, + RequestOptions requestOptions) { final String accept = "application/json"; + String ifMatchInternal = null; + if (requestConditions != null) { + ifMatchInternal = requestConditions.getIfMatch(); + } + String ifMatch = ifMatchInternal; + String ifNoneMatchInternal = null; + if (requestConditions != null) { + ifNoneMatchInternal = requestConditions.getIfNoneMatch(); + } + String ifNoneMatch = ifNoneMatchInternal; + OffsetDateTime ifUnmodifiedSinceInternal = null; + if (requestConditions != null) { + ifUnmodifiedSinceInternal = requestConditions.getIfUnmodifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = ifUnmodifiedSinceInternal; + OffsetDateTime ifModifiedSinceInternal = null; + if (requestConditions != null) { + ifModifiedSinceInternal = requestConditions.getIfModifiedSince(); + } + OffsetDateTime ifModifiedSince = ifModifiedSinceInternal; RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; requestOptionsLocal.addRequestCallback(requestLocal -> { if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); } }); + if (ifMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + if (ifUnmodifiedSince != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + if (ifModifiedSince != null) { + requestOptionsLocal.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } return service.putWithOptionalBodySync(this.client.getEndpoint(), format, accept, requestOptionsLocal, Context.NONE); } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_metadata.json index 801a2d515d3..9ac948c317f 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_metadata.json +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_metadata.json @@ -1 +1 @@ -{"flavor":"Azure","apiVersions":{"TspTest.MethodOverride":"2022-12-01-preview"},"crossLanguagePackageId":"TspTest.MethodOverride","crossLanguageVersion":"0471789f86d4","crossLanguageDefinitions":{"tsptest.methodoverride.MethodOverrideAsyncClient":"TspTest.MethodOverride","tsptest.methodoverride.MethodOverrideAsyncClient.groupAll":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideAsyncClient.groupAllWithResponse":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideAsyncClient.groupExcludeBody":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideAsyncClient.groupExcludeBodyWithResponse":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideAsyncClient.groupNone":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideAsyncClient.groupNoneWithResponse":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideAsyncClient.groupPart":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideAsyncClient.groupPartETag":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideAsyncClient.groupPartETagWithResponse":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideAsyncClient.groupPartWithResponse":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideAsyncClient.groupQuery":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideAsyncClient.groupQueryWithResponse":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideClient":"TspTest.MethodOverride","tsptest.methodoverride.MethodOverrideClient.groupAll":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideClient.groupAllWithResponse":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideClient.groupExcludeBody":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideClient.groupExcludeBodyWithResponse":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideClient.groupNone":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideClient.groupNoneWithResponse":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideClient.groupPart":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideClient.groupPartETag":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideClient.groupPartETagWithResponse":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideClient.groupPartWithResponse":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideClient.groupQuery":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideClient.groupQueryWithResponse":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideClientBuilder":"TspTest.MethodOverride","tsptest.methodoverride.implementation.models.GroupAllRequest":"TspTest.MethodOverride.groupAll.Request.anonymous","tsptest.methodoverride.implementation.models.GroupNoneRequest":"TspTest.MethodOverride.groupNone.Request.anonymous","tsptest.methodoverride.implementation.models.GroupPartETagRequest":"TspTest.MethodOverride.groupPartETag.Request.anonymous","tsptest.methodoverride.implementation.models.GroupPartRequest":"TspTest.MethodOverride.groupPart.Request.anonymous","tsptest.methodoverride.models.GroupAllOptions":null,"tsptest.methodoverride.models.GroupExcludeBodyModel":"TspTest.MethodOverride.GroupExcludeBodyModel","tsptest.methodoverride.models.GroupPartETagOptions":null,"tsptest.methodoverride.models.GroupPartOptions":null,"tsptest.methodoverride.models.GroupQueryOptions":null},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java","src/main/java/tsptest/methodoverride/MethodOverrideClient.java","src/main/java/tsptest/methodoverride/MethodOverrideClientBuilder.java","src/main/java/tsptest/methodoverride/MethodOverrideServiceVersion.java","src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java","src/main/java/tsptest/methodoverride/implementation/models/GroupAllRequest.java","src/main/java/tsptest/methodoverride/implementation/models/GroupNoneRequest.java","src/main/java/tsptest/methodoverride/implementation/models/GroupPartETagRequest.java","src/main/java/tsptest/methodoverride/implementation/models/GroupPartRequest.java","src/main/java/tsptest/methodoverride/implementation/models/package-info.java","src/main/java/tsptest/methodoverride/implementation/package-info.java","src/main/java/tsptest/methodoverride/models/GroupAllOptions.java","src/main/java/tsptest/methodoverride/models/GroupExcludeBodyModel.java","src/main/java/tsptest/methodoverride/models/GroupPartETagOptions.java","src/main/java/tsptest/methodoverride/models/GroupPartOptions.java","src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java","src/main/java/tsptest/methodoverride/models/package-info.java","src/main/java/tsptest/methodoverride/package-info.java"]} \ No newline at end of file +{"flavor":"Azure","apiVersions":{"TspTest.MethodOverride":"2022-12-01-preview"},"crossLanguagePackageId":"TspTest.MethodOverride","crossLanguageVersion":"a03c2afaee27","crossLanguageDefinitions":{"tsptest.methodoverride.MethodOverrideAsyncClient":"TspTest.MethodOverride","tsptest.methodoverride.MethodOverrideAsyncClient.groupAll":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideAsyncClient.groupAllWithResponse":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideAsyncClient.groupExcludeBody":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideAsyncClient.groupExcludeBodyWithResponse":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideAsyncClient.groupHeader":"TspTest.MethodOverride.groupHeader","tsptest.methodoverride.MethodOverrideAsyncClient.groupHeaderWithResponse":"TspTest.MethodOverride.groupHeader","tsptest.methodoverride.MethodOverrideAsyncClient.groupNone":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideAsyncClient.groupNoneWithResponse":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideAsyncClient.groupPart":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideAsyncClient.groupPartETag":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideAsyncClient.groupPartETagWithResponse":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideAsyncClient.groupPartWithResponse":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideAsyncClient.groupQuery":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideAsyncClient.groupQueryWithResponse":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideClient":"TspTest.MethodOverride","tsptest.methodoverride.MethodOverrideClient.groupAll":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideClient.groupAllWithResponse":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideClient.groupExcludeBody":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideClient.groupExcludeBodyWithResponse":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideClient.groupHeader":"TspTest.MethodOverride.groupHeader","tsptest.methodoverride.MethodOverrideClient.groupHeaderWithResponse":"TspTest.MethodOverride.groupHeader","tsptest.methodoverride.MethodOverrideClient.groupNone":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideClient.groupNoneWithResponse":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideClient.groupPart":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideClient.groupPartETag":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideClient.groupPartETagWithResponse":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideClient.groupPartWithResponse":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideClient.groupQuery":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideClient.groupQueryWithResponse":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideClientBuilder":"TspTest.MethodOverride","tsptest.methodoverride.implementation.models.GroupAllRequest":"TspTest.MethodOverride.groupAll.Request.anonymous","tsptest.methodoverride.implementation.models.GroupNoneRequest":"TspTest.MethodOverride.groupNone.Request.anonymous","tsptest.methodoverride.implementation.models.GroupPartETagRequest":"TspTest.MethodOverride.groupPartETag.Request.anonymous","tsptest.methodoverride.implementation.models.GroupPartRequest":"TspTest.MethodOverride.groupPart.Request.anonymous","tsptest.methodoverride.models.GroupAllOptions":null,"tsptest.methodoverride.models.GroupExcludeBodyModel":"TspTest.MethodOverride.GroupExcludeBodyModel","tsptest.methodoverride.models.GroupHeaderOptions":null,"tsptest.methodoverride.models.GroupPartETagOptions":null,"tsptest.methodoverride.models.GroupPartOptions":null,"tsptest.methodoverride.models.GroupQueryKind":"TspTest.MethodOverride.GroupQueryKind","tsptest.methodoverride.models.GroupQueryOptions":null},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java","src/main/java/tsptest/methodoverride/MethodOverrideClient.java","src/main/java/tsptest/methodoverride/MethodOverrideClientBuilder.java","src/main/java/tsptest/methodoverride/MethodOverrideServiceVersion.java","src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java","src/main/java/tsptest/methodoverride/implementation/models/GroupAllRequest.java","src/main/java/tsptest/methodoverride/implementation/models/GroupNoneRequest.java","src/main/java/tsptest/methodoverride/implementation/models/GroupPartETagRequest.java","src/main/java/tsptest/methodoverride/implementation/models/GroupPartRequest.java","src/main/java/tsptest/methodoverride/implementation/models/package-info.java","src/main/java/tsptest/methodoverride/implementation/package-info.java","src/main/java/tsptest/methodoverride/models/GroupAllOptions.java","src/main/java/tsptest/methodoverride/models/GroupExcludeBodyModel.java","src/main/java/tsptest/methodoverride/models/GroupHeaderOptions.java","src/main/java/tsptest/methodoverride/models/GroupPartETagOptions.java","src/main/java/tsptest/methodoverride/models/GroupPartOptions.java","src/main/java/tsptest/methodoverride/models/GroupQueryKind.java","src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java","src/main/java/tsptest/methodoverride/models/package-info.java","src/main/java/tsptest/methodoverride/package-info.java"]} \ No newline at end of file