diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AIVisionFaceModelFactory.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AIVisionFaceModelFactory.cs
index 3c74552a2652..75986f605713 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AIVisionFaceModelFactory.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/AIVisionFaceModelFactory.cs
@@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
namespace Azure.AI.Vision.Face
@@ -299,239 +300,265 @@ public static FaceIdentificationCandidate FaceIdentificationCandidate(Guid perso
/// Initializes a new instance of .
/// Type of liveness mode the client should follow.
- /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented.
/// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body.
/// Whether or not store the session image.
- /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen.
+ /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen.
/// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null.
/// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600.
+ /// The number of times a client can attempt a liveness check using the same authToken. Default value is 1. Maximum value is 3.
/// A new instance for mocking.
- public static CreateLivenessSessionContent CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode = default, bool? sendResultsToClient = null, bool? deviceCorrelationIdSetInClient = null, bool? enableSessionImage = null, LivenessModel? livenessSingleModalModel = null, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null)
+ public static CreateLivenessSessionContent CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode = default, bool? deviceCorrelationIdSetInClient = null, bool? enableSessionImage = null, LivenessModel? livenessModelVersion = null, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null, int? numberOfClientAttemptsAllowed = null)
{
return new CreateLivenessSessionContent(
livenessOperationMode,
- sendResultsToClient,
deviceCorrelationIdSetInClient,
enableSessionImage,
- livenessSingleModalModel,
+ livenessModelVersion,
deviceCorrelationId,
authTokenTimeToLiveInSeconds,
+ numberOfClientAttemptsAllowed,
serializedAdditionalRawData: null);
}
- /// Initializes a new instance of .
- /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation.
- /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable.
- /// A new instance for mocking.
- public static CreateLivenessSessionResult CreateLivenessSessionResult(string sessionId = null, string authToken = null)
- {
- return new CreateLivenessSessionResult(sessionId, authToken, serializedAdditionalRawData: null);
- }
-
/// Initializes a new instance of .
- /// The unique ID to reference this session.
- /// DateTime when this session was created.
- /// DateTime when this session was started by the client.
- /// Whether or not the session is expired.
- /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null.
- /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600.
+ /// The unique ID to reference this session.
+ /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable.
/// The current status of the session.
- /// The latest session audit result only populated if status == 'ResultAvailable'.
+ /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen.
+ /// Denotes if the abuse monitoring feature was enabled during this session.
+ /// The results of the liveness session.
/// A new instance for mocking.
- public static LivenessSession LivenessSession(string id = null, DateTimeOffset createdDateTime = default, DateTimeOffset? sessionStartDateTime = null, bool sessionExpired = default, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null, FaceSessionStatus status = default, LivenessSessionAuditEntry result = null)
+ public static LivenessSession LivenessSession(string sessionId = null, string authToken = null, OperationState status = default, LivenessModel? modelVersion = null, bool? isAbuseMonitoringEnabled = null, LivenessSessionResults results = null)
{
return new LivenessSession(
- id,
- createdDateTime,
- sessionStartDateTime,
- sessionExpired,
- deviceCorrelationId,
- authTokenTimeToLiveInSeconds,
+ sessionId,
+ authToken,
status,
- result,
+ modelVersion,
+ isAbuseMonitoringEnabled,
+ results,
serializedAdditionalRawData: null);
}
- /// Initializes a new instance of .
- /// The unique id to refer to this audit request. Use this id with the 'start' query parameter to continue on to the next page of audit results.
- /// The unique sessionId of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding session DELETE operation.
- /// The unique requestId that is returned by the service to the client in the 'apim-request-id' header.
- /// The unique clientRequestId that is sent by the client in the 'client-request-id' header.
- /// The UTC DateTime that the request was received.
- /// The request of this entry.
- /// The response of this entry.
- /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution.
- /// The image ID of the session request.
- /// The sha256 hash of the verify-image in the request.
- /// A new instance for mocking.
- public static LivenessSessionAuditEntry LivenessSessionAuditEntry(long id = default, string sessionId = null, string requestId = null, string clientRequestId = null, DateTimeOffset receivedDateTime = default, AuditRequestInfo request = null, AuditLivenessResponseInfo response = null, string digest = null, string sessionImageId = null, string verifyImageHash = null)
+ /// Initializes a new instance of .
+ /// The attempts data of underlying liveness call with the session.
+ /// A new instance for mocking.
+ public static LivenessSessionResults LivenessSessionResults(IEnumerable attempts = null)
{
- return new LivenessSessionAuditEntry(
- id,
- sessionId,
- requestId,
- clientRequestId,
- receivedDateTime,
- request,
- response,
- digest,
- sessionImageId,
- verifyImageHash,
- serializedAdditionalRawData: null);
- }
+ attempts ??= new List();
- /// Initializes a new instance of .
- /// The relative URL and query of the liveness request.
- /// The HTTP method of the request (i.e., GET, POST, DELETE).
- /// The length of the request body in bytes.
- /// The content type of the request.
- /// The user agent used to submit the request.
- /// A new instance for mocking.
- public static AuditRequestInfo AuditRequestInfo(string url = null, string method = null, long? contentLength = null, string contentType = null, string userAgent = null)
- {
- return new AuditRequestInfo(
- url,
- method,
- contentLength,
- contentType,
- userAgent,
- serializedAdditionalRawData: null);
+ return new LivenessSessionResults(attempts?.ToList(), serializedAdditionalRawData: null);
}
- /// Initializes a new instance of .
- /// The response body. The schema of this field will depend on the request.url and request.method used by the client.
- /// The HTTP status code returned to the client.
- /// The server measured latency for this request in milliseconds.
- /// A new instance for mocking.
- public static AuditLivenessResponseInfo AuditLivenessResponseInfo(LivenessResponseBody body = null, int statusCode = default, long latencyInMilliseconds = default)
+ /// Initializes a new instance of .
+ /// The attempt ID, start from 1.
+ /// The status of the attempt.
+ /// The result of the liveness call, will be null if there is error.
+ /// The error of the liveness call, will be null if there is result.
+ /// The client information gathered during the liveness attempt.
+ /// The abuse monitoring result for the liveness attempt.
+ /// A new instance for mocking.
+ public static LivenessSessionAttempt LivenessSessionAttempt(int attemptId = default, OperationState attemptStatus = default, LivenessResult result = null, LivenessError error = null, IEnumerable clientInformation = null, AbuseMonitoringResult abuseMonitoringResult = null)
{
- return new AuditLivenessResponseInfo(body, statusCode, latencyInMilliseconds, serializedAdditionalRawData: null);
+ clientInformation ??= new List();
+
+ return new LivenessSessionAttempt(
+ attemptId,
+ attemptStatus,
+ result,
+ error,
+ clientInformation?.ToList(),
+ abuseMonitoringResult,
+ serializedAdditionalRawData: null);
}
- /// Initializes a new instance of .
+ /// Initializes a new instance of .
/// The liveness classification for the target face.
- /// Specific targets used for liveness classification.
- /// The model version used for liveness classification.
- /// The face verification output. Only available when the request is liveness with verify.
- /// Additional Properties.
- /// A new instance for mocking.
- public static LivenessResponseBody LivenessResponseBody(FaceLivenessDecision? livenessDecision = null, LivenessOutputsTarget target = null, LivenessModel? modelVersionUsed = null, LivenessWithVerifyOutputs verifyResult = null, IReadOnlyDictionary additionalProperties = null)
+ /// Targets used for liveness classification.
+ /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution.
+ /// The image ID of the session request.
+ /// A new instance for mocking.
+ public static LivenessResult LivenessResult(FaceLivenessDecision? livenessDecision = null, LivenessDecisionTargets targets = null, string digest = null, string sessionImageId = null)
{
- additionalProperties ??= new Dictionary();
+ return new LivenessResult(livenessDecision, targets, digest, sessionImageId, serializedAdditionalRawData: null);
+ }
- return new LivenessResponseBody(livenessDecision, target, modelVersionUsed, verifyResult, additionalProperties);
+ /// Initializes a new instance of .
+ /// The target from color image used for liveness classification.
+ /// A new instance for mocking.
+ public static LivenessDecisionTargets LivenessDecisionTargets(LivenessColorDecisionTarget color = null)
+ {
+ return new LivenessDecisionTargets(color, serializedAdditionalRawData: null);
}
- /// Initializes a new instance of .
+ /// Initializes a new instance of .
/// The face region where the liveness classification was made on.
- /// The file name which contains the face rectangle where the liveness classification was made on.
- /// The time offset within the file of the frame which contains the face rectangle where the liveness classification was made on.
- /// The image type which contains the face rectangle where the liveness classification was made on.
- /// A new instance for mocking.
- public static LivenessOutputsTarget LivenessOutputsTarget(FaceRectangle faceRectangle = null, string fileName = null, int timeOffsetWithinFile = default, FaceImageType imageType = default)
+ /// A new instance for mocking.
+ public static LivenessColorDecisionTarget LivenessColorDecisionTarget(FaceRectangle faceRectangle = null)
{
- return new LivenessOutputsTarget(faceRectangle, fileName, timeOffsetWithinFile, imageType, serializedAdditionalRawData: null);
+ return new LivenessColorDecisionTarget(faceRectangle, serializedAdditionalRawData: null);
}
- /// Initializes a new instance of .
- /// The detail of face for verification.
- /// The target face liveness face and comparison image face verification confidence.
- /// Whether the target liveness face and comparison image face match.
- /// A new instance for mocking.
- public static LivenessWithVerifyOutputs LivenessWithVerifyOutputs(LivenessWithVerifyImage verifyImage = null, float matchConfidence = default, bool isIdentical = default)
+ /// Initializes a new instance of .
+ /// The error code.
+ /// The error message.
+ /// Targets used for liveness classification.
+ /// A new instance for mocking.
+ public static LivenessError LivenessError(string code = null, string message = null, LivenessDecisionTargets targets = null)
{
- return new LivenessWithVerifyOutputs(verifyImage, matchConfidence, isIdentical, serializedAdditionalRawData: null);
+ return new LivenessError(code, message, targets, serializedAdditionalRawData: null);
}
- /// Initializes a new instance of .
- /// The face region where the comparison image's classification was made.
- /// Quality of face image for recognition.
- /// A new instance for mocking.
- public static LivenessWithVerifyImage LivenessWithVerifyImage(FaceRectangle faceRectangle = null, QualityForRecognition qualityForRecognition = default)
+ /// Initializes a new instance of .
+ /// The client ip address seen during the liveness attempt.
+ /// A new instance for mocking.
+ public static ClientInformation ClientInformation(string ip = null)
{
- return new LivenessWithVerifyImage(faceRectangle, qualityForRecognition, serializedAdditionalRawData: null);
+ return new ClientInformation(ip, serializedAdditionalRawData: null);
}
- /// Initializes a new instance of .
- /// The unique ID to reference this session.
- /// DateTime when this session was created.
- /// DateTime when this session was started by the client.
- /// Whether or not the session is expired.
- /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null.
- /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600.
- /// A new instance for mocking.
- public static LivenessSessionItem LivenessSessionItem(string id = null, DateTimeOffset createdDateTime = default, DateTimeOffset? sessionStartDateTime = null, bool sessionExpired = default, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null)
+ /// Initializes a new instance of .
+ /// Denotes if abuse detection triggered during this liveness attempt.
+ /// Denotes if abuse detection triggered during this liveness attempt.
+ /// A new instance for mocking.
+ public static AbuseMonitoringResult AbuseMonitoringResult(bool isAbuseDetected = default, IEnumerable otherFlaggedSessions = null)
{
- return new LivenessSessionItem(
- id,
- createdDateTime,
- sessionStartDateTime,
- sessionExpired,
- deviceCorrelationId,
- authTokenTimeToLiveInSeconds,
- serializedAdditionalRawData: null);
+ otherFlaggedSessions ??= new List();
+
+ return new AbuseMonitoringResult(isAbuseDetected, otherFlaggedSessions?.ToList(), serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The attempt ID, start from 1.
+ /// The unique session ID of the flagged session.
+ /// The image ID from the flagged session.
+ /// A new instance for mocking.
+ public static OtherFlaggedSessions OtherFlaggedSessions(int attemptId = default, string sessionId = null, string sessionImageId = null)
+ {
+ return new OtherFlaggedSessions(attemptId, sessionId, sessionImageId, serializedAdditionalRawData: null);
}
/// Initializes a new instance of .
/// Type of liveness mode the client should follow.
- /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented.
/// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body.
/// Whether or not store the session image.
- /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen.
+ /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen.
+ /// Whether or not return the verify image hash.
+ /// Threshold for confidence of the face verification. Please refer to the documentation for more details. https://learn.microsoft.com/legal/cognitive-services/face/characteristics-and-limitations?context=%2Fazure%2Fai-services%2Fcomputer-vision%2Fcontext%2Fcontext#recognition-confidence-score.
+ /// The image stream for verify. Content-Disposition header field for this part must have filename.
/// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null.
/// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600.
- /// Whether or not return the verify image hash.
- /// Threshold for confidence of the face verification.
+ /// The number of times a client can attempt a liveness check using the same authToken. Default value is 1. Maximum value is 3.
/// A new instance for mocking.
- public static CreateLivenessWithVerifySessionContent CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode = default, bool? sendResultsToClient = null, bool? deviceCorrelationIdSetInClient = null, bool? enableSessionImage = null, LivenessModel? livenessSingleModalModel = null, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null, bool? returnVerifyImageHash = null, float? verifyConfidenceThreshold = null)
+ public static CreateLivenessWithVerifySessionContent CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode = default, bool? deviceCorrelationIdSetInClient = null, bool? enableSessionImage = null, LivenessModel? livenessModelVersion = null, bool? returnVerifyImageHash = null, float? verifyConfidenceThreshold = null, Stream verifyImage = null, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null, int? numberOfClientAttemptsAllowed = null)
{
return new CreateLivenessWithVerifySessionContent(
livenessOperationMode,
- sendResultsToClient,
deviceCorrelationIdSetInClient,
enableSessionImage,
- livenessSingleModalModel,
- deviceCorrelationId,
- authTokenTimeToLiveInSeconds,
+ livenessModelVersion,
returnVerifyImageHash,
verifyConfidenceThreshold,
+ verifyImage,
+ deviceCorrelationId,
+ authTokenTimeToLiveInSeconds,
+ numberOfClientAttemptsAllowed,
serializedAdditionalRawData: null);
}
- /// Initializes a new instance of .
- /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation.
- /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable.
- /// The detail of face for verification.
- /// A new instance for mocking.
- public static CreateLivenessWithVerifySessionResult CreateLivenessWithVerifySessionResult(string sessionId = null, string authToken = null, LivenessWithVerifyImage verifyImage = null)
- {
- return new CreateLivenessWithVerifySessionResult(sessionId, authToken, verifyImage, serializedAdditionalRawData: null);
- }
-
/// Initializes a new instance of .
- /// The unique ID to reference this session.
- /// DateTime when this session was created.
- /// DateTime when this session was started by the client.
- /// Whether or not the session is expired.
- /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null.
- /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600.
+ /// The unique ID to reference this session.
+ /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable.
/// The current status of the session.
- /// The latest session audit result only populated if status == 'ResultAvailable'.
+ /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen.
+ /// Denotes if the abuse monitoring feature was enabled during this session.
+ /// The results of the liveness with verify session.
/// A new instance for mocking.
- public static LivenessWithVerifySession LivenessWithVerifySession(string id = null, DateTimeOffset createdDateTime = default, DateTimeOffset? sessionStartDateTime = null, bool sessionExpired = default, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null, FaceSessionStatus status = default, LivenessSessionAuditEntry result = null)
+ public static LivenessWithVerifySession LivenessWithVerifySession(string sessionId = null, string authToken = null, OperationState status = default, LivenessModel? modelVersion = null, bool? isAbuseMonitoringEnabled = null, LivenessWithVerifySessionResults results = null)
{
return new LivenessWithVerifySession(
- id,
- createdDateTime,
- sessionStartDateTime,
- sessionExpired,
- deviceCorrelationId,
- authTokenTimeToLiveInSeconds,
+ sessionId,
+ authToken,
status,
+ modelVersion,
+ isAbuseMonitoringEnabled,
+ results,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The references used for face verification.
+ /// The attempts data of underlying liveness with verify call with the session.
+ /// A new instance for mocking.
+ public static LivenessWithVerifySessionResults LivenessWithVerifySessionResults(IEnumerable verifyReferences = null, IEnumerable attempts = null)
+ {
+ verifyReferences ??= new List();
+ attempts ??= new List();
+
+ return new LivenessWithVerifySessionResults(verifyReferences?.ToList(), attempts?.ToList(), serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The image type which contains the face rectangle where the liveness classification was made on.
+ /// The face region where the comparison image's classification was made.
+ /// Quality of face image for recognition.
+ /// A new instance for mocking.
+ public static LivenessWithVerifyReference LivenessWithVerifyReference(FaceImageType referenceType = default, FaceRectangle faceRectangle = null, QualityForRecognition qualityForRecognition = default)
+ {
+ return new LivenessWithVerifyReference(referenceType, faceRectangle, qualityForRecognition, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The attempt ID, start from 1.
+ /// The status of the attempt.
+ /// The result of the liveness with verify call, will be null if there is error.
+ /// The error of the liveness with verify call, will be null if there is result.
+ /// The client information gathered during the liveness attempt.
+ /// The abuse monitoring result for the liveness attempt.
+ /// A new instance for mocking.
+ public static LivenessWithVerifySessionAttempt LivenessWithVerifySessionAttempt(int attemptId = default, OperationState attemptStatus = default, LivenessWithVerifyResult result = null, LivenessError error = null, IEnumerable clientInformation = null, AbuseMonitoringResult abuseMonitoringResult = null)
+ {
+ clientInformation ??= new List();
+
+ return new LivenessWithVerifySessionAttempt(
+ attemptId,
+ attemptStatus,
result,
+ error,
+ clientInformation?.ToList(),
+ abuseMonitoringResult,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The liveness classification for the target face.
+ /// Targets used for liveness classification.
+ /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution.
+ /// The image ID of the session request.
+ /// The face verification output. Only available when the request is liveness with verify.
+ /// The sha256 hash of the verify-image in the request.
+ /// A new instance for mocking.
+ public static LivenessWithVerifyResult LivenessWithVerifyResult(FaceLivenessDecision? livenessDecision = null, LivenessDecisionTargets targets = null, string digest = null, string sessionImageId = null, LivenessWithVerifyOutputs verifyResult = null, string verifyImageHash = null)
+ {
+ return new LivenessWithVerifyResult(
+ livenessDecision,
+ targets,
+ digest,
+ sessionImageId,
+ verifyResult,
+ verifyImageHash,
serializedAdditionalRawData: null);
}
+ /// Initializes a new instance of .
+ /// The target face liveness face and comparison image face verification confidence.
+ /// Whether the target liveness face and comparison image face match.
+ /// A new instance for mocking.
+ public static LivenessWithVerifyOutputs LivenessWithVerifyOutputs(float matchConfidence = default, bool isIdentical = default)
+ {
+ return new LivenessWithVerifyOutputs(matchConfidence, isIdentical, serializedAdditionalRawData: null);
+ }
+
/// Initializes a new instance of .
/// User defined name, maximum length is 128.
/// Optional user defined data. Length should not exceed 16K.
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AbuseMonitoringResult.Serialization.cs
similarity index 59%
rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.Serialization.cs
rename to sdk/face/Azure.AI.Vision.Face/src/Generated/AbuseMonitoringResult.Serialization.cs
index fe769e9deb54..0b1090d1ddc4 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.Serialization.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/AbuseMonitoringResult.Serialization.cs
@@ -13,11 +13,11 @@
namespace Azure.AI.Vision.Face
{
- public partial class LivenessOutputsTarget : IUtf8JsonSerializable, IJsonModel
+ public partial class AbuseMonitoringResult : IUtf8JsonSerializable, IJsonModel
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
- void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
writer.WriteStartObject();
JsonModelWriteCore(writer, options);
@@ -28,20 +28,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW
/// The client options for reading and writing models.
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
- throw new FormatException($"The model {nameof(LivenessOutputsTarget)} does not support writing '{format}' format.");
+ throw new FormatException($"The model {nameof(AbuseMonitoringResult)} does not support writing '{format}' format.");
}
- writer.WritePropertyName("faceRectangle"u8);
- writer.WriteObjectValue(FaceRectangle, options);
- writer.WritePropertyName("fileName"u8);
- writer.WriteStringValue(FileName);
- writer.WritePropertyName("timeOffsetWithinFile"u8);
- writer.WriteNumberValue(TimeOffsetWithinFile);
- writer.WritePropertyName("imageType"u8);
- writer.WriteStringValue(ImageType.ToString());
+ writer.WritePropertyName("isAbuseDetected"u8);
+ writer.WriteBooleanValue(IsAbuseDetected);
+ writer.WritePropertyName("otherFlaggedSessions"u8);
+ writer.WriteStartArray();
+ foreach (var item in OtherFlaggedSessions)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
if (options.Format != "W" && _serializedAdditionalRawData != null)
{
foreach (var item in _serializedAdditionalRawData)
@@ -59,19 +60,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
}
}
- LivenessOutputsTarget IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ AbuseMonitoringResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
- throw new FormatException($"The model {nameof(LivenessOutputsTarget)} does not support reading '{format}' format.");
+ throw new FormatException($"The model {nameof(AbuseMonitoringResult)} does not support reading '{format}' format.");
}
using JsonDocument document = JsonDocument.ParseValue(ref reader);
- return DeserializeLivenessOutputsTarget(document.RootElement, options);
+ return DeserializeAbuseMonitoringResult(document.RootElement, options);
}
- internal static LivenessOutputsTarget DeserializeLivenessOutputsTarget(JsonElement element, ModelReaderWriterOptions options = null)
+ internal static AbuseMonitoringResult DeserializeAbuseMonitoringResult(JsonElement element, ModelReaderWriterOptions options = null)
{
options ??= ModelSerializationExtensions.WireOptions;
@@ -79,32 +80,25 @@ internal static LivenessOutputsTarget DeserializeLivenessOutputsTarget(JsonEleme
{
return null;
}
- FaceRectangle faceRectangle = default;
- string fileName = default;
- int timeOffsetWithinFile = default;
- FaceImageType imageType = default;
+ bool isAbuseDetected = default;
+ IReadOnlyList otherFlaggedSessions = default;
IDictionary serializedAdditionalRawData = default;
Dictionary rawDataDictionary = new Dictionary();
foreach (var property in element.EnumerateObject())
{
- if (property.NameEquals("faceRectangle"u8))
- {
- faceRectangle = FaceRectangle.DeserializeFaceRectangle(property.Value, options);
- continue;
- }
- if (property.NameEquals("fileName"u8))
+ if (property.NameEquals("isAbuseDetected"u8))
{
- fileName = property.Value.GetString();
+ isAbuseDetected = property.Value.GetBoolean();
continue;
}
- if (property.NameEquals("timeOffsetWithinFile"u8))
+ if (property.NameEquals("otherFlaggedSessions"u8))
{
- timeOffsetWithinFile = property.Value.GetInt32();
- continue;
- }
- if (property.NameEquals("imageType"u8))
- {
- imageType = new FaceImageType(property.Value.GetString());
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(Face.OtherFlaggedSessions.DeserializeOtherFlaggedSessions(item, options));
+ }
+ otherFlaggedSessions = array;
continue;
}
if (options.Format != "W")
@@ -113,46 +107,46 @@ internal static LivenessOutputsTarget DeserializeLivenessOutputsTarget(JsonEleme
}
}
serializedAdditionalRawData = rawDataDictionary;
- return new LivenessOutputsTarget(faceRectangle, fileName, timeOffsetWithinFile, imageType, serializedAdditionalRawData);
+ return new AbuseMonitoringResult(isAbuseDetected, otherFlaggedSessions, serializedAdditionalRawData);
}
- BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
switch (format)
{
case "J":
return ModelReaderWriter.Write(this, options);
default:
- throw new FormatException($"The model {nameof(LivenessOutputsTarget)} does not support writing '{options.Format}' format.");
+ throw new FormatException($"The model {nameof(AbuseMonitoringResult)} does not support writing '{options.Format}' format.");
}
}
- LivenessOutputsTarget IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ AbuseMonitoringResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
switch (format)
{
case "J":
{
using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
- return DeserializeLivenessOutputsTarget(document.RootElement, options);
+ return DeserializeAbuseMonitoringResult(document.RootElement, options);
}
default:
- throw new FormatException($"The model {nameof(LivenessOutputsTarget)} does not support reading '{options.Format}' format.");
+ throw new FormatException($"The model {nameof(AbuseMonitoringResult)} does not support reading '{options.Format}' format.");
}
}
- string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
/// Deserializes the model from a raw response.
/// The response to deserialize the model from.
- internal static LivenessOutputsTarget FromResponse(Response response)
+ internal static AbuseMonitoringResult FromResponse(Response response)
{
using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
- return DeserializeLivenessOutputsTarget(document.RootElement);
+ return DeserializeAbuseMonitoringResult(document.RootElement);
}
/// Convert into a .
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AbuseMonitoringResult.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AbuseMonitoringResult.cs
new file mode 100644
index 000000000000..1b5aac8fe065
--- /dev/null
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/AbuseMonitoringResult.cs
@@ -0,0 +1,82 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Azure.AI.Vision.Face
+{
+ /// The abuse monitoring result for the liveness attempt.
+ public partial class AbuseMonitoringResult
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// Denotes if abuse detection triggered during this liveness attempt.
+ /// Denotes if abuse detection triggered during this liveness attempt.
+ /// is null.
+ internal AbuseMonitoringResult(bool isAbuseDetected, IEnumerable otherFlaggedSessions)
+ {
+ Argument.AssertNotNull(otherFlaggedSessions, nameof(otherFlaggedSessions));
+
+ IsAbuseDetected = isAbuseDetected;
+ OtherFlaggedSessions = otherFlaggedSessions.ToList();
+ }
+
+ /// Initializes a new instance of .
+ /// Denotes if abuse detection triggered during this liveness attempt.
+ /// Denotes if abuse detection triggered during this liveness attempt.
+ /// Keeps track of any properties unknown to the library.
+ internal AbuseMonitoringResult(bool isAbuseDetected, IReadOnlyList otherFlaggedSessions, IDictionary serializedAdditionalRawData)
+ {
+ IsAbuseDetected = isAbuseDetected;
+ OtherFlaggedSessions = otherFlaggedSessions;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AbuseMonitoringResult()
+ {
+ }
+
+ /// Denotes if abuse detection triggered during this liveness attempt.
+ public bool IsAbuseDetected { get; }
+ /// Denotes if abuse detection triggered during this liveness attempt.
+ public IReadOnlyList OtherFlaggedSessions { get; }
+ }
+}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.cs
deleted file mode 100644
index 3448b284f8e3..000000000000
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-//
-
-#nullable disable
-
-using System;
-using System.Collections.Generic;
-
-namespace Azure.AI.Vision.Face
-{
- /// Audit entry for a response in the session.
- public partial class AuditLivenessResponseInfo
- {
- ///
- /// Keeps track of any properties unknown to the library.
- ///
- /// To assign an object to the value of this property use .
- ///
- ///
- /// To assign an already formatted json string to this property use .
- ///
- ///
- /// Examples:
- ///
- /// -
- /// BinaryData.FromObjectAsJson("foo")
- /// Creates a payload of "foo".
- ///
- /// -
- /// BinaryData.FromString("\"foo\"")
- /// Creates a payload of "foo".
- ///
- /// -
- /// BinaryData.FromObjectAsJson(new { key = "value" })
- /// Creates a payload of { "key": "value" }.
- ///
- /// -
- /// BinaryData.FromString("{\"key\": \"value\"}")
- /// Creates a payload of { "key": "value" }.
- ///
- ///
- ///
- ///
- private IDictionary _serializedAdditionalRawData;
-
- /// Initializes a new instance of .
- /// The response body. The schema of this field will depend on the request.url and request.method used by the client.
- /// The HTTP status code returned to the client.
- /// The server measured latency for this request in milliseconds.
- /// is null.
- internal AuditLivenessResponseInfo(LivenessResponseBody body, int statusCode, long latencyInMilliseconds)
- {
- Argument.AssertNotNull(body, nameof(body));
-
- Body = body;
- StatusCode = statusCode;
- LatencyInMilliseconds = latencyInMilliseconds;
- }
-
- /// Initializes a new instance of .
- /// The response body. The schema of this field will depend on the request.url and request.method used by the client.
- /// The HTTP status code returned to the client.
- /// The server measured latency for this request in milliseconds.
- /// Keeps track of any properties unknown to the library.
- internal AuditLivenessResponseInfo(LivenessResponseBody body, int statusCode, long latencyInMilliseconds, IDictionary serializedAdditionalRawData)
- {
- Body = body;
- StatusCode = statusCode;
- LatencyInMilliseconds = latencyInMilliseconds;
- _serializedAdditionalRawData = serializedAdditionalRawData;
- }
-
- /// Initializes a new instance of for deserialization.
- internal AuditLivenessResponseInfo()
- {
- }
-
- /// The response body. The schema of this field will depend on the request.url and request.method used by the client.
- public LivenessResponseBody Body { get; }
- /// The HTTP status code returned to the client.
- public int StatusCode { get; }
- /// The server measured latency for this request in milliseconds.
- public long LatencyInMilliseconds { get; }
- }
-}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.cs
deleted file mode 100644
index 39356d1eb8f8..000000000000
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-//
-
-#nullable disable
-
-using System;
-using System.Collections.Generic;
-
-namespace Azure.AI.Vision.Face
-{
- /// Audit entry for a request in the session.
- public partial class AuditRequestInfo
- {
- ///
- /// Keeps track of any properties unknown to the library.
- ///
- /// To assign an object to the value of this property use .
- ///
- ///
- /// To assign an already formatted json string to this property use .
- ///
- ///
- /// Examples:
- ///
- /// -
- /// BinaryData.FromObjectAsJson("foo")
- /// Creates a payload of "foo".
- ///
- /// -
- /// BinaryData.FromString("\"foo\"")
- /// Creates a payload of "foo".
- ///
- /// -
- /// BinaryData.FromObjectAsJson(new { key = "value" })
- /// Creates a payload of { "key": "value" }.
- ///
- /// -
- /// BinaryData.FromString("{\"key\": \"value\"}")
- /// Creates a payload of { "key": "value" }.
- ///
- ///
- ///
- ///
- private IDictionary _serializedAdditionalRawData;
-
- /// Initializes a new instance of .
- /// The relative URL and query of the liveness request.
- /// The HTTP method of the request (i.e., GET, POST, DELETE).
- /// The content type of the request.
- /// , or is null.
- internal AuditRequestInfo(string url, string method, string contentType)
- {
- Argument.AssertNotNull(url, nameof(url));
- Argument.AssertNotNull(method, nameof(method));
- Argument.AssertNotNull(contentType, nameof(contentType));
-
- Url = url;
- Method = method;
- ContentType = contentType;
- }
-
- /// Initializes a new instance of .
- /// The relative URL and query of the liveness request.
- /// The HTTP method of the request (i.e., GET, POST, DELETE).
- /// The length of the request body in bytes.
- /// The content type of the request.
- /// The user agent used to submit the request.
- /// Keeps track of any properties unknown to the library.
- internal AuditRequestInfo(string url, string method, long? contentLength, string contentType, string userAgent, IDictionary serializedAdditionalRawData)
- {
- Url = url;
- Method = method;
- ContentLength = contentLength;
- ContentType = contentType;
- UserAgent = userAgent;
- _serializedAdditionalRawData = serializedAdditionalRawData;
- }
-
- /// Initializes a new instance of for deserialization.
- internal AuditRequestInfo()
- {
- }
-
- /// The relative URL and query of the liveness request.
- public string Url { get; }
- /// The HTTP method of the request (i.e., GET, POST, DELETE).
- public string Method { get; }
- /// The length of the request body in bytes.
- public long? ContentLength { get; }
- /// The content type of the request.
- public string ContentType { get; }
- /// The user agent used to submit the request.
- public string UserAgent { get; }
- }
-}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AzureAIVisionFaceClientOptions.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AzureAIVisionFaceClientOptions.cs
index a27f25f2a008..c7d76b5a29d7 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AzureAIVisionFaceClientOptions.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/AzureAIVisionFaceClientOptions.cs
@@ -13,7 +13,7 @@ namespace Azure.AI.Vision.Face
/// Client options for Azure.AI.Vision.Face library clients.
public partial class AzureAIVisionFaceClientOptions : ClientOptions
{
- private const ServiceVersion LatestVersion = ServiceVersion.V1_2_Preview_1;
+ private const ServiceVersion LatestVersion = ServiceVersion.V1_3_Preview_1;
/// The version of the service to use.
public enum ServiceVersion
@@ -22,6 +22,10 @@ public enum ServiceVersion
V1_1_Preview_1 = 1,
/// Service version "v1.2-preview.1".
V1_2_Preview_1 = 2,
+ /// Service version "v1.2".
+ V1_2 = 3,
+ /// Service version "v1.3-preview.1".
+ V1_3_Preview_1 = 4,
}
internal string Version { get; }
@@ -33,6 +37,8 @@ public AzureAIVisionFaceClientOptions(ServiceVersion version = LatestVersion)
{
ServiceVersion.V1_1_Preview_1 => "v1.1-preview.1",
ServiceVersion.V1_2_Preview_1 => "v1.2-preview.1",
+ ServiceVersion.V1_2 => "v1.2",
+ ServiceVersion.V1_3_Preview_1 => "v1.3-preview.1",
_ => throw new NotSupportedException()
};
}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/ClientInformation.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/ClientInformation.Serialization.cs
new file mode 100644
index 000000000000..85ed547a6565
--- /dev/null
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/ClientInformation.Serialization.cs
@@ -0,0 +1,142 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.Vision.Face
+{
+ public partial class ClientInformation : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ writer.WriteStartObject();
+ JsonModelWriteCore(writer, options);
+ writer.WriteEndObject();
+ }
+
+ /// The JSON writer.
+ /// The client options for reading and writing models.
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(ClientInformation)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("ip"u8);
+ writer.WriteStringValue(Ip);
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ ClientInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(ClientInformation)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeClientInformation(document.RootElement, options);
+ }
+
+ internal static ClientInformation DeserializeClientInformation(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string ip = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("ip"u8))
+ {
+ ip = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new ClientInformation(ip, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(ClientInformation)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ ClientInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeClientInformation(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(ClientInformation)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static ClientInformation FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeClientInformation(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/ClientInformation.cs
similarity index 52%
rename from sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.cs
rename to sdk/face/Azure.AI.Vision.Face/src/Generated/ClientInformation.cs
index 972c14733528..401e1c8b4760 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/ClientInformation.cs
@@ -7,12 +7,11 @@
using System;
using System.Collections.Generic;
-using System.IO;
namespace Azure.AI.Vision.Face
{
- /// Request of liveness with verify session creation.
- internal partial class CreateLivenessWithVerifySessionMultipartContent
+ /// The client information gathered during the liveness attempt.
+ public partial class ClientInformation
{
///
/// Keeps track of any properties unknown to the library.
@@ -46,38 +45,31 @@ internal partial class CreateLivenessWithVerifySessionMultipartContent
///
private IDictionary _serializedAdditionalRawData;
- /// Initializes a new instance of .
- /// The parameters for creating session.
- /// The image stream for verify. Content-Disposition header field for this part must have filename.
- /// or is null.
- public CreateLivenessWithVerifySessionMultipartContent(CreateLivenessWithVerifySessionContent parameters, Stream verifyImage)
+ /// Initializes a new instance of .
+ /// The client ip address seen during the liveness attempt.
+ /// is null.
+ internal ClientInformation(string ip)
{
- Argument.AssertNotNull(parameters, nameof(parameters));
- Argument.AssertNotNull(verifyImage, nameof(verifyImage));
+ Argument.AssertNotNull(ip, nameof(ip));
- Parameters = parameters;
- VerifyImage = verifyImage;
+ Ip = ip;
}
- /// Initializes a new instance of .
- /// The parameters for creating session.
- /// The image stream for verify. Content-Disposition header field for this part must have filename.
+ /// Initializes a new instance of .
+ /// The client ip address seen during the liveness attempt.
/// Keeps track of any properties unknown to the library.
- internal CreateLivenessWithVerifySessionMultipartContent(CreateLivenessWithVerifySessionContent parameters, Stream verifyImage, IDictionary serializedAdditionalRawData)
+ internal ClientInformation(string ip, IDictionary serializedAdditionalRawData)
{
- Parameters = parameters;
- VerifyImage = verifyImage;
+ Ip = ip;
_serializedAdditionalRawData = serializedAdditionalRawData;
}
- /// Initializes a new instance of for deserialization.
- internal CreateLivenessWithVerifySessionMultipartContent()
+ /// Initializes a new instance of for deserialization.
+ internal ClientInformation()
{
}
- /// The parameters for creating session.
- public CreateLivenessWithVerifySessionContent Parameters { get; }
- /// The image stream for verify. Content-Disposition header field for this part must have filename.
- public Stream VerifyImage { get; }
+ /// The client ip address seen during the liveness attempt.
+ public string Ip { get; }
}
}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.Serialization.cs
index 4c6879d0bbf9..0eea74723eef 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.Serialization.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.Serialization.cs
@@ -36,11 +36,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
writer.WritePropertyName("livenessOperationMode"u8);
writer.WriteStringValue(LivenessOperationMode.ToString());
- if (Optional.IsDefined(SendResultsToClient))
- {
- writer.WritePropertyName("sendResultsToClient"u8);
- writer.WriteBooleanValue(SendResultsToClient.Value);
- }
if (Optional.IsDefined(DeviceCorrelationIdSetInClient))
{
writer.WritePropertyName("deviceCorrelationIdSetInClient"u8);
@@ -51,10 +46,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
writer.WritePropertyName("enableSessionImage"u8);
writer.WriteBooleanValue(EnableSessionImage.Value);
}
- if (Optional.IsDefined(LivenessSingleModalModel))
+ if (Optional.IsDefined(LivenessModelVersion))
{
- writer.WritePropertyName("livenessSingleModalModel"u8);
- writer.WriteStringValue(LivenessSingleModalModel.Value.ToString());
+ writer.WritePropertyName("livenessModelVersion"u8);
+ writer.WriteStringValue(LivenessModelVersion.Value.ToString());
}
if (Optional.IsDefined(DeviceCorrelationId))
{
@@ -66,6 +61,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
writer.WritePropertyName("authTokenTimeToLiveInSeconds"u8);
writer.WriteNumberValue(AuthTokenTimeToLiveInSeconds.Value);
}
+ if (Optional.IsDefined(NumberOfClientAttemptsAllowed))
+ {
+ writer.WritePropertyName("numberOfClientAttemptsAllowed"u8);
+ writer.WriteNumberValue(NumberOfClientAttemptsAllowed.Value);
+ }
if (options.Format != "W" && _serializedAdditionalRawData != null)
{
foreach (var item in _serializedAdditionalRawData)
@@ -104,12 +104,12 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon
return null;
}
LivenessOperationMode livenessOperationMode = default;
- bool? sendResultsToClient = default;
bool? deviceCorrelationIdSetInClient = default;
bool? enableSessionImage = default;
- LivenessModel? livenessSingleModalModel = default;
+ LivenessModel? livenessModelVersion = default;
string deviceCorrelationId = default;
int? authTokenTimeToLiveInSeconds = default;
+ int? numberOfClientAttemptsAllowed = default;
IDictionary serializedAdditionalRawData = default;
Dictionary rawDataDictionary = new Dictionary();
foreach (var property in element.EnumerateObject())
@@ -119,15 +119,6 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon
livenessOperationMode = new LivenessOperationMode(property.Value.GetString());
continue;
}
- if (property.NameEquals("sendResultsToClient"u8))
- {
- if (property.Value.ValueKind == JsonValueKind.Null)
- {
- continue;
- }
- sendResultsToClient = property.Value.GetBoolean();
- continue;
- }
if (property.NameEquals("deviceCorrelationIdSetInClient"u8))
{
if (property.Value.ValueKind == JsonValueKind.Null)
@@ -146,13 +137,13 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon
enableSessionImage = property.Value.GetBoolean();
continue;
}
- if (property.NameEquals("livenessSingleModalModel"u8))
+ if (property.NameEquals("livenessModelVersion"u8))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
- livenessSingleModalModel = new LivenessModel(property.Value.GetString());
+ livenessModelVersion = new LivenessModel(property.Value.GetString());
continue;
}
if (property.NameEquals("deviceCorrelationId"u8))
@@ -169,6 +160,15 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon
authTokenTimeToLiveInSeconds = property.Value.GetInt32();
continue;
}
+ if (property.NameEquals("numberOfClientAttemptsAllowed"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ numberOfClientAttemptsAllowed = property.Value.GetInt32();
+ continue;
+ }
if (options.Format != "W")
{
rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
@@ -177,12 +177,12 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon
serializedAdditionalRawData = rawDataDictionary;
return new CreateLivenessSessionContent(
livenessOperationMode,
- sendResultsToClient,
deviceCorrelationIdSetInClient,
enableSessionImage,
- livenessSingleModalModel,
+ livenessModelVersion,
deviceCorrelationId,
authTokenTimeToLiveInSeconds,
+ numberOfClientAttemptsAllowed,
serializedAdditionalRawData);
}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.cs
index 9de38ee841c6..de98204dd766 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.cs
@@ -54,22 +54,22 @@ public CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode)
/// Initializes a new instance of .
/// Type of liveness mode the client should follow.
- /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented.
/// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body.
/// Whether or not store the session image.
- /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen.
+ /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen.
/// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null.
/// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600.
+ /// The number of times a client can attempt a liveness check using the same authToken. Default value is 1. Maximum value is 3.
/// Keeps track of any properties unknown to the library.
- internal CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode, bool? sendResultsToClient, bool? deviceCorrelationIdSetInClient, bool? enableSessionImage, LivenessModel? livenessSingleModalModel, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, IDictionary serializedAdditionalRawData)
+ internal CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode, bool? deviceCorrelationIdSetInClient, bool? enableSessionImage, LivenessModel? livenessModelVersion, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, int? numberOfClientAttemptsAllowed, IDictionary serializedAdditionalRawData)
{
LivenessOperationMode = livenessOperationMode;
- SendResultsToClient = sendResultsToClient;
DeviceCorrelationIdSetInClient = deviceCorrelationIdSetInClient;
EnableSessionImage = enableSessionImage;
- LivenessSingleModalModel = livenessSingleModalModel;
+ LivenessModelVersion = livenessModelVersion;
DeviceCorrelationId = deviceCorrelationId;
AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds;
+ NumberOfClientAttemptsAllowed = numberOfClientAttemptsAllowed;
_serializedAdditionalRawData = serializedAdditionalRawData;
}
@@ -80,17 +80,17 @@ internal CreateLivenessSessionContent()
/// Type of liveness mode the client should follow.
public LivenessOperationMode LivenessOperationMode { get; }
- /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented.
- public bool? SendResultsToClient { get; set; }
/// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body.
public bool? DeviceCorrelationIdSetInClient { get; set; }
/// Whether or not store the session image.
public bool? EnableSessionImage { get; set; }
/// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen.
- public LivenessModel? LivenessSingleModalModel { get; set; }
+ public LivenessModel? LivenessModelVersion { get; set; }
/// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null.
public string DeviceCorrelationId { get; set; }
/// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600.
public int? AuthTokenTimeToLiveInSeconds { get; set; }
+ /// The number of times a client can attempt a liveness check using the same authToken. Default value is 1. Maximum value is 3.
+ public int? NumberOfClientAttemptsAllowed { get; set; }
}
}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.cs
deleted file mode 100644
index cf8e5b8e2c7f..000000000000
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-//
-
-#nullable disable
-
-using System;
-using System.Collections.Generic;
-
-namespace Azure.AI.Vision.Face
-{
- /// Response of liveness session creation.
- public partial class CreateLivenessSessionResult
- {
- ///
- /// Keeps track of any properties unknown to the library.
- ///
- /// To assign an object to the value of this property use .
- ///
- ///
- /// To assign an already formatted json string to this property use .
- ///
- ///
- /// Examples:
- ///
- /// -
- /// BinaryData.FromObjectAsJson("foo")
- /// Creates a payload of "foo".
- ///
- /// -
- /// BinaryData.FromString("\"foo\"")
- /// Creates a payload of "foo".
- ///
- /// -
- /// BinaryData.FromObjectAsJson(new { key = "value" })
- /// Creates a payload of { "key": "value" }.
- ///
- /// -
- /// BinaryData.FromString("{\"key\": \"value\"}")
- /// Creates a payload of { "key": "value" }.
- ///
- ///
- ///
- ///
- private IDictionary _serializedAdditionalRawData;
-
- /// Initializes a new instance of .
- /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation.
- /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable.
- /// or is null.
- internal CreateLivenessSessionResult(string sessionId, string authToken)
- {
- Argument.AssertNotNull(sessionId, nameof(sessionId));
- Argument.AssertNotNull(authToken, nameof(authToken));
-
- SessionId = sessionId;
- AuthToken = authToken;
- }
-
- /// Initializes a new instance of .
- /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation.
- /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable.
- /// Keeps track of any properties unknown to the library.
- internal CreateLivenessSessionResult(string sessionId, string authToken, IDictionary serializedAdditionalRawData)
- {
- SessionId = sessionId;
- AuthToken = authToken;
- _serializedAdditionalRawData = serializedAdditionalRawData;
- }
-
- /// Initializes a new instance of for deserialization.
- internal CreateLivenessSessionResult()
- {
- }
-
- /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation.
- public string SessionId { get; }
- /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable.
- public string AuthToken { get; }
- }
-}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.Serialization.cs
index 27a9c425fb45..8713346aba0a 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.Serialization.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.Serialization.cs
@@ -8,6 +8,7 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.IO;
using System.Text.Json;
using Azure.Core;
@@ -36,11 +37,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
writer.WritePropertyName("livenessOperationMode"u8);
writer.WriteStringValue(LivenessOperationMode.ToString());
- if (Optional.IsDefined(SendResultsToClient))
- {
- writer.WritePropertyName("sendResultsToClient"u8);
- writer.WriteBooleanValue(SendResultsToClient.Value);
- }
if (Optional.IsDefined(DeviceCorrelationIdSetInClient))
{
writer.WritePropertyName("deviceCorrelationIdSetInClient"u8);
@@ -51,11 +47,30 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
writer.WritePropertyName("enableSessionImage"u8);
writer.WriteBooleanValue(EnableSessionImage.Value);
}
- if (Optional.IsDefined(LivenessSingleModalModel))
+ if (Optional.IsDefined(LivenessModelVersion))
{
- writer.WritePropertyName("livenessSingleModalModel"u8);
- writer.WriteStringValue(LivenessSingleModalModel.Value.ToString());
+ writer.WritePropertyName("livenessModelVersion"u8);
+ writer.WriteStringValue(LivenessModelVersion.Value.ToString());
+ }
+ if (Optional.IsDefined(ReturnVerifyImageHash))
+ {
+ writer.WritePropertyName("returnVerifyImageHash"u8);
+ writer.WriteBooleanValue(ReturnVerifyImageHash.Value);
}
+ if (Optional.IsDefined(VerifyConfidenceThreshold))
+ {
+ writer.WritePropertyName("verifyConfidenceThreshold"u8);
+ writer.WriteNumberValue(VerifyConfidenceThreshold.Value);
+ }
+ writer.WritePropertyName("verifyImage"u8);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(global::System.BinaryData.FromStream(VerifyImage));
+#else
+ using (JsonDocument document = JsonDocument.Parse(BinaryData.FromStream(VerifyImage), ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
if (Optional.IsDefined(DeviceCorrelationId))
{
writer.WritePropertyName("deviceCorrelationId"u8);
@@ -66,15 +81,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
writer.WritePropertyName("authTokenTimeToLiveInSeconds"u8);
writer.WriteNumberValue(AuthTokenTimeToLiveInSeconds.Value);
}
- if (Optional.IsDefined(ReturnVerifyImageHash))
- {
- writer.WritePropertyName("returnVerifyImageHash"u8);
- writer.WriteBooleanValue(ReturnVerifyImageHash.Value);
- }
- if (Optional.IsDefined(VerifyConfidenceThreshold))
+ if (Optional.IsDefined(NumberOfClientAttemptsAllowed))
{
- writer.WritePropertyName("verifyConfidenceThreshold"u8);
- writer.WriteNumberValue(VerifyConfidenceThreshold.Value);
+ writer.WritePropertyName("numberOfClientAttemptsAllowed"u8);
+ writer.WriteNumberValue(NumberOfClientAttemptsAllowed.Value);
}
if (options.Format != "W" && _serializedAdditionalRawData != null)
{
@@ -114,14 +124,15 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness
return null;
}
LivenessOperationMode livenessOperationMode = default;
- bool? sendResultsToClient = default;
bool? deviceCorrelationIdSetInClient = default;
bool? enableSessionImage = default;
- LivenessModel? livenessSingleModalModel = default;
- string deviceCorrelationId = default;
- int? authTokenTimeToLiveInSeconds = default;
+ LivenessModel? livenessModelVersion = default;
bool? returnVerifyImageHash = default;
float? verifyConfidenceThreshold = default;
+ Stream verifyImage = default;
+ string deviceCorrelationId = default;
+ int? authTokenTimeToLiveInSeconds = default;
+ int? numberOfClientAttemptsAllowed = default;
IDictionary serializedAdditionalRawData = default;
Dictionary rawDataDictionary = new Dictionary();
foreach (var property in element.EnumerateObject())
@@ -131,15 +142,6 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness
livenessOperationMode = new LivenessOperationMode(property.Value.GetString());
continue;
}
- if (property.NameEquals("sendResultsToClient"u8))
- {
- if (property.Value.ValueKind == JsonValueKind.Null)
- {
- continue;
- }
- sendResultsToClient = property.Value.GetBoolean();
- continue;
- }
if (property.NameEquals("deviceCorrelationIdSetInClient"u8))
{
if (property.Value.ValueKind == JsonValueKind.Null)
@@ -158,45 +160,59 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness
enableSessionImage = property.Value.GetBoolean();
continue;
}
- if (property.NameEquals("livenessSingleModalModel"u8))
+ if (property.NameEquals("livenessModelVersion"u8))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
- livenessSingleModalModel = new LivenessModel(property.Value.GetString());
+ livenessModelVersion = new LivenessModel(property.Value.GetString());
continue;
}
- if (property.NameEquals("deviceCorrelationId"u8))
+ if (property.NameEquals("returnVerifyImageHash"u8))
{
- deviceCorrelationId = property.Value.GetString();
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ returnVerifyImageHash = property.Value.GetBoolean();
continue;
}
- if (property.NameEquals("authTokenTimeToLiveInSeconds"u8))
+ if (property.NameEquals("verifyConfidenceThreshold"u8))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
- authTokenTimeToLiveInSeconds = property.Value.GetInt32();
+ verifyConfidenceThreshold = property.Value.GetSingle();
continue;
}
- if (property.NameEquals("returnVerifyImageHash"u8))
+ if (property.NameEquals("verifyImage"u8))
+ {
+ verifyImage = BinaryData.FromString(property.Value.GetRawText()).ToStream();
+ continue;
+ }
+ if (property.NameEquals("deviceCorrelationId"u8))
+ {
+ deviceCorrelationId = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("authTokenTimeToLiveInSeconds"u8))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
- returnVerifyImageHash = property.Value.GetBoolean();
+ authTokenTimeToLiveInSeconds = property.Value.GetInt32();
continue;
}
- if (property.NameEquals("verifyConfidenceThreshold"u8))
+ if (property.NameEquals("numberOfClientAttemptsAllowed"u8))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
- verifyConfidenceThreshold = property.Value.GetSingle();
+ numberOfClientAttemptsAllowed = property.Value.GetInt32();
continue;
}
if (options.Format != "W")
@@ -207,17 +223,73 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness
serializedAdditionalRawData = rawDataDictionary;
return new CreateLivenessWithVerifySessionContent(
livenessOperationMode,
- sendResultsToClient,
deviceCorrelationIdSetInClient,
enableSessionImage,
- livenessSingleModalModel,
- deviceCorrelationId,
- authTokenTimeToLiveInSeconds,
+ livenessModelVersion,
returnVerifyImageHash,
verifyConfidenceThreshold,
+ verifyImage,
+ deviceCorrelationId,
+ authTokenTimeToLiveInSeconds,
+ numberOfClientAttemptsAllowed,
serializedAdditionalRawData);
}
+ private BinaryData SerializeMultipart(ModelReaderWriterOptions options)
+ {
+ using MultipartFormDataRequestContent content = ToMultipartRequestContent();
+ using MemoryStream stream = new MemoryStream();
+ content.WriteTo(stream);
+ if (stream.Position > int.MaxValue)
+ {
+ return BinaryData.FromStream(stream);
+ }
+ else
+ {
+ return new BinaryData(stream.GetBuffer().AsMemory(0, (int)stream.Position));
+ }
+ }
+
+ internal virtual MultipartFormDataRequestContent ToMultipartRequestContent()
+ {
+ MultipartFormDataRequestContent content = new MultipartFormDataRequestContent();
+ content.Add(LivenessOperationMode.ToString(), "livenessOperationMode");
+ if (Optional.IsDefined(DeviceCorrelationIdSetInClient))
+ {
+ content.Add(DeviceCorrelationIdSetInClient.Value, "deviceCorrelationIdSetInClient");
+ }
+ if (Optional.IsDefined(EnableSessionImage))
+ {
+ content.Add(EnableSessionImage.Value, "enableSessionImage");
+ }
+ if (Optional.IsDefined(LivenessModelVersion))
+ {
+ content.Add(LivenessModelVersion.Value.ToString(), "livenessModelVersion");
+ }
+ if (Optional.IsDefined(ReturnVerifyImageHash))
+ {
+ content.Add(ReturnVerifyImageHash.Value, "returnVerifyImageHash");
+ }
+ if (Optional.IsDefined(VerifyConfidenceThreshold))
+ {
+ content.Add(VerifyConfidenceThreshold.Value, "verifyConfidenceThreshold");
+ }
+ content.Add(VerifyImage, "verifyImage", "verifyImage", "application/octet-stream");
+ if (Optional.IsDefined(DeviceCorrelationId))
+ {
+ content.Add(DeviceCorrelationId, "deviceCorrelationId");
+ }
+ if (Optional.IsDefined(AuthTokenTimeToLiveInSeconds))
+ {
+ content.Add(AuthTokenTimeToLiveInSeconds.Value, "authTokenTimeToLiveInSeconds");
+ }
+ if (Optional.IsDefined(NumberOfClientAttemptsAllowed))
+ {
+ content.Add(NumberOfClientAttemptsAllowed.Value, "numberOfClientAttemptsAllowed");
+ }
+ return content;
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -226,6 +298,8 @@ BinaryData IPersistableModel.Write(Model
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "MFD":
+ return SerializeMultipart(options);
default:
throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionContent)} does not support writing '{options.Format}' format.");
}
@@ -247,7 +321,7 @@ CreateLivenessWithVerifySessionContent IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "MFD";
/// Deserializes the model from a raw response.
/// The response to deserialize the model from.
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.cs
index 99e890eaf7e3..2b9155927d87 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.cs
@@ -7,10 +7,11 @@
using System;
using System.Collections.Generic;
+using System.IO;
namespace Azure.AI.Vision.Face
{
- /// Request for creating liveness with verify session.
+ /// Request of liveness with verify session creation.
public partial class CreateLivenessWithVerifySessionContent
{
///
@@ -47,33 +48,40 @@ public partial class CreateLivenessWithVerifySessionContent
/// Initializes a new instance of .
/// Type of liveness mode the client should follow.
- public CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode)
+ /// The image stream for verify. Content-Disposition header field for this part must have filename.
+ /// is null.
+ public CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode, Stream verifyImage)
{
+ Argument.AssertNotNull(verifyImage, nameof(verifyImage));
+
LivenessOperationMode = livenessOperationMode;
+ VerifyImage = verifyImage;
}
/// Initializes a new instance of .
/// Type of liveness mode the client should follow.
- /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented.
/// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body.
/// Whether or not store the session image.
- /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen.
+ /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen.
+ /// Whether or not return the verify image hash.
+ /// Threshold for confidence of the face verification. Please refer to the documentation for more details. https://learn.microsoft.com/legal/cognitive-services/face/characteristics-and-limitations?context=%2Fazure%2Fai-services%2Fcomputer-vision%2Fcontext%2Fcontext#recognition-confidence-score.
+ /// The image stream for verify. Content-Disposition header field for this part must have filename.
/// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null.
/// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600.
- /// Whether or not return the verify image hash.
- /// Threshold for confidence of the face verification.
+ /// The number of times a client can attempt a liveness check using the same authToken. Default value is 1. Maximum value is 3.
/// Keeps track of any properties unknown to the library.
- internal CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode, bool? sendResultsToClient, bool? deviceCorrelationIdSetInClient, bool? enableSessionImage, LivenessModel? livenessSingleModalModel, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, bool? returnVerifyImageHash, float? verifyConfidenceThreshold, IDictionary serializedAdditionalRawData)
+ internal CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode, bool? deviceCorrelationIdSetInClient, bool? enableSessionImage, LivenessModel? livenessModelVersion, bool? returnVerifyImageHash, float? verifyConfidenceThreshold, Stream verifyImage, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, int? numberOfClientAttemptsAllowed, IDictionary serializedAdditionalRawData)
{
LivenessOperationMode = livenessOperationMode;
- SendResultsToClient = sendResultsToClient;
DeviceCorrelationIdSetInClient = deviceCorrelationIdSetInClient;
EnableSessionImage = enableSessionImage;
- LivenessSingleModalModel = livenessSingleModalModel;
- DeviceCorrelationId = deviceCorrelationId;
- AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds;
+ LivenessModelVersion = livenessModelVersion;
ReturnVerifyImageHash = returnVerifyImageHash;
VerifyConfidenceThreshold = verifyConfidenceThreshold;
+ VerifyImage = verifyImage;
+ DeviceCorrelationId = deviceCorrelationId;
+ AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds;
+ NumberOfClientAttemptsAllowed = numberOfClientAttemptsAllowed;
_serializedAdditionalRawData = serializedAdditionalRawData;
}
@@ -84,21 +92,23 @@ internal CreateLivenessWithVerifySessionContent()
/// Type of liveness mode the client should follow.
public LivenessOperationMode LivenessOperationMode { get; }
- /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented.
- public bool? SendResultsToClient { get; set; }
/// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body.
public bool? DeviceCorrelationIdSetInClient { get; set; }
/// Whether or not store the session image.
public bool? EnableSessionImage { get; set; }
/// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen.
- public LivenessModel? LivenessSingleModalModel { get; set; }
+ public LivenessModel? LivenessModelVersion { get; set; }
+ /// Whether or not return the verify image hash.
+ public bool? ReturnVerifyImageHash { get; set; }
+ /// Threshold for confidence of the face verification. Please refer to the documentation for more details. https://learn.microsoft.com/legal/cognitive-services/face/characteristics-and-limitations?context=%2Fazure%2Fai-services%2Fcomputer-vision%2Fcontext%2Fcontext#recognition-confidence-score.
+ public float? VerifyConfidenceThreshold { get; set; }
+ /// The image stream for verify. Content-Disposition header field for this part must have filename.
+ public Stream VerifyImage { get; }
/// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null.
public string DeviceCorrelationId { get; set; }
/// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600.
public int? AuthTokenTimeToLiveInSeconds { get; set; }
- /// Whether or not return the verify image hash.
- public bool? ReturnVerifyImageHash { get; set; }
- /// Threshold for confidence of the face verification.
- public float? VerifyConfidenceThreshold { get; set; }
+ /// The number of times a client can attempt a liveness check using the same authToken. Default value is 1. Maximum value is 3.
+ public int? NumberOfClientAttemptsAllowed { get; set; }
}
}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.Serialization.cs
deleted file mode 100644
index edc3e7532592..000000000000
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.Serialization.cs
+++ /dev/null
@@ -1,183 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-//
-
-#nullable disable
-
-using System;
-using System.ClientModel.Primitives;
-using System.Collections.Generic;
-using System.IO;
-using System.Text.Json;
-using Azure.Core;
-
-namespace Azure.AI.Vision.Face
-{
- internal partial class CreateLivenessWithVerifySessionMultipartContent : IUtf8JsonSerializable, IJsonModel
- {
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
-
- void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
- {
- writer.WriteStartObject();
- JsonModelWriteCore(writer, options);
- writer.WriteEndObject();
- }
-
- /// The JSON writer.
- /// The client options for reading and writing models.
- protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
- {
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
- if (format != "J")
- {
- throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionMultipartContent)} does not support writing '{format}' format.");
- }
-
- writer.WritePropertyName("Parameters"u8);
- writer.WriteObjectValue(Parameters, options);
- writer.WritePropertyName("VerifyImage"u8);
-#if NET6_0_OR_GREATER
- writer.WriteRawValue(global::System.BinaryData.FromStream(VerifyImage));
-#else
- using (JsonDocument document = JsonDocument.Parse(BinaryData.FromStream(VerifyImage), ModelSerializationExtensions.JsonDocumentOptions))
- {
- JsonSerializer.Serialize(writer, document.RootElement);
- }
-#endif
- if (options.Format != "W" && _serializedAdditionalRawData != null)
- {
- foreach (var item in _serializedAdditionalRawData)
- {
- writer.WritePropertyName(item.Key);
-#if NET6_0_OR_GREATER
- writer.WriteRawValue(item.Value);
-#else
- using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
- {
- JsonSerializer.Serialize(writer, document.RootElement);
- }
-#endif
- }
- }
- }
-
- CreateLivenessWithVerifySessionMultipartContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
- {
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
- if (format != "J")
- {
- throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionMultipartContent)} does not support reading '{format}' format.");
- }
-
- using JsonDocument document = JsonDocument.ParseValue(ref reader);
- return DeserializeCreateLivenessWithVerifySessionMultipartContent(document.RootElement, options);
- }
-
- internal static CreateLivenessWithVerifySessionMultipartContent DeserializeCreateLivenessWithVerifySessionMultipartContent(JsonElement element, ModelReaderWriterOptions options = null)
- {
- options ??= ModelSerializationExtensions.WireOptions;
-
- if (element.ValueKind == JsonValueKind.Null)
- {
- return null;
- }
- CreateLivenessWithVerifySessionContent parameters = default;
- Stream verifyImage = default;
- IDictionary serializedAdditionalRawData = default;
- Dictionary rawDataDictionary = new Dictionary();
- foreach (var property in element.EnumerateObject())
- {
- if (property.NameEquals("Parameters"u8))
- {
- parameters = CreateLivenessWithVerifySessionContent.DeserializeCreateLivenessWithVerifySessionContent(property.Value, options);
- continue;
- }
- if (property.NameEquals("VerifyImage"u8))
- {
- verifyImage = BinaryData.FromString(property.Value.GetRawText()).ToStream();
- continue;
- }
- if (options.Format != "W")
- {
- rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
- }
- }
- serializedAdditionalRawData = rawDataDictionary;
- return new CreateLivenessWithVerifySessionMultipartContent(parameters, verifyImage, serializedAdditionalRawData);
- }
-
- private BinaryData SerializeMultipart(ModelReaderWriterOptions options)
- {
- using MultipartFormDataRequestContent content = ToMultipartRequestContent();
- using MemoryStream stream = new MemoryStream();
- content.WriteTo(stream);
- if (stream.Position > int.MaxValue)
- {
- return BinaryData.FromStream(stream);
- }
- else
- {
- return new BinaryData(stream.GetBuffer().AsMemory(0, (int)stream.Position));
- }
- }
-
- internal virtual MultipartFormDataRequestContent ToMultipartRequestContent()
- {
- MultipartFormDataRequestContent content = new MultipartFormDataRequestContent();
- content.Add(ModelReaderWriter.Write(Parameters, ModelSerializationExtensions.WireOptions), "Parameters");
- content.Add(VerifyImage, "VerifyImage", "VerifyImage", "application/octet-stream");
- return content;
- }
-
- BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
- {
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
-
- switch (format)
- {
- case "J":
- return ModelReaderWriter.Write(this, options);
- case "MFD":
- return SerializeMultipart(options);
- default:
- throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionMultipartContent)} does not support writing '{options.Format}' format.");
- }
- }
-
- CreateLivenessWithVerifySessionMultipartContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
- {
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
-
- switch (format)
- {
- case "J":
- {
- using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
- return DeserializeCreateLivenessWithVerifySessionMultipartContent(document.RootElement, options);
- }
- default:
- throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionMultipartContent)} does not support reading '{options.Format}' format.");
- }
- }
-
- string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "MFD";
-
- /// Deserializes the model from a raw response.
- /// The response to deserialize the model from.
- internal static CreateLivenessWithVerifySessionMultipartContent FromResponse(Response response)
- {
- using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
- return DeserializeCreateLivenessWithVerifySessionMultipartContent(document.RootElement);
- }
-
- /// Convert into a .
- internal virtual RequestContent ToRequestContent()
- {
- var content = new Utf8JsonRequestContent();
- content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
- return content;
- }
- }
-}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.cs
deleted file mode 100644
index b969512f54ce..000000000000
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-//
-
-#nullable disable
-
-using System;
-using System.Collections.Generic;
-
-namespace Azure.AI.Vision.Face
-{
- /// Response of liveness session with verify creation with verify image provided.
- public partial class CreateLivenessWithVerifySessionResult
- {
- ///
- /// Keeps track of any properties unknown to the library.
- ///
- /// To assign an object to the value of this property use .
- ///
- ///
- /// To assign an already formatted json string to this property use .
- ///
- ///
- /// Examples:
- ///
- /// -
- /// BinaryData.FromObjectAsJson("foo")
- /// Creates a payload of "foo".
- ///
- /// -
- /// BinaryData.FromString("\"foo\"")
- /// Creates a payload of "foo".
- ///
- /// -
- /// BinaryData.FromObjectAsJson(new { key = "value" })
- /// Creates a payload of { "key": "value" }.
- ///
- /// -
- /// BinaryData.FromString("{\"key\": \"value\"}")
- /// Creates a payload of { "key": "value" }.
- ///
- ///
- ///
- ///
- private IDictionary _serializedAdditionalRawData;
-
- /// Initializes a new instance of .
- /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation.
- /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable.
- /// or is null.
- internal CreateLivenessWithVerifySessionResult(string sessionId, string authToken)
- {
- Argument.AssertNotNull(sessionId, nameof(sessionId));
- Argument.AssertNotNull(authToken, nameof(authToken));
-
- SessionId = sessionId;
- AuthToken = authToken;
- }
-
- /// Initializes a new instance of .
- /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation.
- /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable.
- /// The detail of face for verification.
- /// Keeps track of any properties unknown to the library.
- internal CreateLivenessWithVerifySessionResult(string sessionId, string authToken, LivenessWithVerifyImage verifyImage, IDictionary serializedAdditionalRawData)
- {
- SessionId = sessionId;
- AuthToken = authToken;
- VerifyImage = verifyImage;
- _serializedAdditionalRawData = serializedAdditionalRawData;
- }
-
- /// Initializes a new instance of for deserialization.
- internal CreateLivenessWithVerifySessionResult()
- {
- }
-
- /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation.
- public string SessionId { get; }
- /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable.
- public string AuthToken { get; }
- /// The detail of face for verification.
- public LivenessWithVerifyImage VerifyImage { get; }
- }
-}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/Docs/FaceSessionClient.xml b/sdk/face/Azure.AI.Vision.Face/src/Generated/Docs/FaceSessionClient.xml
index 3754a0217479..f6f387046195 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/Docs/FaceSessionClient.xml
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/Docs/FaceSessionClient.xml
@@ -11,12 +11,12 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential);
CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive)
{
- SendResultsToClient = true,
- DeviceCorrelationIdSetInClient = true,
+ DeviceCorrelationIdSetInClient = false,
DeviceCorrelationId = "your_device_correlation_id",
AuthTokenTimeToLiveInSeconds = 60,
+ NumberOfClientAttemptsAllowed = 1,
};
-Response response = await client.CreateLivenessSessionAsync(body);
+Response response = await client.CreateLivenessSessionAsync(body);
]]>
@@ -29,12 +29,12 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential);
CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive)
{
- SendResultsToClient = true,
- DeviceCorrelationIdSetInClient = true,
+ DeviceCorrelationIdSetInClient = false,
DeviceCorrelationId = "your_device_correlation_id",
AuthTokenTimeToLiveInSeconds = 60,
+ NumberOfClientAttemptsAllowed = 1,
};
-Response response = client.CreateLivenessSession(body);
+Response response = client.CreateLivenessSession(body);
]]>
@@ -48,16 +48,19 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
livenessOperationMode = "Passive",
- sendResultsToClient = true,
- deviceCorrelationIdSetInClient = true,
+ deviceCorrelationIdSetInClient = false,
deviceCorrelationId = "your_device_correlation_id",
authTokenTimeToLiveInSeconds = 60,
+ numberOfClientAttemptsAllowed = 1,
});
Response response = await client.CreateLivenessSessionAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("sessionId").ToString());
Console.WriteLine(result.GetProperty("authToken").ToString());
+Console.WriteLine(result.GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString());
]]>
@@ -71,16 +74,19 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
livenessOperationMode = "Passive",
- sendResultsToClient = true,
- deviceCorrelationIdSetInClient = true,
+ deviceCorrelationIdSetInClient = false,
deviceCorrelationId = "your_device_correlation_id",
authTokenTimeToLiveInSeconds = 60,
+ numberOfClientAttemptsAllowed = 1,
});
Response response = client.CreateLivenessSession(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("sessionId").ToString());
Console.WriteLine(result.GetProperty("authToken").ToString());
+Console.WriteLine(result.GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString());
]]>
@@ -142,10 +148,11 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential);
Response response = await client.GetLivenessSessionResultAsync("b12e033e-bda7-4b83-a211-e721c661f30e", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
-Console.WriteLine(result.GetProperty("id").ToString());
-Console.WriteLine(result.GetProperty("createdDateTime").ToString());
-Console.WriteLine(result.GetProperty("sessionExpired").ToString());
+Console.WriteLine(result.GetProperty("sessionId").ToString());
+Console.WriteLine(result.GetProperty("authToken").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString());
]]>
@@ -159,136 +166,85 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential);
Response response = client.GetLivenessSessionResult("b12e033e-bda7-4b83-a211-e721c661f30e", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
-Console.WriteLine(result.GetProperty("id").ToString());
-Console.WriteLine(result.GetProperty("createdDateTime").ToString());
-Console.WriteLine(result.GetProperty("sessionExpired").ToString());
+Console.WriteLine(result.GetProperty("sessionId").ToString());
+Console.WriteLine(result.GetProperty("authToken").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString());
]]>
-
-
-This sample shows how to call GetLivenessSessionsAsync.
-");
-AzureKeyCredential credential = new AzureKeyCredential("");
-FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-
-Response> response = await client.GetLivenessSessionsAsync();
-]]>
-
-
-
-This sample shows how to call GetLivenessSessions.
-");
-AzureKeyCredential credential = new AzureKeyCredential("");
-FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-
-Response> response = client.GetLivenessSessions();
-]]>
-
-
-
-This sample shows how to call GetLivenessSessionsAsync and parse the result.
-");
-AzureKeyCredential credential = new AzureKeyCredential("");
-FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-
-Response response = await client.GetLivenessSessionsAsync("00000000-0000-0000-0000-000000000000", 20, null);
-
-JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
-Console.WriteLine(result[0].GetProperty("id").ToString());
-Console.WriteLine(result[0].GetProperty("createdDateTime").ToString());
-Console.WriteLine(result[0].GetProperty("sessionExpired").ToString());
-]]>
-
-
-
-This sample shows how to call GetLivenessSessions and parse the result.
-");
-AzureKeyCredential credential = new AzureKeyCredential("");
-FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-
-Response response = client.GetLivenessSessions("00000000-0000-0000-0000-000000000000", 20, null);
-
-JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
-Console.WriteLine(result[0].GetProperty("id").ToString());
-Console.WriteLine(result[0].GetProperty("createdDateTime").ToString());
-Console.WriteLine(result[0].GetProperty("sessionExpired").ToString());
-]]>
-
-
+
-This sample shows how to call GetLivenessSessionAuditEntriesAsync.
+This sample shows how to call CreateLivenessWithVerifySessionAsync.
");
AzureKeyCredential credential = new AzureKeyCredential("");
FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-Response> response = await client.GetLivenessSessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e");
+CreateLivenessWithVerifySessionContent body = null;
+Response response = await client.CreateLivenessWithVerifySessionAsync(body);
]]>
-
+
-This sample shows how to call GetLivenessSessionAuditEntries.
+This sample shows how to call CreateLivenessWithVerifySession.
");
AzureKeyCredential credential = new AzureKeyCredential("");
FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-Response> response = client.GetLivenessSessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e");
+CreateLivenessWithVerifySessionContent body = null;
+Response response = client.CreateLivenessWithVerifySession(body);
]]>
-
+
-This sample shows how to call GetLivenessSessionAuditEntriesAsync and parse the result.
+This sample shows how to call CreateLivenessWithVerifySessionAsync and parse the result.
");
AzureKeyCredential credential = new AzureKeyCredential("");
FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-Response response = await client.GetLivenessSessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null);
+using RequestContent content = null;
+Response response = await client.CreateLivenessWithVerifySessionAsync(content, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
-Console.WriteLine(result[0].GetProperty("id").ToString());
-Console.WriteLine(result[0].GetProperty("sessionId").ToString());
-Console.WriteLine(result[0].GetProperty("requestId").ToString());
-Console.WriteLine(result[0].GetProperty("clientRequestId").ToString());
-Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString());
-Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString());
-Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString());
-Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString());
-Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString());
-Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString());
-Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString());
-Console.WriteLine(result[0].GetProperty("digest").ToString());
+Console.WriteLine(result.GetProperty("sessionId").ToString());
+Console.WriteLine(result.GetProperty("authToken").ToString());
+Console.WriteLine(result.GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString());
]]>
-
+
-This sample shows how to call GetLivenessSessionAuditEntries and parse the result.
+This sample shows how to call CreateLivenessWithVerifySession and parse the result.
");
AzureKeyCredential credential = new AzureKeyCredential("");
FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-Response response = client.GetLivenessSessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null);
+using RequestContent content = null;
+Response response = client.CreateLivenessWithVerifySession(content, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
-Console.WriteLine(result[0].GetProperty("id").ToString());
-Console.WriteLine(result[0].GetProperty("sessionId").ToString());
-Console.WriteLine(result[0].GetProperty("requestId").ToString());
-Console.WriteLine(result[0].GetProperty("clientRequestId").ToString());
-Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString());
-Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString());
-Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString());
-Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString());
-Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString());
-Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString());
-Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString());
-Console.WriteLine(result[0].GetProperty("digest").ToString());
+Console.WriteLine(result.GetProperty("sessionId").ToString());
+Console.WriteLine(result.GetProperty("authToken").ToString());
+Console.WriteLine(result.GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString());
]]>
@@ -350,10 +306,17 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential);
Response response = await client.GetLivenessWithVerifySessionResultAsync("b12e033e-bda7-4b83-a211-e721c661f30e", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
-Console.WriteLine(result.GetProperty("id").ToString());
-Console.WriteLine(result.GetProperty("createdDateTime").ToString());
-Console.WriteLine(result.GetProperty("sessionExpired").ToString());
+Console.WriteLine(result.GetProperty("sessionId").ToString());
+Console.WriteLine(result.GetProperty("authToken").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString());
]]>
@@ -367,136 +330,17 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential);
Response response = client.GetLivenessWithVerifySessionResult("b12e033e-bda7-4b83-a211-e721c661f30e", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
-Console.WriteLine(result.GetProperty("id").ToString());
-Console.WriteLine(result.GetProperty("createdDateTime").ToString());
-Console.WriteLine(result.GetProperty("sessionExpired").ToString());
+Console.WriteLine(result.GetProperty("sessionId").ToString());
+Console.WriteLine(result.GetProperty("authToken").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
-]]>
-
-
-
-This sample shows how to call GetLivenessWithVerifySessionsAsync.
-");
-AzureKeyCredential credential = new AzureKeyCredential("");
-FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-
-Response> response = await client.GetLivenessWithVerifySessionsAsync();
-]]>
-
-
-
-This sample shows how to call GetLivenessWithVerifySessions.
-");
-AzureKeyCredential credential = new AzureKeyCredential("");
-FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-
-Response> response = client.GetLivenessWithVerifySessions();
-]]>
-
-
-
-This sample shows how to call GetLivenessWithVerifySessionsAsync and parse the result.
-");
-AzureKeyCredential credential = new AzureKeyCredential("");
-FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-
-Response response = await client.GetLivenessWithVerifySessionsAsync("00000000-0000-0000-0000-000000000000", 20, null);
-
-JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
-Console.WriteLine(result[0].GetProperty("id").ToString());
-Console.WriteLine(result[0].GetProperty("createdDateTime").ToString());
-Console.WriteLine(result[0].GetProperty("sessionExpired").ToString());
-]]>
-
-
-
-This sample shows how to call GetLivenessWithVerifySessions and parse the result.
-");
-AzureKeyCredential credential = new AzureKeyCredential("");
-FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-
-Response response = client.GetLivenessWithVerifySessions("00000000-0000-0000-0000-000000000000", 20, null);
-
-JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
-Console.WriteLine(result[0].GetProperty("id").ToString());
-Console.WriteLine(result[0].GetProperty("createdDateTime").ToString());
-Console.WriteLine(result[0].GetProperty("sessionExpired").ToString());
-]]>
-
-
-
-This sample shows how to call GetLivenessWithVerifySessionAuditEntriesAsync.
-");
-AzureKeyCredential credential = new AzureKeyCredential("");
-FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-
-Response> response = await client.GetLivenessWithVerifySessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e");
-]]>
-
-
-
-This sample shows how to call GetLivenessWithVerifySessionAuditEntries.
-");
-AzureKeyCredential credential = new AzureKeyCredential("");
-FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-
-Response> response = client.GetLivenessWithVerifySessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e");
-]]>
-
-
-
-This sample shows how to call GetLivenessWithVerifySessionAuditEntriesAsync and parse the result.
-");
-AzureKeyCredential credential = new AzureKeyCredential("");
-FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-
-Response response = await client.GetLivenessWithVerifySessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null);
-
-JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
-Console.WriteLine(result[0].GetProperty("id").ToString());
-Console.WriteLine(result[0].GetProperty("sessionId").ToString());
-Console.WriteLine(result[0].GetProperty("requestId").ToString());
-Console.WriteLine(result[0].GetProperty("clientRequestId").ToString());
-Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString());
-Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString());
-Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString());
-Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString());
-Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString());
-Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString());
-Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString());
-Console.WriteLine(result[0].GetProperty("digest").ToString());
-]]>
-
-
-
-This sample shows how to call GetLivenessWithVerifySessionAuditEntries and parse the result.
-");
-AzureKeyCredential credential = new AzureKeyCredential("");
-FaceSessionClient client = new FaceSessionClient(endpoint, credential);
-
-Response response = client.GetLivenessWithVerifySessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null);
-
-JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
-Console.WriteLine(result[0].GetProperty("id").ToString());
-Console.WriteLine(result[0].GetProperty("sessionId").ToString());
-Console.WriteLine(result[0].GetProperty("requestId").ToString());
-Console.WriteLine(result[0].GetProperty("clientRequestId").ToString());
-Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString());
-Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString());
-Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString());
-Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString());
-Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString());
-Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString());
-Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString());
-Console.WriteLine(result[0].GetProperty("digest").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString());
+Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString());
]]>
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionClient.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionClient.cs
index c3695cc5455d..2d54e4f2d175 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionClient.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionClient.cs
@@ -108,14 +108,14 @@ public FaceSessionClient(Uri endpoint, TokenCredential credential, AzureAIVision
/// is null.
/// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-session for more details.
///
- public virtual async Task> CreateLivenessSessionAsync(CreateLivenessSessionContent body, CancellationToken cancellationToken = default)
+ public virtual async Task> CreateLivenessSessionAsync(CreateLivenessSessionContent body, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(body, nameof(body));
using RequestContent content = body.ToRequestContent();
RequestContext context = FromCancellationToken(cancellationToken);
Response response = await CreateLivenessSessionAsync(content, context).ConfigureAwait(false);
- return Response.FromValue(CreateLivenessSessionResult.FromResponse(response), response);
+ return Response.FromValue(LivenessSession.FromResponse(response), response);
}
/// Create a new detect liveness session.
@@ -124,14 +124,14 @@ public virtual async Task> CreateLivenessS
/// is null.
/// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-session for more details.
///
- public virtual Response CreateLivenessSession(CreateLivenessSessionContent body, CancellationToken cancellationToken = default)
+ public virtual Response CreateLivenessSession(CreateLivenessSessionContent body, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(body, nameof(body));
using RequestContent content = body.ToRequestContent();
RequestContext context = FromCancellationToken(cancellationToken);
Response response = CreateLivenessSession(content, context);
- return Response.FromValue(CreateLivenessSessionResult.FromResponse(response), response);
+ return Response.FromValue(LivenessSession.FromResponse(response), response);
}
///
@@ -336,555 +336,15 @@ public virtual Response GetLivenessSessionResult(string session
/// Service returned a non-success status code.
/// The response returned from the service.
///
- public virtual async Task GetLivenessSessionResultAsync(string sessionId, RequestContext context)
- {
- Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
-
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionResult");
- scope.Start();
- try
- {
- using HttpMessage message = CreateGetLivenessSessionResultRequest(sessionId, context);
- return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
-
- ///
- /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-result for more details.
- ///
- /// -
- ///
- /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- ///
- ///
- /// -
- ///
- /// Please try the simpler convenience overload with strongly typed models first.
- ///
- ///
- ///
- ///
- /// The unique ID to reference this session.
- /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
- /// Service returned a non-success status code.
- /// The response returned from the service.
- ///
- public virtual Response GetLivenessSessionResult(string sessionId, RequestContext context)
- {
- Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
-
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionResult");
- scope.Start();
- try
- {
- using HttpMessage message = CreateGetLivenessSessionResultRequest(sessionId, context);
- return _pipeline.ProcessMessage(message, context);
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
-
- /// Lists sessions for /detectLiveness/SingleModal.
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
- /// The cancellation token to use.
- /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-sessions for more details.
- ///
- public virtual async Task>> GetLivenessSessionsAsync(string start = null, int? top = null, CancellationToken cancellationToken = default)
- {
- RequestContext context = FromCancellationToken(cancellationToken);
- Response response = await GetLivenessSessionsAsync(start, top, context).ConfigureAwait(false);
- IReadOnlyList value = default;
- using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false);
- List array = new List();
- foreach (var item in document.RootElement.EnumerateArray())
- {
- array.Add(LivenessSessionItem.DeserializeLivenessSessionItem(item));
- }
- value = array;
- return Response.FromValue(value, response);
- }
-
- /// Lists sessions for /detectLiveness/SingleModal.
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
- /// The cancellation token to use.
- /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-sessions for more details.
- ///
- public virtual Response> GetLivenessSessions(string start = null, int? top = null, CancellationToken cancellationToken = default)
- {
- RequestContext context = FromCancellationToken(cancellationToken);
- Response response = GetLivenessSessions(start, top, context);
- IReadOnlyList value = default;
- using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions);
- List array = new List();
- foreach (var item in document.RootElement.EnumerateArray())
- {
- array.Add(LivenessSessionItem.DeserializeLivenessSessionItem(item));
- }
- value = array;
- return Response.FromValue(value, response);
- }
-
- ///
- /// [Protocol Method] Lists sessions for /detectLiveness/SingleModal.
- ///
- /// -
- ///
- /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- ///
- ///
- /// -
- ///
- /// Please try the simpler convenience overload with strongly typed models first.
- ///
- ///
- ///
- ///
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
- /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
- /// Service returned a non-success status code.
- /// The response returned from the service.
- ///
- public virtual async Task GetLivenessSessionsAsync(string start, int? top, RequestContext context)
- {
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessions");
- scope.Start();
- try
- {
- using HttpMessage message = CreateGetLivenessSessionsRequest(start, top, context);
- return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
-
- ///
- /// [Protocol Method] Lists sessions for /detectLiveness/SingleModal.
- ///
- /// -
- ///
- /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- ///
- ///
- /// -
- ///
- /// Please try the simpler convenience overload with strongly typed models first.
- ///
- ///
- ///
- ///
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
- /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
- /// Service returned a non-success status code.
- /// The response returned from the service.
- ///
- public virtual Response GetLivenessSessions(string start, int? top, RequestContext context)
- {
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessions");
- scope.Start();
- try
- {
- using HttpMessage message = CreateGetLivenessSessionsRequest(start, top, context);
- return _pipeline.ProcessMessage(message, context);
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
-
- /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-audit-entries for more details.
- /// The unique ID to reference this session.
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
- /// The cancellation token to use.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
- ///
- public virtual async Task>> GetLivenessSessionAuditEntriesAsync(string sessionId, string start = null, int? top = null, CancellationToken cancellationToken = default)
- {
- Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
-
- RequestContext context = FromCancellationToken(cancellationToken);
- Response response = await GetLivenessSessionAuditEntriesAsync(sessionId, start, top, context).ConfigureAwait(false);
- IReadOnlyList value = default;
- using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false);
- List array = new List();
- foreach (var item in document.RootElement.EnumerateArray())
- {
- array.Add(LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(item));
- }
- value = array;
- return Response.FromValue(value, response);
- }
-
- /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-audit-entries for more details.
- /// The unique ID to reference this session.
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
- /// The cancellation token to use.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
- ///
- public virtual Response> GetLivenessSessionAuditEntries(string sessionId, string start = null, int? top = null, CancellationToken cancellationToken = default)
- {
- Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
-
- RequestContext context = FromCancellationToken(cancellationToken);
- Response response = GetLivenessSessionAuditEntries(sessionId, start, top, context);
- IReadOnlyList value = default;
- using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions);
- List array = new List();
- foreach (var item in document.RootElement.EnumerateArray())
- {
- array.Add(LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(item));
- }
- value = array;
- return Response.FromValue(value, response);
- }
-
- ///
- /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-audit-entries for more details.
- ///
- /// -
- ///
- /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- ///
- ///
- /// -
- ///
- /// Please try the simpler convenience overload with strongly typed models first.
- ///
- ///
- ///
- ///
- /// The unique ID to reference this session.
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
- /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
- /// Service returned a non-success status code.
- /// The response returned from the service.
- ///
- public virtual async Task GetLivenessSessionAuditEntriesAsync(string sessionId, string start, int? top, RequestContext context)
- {
- Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
-
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionAuditEntries");
- scope.Start();
- try
- {
- using HttpMessage message = CreateGetLivenessSessionAuditEntriesRequest(sessionId, start, top, context);
- return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
-
- ///
- /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-audit-entries for more details.
- ///
- /// -
- ///
- /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- ///
- ///
- /// -
- ///
- /// Please try the simpler convenience overload with strongly typed models first.
- ///
- ///
- ///
- ///
- /// The unique ID to reference this session.
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
- /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
- /// Service returned a non-success status code.
- /// The response returned from the service.
- ///
- public virtual Response GetLivenessSessionAuditEntries(string sessionId, string start, int? top, RequestContext context)
- {
- Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
-
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionAuditEntries");
- scope.Start();
- try
- {
- using HttpMessage message = CreateGetLivenessSessionAuditEntriesRequest(sessionId, start, top, context);
- return _pipeline.ProcessMessage(message, context);
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
-
- /// Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call.
- /// Body parameter.
- /// The cancellation token to use.
- /// is null.
- /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session for more details.
- internal virtual async Task> CreateLivenessWithVerifySessionAsync(CreateLivenessWithVerifySessionContent body, CancellationToken cancellationToken = default)
- {
- Argument.AssertNotNull(body, nameof(body));
-
- using RequestContent content = body.ToRequestContent();
- RequestContext context = FromCancellationToken(cancellationToken);
- Response response = await CreateLivenessWithVerifySessionAsync(content, context).ConfigureAwait(false);
- return Response.FromValue(CreateLivenessWithVerifySessionResult.FromResponse(response), response);
- }
-
- /// Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call.
- /// Body parameter.
- /// The cancellation token to use.
- /// is null.
- /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session for more details.
- internal virtual Response CreateLivenessWithVerifySession(CreateLivenessWithVerifySessionContent body, CancellationToken cancellationToken = default)
- {
- Argument.AssertNotNull(body, nameof(body));
-
- using RequestContent content = body.ToRequestContent();
- RequestContext context = FromCancellationToken(cancellationToken);
- Response response = CreateLivenessWithVerifySession(content, context);
- return Response.FromValue(CreateLivenessWithVerifySessionResult.FromResponse(response), response);
- }
-
- ///
- /// [Protocol Method] Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call.
- ///
- /// -
- ///
- /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- ///
- ///
- /// -
- ///
- /// Please try the simpler convenience overload with strongly typed models first.
- ///
- ///
- ///
- ///
- /// The content to send as the body of the request.
- /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
- /// is null.
- /// Service returned a non-success status code.
- /// The response returned from the service.
- internal virtual async Task CreateLivenessWithVerifySessionAsync(RequestContent content, RequestContext context = null)
- {
- Argument.AssertNotNull(content, nameof(content));
-
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySession");
- scope.Start();
- try
- {
- using HttpMessage message = CreateCreateLivenessWithVerifySessionRequest(content, context);
- return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
-
- ///
- /// [Protocol Method] Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call.
- ///
- /// -
- ///
- /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- ///
- ///
- /// -
- ///
- /// Please try the simpler convenience overload with strongly typed models first.
- ///
- ///
- ///
- ///
- /// The content to send as the body of the request.
- /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
- /// is null.
- /// Service returned a non-success status code.
- /// The response returned from the service.
- internal virtual Response CreateLivenessWithVerifySession(RequestContent content, RequestContext context = null)
- {
- Argument.AssertNotNull(content, nameof(content));
-
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySession");
- scope.Start();
- try
- {
- using HttpMessage message = CreateCreateLivenessWithVerifySessionRequest(content, context);
- return _pipeline.ProcessMessage(message, context);
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
-
- /// Create a new liveness session with verify. Provide the verify image during session creation.
- /// Request content of liveness with verify session creation.
- /// The cancellation token to use.
- /// is null.
- /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session-with-verify-image for more details.
- internal virtual async Task> CreateLivenessWithVerifySessionWithVerifyImageAsync(CreateLivenessWithVerifySessionMultipartContent body, CancellationToken cancellationToken = default)
- {
- Argument.AssertNotNull(body, nameof(body));
-
- using MultipartFormDataRequestContent content = body.ToMultipartRequestContent();
- RequestContext context = FromCancellationToken(cancellationToken);
- Response response = await CreateLivenessWithVerifySessionWithVerifyImageAsync(content, content.ContentType, context).ConfigureAwait(false);
- return Response.FromValue(CreateLivenessWithVerifySessionResult.FromResponse(response), response);
- }
-
- /// Create a new liveness session with verify. Provide the verify image during session creation.
- /// Request content of liveness with verify session creation.
- /// The cancellation token to use.
- /// is null.
- /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session-with-verify-image for more details.
- internal virtual Response CreateLivenessWithVerifySessionWithVerifyImage(CreateLivenessWithVerifySessionMultipartContent body, CancellationToken cancellationToken = default)
- {
- Argument.AssertNotNull(body, nameof(body));
-
- using MultipartFormDataRequestContent content = body.ToMultipartRequestContent();
- RequestContext context = FromCancellationToken(cancellationToken);
- Response response = CreateLivenessWithVerifySessionWithVerifyImage(content, content.ContentType, context);
- return Response.FromValue(CreateLivenessWithVerifySessionResult.FromResponse(response), response);
- }
-
- ///
- /// [Protocol Method] Create a new liveness session with verify. Provide the verify image during session creation.
- ///
- /// -
- ///
- /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- ///
- ///
- /// -
- ///
- /// Please try the simpler convenience overload with strongly typed models first.
- ///
- ///
- ///
- ///
- /// The content to send as the body of the request.
- /// The content type for the operation. Always multipart/form-data for this operation. Allowed values: "multipart/form-data".
- /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
- /// is null.
- /// Service returned a non-success status code.
- /// The response returned from the service.
- internal virtual async Task CreateLivenessWithVerifySessionWithVerifyImageAsync(RequestContent content, string contentType, RequestContext context = null)
- {
- Argument.AssertNotNull(content, nameof(content));
-
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySessionWithVerifyImage");
- scope.Start();
- try
- {
- using HttpMessage message = CreateCreateLivenessWithVerifySessionWithVerifyImageRequest(content, contentType, context);
- return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
-
- ///
- /// [Protocol Method] Create a new liveness session with verify. Provide the verify image during session creation.
- ///
- /// -
- ///
- /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- ///
- ///
- /// -
- ///
- /// Please try the simpler convenience overload with strongly typed models first.
- ///
- ///
- ///
- ///
- /// The content to send as the body of the request.
- /// The content type for the operation. Always multipart/form-data for this operation. Allowed values: "multipart/form-data".
- /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
- /// is null.
- /// Service returned a non-success status code.
- /// The response returned from the service.
- internal virtual Response CreateLivenessWithVerifySessionWithVerifyImage(RequestContent content, string contentType, RequestContext context = null)
- {
- Argument.AssertNotNull(content, nameof(content));
-
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySessionWithVerifyImage");
- scope.Start();
- try
- {
- using HttpMessage message = CreateCreateLivenessWithVerifySessionWithVerifyImageRequest(content, contentType, context);
- return _pipeline.ProcessMessage(message, context);
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
-
- // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
- ///
- /// [Protocol Method] Delete all session related information for matching the specified session id.
- ///
- /// -
- ///
- /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- ///
- ///
- ///
- ///
- /// The unique ID to reference this session.
- /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
- /// Service returned a non-success status code.
- /// The response returned from the service.
- ///
- public virtual async Task DeleteLivenessWithVerifySessionAsync(string sessionId, RequestContext context = null)
+ public virtual async Task GetLivenessSessionResultAsync(string sessionId, RequestContext context)
{
Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.DeleteLivenessWithVerifySession");
+ using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionResult");
scope.Start();
try
{
- using HttpMessage message = CreateDeleteLivenessWithVerifySessionRequest(sessionId, context);
+ using HttpMessage message = CreateGetLivenessSessionResultRequest(sessionId, context);
return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
catch (Exception e)
@@ -894,15 +354,19 @@ public virtual async Task DeleteLivenessWithVerifySessionAsync(string
}
}
- // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
///
- /// [Protocol Method] Delete all session related information for matching the specified session id.
+ /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-result for more details.
///
/// -
///
/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
///
///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
///
///
/// The unique ID to reference this session.
@@ -911,16 +375,16 @@ public virtual async Task DeleteLivenessWithVerifySessionAsync(string
/// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- ///
- public virtual Response DeleteLivenessWithVerifySession(string sessionId, RequestContext context = null)
+ ///
+ public virtual Response GetLivenessSessionResult(string sessionId, RequestContext context)
{
Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.DeleteLivenessWithVerifySession");
+ using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionResult");
scope.Start();
try
{
- using HttpMessage message = CreateDeleteLivenessWithVerifySessionRequest(sessionId, context);
+ using HttpMessage message = CreateGetLivenessSessionResultRequest(sessionId, context);
return _pipeline.ProcessMessage(message, context);
}
catch (Exception e)
@@ -930,38 +394,40 @@ public virtual Response DeleteLivenessWithVerifySession(string sessionId, Reques
}
}
- /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details.
- /// The unique ID to reference this session.
+ /// Create a new liveness session with verify. Provide the verify image during session creation.
+ /// Request content of liveness with verify session creation.
/// The cancellation token to use.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
- ///
- public virtual async Task> GetLivenessWithVerifySessionResultAsync(string sessionId, CancellationToken cancellationToken = default)
+ /// is null.
+ /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session-with-verify-image for more details.
+ ///
+ public virtual async Task> CreateLivenessWithVerifySessionAsync(CreateLivenessWithVerifySessionContent body, CancellationToken cancellationToken = default)
{
- Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
+ Argument.AssertNotNull(body, nameof(body));
+ using MultipartFormDataRequestContent content = body.ToMultipartRequestContent();
RequestContext context = FromCancellationToken(cancellationToken);
- Response response = await GetLivenessWithVerifySessionResultAsync(sessionId, context).ConfigureAwait(false);
+ Response response = await CreateLivenessWithVerifySessionAsync(content, content.ContentType, context).ConfigureAwait(false);
return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response);
}
- /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details.
- /// The unique ID to reference this session.
+ /// Create a new liveness session with verify. Provide the verify image during session creation.
+ /// Request content of liveness with verify session creation.
/// The cancellation token to use.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
- ///
- public virtual Response GetLivenessWithVerifySessionResult(string sessionId, CancellationToken cancellationToken = default)
+ /// is null.
+ /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session-with-verify-image for more details.
+ ///
+ public virtual Response CreateLivenessWithVerifySession(CreateLivenessWithVerifySessionContent body, CancellationToken cancellationToken = default)
{
- Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
+ Argument.AssertNotNull(body, nameof(body));
+ using MultipartFormDataRequestContent content = body.ToMultipartRequestContent();
RequestContext context = FromCancellationToken(cancellationToken);
- Response response = GetLivenessWithVerifySessionResult(sessionId, context);
+ Response response = CreateLivenessWithVerifySession(content, content.ContentType, context);
return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response);
}
///
- /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details.
+ /// [Protocol Method] Create a new liveness session with verify. Provide the verify image during session creation.
///
/// -
///
@@ -970,27 +436,27 @@ public virtual Response GetLivenessWithVerifySessionR
///
/// -
///
- /// Please try the simpler convenience overload with strongly typed models first.
+ /// Please try the simpler convenience overload with strongly typed models first.
///
///
///
///
- /// The unique ID to reference this session.
+ /// The content to send as the body of the request.
+ /// The content type for the operation. Always multipart/form-data for this operation. Allowed values: "multipart/form-data".
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
+ /// is null.
/// Service returned a non-success status code.
/// The response returned from the service.
- ///
- public virtual async Task GetLivenessWithVerifySessionResultAsync(string sessionId, RequestContext context)
+ ///
+ public virtual async Task CreateLivenessWithVerifySessionAsync(RequestContent content, string contentType, RequestContext context = null)
{
- Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
+ Argument.AssertNotNull(content, nameof(content));
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionResult");
+ using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySession");
scope.Start();
try
{
- using HttpMessage message = CreateGetLivenessWithVerifySessionResultRequest(sessionId, context);
+ using HttpMessage message = CreateCreateLivenessWithVerifySessionRequest(content, contentType, context);
return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
catch (Exception e)
@@ -1001,7 +467,7 @@ public virtual async Task GetLivenessWithVerifySessionResultAsync(stri
}
///
- /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details.
+ /// [Protocol Method] Create a new liveness session with verify. Provide the verify image during session creation.
///
/// -
///
@@ -1010,27 +476,27 @@ public virtual async Task GetLivenessWithVerifySessionResultAsync(stri
///
/// -
///
- /// Please try the simpler convenience overload with strongly typed models first.
+ /// Please try the simpler convenience overload with strongly typed models first.
///
///
///
///
- /// The unique ID to reference this session.
+ /// The content to send as the body of the request.
+ /// The content type for the operation. Always multipart/form-data for this operation. Allowed values: "multipart/form-data".
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
+ /// is null.
/// Service returned a non-success status code.
/// The response returned from the service.
- ///
- public virtual Response GetLivenessWithVerifySessionResult(string sessionId, RequestContext context)
+ ///
+ public virtual Response CreateLivenessWithVerifySession(RequestContent content, string contentType, RequestContext context = null)
{
- Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
+ Argument.AssertNotNull(content, nameof(content));
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionResult");
+ using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySession");
scope.Start();
try
{
- using HttpMessage message = CreateGetLivenessWithVerifySessionResultRequest(sessionId, context);
+ using HttpMessage message = CreateCreateLivenessWithVerifySessionRequest(content, contentType, context);
return _pipeline.ProcessMessage(message, context);
}
catch (Exception e)
@@ -1040,76 +506,33 @@ public virtual Response GetLivenessWithVerifySessionResult(string sessionId, Req
}
}
- /// Lists sessions for /detectLivenessWithVerify/SingleModal.
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
- /// The cancellation token to use.
- /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-sessions for more details.
- ///
- public virtual async Task>> GetLivenessWithVerifySessionsAsync(string start = null, int? top = null, CancellationToken cancellationToken = default)
- {
- RequestContext context = FromCancellationToken(cancellationToken);
- Response response = await GetLivenessWithVerifySessionsAsync(start, top, context).ConfigureAwait(false);
- IReadOnlyList value = default;
- using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false);
- List array = new List();
- foreach (var item in document.RootElement.EnumerateArray())
- {
- array.Add(LivenessSessionItem.DeserializeLivenessSessionItem(item));
- }
- value = array;
- return Response.FromValue(value, response);
- }
-
- /// Lists sessions for /detectLivenessWithVerify/SingleModal.
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
- /// The cancellation token to use.
- /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-sessions for more details.
- ///
- public virtual Response> GetLivenessWithVerifySessions(string start = null, int? top = null, CancellationToken cancellationToken = default)
- {
- RequestContext context = FromCancellationToken(cancellationToken);
- Response response = GetLivenessWithVerifySessions(start, top, context);
- IReadOnlyList value = default;
- using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions);
- List array = new List();
- foreach (var item in document.RootElement.EnumerateArray())
- {
- array.Add(LivenessSessionItem.DeserializeLivenessSessionItem(item));
- }
- value = array;
- return Response.FromValue(value, response);
- }
-
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
///
- /// [Protocol Method] Lists sessions for /detectLivenessWithVerify/SingleModal.
+ /// [Protocol Method] Delete all session related information for matching the specified session id.
///
/// -
///
/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
///
///
- /// -
- ///
- /// Please try the simpler convenience overload with strongly typed models first.
- ///
- ///
///
///
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
+ /// The unique ID to reference this session.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- ///
- public virtual async Task GetLivenessWithVerifySessionsAsync(string start, int? top, RequestContext context)
+ ///
+ public virtual async Task DeleteLivenessWithVerifySessionAsync(string sessionId, RequestContext context = null)
{
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessions");
+ Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
+
+ using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.DeleteLivenessWithVerifySession");
scope.Start();
try
{
- using HttpMessage message = CreateGetLivenessWithVerifySessionsRequest(start, top, context);
+ using HttpMessage message = CreateDeleteLivenessWithVerifySessionRequest(sessionId, context);
return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
catch (Exception e)
@@ -1119,34 +542,33 @@ public virtual async Task GetLivenessWithVerifySessionsAsync(string st
}
}
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
///
- /// [Protocol Method] Lists sessions for /detectLivenessWithVerify/SingleModal.
+ /// [Protocol Method] Delete all session related information for matching the specified session id.
///
/// -
///
/// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
///
///
- /// -
- ///
- /// Please try the simpler convenience overload with strongly typed models first.
- ///
- ///
///
///
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
+ /// The unique ID to reference this session.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- ///
- public virtual Response GetLivenessWithVerifySessions(string start, int? top, RequestContext context)
+ ///
+ public virtual Response DeleteLivenessWithVerifySession(string sessionId, RequestContext context = null)
{
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessions");
+ Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
+
+ using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.DeleteLivenessWithVerifySession");
scope.Start();
try
{
- using HttpMessage message = CreateGetLivenessWithVerifySessionsRequest(start, top, context);
+ using HttpMessage message = CreateDeleteLivenessWithVerifySessionRequest(sessionId, context);
return _pipeline.ProcessMessage(message, context);
}
catch (Exception e)
@@ -1156,58 +578,38 @@ public virtual Response GetLivenessWithVerifySessions(string start, int? top, Re
}
}
- /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-audit-entries for more details.
+ /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details.
/// The unique ID to reference this session.
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
/// The cancellation token to use.
/// is null.
/// is an empty string, and was expected to be non-empty.
- ///
- public virtual async Task>> GetLivenessWithVerifySessionAuditEntriesAsync(string sessionId, string start = null, int? top = null, CancellationToken cancellationToken = default)
+ ///
+ public virtual async Task> GetLivenessWithVerifySessionResultAsync(string sessionId, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
RequestContext context = FromCancellationToken(cancellationToken);
- Response response = await GetLivenessWithVerifySessionAuditEntriesAsync(sessionId, start, top, context).ConfigureAwait(false);
- IReadOnlyList value = default;
- using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false);
- List array = new List();
- foreach (var item in document.RootElement.EnumerateArray())
- {
- array.Add(LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(item));
- }
- value = array;
- return Response.FromValue(value, response);
+ Response response = await GetLivenessWithVerifySessionResultAsync(sessionId, context).ConfigureAwait(false);
+ return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response);
}
- /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-audit-entries for more details.
+ /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details.
/// The unique ID to reference this session.
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
/// The cancellation token to use.
/// is null.
/// is an empty string, and was expected to be non-empty.
- ///
- public virtual Response> GetLivenessWithVerifySessionAuditEntries(string sessionId, string start = null, int? top = null, CancellationToken cancellationToken = default)
+ ///
+ public virtual Response GetLivenessWithVerifySessionResult(string sessionId, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
RequestContext context = FromCancellationToken(cancellationToken);
- Response response = GetLivenessWithVerifySessionAuditEntries(sessionId, start, top, context);
- IReadOnlyList value = default;
- using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions);
- List array = new List();
- foreach (var item in document.RootElement.EnumerateArray())
- {
- array.Add(LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(item));
- }
- value = array;
- return Response.FromValue(value, response);
+ Response response = GetLivenessWithVerifySessionResult(sessionId, context);
+ return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response);
}
///
- /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-audit-entries for more details.
+ /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details.
///
/// -
///
@@ -1216,29 +618,27 @@ public virtual Response> GetLivenessWit
///
/// -
///
- /// Please try the simpler convenience overload with strongly typed models first.
+ /// Please try the simpler convenience overload with strongly typed models first.
///
///
///
///
/// The unique ID to reference this session.
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// is null.
/// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- ///
- public virtual async Task GetLivenessWithVerifySessionAuditEntriesAsync(string sessionId, string start, int? top, RequestContext context)
+ ///
+ public virtual async Task GetLivenessWithVerifySessionResultAsync(string sessionId, RequestContext context)
{
Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionAuditEntries");
+ using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionResult");
scope.Start();
try
{
- using HttpMessage message = CreateGetLivenessWithVerifySessionAuditEntriesRequest(sessionId, start, top, context);
+ using HttpMessage message = CreateGetLivenessWithVerifySessionResultRequest(sessionId, context);
return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
catch (Exception e)
@@ -1249,7 +649,7 @@ public virtual async Task GetLivenessWithVerifySessionAuditEntriesAsyn
}
///
- /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-audit-entries for more details.
+ /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details.
///
/// -
///
@@ -1258,29 +658,27 @@ public virtual async Task GetLivenessWithVerifySessionAuditEntriesAsyn
///
/// -
///
- /// Please try the simpler convenience overload with strongly typed models first.
+ /// Please try the simpler convenience overload with strongly typed models first.
///
///
///
///
/// The unique ID to reference this session.
- /// List resources greater than the "start". It contains no more than 64 characters. Default is empty.
- /// The number of items to list, ranging in [1, 1000]. Default is 1000.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// is null.
/// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- ///
- public virtual Response GetLivenessWithVerifySessionAuditEntries(string sessionId, string start, int? top, RequestContext context)
+ ///
+ public virtual Response GetLivenessWithVerifySessionResult(string sessionId, RequestContext context)
{
Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId));
- using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionAuditEntries");
+ using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionResult");
scope.Start();
try
{
- using HttpMessage message = CreateGetLivenessWithVerifySessionAuditEntriesRequest(sessionId, start, top, context);
+ using HttpMessage message = CreateGetLivenessWithVerifySessionResultRequest(sessionId, context);
return _pipeline.ProcessMessage(message, context);
}
catch (Exception e)
@@ -1563,7 +961,7 @@ internal HttpMessage CreateCreateLivenessSessionRequest(RequestContent content,
uri.Reset(_endpoint);
uri.AppendRaw("/face/", false);
uri.AppendRaw(_apiVersion, true);
- uri.AppendPath("/detectLiveness/singleModal/sessions", false);
+ uri.AppendPath("/detectLiveness-sessions", false);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Content-Type", "application/json");
@@ -1573,14 +971,14 @@ internal HttpMessage CreateCreateLivenessSessionRequest(RequestContent content,
internal HttpMessage CreateDeleteLivenessSessionRequest(string sessionId, RequestContext context)
{
- var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var message = _pipeline.CreateMessage(context, ResponseClassifier204);
var request = message.Request;
request.Method = RequestMethod.Delete;
var uri = new RawRequestUriBuilder();
uri.Reset(_endpoint);
uri.AppendRaw("/face/", false);
uri.AppendRaw(_apiVersion, true);
- uri.AppendPath("/detectLiveness/singleModal/sessions/", false);
+ uri.AppendPath("/detectLiveness-sessions/", false);
uri.AppendPath(sessionId, true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
@@ -1596,79 +994,14 @@ internal HttpMessage CreateGetLivenessSessionResultRequest(string sessionId, Req
uri.Reset(_endpoint);
uri.AppendRaw("/face/", false);
uri.AppendRaw(_apiVersion, true);
- uri.AppendPath("/detectLiveness/singleModal/sessions/", false);
- uri.AppendPath(sessionId, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
- }
-
- internal HttpMessage CreateGetLivenessSessionsRequest(string start, int? top, RequestContext context)
- {
- var message = _pipeline.CreateMessage(context, ResponseClassifier200);
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendRaw("/face/", false);
- uri.AppendRaw(_apiVersion, true);
- uri.AppendPath("/detectLiveness/singleModal/sessions", false);
- if (start != null)
- {
- uri.AppendQuery("start", start, true);
- }
- if (top != null)
- {
- uri.AppendQuery("top", top.Value, true);
- }
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
- }
-
- internal HttpMessage CreateGetLivenessSessionAuditEntriesRequest(string sessionId, string start, int? top, RequestContext context)
- {
- var message = _pipeline.CreateMessage(context, ResponseClassifier200);
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendRaw("/face/", false);
- uri.AppendRaw(_apiVersion, true);
- uri.AppendPath("/detectLiveness/singleModal/sessions/", false);
+ uri.AppendPath("/detectLiveness-sessions/", false);
uri.AppendPath(sessionId, true);
- uri.AppendPath("/audit", false);
- if (start != null)
- {
- uri.AppendQuery("start", start, true);
- }
- if (top != null)
- {
- uri.AppendQuery("top", top.Value, true);
- }
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
- }
-
- internal HttpMessage CreateCreateLivenessWithVerifySessionRequest(RequestContent content, RequestContext context)
- {
- var message = _pipeline.CreateMessage(context, ResponseClassifier200);
- var request = message.Request;
- request.Method = RequestMethod.Post;
- var uri = new RawRequestUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendRaw("/face/", false);
- uri.AppendRaw(_apiVersion, true);
- uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions", false);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
- request.Headers.Add("Content-Type", "application/json");
- request.Content = content;
return message;
}
- internal HttpMessage CreateCreateLivenessWithVerifySessionWithVerifyImageRequest(RequestContent content, string contentType, RequestContext context)
+ internal HttpMessage CreateCreateLivenessWithVerifySessionRequest(RequestContent content, string contentType, RequestContext context)
{
var message = _pipeline.CreateMessage(context, ResponseClassifier200);
var request = message.Request;
@@ -1677,7 +1010,7 @@ internal HttpMessage CreateCreateLivenessWithVerifySessionWithVerifyImageRequest
uri.Reset(_endpoint);
uri.AppendRaw("/face/", false);
uri.AppendRaw(_apiVersion, true);
- uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions", false);
+ uri.AppendPath("/detectLivenessWithVerify-sessions", false);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Content-Type", contentType);
@@ -1687,14 +1020,14 @@ internal HttpMessage CreateCreateLivenessWithVerifySessionWithVerifyImageRequest
internal HttpMessage CreateDeleteLivenessWithVerifySessionRequest(string sessionId, RequestContext context)
{
- var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var message = _pipeline.CreateMessage(context, ResponseClassifier204);
var request = message.Request;
request.Method = RequestMethod.Delete;
var uri = new RawRequestUriBuilder();
uri.Reset(_endpoint);
uri.AppendRaw("/face/", false);
uri.AppendRaw(_apiVersion, true);
- uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions/", false);
+ uri.AppendPath("/detectLivenessWithVerify-sessions/", false);
uri.AppendPath(sessionId, true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
@@ -1710,56 +1043,8 @@ internal HttpMessage CreateGetLivenessWithVerifySessionResultRequest(string sess
uri.Reset(_endpoint);
uri.AppendRaw("/face/", false);
uri.AppendRaw(_apiVersion, true);
- uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions/", false);
- uri.AppendPath(sessionId, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
- }
-
- internal HttpMessage CreateGetLivenessWithVerifySessionsRequest(string start, int? top, RequestContext context)
- {
- var message = _pipeline.CreateMessage(context, ResponseClassifier200);
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendRaw("/face/", false);
- uri.AppendRaw(_apiVersion, true);
- uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions", false);
- if (start != null)
- {
- uri.AppendQuery("start", start, true);
- }
- if (top != null)
- {
- uri.AppendQuery("top", top.Value, true);
- }
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
- }
-
- internal HttpMessage CreateGetLivenessWithVerifySessionAuditEntriesRequest(string sessionId, string start, int? top, RequestContext context)
- {
- var message = _pipeline.CreateMessage(context, ResponseClassifier200);
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendRaw("/face/", false);
- uri.AppendRaw(_apiVersion, true);
- uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions/", false);
+ uri.AppendPath("/detectLivenessWithVerify-sessions/", false);
uri.AppendPath(sessionId, true);
- uri.AppendPath("/audit", false);
- if (start != null)
- {
- uri.AppendQuery("start", start, true);
- }
- if (top != null)
- {
- uri.AppendQuery("top", top.Value, true);
- }
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
@@ -1819,7 +1104,7 @@ internal HttpMessage CreateGetSessionImageRequest(string sessionImageId, Request
uri.Reset(_endpoint);
uri.AppendRaw("/face/", false);
uri.AppendRaw(_apiVersion, true);
- uri.AppendPath("/session/sessionImages/", false);
+ uri.AppendPath("/sessionImages/", false);
uri.AppendPath(sessionImageId, true);
request.Uri = uri;
request.Headers.Add("Accept", "application/octet-stream");
@@ -1839,5 +1124,7 @@ internal static RequestContext FromCancellationToken(CancellationToken cancellat
private static ResponseClassifier _responseClassifier200;
private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 });
+ private static ResponseClassifier _responseClassifier204;
+ private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 });
}
}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionStatus.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionStatus.cs
deleted file mode 100644
index 6c583b333353..000000000000
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionStatus.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-//
-
-#nullable disable
-
-using System;
-using System.ComponentModel;
-
-namespace Azure.AI.Vision.Face
-{
- /// The current status of the session.
- public readonly partial struct FaceSessionStatus : IEquatable
- {
- private readonly string _value;
-
- /// Initializes a new instance of .
- /// is null.
- public FaceSessionStatus(string value)
- {
- _value = value ?? throw new ArgumentNullException(nameof(value));
- }
-
- private const string NotStartedValue = "NotStarted";
- private const string StartedValue = "Started";
- private const string ResultAvailableValue = "ResultAvailable";
-
- /// Session has not started.
- public static FaceSessionStatus NotStarted { get; } = new FaceSessionStatus(NotStartedValue);
- /// Session has started.
- public static FaceSessionStatus Started { get; } = new FaceSessionStatus(StartedValue);
- /// Session has available result.
- public static FaceSessionStatus ResultAvailable { get; } = new FaceSessionStatus(ResultAvailableValue);
- /// Determines if two values are the same.
- public static bool operator ==(FaceSessionStatus left, FaceSessionStatus right) => left.Equals(right);
- /// Determines if two values are not the same.
- public static bool operator !=(FaceSessionStatus left, FaceSessionStatus right) => !left.Equals(right);
- /// Converts a to a .
- public static implicit operator FaceSessionStatus(string value) => new FaceSessionStatus(value);
-
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override bool Equals(object obj) => obj is FaceSessionStatus other && Equals(other);
- ///
- public bool Equals(FaceSessionStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
-
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;
- ///
- public override string ToString() => _value;
- }
-}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LargeFaceListClient.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LargeFaceListClient.cs
index 77835b1ee957..5ce4d186d6b4 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LargeFaceListClient.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LargeFaceListClient.cs
@@ -49,7 +49,7 @@ protected LargeFaceListClient()
/// https://{resource-name}.cognitiveservices.azure.com).
///
/// Valid character is letter in lower case or digit or '-' or '_', maximum length is 64.
- /// API Version. Allowed values: "v1.1-preview.1" | "v1.2-preview.1".
+ /// API Version. Allowed values: "v1.1-preview.1" | "v1.2-preview.1" | "v1.2" | "v1.3-preview.1".
internal LargeFaceListClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, AzureKeyCredential keyCredential, TokenCredential tokenCredential, Uri endpoint, string largeFaceListId, string apiVersion)
{
ClientDiagnostics = clientDiagnostics;
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LargePersonGroupClient.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LargePersonGroupClient.cs
index 4977323e0232..0db69cb65d30 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LargePersonGroupClient.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LargePersonGroupClient.cs
@@ -49,7 +49,7 @@ protected LargePersonGroupClient()
/// https://{resource-name}.cognitiveservices.azure.com).
///
/// ID of the container.
- /// API Version. Allowed values: "v1.1-preview.1" | "v1.2-preview.1".
+ /// API Version. Allowed values: "v1.1-preview.1" | "v1.2-preview.1" | "v1.2" | "v1.3-preview.1".
internal LargePersonGroupClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, AzureKeyCredential keyCredential, TokenCredential tokenCredential, Uri endpoint, string largePersonGroupId, string apiVersion)
{
ClientDiagnostics = clientDiagnostics;
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.Serialization.cs
similarity index 65%
rename from sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.Serialization.cs
rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.Serialization.cs
index 15b072f6e4b7..f7ba4a27e38d 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.Serialization.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.Serialization.cs
@@ -13,11 +13,11 @@
namespace Azure.AI.Vision.Face
{
- public partial class CreateLivenessSessionResult : IUtf8JsonSerializable, IJsonModel
+ public partial class LivenessColorDecisionTarget : IUtf8JsonSerializable, IJsonModel
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
- void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
writer.WriteStartObject();
JsonModelWriteCore(writer, options);
@@ -28,16 +28,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR
/// The client options for reading and writing models.
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
- throw new FormatException($"The model {nameof(CreateLivenessSessionResult)} does not support writing '{format}' format.");
+ throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support writing '{format}' format.");
}
- writer.WritePropertyName("sessionId"u8);
- writer.WriteStringValue(SessionId);
- writer.WritePropertyName("authToken"u8);
- writer.WriteStringValue(AuthToken);
+ writer.WritePropertyName("faceRectangle"u8);
+ writer.WriteObjectValue(FaceRectangle, options);
if (options.Format != "W" && _serializedAdditionalRawData != null)
{
foreach (var item in _serializedAdditionalRawData)
@@ -55,19 +53,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
}
}
- CreateLivenessSessionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ LivenessColorDecisionTarget IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
- throw new FormatException($"The model {nameof(CreateLivenessSessionResult)} does not support reading '{format}' format.");
+ throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support reading '{format}' format.");
}
using JsonDocument document = JsonDocument.ParseValue(ref reader);
- return DeserializeCreateLivenessSessionResult(document.RootElement, options);
+ return DeserializeLivenessColorDecisionTarget(document.RootElement, options);
}
- internal static CreateLivenessSessionResult DeserializeCreateLivenessSessionResult(JsonElement element, ModelReaderWriterOptions options = null)
+ internal static LivenessColorDecisionTarget DeserializeLivenessColorDecisionTarget(JsonElement element, ModelReaderWriterOptions options = null)
{
options ??= ModelSerializationExtensions.WireOptions;
@@ -75,20 +73,14 @@ internal static CreateLivenessSessionResult DeserializeCreateLivenessSessionResu
{
return null;
}
- string sessionId = default;
- string authToken = default;
+ FaceRectangle faceRectangle = default;
IDictionary serializedAdditionalRawData = default;
Dictionary rawDataDictionary = new Dictionary();
foreach (var property in element.EnumerateObject())
{
- if (property.NameEquals("sessionId"u8))
+ if (property.NameEquals("faceRectangle"u8))
{
- sessionId = property.Value.GetString();
- continue;
- }
- if (property.NameEquals("authToken"u8))
- {
- authToken = property.Value.GetString();
+ faceRectangle = FaceRectangle.DeserializeFaceRectangle(property.Value, options);
continue;
}
if (options.Format != "W")
@@ -97,46 +89,46 @@ internal static CreateLivenessSessionResult DeserializeCreateLivenessSessionResu
}
}
serializedAdditionalRawData = rawDataDictionary;
- return new CreateLivenessSessionResult(sessionId, authToken, serializedAdditionalRawData);
+ return new LivenessColorDecisionTarget(faceRectangle, serializedAdditionalRawData);
}
- BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
switch (format)
{
case "J":
return ModelReaderWriter.Write(this, options);
default:
- throw new FormatException($"The model {nameof(CreateLivenessSessionResult)} does not support writing '{options.Format}' format.");
+ throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support writing '{options.Format}' format.");
}
}
- CreateLivenessSessionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ LivenessColorDecisionTarget IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
switch (format)
{
case "J":
{
using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
- return DeserializeCreateLivenessSessionResult(document.RootElement, options);
+ return DeserializeLivenessColorDecisionTarget(document.RootElement, options);
}
default:
- throw new FormatException($"The model {nameof(CreateLivenessSessionResult)} does not support reading '{options.Format}' format.");
+ throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support reading '{options.Format}' format.");
}
}
- string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
/// Deserializes the model from a raw response.
/// The response to deserialize the model from.
- internal static CreateLivenessSessionResult FromResponse(Response response)
+ internal static LivenessColorDecisionTarget FromResponse(Response response)
{
using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
- return DeserializeCreateLivenessSessionResult(document.RootElement);
+ return DeserializeLivenessColorDecisionTarget(document.RootElement);
}
/// Convert into a .
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.cs
similarity index 51%
rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.cs
rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.cs
index 4469cf9f8d50..9a04763a6e3d 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.cs
@@ -10,8 +10,8 @@
namespace Azure.AI.Vision.Face
{
- /// The liveness classification for target face.
- public partial class LivenessOutputsTarget
+ /// The target from color image used for liveness classification.
+ public partial class LivenessColorDecisionTarget
{
///
/// Keeps track of any properties unknown to the library.
@@ -45,50 +45,31 @@ public partial class LivenessOutputsTarget
///
private IDictionary _serializedAdditionalRawData;
- /// Initializes a new instance of .
+ /// Initializes a new instance of .
/// The face region where the liveness classification was made on.
- /// The file name which contains the face rectangle where the liveness classification was made on.
- /// The time offset within the file of the frame which contains the face rectangle where the liveness classification was made on.
- /// The image type which contains the face rectangle where the liveness classification was made on.
- /// or is null.
- internal LivenessOutputsTarget(FaceRectangle faceRectangle, string fileName, int timeOffsetWithinFile, FaceImageType imageType)
+ /// is null.
+ internal LivenessColorDecisionTarget(FaceRectangle faceRectangle)
{
Argument.AssertNotNull(faceRectangle, nameof(faceRectangle));
- Argument.AssertNotNull(fileName, nameof(fileName));
FaceRectangle = faceRectangle;
- FileName = fileName;
- TimeOffsetWithinFile = timeOffsetWithinFile;
- ImageType = imageType;
}
- /// Initializes a new instance of .
+ /// Initializes a new instance of .
/// The face region where the liveness classification was made on.
- /// The file name which contains the face rectangle where the liveness classification was made on.
- /// The time offset within the file of the frame which contains the face rectangle where the liveness classification was made on.
- /// The image type which contains the face rectangle where the liveness classification was made on.
/// Keeps track of any properties unknown to the library.
- internal LivenessOutputsTarget(FaceRectangle faceRectangle, string fileName, int timeOffsetWithinFile, FaceImageType imageType, IDictionary serializedAdditionalRawData)
+ internal LivenessColorDecisionTarget(FaceRectangle faceRectangle, IDictionary serializedAdditionalRawData)
{
FaceRectangle = faceRectangle;
- FileName = fileName;
- TimeOffsetWithinFile = timeOffsetWithinFile;
- ImageType = imageType;
_serializedAdditionalRawData = serializedAdditionalRawData;
}
- /// Initializes a new instance of for deserialization.
- internal LivenessOutputsTarget()
+ /// Initializes a new instance of for deserialization.
+ internal LivenessColorDecisionTarget()
{
}
/// The face region where the liveness classification was made on.
public FaceRectangle FaceRectangle { get; }
- /// The file name which contains the face rectangle where the liveness classification was made on.
- public string FileName { get; }
- /// The time offset within the file of the frame which contains the face rectangle where the liveness classification was made on.
- public int TimeOffsetWithinFile { get; }
- /// The image type which contains the face rectangle where the liveness classification was made on.
- public FaceImageType ImageType { get; }
}
}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.Serialization.cs
new file mode 100644
index 000000000000..20ea28c7a099
--- /dev/null
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.Serialization.cs
@@ -0,0 +1,142 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.Vision.Face
+{
+ public partial class LivenessDecisionTargets : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ writer.WriteStartObject();
+ JsonModelWriteCore(writer, options);
+ writer.WriteEndObject();
+ }
+
+ /// The JSON writer.
+ /// The client options for reading and writing models.
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(LivenessDecisionTargets)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("color"u8);
+ writer.WriteObjectValue(Color, options);
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ LivenessDecisionTargets IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(LivenessDecisionTargets)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeLivenessDecisionTargets(document.RootElement, options);
+ }
+
+ internal static LivenessDecisionTargets DeserializeLivenessDecisionTargets(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ LivenessColorDecisionTarget color = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("color"u8))
+ {
+ color = LivenessColorDecisionTarget.DeserializeLivenessColorDecisionTarget(property.Value, options);
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new LivenessDecisionTargets(color, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(LivenessDecisionTargets)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ LivenessDecisionTargets IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeLivenessDecisionTargets(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(LivenessDecisionTargets)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static LivenessDecisionTargets FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeLivenessDecisionTargets(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.cs
new file mode 100644
index 000000000000..8e64b0560f73
--- /dev/null
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.cs
@@ -0,0 +1,75 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.AI.Vision.Face
+{
+ /// The targets used for liveness classification.
+ public partial class LivenessDecisionTargets
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The target from color image used for liveness classification.
+ /// is null.
+ internal LivenessDecisionTargets(LivenessColorDecisionTarget color)
+ {
+ Argument.AssertNotNull(color, nameof(color));
+
+ Color = color;
+ }
+
+ /// Initializes a new instance of .
+ /// The target from color image used for liveness classification.
+ /// Keeps track of any properties unknown to the library.
+ internal LivenessDecisionTargets(LivenessColorDecisionTarget color, IDictionary serializedAdditionalRawData)
+ {
+ Color = color;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal LivenessDecisionTargets()
+ {
+ }
+
+ /// The target from color image used for liveness classification.
+ public LivenessColorDecisionTarget Color { get; }
+ }
+}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.Serialization.cs
similarity index 57%
rename from sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.Serialization.cs
rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.Serialization.cs
index 3d4f997e8429..617f0c01c590 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.Serialization.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.Serialization.cs
@@ -13,11 +13,11 @@
namespace Azure.AI.Vision.Face
{
- public partial class AuditLivenessResponseInfo : IUtf8JsonSerializable, IJsonModel
+ public partial class LivenessError : IUtf8JsonSerializable, IJsonModel
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
- void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
writer.WriteStartObject();
JsonModelWriteCore(writer, options);
@@ -28,18 +28,18 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea
/// The client options for reading and writing models.
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
- throw new FormatException($"The model {nameof(AuditLivenessResponseInfo)} does not support writing '{format}' format.");
+ throw new FormatException($"The model {nameof(LivenessError)} does not support writing '{format}' format.");
}
- writer.WritePropertyName("body"u8);
- writer.WriteObjectValue(Body, options);
- writer.WritePropertyName("statusCode"u8);
- writer.WriteNumberValue(StatusCode);
- writer.WritePropertyName("latencyInMilliseconds"u8);
- writer.WriteNumberValue(LatencyInMilliseconds);
+ writer.WritePropertyName("code"u8);
+ writer.WriteStringValue(Code);
+ writer.WritePropertyName("message"u8);
+ writer.WriteStringValue(Message);
+ writer.WritePropertyName("targets"u8);
+ writer.WriteObjectValue(Targets, options);
if (options.Format != "W" && _serializedAdditionalRawData != null)
{
foreach (var item in _serializedAdditionalRawData)
@@ -57,19 +57,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
}
}
- AuditLivenessResponseInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ LivenessError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
- throw new FormatException($"The model {nameof(AuditLivenessResponseInfo)} does not support reading '{format}' format.");
+ throw new FormatException($"The model {nameof(LivenessError)} does not support reading '{format}' format.");
}
using JsonDocument document = JsonDocument.ParseValue(ref reader);
- return DeserializeAuditLivenessResponseInfo(document.RootElement, options);
+ return DeserializeLivenessError(document.RootElement, options);
}
- internal static AuditLivenessResponseInfo DeserializeAuditLivenessResponseInfo(JsonElement element, ModelReaderWriterOptions options = null)
+ internal static LivenessError DeserializeLivenessError(JsonElement element, ModelReaderWriterOptions options = null)
{
options ??= ModelSerializationExtensions.WireOptions;
@@ -77,26 +77,26 @@ internal static AuditLivenessResponseInfo DeserializeAuditLivenessResponseInfo(J
{
return null;
}
- LivenessResponseBody body = default;
- int statusCode = default;
- long latencyInMilliseconds = default;
+ string code = default;
+ string message = default;
+ LivenessDecisionTargets targets = default;
IDictionary serializedAdditionalRawData = default;
Dictionary rawDataDictionary = new Dictionary();
foreach (var property in element.EnumerateObject())
{
- if (property.NameEquals("body"u8))
+ if (property.NameEquals("code"u8))
{
- body = LivenessResponseBody.DeserializeLivenessResponseBody(property.Value, options);
+ code = property.Value.GetString();
continue;
}
- if (property.NameEquals("statusCode"u8))
+ if (property.NameEquals("message"u8))
{
- statusCode = property.Value.GetInt32();
+ message = property.Value.GetString();
continue;
}
- if (property.NameEquals("latencyInMilliseconds"u8))
+ if (property.NameEquals("targets"u8))
{
- latencyInMilliseconds = property.Value.GetInt64();
+ targets = LivenessDecisionTargets.DeserializeLivenessDecisionTargets(property.Value, options);
continue;
}
if (options.Format != "W")
@@ -105,46 +105,46 @@ internal static AuditLivenessResponseInfo DeserializeAuditLivenessResponseInfo(J
}
}
serializedAdditionalRawData = rawDataDictionary;
- return new AuditLivenessResponseInfo(body, statusCode, latencyInMilliseconds, serializedAdditionalRawData);
+ return new LivenessError(code, message, targets, serializedAdditionalRawData);
}
- BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
switch (format)
{
case "J":
return ModelReaderWriter.Write(this, options);
default:
- throw new FormatException($"The model {nameof(AuditLivenessResponseInfo)} does not support writing '{options.Format}' format.");
+ throw new FormatException($"The model {nameof(LivenessError)} does not support writing '{options.Format}' format.");
}
}
- AuditLivenessResponseInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ LivenessError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
switch (format)
{
case "J":
{
using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
- return DeserializeAuditLivenessResponseInfo(document.RootElement, options);
+ return DeserializeLivenessError(document.RootElement, options);
}
default:
- throw new FormatException($"The model {nameof(AuditLivenessResponseInfo)} does not support reading '{options.Format}' format.");
+ throw new FormatException($"The model {nameof(LivenessError)} does not support reading '{options.Format}' format.");
}
}
- string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
/// Deserializes the model from a raw response.
/// The response to deserialize the model from.
- internal static AuditLivenessResponseInfo FromResponse(Response response)
+ internal static LivenessError FromResponse(Response response)
{
using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
- return DeserializeAuditLivenessResponseInfo(document.RootElement);
+ return DeserializeLivenessError(document.RootElement);
}
/// Convert into a .
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.cs
new file mode 100644
index 000000000000..4b38aa3b7260
--- /dev/null
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.cs
@@ -0,0 +1,89 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.AI.Vision.Face
+{
+ /// The error of the liveness classification.
+ public partial class LivenessError
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The error code.
+ /// The error message.
+ /// Targets used for liveness classification.
+ /// , or is null.
+ internal LivenessError(string code, string message, LivenessDecisionTargets targets)
+ {
+ Argument.AssertNotNull(code, nameof(code));
+ Argument.AssertNotNull(message, nameof(message));
+ Argument.AssertNotNull(targets, nameof(targets));
+
+ Code = code;
+ Message = message;
+ Targets = targets;
+ }
+
+ /// Initializes a new instance of .
+ /// The error code.
+ /// The error message.
+ /// Targets used for liveness classification.
+ /// Keeps track of any properties unknown to the library.
+ internal LivenessError(string code, string message, LivenessDecisionTargets targets, IDictionary serializedAdditionalRawData)
+ {
+ Code = code;
+ Message = message;
+ Targets = targets;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal LivenessError()
+ {
+ }
+
+ /// The error code.
+ public string Code { get; }
+ /// The error message.
+ public string Message { get; }
+ /// Targets used for liveness classification.
+ public LivenessDecisionTargets Targets { get; }
+ }
+}
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessModel.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessModel.cs
index f5a0af9fc967..8cf63b931713 100644
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessModel.cs
+++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessModel.cs
@@ -22,13 +22,10 @@ public LivenessModel(string value)
_value = value ?? throw new ArgumentNullException(nameof(value));
}
- private const string V20221015Preview04Value = "2022-10-15-preview.04";
- private const string V20231220Preview06Value = "2023-12-20-preview.06";
+ private const string V20241115Value = "2024-11-15";
- /// 2022-10-15-preview.04.
- public static LivenessModel V20221015Preview04 { get; } = new LivenessModel(V20221015Preview04Value);
- /// 2023-12-20-preview.06.
- public static LivenessModel V20231220Preview06 { get; } = new LivenessModel(V20231220Preview06Value);
+ /// 2024-11-15.
+ public static LivenessModel V20241115 { get; } = new LivenessModel(V20241115Value);
/// Determines if two values are the same.
public static bool operator ==(LivenessModel left, LivenessModel right) => left.Equals(right);
/// Determines if two values are not the same.
diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.Serialization.cs
deleted file mode 100644
index 02ee779e066f..000000000000
--- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.Serialization.cs
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-//
-
-#nullable disable
-
-using System;
-using System.ClientModel.Primitives;
-using System.Collections.Generic;
-using System.Text.Json;
-using Azure.Core;
-
-namespace Azure.AI.Vision.Face
-{
- public partial class LivenessResponseBody : IUtf8JsonSerializable, IJsonModel
- {
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
-
- void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
- {
- writer.WriteStartObject();
- JsonModelWriteCore(writer, options);
- writer.WriteEndObject();
- }
-
- ///