Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[AutoPR azure-ai-vision-face] [Face] Enable stream-style-serialization #11161

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ Mono<Response<BinaryData>> createLivenessWithVerifySessionWithResponse(BinaryDat
* }
* }</pre>
*
* @param createLivenessWithVerifySessionContent Request of liveness with verify session creation.
* @param body Request content of liveness with verify session creation.
* @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.
Expand All @@ -451,12 +451,11 @@ Mono<Response<BinaryData>> createLivenessWithVerifySessionWithResponse(BinaryDat
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<BinaryData>> createLivenessWithVerifySessionWithVerifyImageWithResponse(
BinaryData createLivenessWithVerifySessionContent, RequestOptions requestOptions) {
Mono<Response<BinaryData>> createLivenessWithVerifySessionWithVerifyImageWithResponse(BinaryData body,
RequestOptions requestOptions) {
// Protocol API requires serialization of parts with content-disposition and data, as operation
// 'createLivenessWithVerifySessionWithVerifyImage' is 'multipart/form-data'
return this.serviceClient.createLivenessWithVerifySessionWithVerifyImageWithResponseAsync(
createLivenessWithVerifySessionContent, requestOptions);
return this.serviceClient.createLivenessWithVerifySessionWithVerifyImageWithResponseAsync(body, requestOptions);
}

/**
Expand Down Expand Up @@ -944,7 +943,7 @@ Mono<CreateLivenessWithVerifySessionResult> createLivenessWithVerifySession(Crea
*
* Recommended Option: VerifyImage is provided during session creation.
*
* @param createLivenessWithVerifySessionContent Request of liveness with verify session creation.
* @param body Request content of liveness with verify session creation.
* @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.
Expand All @@ -956,17 +955,17 @@ Mono<CreateLivenessWithVerifySessionResult> createLivenessWithVerifySession(Crea
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<CreateLivenessWithVerifySessionResult> createLivenessWithVerifySessionWithVerifyImage(
CreateLivenessWithVerifySessionContent createLivenessWithVerifySessionContent) {
Mono<CreateLivenessWithVerifySessionResult>
createLivenessWithVerifySessionWithVerifyImage(CreateLivenessWithVerifySessionContent body) {
// Generated convenience method for createLivenessWithVerifySessionWithVerifyImageWithResponse
RequestOptions requestOptions = new RequestOptions();
return createLivenessWithVerifySessionWithVerifyImageWithResponse(new MultipartFormDataHelper(requestOptions)
.serializeJsonField("Parameters", createLivenessWithVerifySessionContent.getParameters())
.serializeFileField("VerifyImage", createLivenessWithVerifySessionContent.getVerifyImage().getContent(),
createLivenessWithVerifySessionContent.getVerifyImage().getContentType(),
createLivenessWithVerifySessionContent.getVerifyImage().getFilename())
.end()
.getRequestBody(), requestOptions).flatMap(FluxUtil::toMono)
return createLivenessWithVerifySessionWithVerifyImageWithResponse(
new MultipartFormDataHelper(requestOptions).serializeJsonField("Parameters", body.getParameters())
.serializeFileField("VerifyImage", body.getVerifyImage().getContent(),
body.getVerifyImage().getContentType(), body.getVerifyImage().getFilename())
.end()
.getRequestBody(),
requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(CreateLivenessWithVerifySessionResult.class));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ Response<BinaryData> createLivenessWithVerifySessionWithResponse(BinaryData body
* }
* }</pre>
*
* @param createLivenessWithVerifySessionContent Request of liveness with verify session creation.
* @param body Request content of liveness with verify session creation.
* @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.
Expand All @@ -441,12 +441,11 @@ Response<BinaryData> createLivenessWithVerifySessionWithResponse(BinaryData body
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
Response<BinaryData> createLivenessWithVerifySessionWithVerifyImageWithResponse(
BinaryData createLivenessWithVerifySessionContent, RequestOptions requestOptions) {
Response<BinaryData> createLivenessWithVerifySessionWithVerifyImageWithResponse(BinaryData body,
RequestOptions requestOptions) {
// Protocol API requires serialization of parts with content-disposition and data, as operation
// 'createLivenessWithVerifySessionWithVerifyImage' is 'multipart/form-data'
return this.serviceClient.createLivenessWithVerifySessionWithVerifyImageWithResponse(
createLivenessWithVerifySessionContent, requestOptions);
return this.serviceClient.createLivenessWithVerifySessionWithVerifyImageWithResponse(body, requestOptions);
}

/**
Expand Down Expand Up @@ -927,7 +926,7 @@ CreateLivenessWithVerifySessionResult createLivenessWithVerifySession(CreateLive
*
* Recommended Option: VerifyImage is provided during session creation.
*
* @param createLivenessWithVerifySessionContent Request of liveness with verify session creation.
* @param body Request content of liveness with verify session creation.
* @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.
Expand All @@ -938,17 +937,17 @@ CreateLivenessWithVerifySessionResult createLivenessWithVerifySession(CreateLive
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
CreateLivenessWithVerifySessionResult createLivenessWithVerifySessionWithVerifyImage(
CreateLivenessWithVerifySessionContent createLivenessWithVerifySessionContent) {
CreateLivenessWithVerifySessionResult
createLivenessWithVerifySessionWithVerifyImage(CreateLivenessWithVerifySessionContent body) {
// Generated convenience method for createLivenessWithVerifySessionWithVerifyImageWithResponse
RequestOptions requestOptions = new RequestOptions();
return createLivenessWithVerifySessionWithVerifyImageWithResponse(new MultipartFormDataHelper(requestOptions)
.serializeJsonField("Parameters", createLivenessWithVerifySessionContent.getParameters())
.serializeFileField("VerifyImage", createLivenessWithVerifySessionContent.getVerifyImage().getContent(),
createLivenessWithVerifySessionContent.getVerifyImage().getContentType(),
createLivenessWithVerifySessionContent.getVerifyImage().getFilename())
.end()
.getRequestBody(), requestOptions).getValue().toObject(CreateLivenessWithVerifySessionResult.class);
return createLivenessWithVerifySessionWithVerifyImageWithResponse(
new MultipartFormDataHelper(requestOptions).serializeJsonField("Parameters", body.getParameters())
.serializeFileField("VerifyImage", body.getVerifyImage().getContent(),
body.getVerifyImage().getContentType(), body.getVerifyImage().getFilename())
.end()
.getRequestBody(),
requestOptions).getValue().toObject(CreateLivenessWithVerifySessionResult.class);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,7 @@ Response<BinaryData> createLivenessWithVerifySessionSync(@HostParam("endpoint")
Mono<Response<BinaryData>> createLivenessWithVerifySessionWithVerifyImage(
@HostParam("endpoint") String endpoint, @HostParam("apiVersion") String apiVersion,
@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept,
@BodyParam("multipart/form-data") BinaryData createLivenessWithVerifySessionContent,
RequestOptions requestOptions, Context context);
@BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context);

// @Multipart not supported by RestProxy
@Post("/detectLivenessWithVerify/singleModal/sessions")
Expand All @@ -294,8 +293,7 @@ Mono<Response<BinaryData>> createLivenessWithVerifySessionWithVerifyImage(
@UnexpectedResponseExceptionType(HttpResponseException.class)
Response<BinaryData> createLivenessWithVerifySessionWithVerifyImageSync(@HostParam("endpoint") String endpoint,
@HostParam("apiVersion") String apiVersion, @HeaderParam("Content-Type") String contentType,
@HeaderParam("accept") String accept,
@BodyParam("multipart/form-data") BinaryData createLivenessWithVerifySessionContent,
@HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body,
RequestOptions requestOptions, Context context);

@Delete("/detectLivenessWithVerify/singleModal/sessions/{sessionId}")
Expand Down Expand Up @@ -1127,7 +1125,7 @@ public Response<BinaryData> createLivenessWithVerifySessionWithResponse(BinaryDa
* }
* }</pre>
*
* @param createLivenessWithVerifySessionContent Request of liveness with verify session creation.
* @param body Request content of liveness with verify session creation.
* @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.
Expand All @@ -1137,14 +1135,13 @@ public Response<BinaryData> createLivenessWithVerifySessionWithResponse(BinaryDa
* on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<BinaryData>> createLivenessWithVerifySessionWithVerifyImageWithResponseAsync(
BinaryData createLivenessWithVerifySessionContent, RequestOptions requestOptions) {
public Mono<Response<BinaryData>> createLivenessWithVerifySessionWithVerifyImageWithResponseAsync(BinaryData body,
RequestOptions requestOptions) {
final String contentType = "multipart/form-data";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createLivenessWithVerifySessionWithVerifyImage(this.getEndpoint(),
this.getServiceVersion().getVersion(), contentType, accept, createLivenessWithVerifySessionContent,
requestOptions, context));
this.getServiceVersion().getVersion(), contentType, accept, body, requestOptions, context));
}

/**
Expand Down Expand Up @@ -1188,7 +1185,7 @@ public Mono<Response<BinaryData>> createLivenessWithVerifySessionWithVerifyImage
* }
* }</pre>
*
* @param createLivenessWithVerifySessionContent Request of liveness with verify session creation.
* @param body Request content of liveness with verify session creation.
* @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.
Expand All @@ -1197,13 +1194,12 @@ public Mono<Response<BinaryData>> createLivenessWithVerifySessionWithVerifyImage
* @return response of liveness session with verify creation with verify image provided along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<BinaryData> createLivenessWithVerifySessionWithVerifyImageWithResponse(
BinaryData createLivenessWithVerifySessionContent, RequestOptions requestOptions) {
public Response<BinaryData> createLivenessWithVerifySessionWithVerifyImageWithResponse(BinaryData body,
RequestOptions requestOptions) {
final String contentType = "multipart/form-data";
final String accept = "application/json";
return service.createLivenessWithVerifySessionWithVerifyImageSync(this.getEndpoint(),
this.getServiceVersion().getVersion(), contentType, accept, createLivenessWithVerifySessionContent,
requestOptions, Context.NONE);
this.getServiceVersion().getVersion(), contentType, accept, body, requestOptions, Context.NONE);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
* The DetectFromUrlImplRequest model.
*/
@Immutable
public final class DetectFromUrlImplRequest {
public final class DetectFromUrlImplRequest implements JsonSerializable<DetectFromUrlImplRequest> {

/*
* URL of input image.
*/
@Generated
@JsonProperty(value = "url")
private final String url;

/**
Expand All @@ -27,8 +29,7 @@ public final class DetectFromUrlImplRequest {
* @param url the url value to set.
*/
@Generated
@JsonCreator
public DetectFromUrlImplRequest(@JsonProperty(value = "url") String url) {
public DetectFromUrlImplRequest(String url) {
this.url = url;
}

Expand All @@ -41,4 +42,41 @@ public DetectFromUrlImplRequest(@JsonProperty(value = "url") String url) {
public String getUrl() {
return this.url;
}

/**
* {@inheritDoc}
*/
@Generated
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("url", this.url);
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of DetectFromUrlImplRequest from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DetectFromUrlImplRequest if the JsonReader was pointing to an instance of it, or null if
* it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the DetectFromUrlImplRequest.
*/
@Generated
public static DetectFromUrlImplRequest fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
String url = null;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("url".equals(fieldName)) {
url = reader.getString();
} else {
reader.skipChildren();
}
}
return new DetectFromUrlImplRequest(url);
});
}
}
Loading