diff --git a/sdk/face/Azure.AI.Vision.Face/CHANGELOG.md b/sdk/face/Azure.AI.Vision.Face/CHANGELOG.md index 30506182f268..e1bd7abb5c63 100644 --- a/sdk/face/Azure.AI.Vision.Face/CHANGELOG.md +++ b/sdk/face/Azure.AI.Vision.Face/CHANGELOG.md @@ -5,8 +5,10 @@ ### Features Added - Exposed `JsonModelWriteCore` for model serialization procedure. +- Added support for service versions `v1.2` and `v1.3-preview.1`. ### Breaking Changes +- Removed deprecated operations prior to service version `v1.2`. ### Bugs Fixed diff --git a/sdk/face/Azure.AI.Vision.Face/README.md b/sdk/face/Azure.AI.Vision.Face/README.md index ac1dead04aa6..fb05ae0c3766 100644 --- a/sdk/face/Azure.AI.Vision.Face/README.md +++ b/sdk/face/Azure.AI.Vision.Face/README.md @@ -252,8 +252,8 @@ Here is an example to create the session for liveness detection. ```C# Snippet:CreateLivenessSession var createContent = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, DeviceCorrelationId = Guid.NewGuid().ToString(), + UserCorrelationId = Guid.NewGuid().ToString(), }; var createResponse = sessionClient.CreateLivenessSession(createContent); @@ -268,15 +268,11 @@ After you've performed liveness detection, you can retrieve the result by provid ```C# Snippet:GetLivenessSessionResult var getResultResponse = sessionClient.GetLivenessSessionResult(sessionId); var sessionResult = getResultResponse.Value; -Console.WriteLine($"Id: {sessionResult.Id}"); -Console.WriteLine($"CreatedDateTime: {sessionResult.CreatedDateTime}"); -Console.WriteLine($"SessionExpired: {sessionResult.SessionExpired}"); -Console.WriteLine($"DeviceCorrelationId: {sessionResult.DeviceCorrelationId}"); -Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {sessionResult.AuthTokenTimeToLiveInSeconds}"); +Console.WriteLine($"Id: {sessionResult.SessionId}"); Console.WriteLine($"Status: {sessionResult.Status}"); -Console.WriteLine($"SessionStartDateTime: {sessionResult.SessionStartDateTime}"); -if (sessionResult.Result != null) { - WriteLivenessSessionAuditEntry(sessionResult.Result); +if (sessionResult.Results != null) +{ + WriteLivenessSessionResults(sessionResult.Results); } ``` diff --git a/sdk/face/Azure.AI.Vision.Face/api/Azure.AI.Vision.Face.net8.0.cs b/sdk/face/Azure.AI.Vision.Face/api/Azure.AI.Vision.Face.net8.0.cs index 7ee3660e8598..fa49ca84e597 100644 --- a/sdk/face/Azure.AI.Vision.Face/api/Azure.AI.Vision.Face.net8.0.cs +++ b/sdk/face/Azure.AI.Vision.Face/api/Azure.AI.Vision.Face.net8.0.cs @@ -1,5 +1,17 @@ namespace Azure.AI.Vision.Face { + public partial class AbuseMonitoringResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AbuseMonitoringResult() { } + public bool IsAbuseDetected { get { throw null; } } + public System.Collections.Generic.IReadOnlyList OtherFlaggedSessions { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.AbuseMonitoringResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.AbuseMonitoringResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class AccessoryItem : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal AccessoryItem() { } @@ -44,15 +56,13 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } public static partial class AIVisionFaceModelFactory { + public static Azure.AI.Vision.Face.AbuseMonitoringResult AbuseMonitoringResult(bool isAbuseDetected = false, System.Collections.Generic.IEnumerable otherFlaggedSessions = null) { throw null; } public static Azure.AI.Vision.Face.AccessoryItem AccessoryItem(Azure.AI.Vision.Face.AccessoryType type = default(Azure.AI.Vision.Face.AccessoryType), float confidence = 0f) { throw null; } public static Azure.AI.Vision.Face.AddFaceResult AddFaceResult(System.Guid persistedFaceId = default(System.Guid)) { throw null; } - public static Azure.AI.Vision.Face.AuditLivenessResponseInfo AuditLivenessResponseInfo(Azure.AI.Vision.Face.LivenessResponseBody body = null, int statusCode = 0, long latencyInMilliseconds = (long)0) { throw null; } - public static Azure.AI.Vision.Face.AuditRequestInfo AuditRequestInfo(string url = null, string method = null, long? contentLength = default(long?), string contentType = null, string userAgent = null) { throw null; } public static Azure.AI.Vision.Face.BlurProperties BlurProperties(Azure.AI.Vision.Face.BlurLevel blurLevel = default(Azure.AI.Vision.Face.BlurLevel), float value = 0f) { throw null; } - public static Azure.AI.Vision.Face.CreateLivenessSessionContent CreateLivenessSessionContent(Azure.AI.Vision.Face.LivenessOperationMode livenessOperationMode = default(Azure.AI.Vision.Face.LivenessOperationMode), bool? sendResultsToClient = default(bool?), bool? deviceCorrelationIdSetInClient = default(bool?), bool? enableSessionImage = default(bool?), Azure.AI.Vision.Face.LivenessModel? livenessSingleModalModel = default(Azure.AI.Vision.Face.LivenessModel?), string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?)) { throw null; } - public static Azure.AI.Vision.Face.CreateLivenessSessionResult CreateLivenessSessionResult(string sessionId = null, string authToken = null) { throw null; } - public static Azure.AI.Vision.Face.CreateLivenessWithVerifySessionContent CreateLivenessWithVerifySessionContent(Azure.AI.Vision.Face.LivenessOperationMode livenessOperationMode = default(Azure.AI.Vision.Face.LivenessOperationMode), bool? sendResultsToClient = default(bool?), bool? deviceCorrelationIdSetInClient = default(bool?), bool? enableSessionImage = default(bool?), Azure.AI.Vision.Face.LivenessModel? livenessSingleModalModel = default(Azure.AI.Vision.Face.LivenessModel?), string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?), bool? returnVerifyImageHash = default(bool?), float? verifyConfidenceThreshold = default(float?)) { throw null; } - public static Azure.AI.Vision.Face.CreateLivenessWithVerifySessionResult CreateLivenessWithVerifySessionResult(string sessionId = null, string authToken = null, Azure.AI.Vision.Face.LivenessWithVerifyImage verifyImage = null) { throw null; } + public static Azure.AI.Vision.Face.ClientInformation ClientInformation(string ip = null) { throw null; } + public static Azure.AI.Vision.Face.CreateLivenessSessionContent CreateLivenessSessionContent(Azure.AI.Vision.Face.LivenessOperationMode livenessOperationMode = default(Azure.AI.Vision.Face.LivenessOperationMode), bool? deviceCorrelationIdSetInClient = default(bool?), bool? enableSessionImage = default(bool?), Azure.AI.Vision.Face.LivenessModel? livenessModelVersion = default(Azure.AI.Vision.Face.LivenessModel?), string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?), int numberOfClientAttemptsAllowed = 0, string userCorrelationId = null, bool? userCorrelationIdSetInClient = default(bool?), string expectedClientIpAddress = null) { throw null; } + public static Azure.AI.Vision.Face.CreateLivenessWithVerifySessionContent CreateLivenessWithVerifySessionContent(Azure.AI.Vision.Face.LivenessOperationMode livenessOperationMode = default(Azure.AI.Vision.Face.LivenessOperationMode), bool? deviceCorrelationIdSetInClient = default(bool?), bool? enableSessionImage = default(bool?), Azure.AI.Vision.Face.LivenessModel? livenessModelVersion = default(Azure.AI.Vision.Face.LivenessModel?), bool? returnVerifyImageHash = default(bool?), float? verifyConfidenceThreshold = default(float?), System.IO.Stream verifyImage = null, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?), int? numberOfClientAttemptsAllowed = default(int?)) { throw null; } public static Azure.AI.Vision.Face.CreatePersonResult CreatePersonResult(System.Guid personId = default(System.Guid)) { throw null; } public static Azure.AI.Vision.Face.ExposureProperties ExposureProperties(Azure.AI.Vision.Face.ExposureLevel exposureLevel = default(Azure.AI.Vision.Face.ExposureLevel), float value = 0f) { throw null; } public static Azure.AI.Vision.Face.FaceAttributes FaceAttributes(float? age = default(float?), float? smile = default(float?), Azure.AI.Vision.Face.FacialHair facialHair = null, Azure.AI.Vision.Face.GlassesType? glasses = default(Azure.AI.Vision.Face.GlassesType?), Azure.AI.Vision.Face.HeadPose headPose = null, Azure.AI.Vision.Face.HairProperties hair = null, Azure.AI.Vision.Face.OcclusionProperties occlusion = null, System.Collections.Generic.IEnumerable accessories = null, Azure.AI.Vision.Face.BlurProperties blur = null, Azure.AI.Vision.Face.ExposureProperties exposure = null, Azure.AI.Vision.Face.NoiseProperties noise = null, Azure.AI.Vision.Face.MaskProperties mask = null, Azure.AI.Vision.Face.QualityForRecognition? qualityForRecognition = default(Azure.AI.Vision.Face.QualityForRecognition?)) { throw null; } @@ -75,53 +85,33 @@ public static partial class AIVisionFaceModelFactory public static Azure.AI.Vision.Face.LargePersonGroup LargePersonGroup(string name = null, string userData = null, Azure.AI.Vision.Face.FaceRecognitionModel? recognitionModel = default(Azure.AI.Vision.Face.FaceRecognitionModel?), string largePersonGroupId = null) { throw null; } public static Azure.AI.Vision.Face.LargePersonGroupPerson LargePersonGroupPerson(System.Guid personId = default(System.Guid), string name = null, string userData = null, System.Collections.Generic.IEnumerable persistedFaceIds = null) { throw null; } public static Azure.AI.Vision.Face.LargePersonGroupPersonFace LargePersonGroupPersonFace(System.Guid persistedFaceId = default(System.Guid), string userData = null) { throw null; } - public static Azure.AI.Vision.Face.LivenessOutputsTarget LivenessOutputsTarget(Azure.AI.Vision.Face.FaceRectangle faceRectangle = null, string fileName = null, int timeOffsetWithinFile = 0, Azure.AI.Vision.Face.FaceImageType imageType = default(Azure.AI.Vision.Face.FaceImageType)) { throw null; } - public static Azure.AI.Vision.Face.LivenessResponseBody LivenessResponseBody(Azure.AI.Vision.Face.FaceLivenessDecision? livenessDecision = default(Azure.AI.Vision.Face.FaceLivenessDecision?), Azure.AI.Vision.Face.LivenessOutputsTarget target = null, Azure.AI.Vision.Face.LivenessModel? modelVersionUsed = default(Azure.AI.Vision.Face.LivenessModel?), Azure.AI.Vision.Face.LivenessWithVerifyOutputs verifyResult = null, System.Collections.Generic.IReadOnlyDictionary additionalProperties = null) { throw null; } - public static Azure.AI.Vision.Face.LivenessSession LivenessSession(string id = null, System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? sessionStartDateTime = default(System.DateTimeOffset?), bool sessionExpired = false, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?), Azure.AI.Vision.Face.FaceSessionStatus status = default(Azure.AI.Vision.Face.FaceSessionStatus), Azure.AI.Vision.Face.LivenessSessionAuditEntry result = null) { throw null; } - public static Azure.AI.Vision.Face.LivenessSessionAuditEntry LivenessSessionAuditEntry(long id = (long)0, string sessionId = null, string requestId = null, string clientRequestId = null, System.DateTimeOffset receivedDateTime = default(System.DateTimeOffset), Azure.AI.Vision.Face.AuditRequestInfo request = null, Azure.AI.Vision.Face.AuditLivenessResponseInfo response = null, string digest = null, string sessionImageId = null, string verifyImageHash = null) { throw null; } - public static Azure.AI.Vision.Face.LivenessSessionItem LivenessSessionItem(string id = null, System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? sessionStartDateTime = default(System.DateTimeOffset?), bool sessionExpired = false, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?)) { throw null; } - public static Azure.AI.Vision.Face.LivenessWithVerifyImage LivenessWithVerifyImage(Azure.AI.Vision.Face.FaceRectangle faceRectangle = null, Azure.AI.Vision.Face.QualityForRecognition qualityForRecognition = default(Azure.AI.Vision.Face.QualityForRecognition)) { throw null; } - public static Azure.AI.Vision.Face.LivenessWithVerifyOutputs LivenessWithVerifyOutputs(Azure.AI.Vision.Face.LivenessWithVerifyImage verifyImage = null, float matchConfidence = 0f, bool isIdentical = false) { throw null; } - public static Azure.AI.Vision.Face.LivenessWithVerifySession LivenessWithVerifySession(string id = null, System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? sessionStartDateTime = default(System.DateTimeOffset?), bool sessionExpired = false, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?), Azure.AI.Vision.Face.FaceSessionStatus status = default(Azure.AI.Vision.Face.FaceSessionStatus), Azure.AI.Vision.Face.LivenessSessionAuditEntry result = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessColorDecisionTarget LivenessColorDecisionTarget(Azure.AI.Vision.Face.FaceRectangle faceRectangle = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessDecisionTargets LivenessDecisionTargets(Azure.AI.Vision.Face.LivenessColorDecisionTarget color = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessError LivenessError(string code = null, string message = null, Azure.AI.Vision.Face.LivenessDecisionTargets targets = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessResult LivenessResult(Azure.AI.Vision.Face.FaceLivenessDecision? livenessDecision = default(Azure.AI.Vision.Face.FaceLivenessDecision?), Azure.AI.Vision.Face.LivenessDecisionTargets targets = null, string digest = null, string sessionImageId = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessSession LivenessSession(string sessionId = null, string authToken = null, Azure.AI.Vision.Face.OperationState status = default(Azure.AI.Vision.Face.OperationState), Azure.AI.Vision.Face.LivenessModel? modelVersion = default(Azure.AI.Vision.Face.LivenessModel?), bool isAbuseMonitoringEnabled = false, string expectedClientIpAddress = null, Azure.AI.Vision.Face.LivenessSessionResults results = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessSessionAttempt LivenessSessionAttempt(int attemptId = 0, Azure.AI.Vision.Face.OperationState attemptStatus = default(Azure.AI.Vision.Face.OperationState), Azure.AI.Vision.Face.LivenessResult result = null, Azure.AI.Vision.Face.LivenessError error = null, System.Collections.Generic.IEnumerable clientInformation = null, Azure.AI.Vision.Face.AbuseMonitoringResult abuseMonitoringResult = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessSessionResults LivenessSessionResults(System.Collections.Generic.IEnumerable attempts = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessWithVerifyOutputs LivenessWithVerifyOutputs(float matchConfidence = 0f, bool isIdentical = false) { throw null; } + public static Azure.AI.Vision.Face.LivenessWithVerifyReference LivenessWithVerifyReference(Azure.AI.Vision.Face.FaceImageType referenceType = default(Azure.AI.Vision.Face.FaceImageType), Azure.AI.Vision.Face.FaceRectangle faceRectangle = null, Azure.AI.Vision.Face.QualityForRecognition qualityForRecognition = default(Azure.AI.Vision.Face.QualityForRecognition)) { throw null; } + public static Azure.AI.Vision.Face.LivenessWithVerifyResult LivenessWithVerifyResult(Azure.AI.Vision.Face.FaceLivenessDecision? livenessDecision = default(Azure.AI.Vision.Face.FaceLivenessDecision?), Azure.AI.Vision.Face.LivenessDecisionTargets targets = null, string digest = null, string sessionImageId = null, Azure.AI.Vision.Face.LivenessWithVerifyOutputs verifyResult = null, string verifyImageHash = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessWithVerifySession LivenessWithVerifySession(string sessionId = null, string authToken = null, Azure.AI.Vision.Face.OperationState status = default(Azure.AI.Vision.Face.OperationState), Azure.AI.Vision.Face.LivenessModel? modelVersion = default(Azure.AI.Vision.Face.LivenessModel?), bool isAbuseMonitoringEnabled = false, string expectedClientIpAddress = null, Azure.AI.Vision.Face.LivenessWithVerifySessionResults results = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessWithVerifySessionAttempt LivenessWithVerifySessionAttempt(int attemptId = 0, Azure.AI.Vision.Face.OperationState attemptStatus = default(Azure.AI.Vision.Face.OperationState), Azure.AI.Vision.Face.LivenessWithVerifyResult result = null, Azure.AI.Vision.Face.LivenessError error = null, System.Collections.Generic.IEnumerable clientInformation = null, Azure.AI.Vision.Face.AbuseMonitoringResult abuseMonitoringResult = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessWithVerifySessionResults LivenessWithVerifySessionResults(System.Collections.Generic.IEnumerable verifyReferences = null, System.Collections.Generic.IEnumerable attempts = null) { throw null; } public static Azure.AI.Vision.Face.MaskProperties MaskProperties(bool noseAndMouthCovered = false, Azure.AI.Vision.Face.MaskType type = default(Azure.AI.Vision.Face.MaskType)) { throw null; } public static Azure.AI.Vision.Face.NoiseProperties NoiseProperties(Azure.AI.Vision.Face.NoiseLevel noiseLevel = default(Azure.AI.Vision.Face.NoiseLevel), float value = 0f) { throw null; } public static Azure.AI.Vision.Face.OcclusionProperties OcclusionProperties(bool foreheadOccluded = false, bool eyeOccluded = false, bool mouthOccluded = false) { throw null; } - } - public partial class AuditLivenessResponseInfo : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal AuditLivenessResponseInfo() { } - public Azure.AI.Vision.Face.LivenessResponseBody Body { get { throw null; } } - public long LatencyInMilliseconds { get { throw null; } } - public int StatusCode { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.AuditLivenessResponseInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.AuditLivenessResponseInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class AuditRequestInfo : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal AuditRequestInfo() { } - public long? ContentLength { get { throw null; } } - public string ContentType { get { throw null; } } - public string Method { get { throw null; } } - public string Url { get { throw null; } } - public string UserAgent { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.AuditRequestInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.AuditRequestInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public static Azure.AI.Vision.Face.OtherFlaggedSessions OtherFlaggedSessions(int attemptId = 0, string sessionId = null, string sessionImageId = null) { throw null; } } public partial class AzureAIVisionFaceClientOptions : Azure.Core.ClientOptions { - public AzureAIVisionFaceClientOptions(Azure.AI.Vision.Face.AzureAIVisionFaceClientOptions.ServiceVersion version = Azure.AI.Vision.Face.AzureAIVisionFaceClientOptions.ServiceVersion.V1_2_Preview_1) { } + public AzureAIVisionFaceClientOptions(Azure.AI.Vision.Face.AzureAIVisionFaceClientOptions.ServiceVersion version = Azure.AI.Vision.Face.AzureAIVisionFaceClientOptions.ServiceVersion.V1_3_Preview_1) { } public enum ServiceVersion { V1_1_Preview_1 = 1, V1_2_Preview_1 = 2, + V1_2 = 3, + V1_3_Preview_1 = 4, } } public partial class AzureAIVisionFaceContext : System.ClientModel.Primitives.ModelReaderWriterContext @@ -161,6 +151,17 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class ClientInformation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ClientInformation() { } + public string Ip { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.ClientInformation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.ClientInformation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class CreateLivenessSessionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public CreateLivenessSessionContent(Azure.AI.Vision.Face.LivenessOperationMode livenessOperationMode) { } @@ -168,9 +169,12 @@ public CreateLivenessSessionContent(Azure.AI.Vision.Face.LivenessOperationMode l public string DeviceCorrelationId { get { throw null; } set { } } public bool? DeviceCorrelationIdSetInClient { get { throw null; } set { } } public bool? EnableSessionImage { get { throw null; } set { } } + public string ExpectedClientIpAddress { get { throw null; } set { } } + public Azure.AI.Vision.Face.LivenessModel? LivenessModelVersion { get { throw null; } set { } } public Azure.AI.Vision.Face.LivenessOperationMode LivenessOperationMode { get { throw null; } } - public Azure.AI.Vision.Face.LivenessModel? LivenessSingleModalModel { get { throw null; } set { } } - public bool? SendResultsToClient { get { throw null; } set { } } + public int NumberOfClientAttemptsAllowed { get { throw null; } set { } } + public string UserCorrelationId { get { throw null; } set { } } + public bool? UserCorrelationIdSetInClient { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Vision.Face.CreateLivenessSessionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -178,30 +182,19 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class CreateLivenessSessionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal CreateLivenessSessionResult() { } - public string AuthToken { get { throw null; } } - public string SessionId { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.CreateLivenessSessionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.CreateLivenessSessionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class CreateLivenessWithVerifySessionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public CreateLivenessWithVerifySessionContent(Azure.AI.Vision.Face.LivenessOperationMode livenessOperationMode) { } + public CreateLivenessWithVerifySessionContent(Azure.AI.Vision.Face.LivenessOperationMode livenessOperationMode, System.IO.Stream verifyImage) { } public int? AuthTokenTimeToLiveInSeconds { get { throw null; } set { } } public string DeviceCorrelationId { get { throw null; } set { } } public bool? DeviceCorrelationIdSetInClient { get { throw null; } set { } } public bool? EnableSessionImage { get { throw null; } set { } } + public Azure.AI.Vision.Face.LivenessModel? LivenessModelVersion { get { throw null; } set { } } public Azure.AI.Vision.Face.LivenessOperationMode LivenessOperationMode { get { throw null; } } - public Azure.AI.Vision.Face.LivenessModel? LivenessSingleModalModel { get { throw null; } set { } } + public int? NumberOfClientAttemptsAllowed { get { throw null; } set { } } public bool? ReturnVerifyImageHash { get { throw null; } set { } } - public bool? SendResultsToClient { get { throw null; } set { } } public float? VerifyConfidenceThreshold { get { throw null; } set { } } + public System.IO.Stream VerifyImage { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Vision.Face.CreateLivenessWithVerifySessionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -209,19 +202,6 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class CreateLivenessWithVerifySessionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal CreateLivenessWithVerifySessionResult() { } - public string AuthToken { get { throw null; } } - public string SessionId { get { throw null; } } - public Azure.AI.Vision.Face.LivenessWithVerifyImage VerifyImage { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.CreateLivenessWithVerifySessionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.CreateLivenessWithVerifySessionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class CreatePersonResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal CreatePersonResult() { } @@ -612,12 +592,14 @@ public FaceSessionClient(System.Uri endpoint, Azure.AzureKeyCredential credentia public FaceSessionClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } public FaceSessionClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.AI.Vision.Face.AzureAIVisionFaceClientOptions options) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response CreateLivenessSession(Azure.AI.Vision.Face.CreateLivenessSessionContent body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateLivenessSession(Azure.AI.Vision.Face.CreateLivenessSessionContent body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateLivenessSession(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> CreateLivenessSessionAsync(Azure.AI.Vision.Face.CreateLivenessSessionContent body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateLivenessSessionAsync(Azure.AI.Vision.Face.CreateLivenessSessionContent body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task CreateLivenessSessionAsync(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response CreateLivenessWithVerifySession(Azure.AI.Vision.Face.CreateLivenessWithVerifySessionContent jsonContent, System.IO.Stream verifyImage, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateLivenessWithVerifySessionAsync(Azure.AI.Vision.Face.CreateLivenessWithVerifySessionContent jsonContent, System.IO.Stream verifyImage, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateLivenessWithVerifySession(Azure.AI.Vision.Face.CreateLivenessWithVerifySessionContent body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateLivenessWithVerifySession(Azure.Core.RequestContent content, string contentType, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> CreateLivenessWithVerifySessionAsync(Azure.AI.Vision.Face.CreateLivenessWithVerifySessionContent body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateLivenessWithVerifySessionAsync(Azure.Core.RequestContent content, string contentType, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response DeleteLivenessSession(string sessionId, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteLivenessSessionAsync(string sessionId, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response DeleteLivenessWithVerifySession(string sessionId, Azure.RequestContext context = null) { throw null; } @@ -626,54 +608,19 @@ public FaceSessionClient(System.Uri endpoint, Azure.Core.TokenCredential credent public virtual Azure.Response> DetectFromSessionImage(string sessionImageId, Azure.AI.Vision.Face.FaceDetectionModel? detectionModel = default(Azure.AI.Vision.Face.FaceDetectionModel?), Azure.AI.Vision.Face.FaceRecognitionModel? recognitionModel = default(Azure.AI.Vision.Face.FaceRecognitionModel?), bool? returnFaceId = default(bool?), System.Collections.Generic.IEnumerable returnFaceAttributes = null, bool? returnFaceLandmarks = default(bool?), bool? returnRecognitionModel = default(bool?), int? faceIdTimeToLive = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DetectFromSessionImageAsync(Azure.Core.RequestContent content, string detectionModel = null, string recognitionModel = null, bool? returnFaceId = default(bool?), System.Collections.Generic.IEnumerable returnFaceAttributes = null, bool? returnFaceLandmarks = default(bool?), bool? returnRecognitionModel = default(bool?), int? faceIdTimeToLive = default(int?), Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task>> DetectFromSessionImageAsync(string sessionImageId, Azure.AI.Vision.Face.FaceDetectionModel? detectionModel = default(Azure.AI.Vision.Face.FaceDetectionModel?), Azure.AI.Vision.Face.FaceRecognitionModel? recognitionModel = default(Azure.AI.Vision.Face.FaceRecognitionModel?), bool? returnFaceId = default(bool?), System.Collections.Generic.IEnumerable returnFaceAttributes = null, bool? returnFaceLandmarks = default(bool?), bool? returnRecognitionModel = default(bool?), int? faceIdTimeToLive = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetLivenessSessionAuditEntries(string sessionId, string start, int? top, Azure.RequestContext context) { throw null; } - public virtual Azure.Response> GetLivenessSessionAuditEntries(string sessionId, string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetLivenessSessionAuditEntriesAsync(string sessionId, string start, int? top, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task>> GetLivenessSessionAuditEntriesAsync(string sessionId, string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetLivenessSessionResult(string sessionId, Azure.RequestContext context) { throw null; } public virtual Azure.Response GetLivenessSessionResult(string sessionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetLivenessSessionResultAsync(string sessionId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> GetLivenessSessionResultAsync(string sessionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetLivenessSessions(string start, int? top, Azure.RequestContext context) { throw null; } - public virtual Azure.Response> GetLivenessSessions(string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetLivenessSessionsAsync(string start, int? top, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task>> GetLivenessSessionsAsync(string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetLivenessWithVerifySessionAuditEntries(string sessionId, string start, int? top, Azure.RequestContext context) { throw null; } - public virtual Azure.Response> GetLivenessWithVerifySessionAuditEntries(string sessionId, string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetLivenessWithVerifySessionAuditEntriesAsync(string sessionId, string start, int? top, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task>> GetLivenessWithVerifySessionAuditEntriesAsync(string sessionId, string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetLivenessWithVerifySessionResult(string sessionId, Azure.RequestContext context) { throw null; } public virtual Azure.Response GetLivenessWithVerifySessionResult(string sessionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetLivenessWithVerifySessionResultAsync(string sessionId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> GetLivenessWithVerifySessionResultAsync(string sessionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetLivenessWithVerifySessions(string start, int? top, Azure.RequestContext context) { throw null; } - public virtual Azure.Response> GetLivenessWithVerifySessions(string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetLivenessWithVerifySessionsAsync(string start, int? top, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task>> GetLivenessWithVerifySessionsAsync(string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetSessionImage(string sessionImageId, Azure.RequestContext context) { throw null; } public virtual Azure.Response GetSessionImage(string sessionImageId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetSessionImageAsync(string sessionImageId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> GetSessionImageAsync(string sessionImageId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct FaceSessionStatus : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public FaceSessionStatus(string value) { throw null; } - public static Azure.AI.Vision.Face.FaceSessionStatus NotStarted { get { throw null; } } - public static Azure.AI.Vision.Face.FaceSessionStatus ResultAvailable { get { throw null; } } - public static Azure.AI.Vision.Face.FaceSessionStatus Started { get { throw null; } } - public bool Equals(Azure.AI.Vision.Face.FaceSessionStatus other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.AI.Vision.Face.FaceSessionStatus left, Azure.AI.Vision.Face.FaceSessionStatus right) { throw null; } - public static implicit operator Azure.AI.Vision.Face.FaceSessionStatus (string value) { throw null; } - public static bool operator !=(Azure.AI.Vision.Face.FaceSessionStatus left, Azure.AI.Vision.Face.FaceSessionStatus right) { throw null; } - public override string ToString() { throw null; } - } public partial class FaceTrainingResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal FaceTrainingResult() { } @@ -1002,14 +949,48 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class LivenessColorDecisionTarget : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LivenessColorDecisionTarget() { } + public Azure.AI.Vision.Face.FaceRectangle FaceRectangle { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessColorDecisionTarget System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessColorDecisionTarget System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LivenessDecisionTargets : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LivenessDecisionTargets() { } + public Azure.AI.Vision.Face.LivenessColorDecisionTarget Color { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessDecisionTargets System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessDecisionTargets System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LivenessError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LivenessError() { } + public string Code { get { throw null; } } + public string Message { get { throw null; } } + public Azure.AI.Vision.Face.LivenessDecisionTargets Targets { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessError System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessError System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct LivenessModel : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; public LivenessModel(string value) { throw null; } - public static Azure.AI.Vision.Face.LivenessModel V20221015Preview04 { get { throw null; } } - public static Azure.AI.Vision.Face.LivenessModel V20231220Preview06 { get { throw null; } } + public static Azure.AI.Vision.Face.LivenessModel V20241115 { get { throw null; } } public bool Equals(Azure.AI.Vision.Face.LivenessModel other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } @@ -1038,46 +1019,30 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.AI.Vision.Face.LivenessOperationMode left, Azure.AI.Vision.Face.LivenessOperationMode right) { throw null; } public override string ToString() { throw null; } } - public partial class LivenessOutputsTarget : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal LivenessOutputsTarget() { } - public Azure.AI.Vision.Face.FaceRectangle FaceRectangle { get { throw null; } } - public string FileName { get { throw null; } } - public Azure.AI.Vision.Face.FaceImageType ImageType { get { throw null; } } - public int TimeOffsetWithinFile { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessOutputsTarget System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessOutputsTarget System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class LivenessResponseBody : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class LivenessResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - internal LivenessResponseBody() { } - public System.Collections.Generic.IReadOnlyDictionary AdditionalProperties { get { throw null; } } + internal LivenessResult() { } + public string Digest { get { throw null; } } public Azure.AI.Vision.Face.FaceLivenessDecision? LivenessDecision { get { throw null; } } - public Azure.AI.Vision.Face.LivenessModel? ModelVersionUsed { get { throw null; } } - public Azure.AI.Vision.Face.LivenessOutputsTarget Target { get { throw null; } } - public Azure.AI.Vision.Face.LivenessWithVerifyOutputs VerifyResult { get { throw null; } } + public string SessionImageId { get { throw null; } } + public Azure.AI.Vision.Face.LivenessDecisionTargets Targets { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessResponseBody System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessResponseBody System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.Vision.Face.LivenessResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } public partial class LivenessSession : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal LivenessSession() { } - public int? AuthTokenTimeToLiveInSeconds { get { throw null; } } - public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public string DeviceCorrelationId { get { throw null; } } - public string Id { get { throw null; } } - public Azure.AI.Vision.Face.LivenessSessionAuditEntry Result { get { throw null; } } - public bool SessionExpired { get { throw null; } } - public System.DateTimeOffset? SessionStartDateTime { get { throw null; } } - public Azure.AI.Vision.Face.FaceSessionStatus Status { get { throw null; } } + public string AuthToken { get { throw null; } } + public string ExpectedClientIpAddress { get { throw null; } } + public bool IsAbuseMonitoringEnabled { get { throw null; } } + public Azure.AI.Vision.Face.LivenessModel? ModelVersion { get { throw null; } } + public Azure.AI.Vision.Face.LivenessSessionResults Results { get { throw null; } } + public string SessionId { get { throw null; } } + public Azure.AI.Vision.Face.OperationState Status { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Vision.Face.LivenessSession System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -1085,60 +1050,38 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class LivenessSessionAuditEntry : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class LivenessSessionAttempt : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - internal LivenessSessionAuditEntry() { } - public string ClientRequestId { get { throw null; } } - public string Digest { get { throw null; } } - public long Id { get { throw null; } } - public System.DateTimeOffset ReceivedDateTime { get { throw null; } } - public Azure.AI.Vision.Face.AuditRequestInfo Request { get { throw null; } } - public string RequestId { get { throw null; } } - public Azure.AI.Vision.Face.AuditLivenessResponseInfo Response { get { throw null; } } - public string SessionId { get { throw null; } } - public string SessionImageId { get { throw null; } } - public string VerifyImageHash { get { throw null; } } + internal LivenessSessionAttempt() { } + public Azure.AI.Vision.Face.AbuseMonitoringResult AbuseMonitoringResult { get { throw null; } } + public int AttemptId { get { throw null; } } + public Azure.AI.Vision.Face.OperationState AttemptStatus { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ClientInformation { get { throw null; } } + public Azure.AI.Vision.Face.LivenessError Error { get { throw null; } } + public Azure.AI.Vision.Face.LivenessResult Result { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessSessionAuditEntry System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessSessionAuditEntry System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.Vision.Face.LivenessSessionAttempt System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessSessionAttempt System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class LivenessSessionItem : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class LivenessSessionResults : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - internal LivenessSessionItem() { } - public int? AuthTokenTimeToLiveInSeconds { get { throw null; } } - public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public string DeviceCorrelationId { get { throw null; } } - public string Id { get { throw null; } } - public bool SessionExpired { get { throw null; } } - public System.DateTimeOffset? SessionStartDateTime { get { throw null; } } + internal LivenessSessionResults() { } + public System.Collections.Generic.IReadOnlyList Attempts { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessSessionItem System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessSessionItem System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class LivenessWithVerifyImage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal LivenessWithVerifyImage() { } - public Azure.AI.Vision.Face.FaceRectangle FaceRectangle { get { throw null; } } - public Azure.AI.Vision.Face.QualityForRecognition QualityForRecognition { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessWithVerifyImage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessWithVerifyImage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.Vision.Face.LivenessSessionResults System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessSessionResults System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } public partial class LivenessWithVerifyOutputs : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal LivenessWithVerifyOutputs() { } public bool IsIdentical { get { throw null; } } public float MatchConfidence { get { throw null; } } - public Azure.AI.Vision.Face.LivenessWithVerifyImage VerifyImage { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Vision.Face.LivenessWithVerifyOutputs System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -1146,17 +1089,45 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class LivenessWithVerifyReference : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LivenessWithVerifyReference() { } + public Azure.AI.Vision.Face.FaceRectangle FaceRectangle { get { throw null; } } + public Azure.AI.Vision.Face.QualityForRecognition QualityForRecognition { get { throw null; } } + public Azure.AI.Vision.Face.FaceImageType ReferenceType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifyReference System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifyReference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LivenessWithVerifyResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LivenessWithVerifyResult() { } + public string Digest { get { throw null; } } + public Azure.AI.Vision.Face.FaceLivenessDecision? LivenessDecision { get { throw null; } } + public string SessionImageId { get { throw null; } } + public Azure.AI.Vision.Face.LivenessDecisionTargets Targets { get { throw null; } } + public string VerifyImageHash { get { throw null; } } + public Azure.AI.Vision.Face.LivenessWithVerifyOutputs VerifyResult { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifyResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifyResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class LivenessWithVerifySession : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal LivenessWithVerifySession() { } - public int? AuthTokenTimeToLiveInSeconds { get { throw null; } } - public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public string DeviceCorrelationId { get { throw null; } } - public string Id { get { throw null; } } - public Azure.AI.Vision.Face.LivenessSessionAuditEntry Result { get { throw null; } } - public bool SessionExpired { get { throw null; } } - public System.DateTimeOffset? SessionStartDateTime { get { throw null; } } - public Azure.AI.Vision.Face.FaceSessionStatus Status { get { throw null; } } + public string AuthToken { get { throw null; } } + public string ExpectedClientIpAddress { get { throw null; } } + public bool IsAbuseMonitoringEnabled { get { throw null; } } + public Azure.AI.Vision.Face.LivenessModel? ModelVersion { get { throw null; } } + public Azure.AI.Vision.Face.LivenessWithVerifySessionResults Results { get { throw null; } } + public string SessionId { get { throw null; } } + public Azure.AI.Vision.Face.OperationState Status { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Vision.Face.LivenessWithVerifySession System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -1164,6 +1135,34 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class LivenessWithVerifySessionAttempt : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LivenessWithVerifySessionAttempt() { } + public Azure.AI.Vision.Face.AbuseMonitoringResult AbuseMonitoringResult { get { throw null; } } + public int AttemptId { get { throw null; } } + public Azure.AI.Vision.Face.OperationState AttemptStatus { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ClientInformation { get { throw null; } } + public Azure.AI.Vision.Face.LivenessError Error { get { throw null; } } + public Azure.AI.Vision.Face.LivenessWithVerifyResult Result { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifySessionAttempt System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifySessionAttempt System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LivenessWithVerifySessionResults : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LivenessWithVerifySessionResults() { } + public System.Collections.Generic.IReadOnlyList Attempts { get { throw null; } } + public System.Collections.Generic.IReadOnlyList VerifyReferences { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifySessionResults System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifySessionResults System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class MaskProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal MaskProperties() { } @@ -1241,6 +1240,40 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct OperationState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OperationState(string value) { throw null; } + public static Azure.AI.Vision.Face.OperationState Canceled { get { throw null; } } + public static Azure.AI.Vision.Face.OperationState Failed { get { throw null; } } + public static Azure.AI.Vision.Face.OperationState NotStarted { get { throw null; } } + public static Azure.AI.Vision.Face.OperationState Running { get { throw null; } } + public static Azure.AI.Vision.Face.OperationState Succeeded { get { throw null; } } + public bool Equals(Azure.AI.Vision.Face.OperationState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Vision.Face.OperationState left, Azure.AI.Vision.Face.OperationState right) { throw null; } + public static implicit operator Azure.AI.Vision.Face.OperationState (string value) { throw null; } + public static bool operator !=(Azure.AI.Vision.Face.OperationState left, Azure.AI.Vision.Face.OperationState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class OtherFlaggedSessions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal OtherFlaggedSessions() { } + public int AttemptId { get { throw null; } } + public string SessionId { get { throw null; } } + public string SessionImageId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.OtherFlaggedSessions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.OtherFlaggedSessions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct QualityForRecognition : System.IEquatable { private readonly object _dummy; diff --git a/sdk/face/Azure.AI.Vision.Face/api/Azure.AI.Vision.Face.netstandard2.0.cs b/sdk/face/Azure.AI.Vision.Face/api/Azure.AI.Vision.Face.netstandard2.0.cs index e6c36fe83593..8ff5970c309b 100644 --- a/sdk/face/Azure.AI.Vision.Face/api/Azure.AI.Vision.Face.netstandard2.0.cs +++ b/sdk/face/Azure.AI.Vision.Face/api/Azure.AI.Vision.Face.netstandard2.0.cs @@ -1,5 +1,17 @@ namespace Azure.AI.Vision.Face { + public partial class AbuseMonitoringResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AbuseMonitoringResult() { } + public bool IsAbuseDetected { get { throw null; } } + public System.Collections.Generic.IReadOnlyList OtherFlaggedSessions { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.AbuseMonitoringResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.AbuseMonitoringResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class AccessoryItem : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal AccessoryItem() { } @@ -44,15 +56,13 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } public static partial class AIVisionFaceModelFactory { + public static Azure.AI.Vision.Face.AbuseMonitoringResult AbuseMonitoringResult(bool isAbuseDetected = false, System.Collections.Generic.IEnumerable otherFlaggedSessions = null) { throw null; } public static Azure.AI.Vision.Face.AccessoryItem AccessoryItem(Azure.AI.Vision.Face.AccessoryType type = default(Azure.AI.Vision.Face.AccessoryType), float confidence = 0f) { throw null; } public static Azure.AI.Vision.Face.AddFaceResult AddFaceResult(System.Guid persistedFaceId = default(System.Guid)) { throw null; } - public static Azure.AI.Vision.Face.AuditLivenessResponseInfo AuditLivenessResponseInfo(Azure.AI.Vision.Face.LivenessResponseBody body = null, int statusCode = 0, long latencyInMilliseconds = (long)0) { throw null; } - public static Azure.AI.Vision.Face.AuditRequestInfo AuditRequestInfo(string url = null, string method = null, long? contentLength = default(long?), string contentType = null, string userAgent = null) { throw null; } public static Azure.AI.Vision.Face.BlurProperties BlurProperties(Azure.AI.Vision.Face.BlurLevel blurLevel = default(Azure.AI.Vision.Face.BlurLevel), float value = 0f) { throw null; } - public static Azure.AI.Vision.Face.CreateLivenessSessionContent CreateLivenessSessionContent(Azure.AI.Vision.Face.LivenessOperationMode livenessOperationMode = default(Azure.AI.Vision.Face.LivenessOperationMode), bool? sendResultsToClient = default(bool?), bool? deviceCorrelationIdSetInClient = default(bool?), bool? enableSessionImage = default(bool?), Azure.AI.Vision.Face.LivenessModel? livenessSingleModalModel = default(Azure.AI.Vision.Face.LivenessModel?), string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?)) { throw null; } - public static Azure.AI.Vision.Face.CreateLivenessSessionResult CreateLivenessSessionResult(string sessionId = null, string authToken = null) { throw null; } - public static Azure.AI.Vision.Face.CreateLivenessWithVerifySessionContent CreateLivenessWithVerifySessionContent(Azure.AI.Vision.Face.LivenessOperationMode livenessOperationMode = default(Azure.AI.Vision.Face.LivenessOperationMode), bool? sendResultsToClient = default(bool?), bool? deviceCorrelationIdSetInClient = default(bool?), bool? enableSessionImage = default(bool?), Azure.AI.Vision.Face.LivenessModel? livenessSingleModalModel = default(Azure.AI.Vision.Face.LivenessModel?), string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?), bool? returnVerifyImageHash = default(bool?), float? verifyConfidenceThreshold = default(float?)) { throw null; } - public static Azure.AI.Vision.Face.CreateLivenessWithVerifySessionResult CreateLivenessWithVerifySessionResult(string sessionId = null, string authToken = null, Azure.AI.Vision.Face.LivenessWithVerifyImage verifyImage = null) { throw null; } + public static Azure.AI.Vision.Face.ClientInformation ClientInformation(string ip = null) { throw null; } + public static Azure.AI.Vision.Face.CreateLivenessSessionContent CreateLivenessSessionContent(Azure.AI.Vision.Face.LivenessOperationMode livenessOperationMode = default(Azure.AI.Vision.Face.LivenessOperationMode), bool? deviceCorrelationIdSetInClient = default(bool?), bool? enableSessionImage = default(bool?), Azure.AI.Vision.Face.LivenessModel? livenessModelVersion = default(Azure.AI.Vision.Face.LivenessModel?), string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?), int numberOfClientAttemptsAllowed = 0, string userCorrelationId = null, bool? userCorrelationIdSetInClient = default(bool?), string expectedClientIpAddress = null) { throw null; } + public static Azure.AI.Vision.Face.CreateLivenessWithVerifySessionContent CreateLivenessWithVerifySessionContent(Azure.AI.Vision.Face.LivenessOperationMode livenessOperationMode = default(Azure.AI.Vision.Face.LivenessOperationMode), bool? deviceCorrelationIdSetInClient = default(bool?), bool? enableSessionImage = default(bool?), Azure.AI.Vision.Face.LivenessModel? livenessModelVersion = default(Azure.AI.Vision.Face.LivenessModel?), bool? returnVerifyImageHash = default(bool?), float? verifyConfidenceThreshold = default(float?), System.IO.Stream verifyImage = null, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?), int? numberOfClientAttemptsAllowed = default(int?)) { throw null; } public static Azure.AI.Vision.Face.CreatePersonResult CreatePersonResult(System.Guid personId = default(System.Guid)) { throw null; } public static Azure.AI.Vision.Face.ExposureProperties ExposureProperties(Azure.AI.Vision.Face.ExposureLevel exposureLevel = default(Azure.AI.Vision.Face.ExposureLevel), float value = 0f) { throw null; } public static Azure.AI.Vision.Face.FaceAttributes FaceAttributes(float? age = default(float?), float? smile = default(float?), Azure.AI.Vision.Face.FacialHair facialHair = null, Azure.AI.Vision.Face.GlassesType? glasses = default(Azure.AI.Vision.Face.GlassesType?), Azure.AI.Vision.Face.HeadPose headPose = null, Azure.AI.Vision.Face.HairProperties hair = null, Azure.AI.Vision.Face.OcclusionProperties occlusion = null, System.Collections.Generic.IEnumerable accessories = null, Azure.AI.Vision.Face.BlurProperties blur = null, Azure.AI.Vision.Face.ExposureProperties exposure = null, Azure.AI.Vision.Face.NoiseProperties noise = null, Azure.AI.Vision.Face.MaskProperties mask = null, Azure.AI.Vision.Face.QualityForRecognition? qualityForRecognition = default(Azure.AI.Vision.Face.QualityForRecognition?)) { throw null; } @@ -75,53 +85,33 @@ public static partial class AIVisionFaceModelFactory public static Azure.AI.Vision.Face.LargePersonGroup LargePersonGroup(string name = null, string userData = null, Azure.AI.Vision.Face.FaceRecognitionModel? recognitionModel = default(Azure.AI.Vision.Face.FaceRecognitionModel?), string largePersonGroupId = null) { throw null; } public static Azure.AI.Vision.Face.LargePersonGroupPerson LargePersonGroupPerson(System.Guid personId = default(System.Guid), string name = null, string userData = null, System.Collections.Generic.IEnumerable persistedFaceIds = null) { throw null; } public static Azure.AI.Vision.Face.LargePersonGroupPersonFace LargePersonGroupPersonFace(System.Guid persistedFaceId = default(System.Guid), string userData = null) { throw null; } - public static Azure.AI.Vision.Face.LivenessOutputsTarget LivenessOutputsTarget(Azure.AI.Vision.Face.FaceRectangle faceRectangle = null, string fileName = null, int timeOffsetWithinFile = 0, Azure.AI.Vision.Face.FaceImageType imageType = default(Azure.AI.Vision.Face.FaceImageType)) { throw null; } - public static Azure.AI.Vision.Face.LivenessResponseBody LivenessResponseBody(Azure.AI.Vision.Face.FaceLivenessDecision? livenessDecision = default(Azure.AI.Vision.Face.FaceLivenessDecision?), Azure.AI.Vision.Face.LivenessOutputsTarget target = null, Azure.AI.Vision.Face.LivenessModel? modelVersionUsed = default(Azure.AI.Vision.Face.LivenessModel?), Azure.AI.Vision.Face.LivenessWithVerifyOutputs verifyResult = null, System.Collections.Generic.IReadOnlyDictionary additionalProperties = null) { throw null; } - public static Azure.AI.Vision.Face.LivenessSession LivenessSession(string id = null, System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? sessionStartDateTime = default(System.DateTimeOffset?), bool sessionExpired = false, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?), Azure.AI.Vision.Face.FaceSessionStatus status = default(Azure.AI.Vision.Face.FaceSessionStatus), Azure.AI.Vision.Face.LivenessSessionAuditEntry result = null) { throw null; } - public static Azure.AI.Vision.Face.LivenessSessionAuditEntry LivenessSessionAuditEntry(long id = (long)0, string sessionId = null, string requestId = null, string clientRequestId = null, System.DateTimeOffset receivedDateTime = default(System.DateTimeOffset), Azure.AI.Vision.Face.AuditRequestInfo request = null, Azure.AI.Vision.Face.AuditLivenessResponseInfo response = null, string digest = null, string sessionImageId = null, string verifyImageHash = null) { throw null; } - public static Azure.AI.Vision.Face.LivenessSessionItem LivenessSessionItem(string id = null, System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? sessionStartDateTime = default(System.DateTimeOffset?), bool sessionExpired = false, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?)) { throw null; } - public static Azure.AI.Vision.Face.LivenessWithVerifyImage LivenessWithVerifyImage(Azure.AI.Vision.Face.FaceRectangle faceRectangle = null, Azure.AI.Vision.Face.QualityForRecognition qualityForRecognition = default(Azure.AI.Vision.Face.QualityForRecognition)) { throw null; } - public static Azure.AI.Vision.Face.LivenessWithVerifyOutputs LivenessWithVerifyOutputs(Azure.AI.Vision.Face.LivenessWithVerifyImage verifyImage = null, float matchConfidence = 0f, bool isIdentical = false) { throw null; } - public static Azure.AI.Vision.Face.LivenessWithVerifySession LivenessWithVerifySession(string id = null, System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? sessionStartDateTime = default(System.DateTimeOffset?), bool sessionExpired = false, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?), Azure.AI.Vision.Face.FaceSessionStatus status = default(Azure.AI.Vision.Face.FaceSessionStatus), Azure.AI.Vision.Face.LivenessSessionAuditEntry result = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessColorDecisionTarget LivenessColorDecisionTarget(Azure.AI.Vision.Face.FaceRectangle faceRectangle = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessDecisionTargets LivenessDecisionTargets(Azure.AI.Vision.Face.LivenessColorDecisionTarget color = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessError LivenessError(string code = null, string message = null, Azure.AI.Vision.Face.LivenessDecisionTargets targets = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessResult LivenessResult(Azure.AI.Vision.Face.FaceLivenessDecision? livenessDecision = default(Azure.AI.Vision.Face.FaceLivenessDecision?), Azure.AI.Vision.Face.LivenessDecisionTargets targets = null, string digest = null, string sessionImageId = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessSession LivenessSession(string sessionId = null, string authToken = null, Azure.AI.Vision.Face.OperationState status = default(Azure.AI.Vision.Face.OperationState), Azure.AI.Vision.Face.LivenessModel? modelVersion = default(Azure.AI.Vision.Face.LivenessModel?), bool isAbuseMonitoringEnabled = false, string expectedClientIpAddress = null, Azure.AI.Vision.Face.LivenessSessionResults results = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessSessionAttempt LivenessSessionAttempt(int attemptId = 0, Azure.AI.Vision.Face.OperationState attemptStatus = default(Azure.AI.Vision.Face.OperationState), Azure.AI.Vision.Face.LivenessResult result = null, Azure.AI.Vision.Face.LivenessError error = null, System.Collections.Generic.IEnumerable clientInformation = null, Azure.AI.Vision.Face.AbuseMonitoringResult abuseMonitoringResult = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessSessionResults LivenessSessionResults(System.Collections.Generic.IEnumerable attempts = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessWithVerifyOutputs LivenessWithVerifyOutputs(float matchConfidence = 0f, bool isIdentical = false) { throw null; } + public static Azure.AI.Vision.Face.LivenessWithVerifyReference LivenessWithVerifyReference(Azure.AI.Vision.Face.FaceImageType referenceType = default(Azure.AI.Vision.Face.FaceImageType), Azure.AI.Vision.Face.FaceRectangle faceRectangle = null, Azure.AI.Vision.Face.QualityForRecognition qualityForRecognition = default(Azure.AI.Vision.Face.QualityForRecognition)) { throw null; } + public static Azure.AI.Vision.Face.LivenessWithVerifyResult LivenessWithVerifyResult(Azure.AI.Vision.Face.FaceLivenessDecision? livenessDecision = default(Azure.AI.Vision.Face.FaceLivenessDecision?), Azure.AI.Vision.Face.LivenessDecisionTargets targets = null, string digest = null, string sessionImageId = null, Azure.AI.Vision.Face.LivenessWithVerifyOutputs verifyResult = null, string verifyImageHash = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessWithVerifySession LivenessWithVerifySession(string sessionId = null, string authToken = null, Azure.AI.Vision.Face.OperationState status = default(Azure.AI.Vision.Face.OperationState), Azure.AI.Vision.Face.LivenessModel? modelVersion = default(Azure.AI.Vision.Face.LivenessModel?), bool isAbuseMonitoringEnabled = false, string expectedClientIpAddress = null, Azure.AI.Vision.Face.LivenessWithVerifySessionResults results = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessWithVerifySessionAttempt LivenessWithVerifySessionAttempt(int attemptId = 0, Azure.AI.Vision.Face.OperationState attemptStatus = default(Azure.AI.Vision.Face.OperationState), Azure.AI.Vision.Face.LivenessWithVerifyResult result = null, Azure.AI.Vision.Face.LivenessError error = null, System.Collections.Generic.IEnumerable clientInformation = null, Azure.AI.Vision.Face.AbuseMonitoringResult abuseMonitoringResult = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessWithVerifySessionResults LivenessWithVerifySessionResults(System.Collections.Generic.IEnumerable verifyReferences = null, System.Collections.Generic.IEnumerable attempts = null) { throw null; } public static Azure.AI.Vision.Face.MaskProperties MaskProperties(bool noseAndMouthCovered = false, Azure.AI.Vision.Face.MaskType type = default(Azure.AI.Vision.Face.MaskType)) { throw null; } public static Azure.AI.Vision.Face.NoiseProperties NoiseProperties(Azure.AI.Vision.Face.NoiseLevel noiseLevel = default(Azure.AI.Vision.Face.NoiseLevel), float value = 0f) { throw null; } public static Azure.AI.Vision.Face.OcclusionProperties OcclusionProperties(bool foreheadOccluded = false, bool eyeOccluded = false, bool mouthOccluded = false) { throw null; } - } - public partial class AuditLivenessResponseInfo : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal AuditLivenessResponseInfo() { } - public Azure.AI.Vision.Face.LivenessResponseBody Body { get { throw null; } } - public long LatencyInMilliseconds { get { throw null; } } - public int StatusCode { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.AuditLivenessResponseInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.AuditLivenessResponseInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class AuditRequestInfo : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal AuditRequestInfo() { } - public long? ContentLength { get { throw null; } } - public string ContentType { get { throw null; } } - public string Method { get { throw null; } } - public string Url { get { throw null; } } - public string UserAgent { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.AuditRequestInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.AuditRequestInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public static Azure.AI.Vision.Face.OtherFlaggedSessions OtherFlaggedSessions(int attemptId = 0, string sessionId = null, string sessionImageId = null) { throw null; } } public partial class AzureAIVisionFaceClientOptions : Azure.Core.ClientOptions { - public AzureAIVisionFaceClientOptions(Azure.AI.Vision.Face.AzureAIVisionFaceClientOptions.ServiceVersion version = Azure.AI.Vision.Face.AzureAIVisionFaceClientOptions.ServiceVersion.V1_2_Preview_1) { } + public AzureAIVisionFaceClientOptions(Azure.AI.Vision.Face.AzureAIVisionFaceClientOptions.ServiceVersion version = Azure.AI.Vision.Face.AzureAIVisionFaceClientOptions.ServiceVersion.V1_3_Preview_1) { } public enum ServiceVersion { V1_1_Preview_1 = 1, V1_2_Preview_1 = 2, + V1_2 = 3, + V1_3_Preview_1 = 4, } } public partial class AzureAIVisionFaceContext : System.ClientModel.Primitives.ModelReaderWriterContext @@ -161,6 +151,17 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class ClientInformation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ClientInformation() { } + public string Ip { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.ClientInformation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.ClientInformation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class CreateLivenessSessionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public CreateLivenessSessionContent(Azure.AI.Vision.Face.LivenessOperationMode livenessOperationMode) { } @@ -168,9 +169,12 @@ public CreateLivenessSessionContent(Azure.AI.Vision.Face.LivenessOperationMode l public string DeviceCorrelationId { get { throw null; } set { } } public bool? DeviceCorrelationIdSetInClient { get { throw null; } set { } } public bool? EnableSessionImage { get { throw null; } set { } } + public string ExpectedClientIpAddress { get { throw null; } set { } } + public Azure.AI.Vision.Face.LivenessModel? LivenessModelVersion { get { throw null; } set { } } public Azure.AI.Vision.Face.LivenessOperationMode LivenessOperationMode { get { throw null; } } - public Azure.AI.Vision.Face.LivenessModel? LivenessSingleModalModel { get { throw null; } set { } } - public bool? SendResultsToClient { get { throw null; } set { } } + public int NumberOfClientAttemptsAllowed { get { throw null; } set { } } + public string UserCorrelationId { get { throw null; } set { } } + public bool? UserCorrelationIdSetInClient { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Vision.Face.CreateLivenessSessionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -178,30 +182,19 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class CreateLivenessSessionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal CreateLivenessSessionResult() { } - public string AuthToken { get { throw null; } } - public string SessionId { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.CreateLivenessSessionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.CreateLivenessSessionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class CreateLivenessWithVerifySessionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public CreateLivenessWithVerifySessionContent(Azure.AI.Vision.Face.LivenessOperationMode livenessOperationMode) { } + public CreateLivenessWithVerifySessionContent(Azure.AI.Vision.Face.LivenessOperationMode livenessOperationMode, System.IO.Stream verifyImage) { } public int? AuthTokenTimeToLiveInSeconds { get { throw null; } set { } } public string DeviceCorrelationId { get { throw null; } set { } } public bool? DeviceCorrelationIdSetInClient { get { throw null; } set { } } public bool? EnableSessionImage { get { throw null; } set { } } + public Azure.AI.Vision.Face.LivenessModel? LivenessModelVersion { get { throw null; } set { } } public Azure.AI.Vision.Face.LivenessOperationMode LivenessOperationMode { get { throw null; } } - public Azure.AI.Vision.Face.LivenessModel? LivenessSingleModalModel { get { throw null; } set { } } + public int? NumberOfClientAttemptsAllowed { get { throw null; } set { } } public bool? ReturnVerifyImageHash { get { throw null; } set { } } - public bool? SendResultsToClient { get { throw null; } set { } } public float? VerifyConfidenceThreshold { get { throw null; } set { } } + public System.IO.Stream VerifyImage { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Vision.Face.CreateLivenessWithVerifySessionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -209,19 +202,6 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class CreateLivenessWithVerifySessionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal CreateLivenessWithVerifySessionResult() { } - public string AuthToken { get { throw null; } } - public string SessionId { get { throw null; } } - public Azure.AI.Vision.Face.LivenessWithVerifyImage VerifyImage { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.CreateLivenessWithVerifySessionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.CreateLivenessWithVerifySessionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class CreatePersonResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal CreatePersonResult() { } @@ -612,12 +592,14 @@ public FaceSessionClient(System.Uri endpoint, Azure.AzureKeyCredential credentia public FaceSessionClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } public FaceSessionClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.AI.Vision.Face.AzureAIVisionFaceClientOptions options) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response CreateLivenessSession(Azure.AI.Vision.Face.CreateLivenessSessionContent body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateLivenessSession(Azure.AI.Vision.Face.CreateLivenessSessionContent body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateLivenessSession(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> CreateLivenessSessionAsync(Azure.AI.Vision.Face.CreateLivenessSessionContent body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateLivenessSessionAsync(Azure.AI.Vision.Face.CreateLivenessSessionContent body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task CreateLivenessSessionAsync(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response CreateLivenessWithVerifySession(Azure.AI.Vision.Face.CreateLivenessWithVerifySessionContent jsonContent, System.IO.Stream verifyImage, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateLivenessWithVerifySessionAsync(Azure.AI.Vision.Face.CreateLivenessWithVerifySessionContent jsonContent, System.IO.Stream verifyImage, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateLivenessWithVerifySession(Azure.AI.Vision.Face.CreateLivenessWithVerifySessionContent body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateLivenessWithVerifySession(Azure.Core.RequestContent content, string contentType, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> CreateLivenessWithVerifySessionAsync(Azure.AI.Vision.Face.CreateLivenessWithVerifySessionContent body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateLivenessWithVerifySessionAsync(Azure.Core.RequestContent content, string contentType, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response DeleteLivenessSession(string sessionId, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteLivenessSessionAsync(string sessionId, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response DeleteLivenessWithVerifySession(string sessionId, Azure.RequestContext context = null) { throw null; } @@ -626,54 +608,19 @@ public FaceSessionClient(System.Uri endpoint, Azure.Core.TokenCredential credent public virtual Azure.Response> DetectFromSessionImage(string sessionImageId, Azure.AI.Vision.Face.FaceDetectionModel? detectionModel = default(Azure.AI.Vision.Face.FaceDetectionModel?), Azure.AI.Vision.Face.FaceRecognitionModel? recognitionModel = default(Azure.AI.Vision.Face.FaceRecognitionModel?), bool? returnFaceId = default(bool?), System.Collections.Generic.IEnumerable returnFaceAttributes = null, bool? returnFaceLandmarks = default(bool?), bool? returnRecognitionModel = default(bool?), int? faceIdTimeToLive = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DetectFromSessionImageAsync(Azure.Core.RequestContent content, string detectionModel = null, string recognitionModel = null, bool? returnFaceId = default(bool?), System.Collections.Generic.IEnumerable returnFaceAttributes = null, bool? returnFaceLandmarks = default(bool?), bool? returnRecognitionModel = default(bool?), int? faceIdTimeToLive = default(int?), Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task>> DetectFromSessionImageAsync(string sessionImageId, Azure.AI.Vision.Face.FaceDetectionModel? detectionModel = default(Azure.AI.Vision.Face.FaceDetectionModel?), Azure.AI.Vision.Face.FaceRecognitionModel? recognitionModel = default(Azure.AI.Vision.Face.FaceRecognitionModel?), bool? returnFaceId = default(bool?), System.Collections.Generic.IEnumerable returnFaceAttributes = null, bool? returnFaceLandmarks = default(bool?), bool? returnRecognitionModel = default(bool?), int? faceIdTimeToLive = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetLivenessSessionAuditEntries(string sessionId, string start, int? top, Azure.RequestContext context) { throw null; } - public virtual Azure.Response> GetLivenessSessionAuditEntries(string sessionId, string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetLivenessSessionAuditEntriesAsync(string sessionId, string start, int? top, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task>> GetLivenessSessionAuditEntriesAsync(string sessionId, string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetLivenessSessionResult(string sessionId, Azure.RequestContext context) { throw null; } public virtual Azure.Response GetLivenessSessionResult(string sessionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetLivenessSessionResultAsync(string sessionId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> GetLivenessSessionResultAsync(string sessionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetLivenessSessions(string start, int? top, Azure.RequestContext context) { throw null; } - public virtual Azure.Response> GetLivenessSessions(string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetLivenessSessionsAsync(string start, int? top, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task>> GetLivenessSessionsAsync(string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetLivenessWithVerifySessionAuditEntries(string sessionId, string start, int? top, Azure.RequestContext context) { throw null; } - public virtual Azure.Response> GetLivenessWithVerifySessionAuditEntries(string sessionId, string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetLivenessWithVerifySessionAuditEntriesAsync(string sessionId, string start, int? top, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task>> GetLivenessWithVerifySessionAuditEntriesAsync(string sessionId, string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetLivenessWithVerifySessionResult(string sessionId, Azure.RequestContext context) { throw null; } public virtual Azure.Response GetLivenessWithVerifySessionResult(string sessionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetLivenessWithVerifySessionResultAsync(string sessionId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> GetLivenessWithVerifySessionResultAsync(string sessionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetLivenessWithVerifySessions(string start, int? top, Azure.RequestContext context) { throw null; } - public virtual Azure.Response> GetLivenessWithVerifySessions(string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetLivenessWithVerifySessionsAsync(string start, int? top, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task>> GetLivenessWithVerifySessionsAsync(string start = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetSessionImage(string sessionImageId, Azure.RequestContext context) { throw null; } public virtual Azure.Response GetSessionImage(string sessionImageId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetSessionImageAsync(string sessionImageId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> GetSessionImageAsync(string sessionImageId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct FaceSessionStatus : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public FaceSessionStatus(string value) { throw null; } - public static Azure.AI.Vision.Face.FaceSessionStatus NotStarted { get { throw null; } } - public static Azure.AI.Vision.Face.FaceSessionStatus ResultAvailable { get { throw null; } } - public static Azure.AI.Vision.Face.FaceSessionStatus Started { get { throw null; } } - public bool Equals(Azure.AI.Vision.Face.FaceSessionStatus other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.AI.Vision.Face.FaceSessionStatus left, Azure.AI.Vision.Face.FaceSessionStatus right) { throw null; } - public static implicit operator Azure.AI.Vision.Face.FaceSessionStatus (string value) { throw null; } - public static bool operator !=(Azure.AI.Vision.Face.FaceSessionStatus left, Azure.AI.Vision.Face.FaceSessionStatus right) { throw null; } - public override string ToString() { throw null; } - } public partial class FaceTrainingResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal FaceTrainingResult() { } @@ -1002,14 +949,48 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class LivenessColorDecisionTarget : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LivenessColorDecisionTarget() { } + public Azure.AI.Vision.Face.FaceRectangle FaceRectangle { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessColorDecisionTarget System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessColorDecisionTarget System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LivenessDecisionTargets : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LivenessDecisionTargets() { } + public Azure.AI.Vision.Face.LivenessColorDecisionTarget Color { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessDecisionTargets System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessDecisionTargets System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LivenessError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LivenessError() { } + public string Code { get { throw null; } } + public string Message { get { throw null; } } + public Azure.AI.Vision.Face.LivenessDecisionTargets Targets { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessError System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessError System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct LivenessModel : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; public LivenessModel(string value) { throw null; } - public static Azure.AI.Vision.Face.LivenessModel V20221015Preview04 { get { throw null; } } - public static Azure.AI.Vision.Face.LivenessModel V20231220Preview06 { get { throw null; } } + public static Azure.AI.Vision.Face.LivenessModel V20241115 { get { throw null; } } public bool Equals(Azure.AI.Vision.Face.LivenessModel other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } @@ -1038,46 +1019,30 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.AI.Vision.Face.LivenessOperationMode left, Azure.AI.Vision.Face.LivenessOperationMode right) { throw null; } public override string ToString() { throw null; } } - public partial class LivenessOutputsTarget : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal LivenessOutputsTarget() { } - public Azure.AI.Vision.Face.FaceRectangle FaceRectangle { get { throw null; } } - public string FileName { get { throw null; } } - public Azure.AI.Vision.Face.FaceImageType ImageType { get { throw null; } } - public int TimeOffsetWithinFile { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessOutputsTarget System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessOutputsTarget System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class LivenessResponseBody : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class LivenessResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - internal LivenessResponseBody() { } - public System.Collections.Generic.IReadOnlyDictionary AdditionalProperties { get { throw null; } } + internal LivenessResult() { } + public string Digest { get { throw null; } } public Azure.AI.Vision.Face.FaceLivenessDecision? LivenessDecision { get { throw null; } } - public Azure.AI.Vision.Face.LivenessModel? ModelVersionUsed { get { throw null; } } - public Azure.AI.Vision.Face.LivenessOutputsTarget Target { get { throw null; } } - public Azure.AI.Vision.Face.LivenessWithVerifyOutputs VerifyResult { get { throw null; } } + public string SessionImageId { get { throw null; } } + public Azure.AI.Vision.Face.LivenessDecisionTargets Targets { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessResponseBody System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessResponseBody System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.Vision.Face.LivenessResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } public partial class LivenessSession : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal LivenessSession() { } - public int? AuthTokenTimeToLiveInSeconds { get { throw null; } } - public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public string DeviceCorrelationId { get { throw null; } } - public string Id { get { throw null; } } - public Azure.AI.Vision.Face.LivenessSessionAuditEntry Result { get { throw null; } } - public bool SessionExpired { get { throw null; } } - public System.DateTimeOffset? SessionStartDateTime { get { throw null; } } - public Azure.AI.Vision.Face.FaceSessionStatus Status { get { throw null; } } + public string AuthToken { get { throw null; } } + public string ExpectedClientIpAddress { get { throw null; } } + public bool IsAbuseMonitoringEnabled { get { throw null; } } + public Azure.AI.Vision.Face.LivenessModel? ModelVersion { get { throw null; } } + public Azure.AI.Vision.Face.LivenessSessionResults Results { get { throw null; } } + public string SessionId { get { throw null; } } + public Azure.AI.Vision.Face.OperationState Status { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Vision.Face.LivenessSession System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -1085,60 +1050,38 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class LivenessSessionAuditEntry : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class LivenessSessionAttempt : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - internal LivenessSessionAuditEntry() { } - public string ClientRequestId { get { throw null; } } - public string Digest { get { throw null; } } - public long Id { get { throw null; } } - public System.DateTimeOffset ReceivedDateTime { get { throw null; } } - public Azure.AI.Vision.Face.AuditRequestInfo Request { get { throw null; } } - public string RequestId { get { throw null; } } - public Azure.AI.Vision.Face.AuditLivenessResponseInfo Response { get { throw null; } } - public string SessionId { get { throw null; } } - public string SessionImageId { get { throw null; } } - public string VerifyImageHash { get { throw null; } } + internal LivenessSessionAttempt() { } + public Azure.AI.Vision.Face.AbuseMonitoringResult AbuseMonitoringResult { get { throw null; } } + public int AttemptId { get { throw null; } } + public Azure.AI.Vision.Face.OperationState AttemptStatus { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ClientInformation { get { throw null; } } + public Azure.AI.Vision.Face.LivenessError Error { get { throw null; } } + public Azure.AI.Vision.Face.LivenessResult Result { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessSessionAuditEntry System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessSessionAuditEntry System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.Vision.Face.LivenessSessionAttempt System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessSessionAttempt System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class LivenessSessionItem : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class LivenessSessionResults : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - internal LivenessSessionItem() { } - public int? AuthTokenTimeToLiveInSeconds { get { throw null; } } - public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public string DeviceCorrelationId { get { throw null; } } - public string Id { get { throw null; } } - public bool SessionExpired { get { throw null; } } - public System.DateTimeOffset? SessionStartDateTime { get { throw null; } } + internal LivenessSessionResults() { } + public System.Collections.Generic.IReadOnlyList Attempts { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessSessionItem System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessSessionItem System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class LivenessWithVerifyImage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal LivenessWithVerifyImage() { } - public Azure.AI.Vision.Face.FaceRectangle FaceRectangle { get { throw null; } } - public Azure.AI.Vision.Face.QualityForRecognition QualityForRecognition { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessWithVerifyImage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Vision.Face.LivenessWithVerifyImage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.Vision.Face.LivenessSessionResults System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessSessionResults System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } public partial class LivenessWithVerifyOutputs : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal LivenessWithVerifyOutputs() { } public bool IsIdentical { get { throw null; } } public float MatchConfidence { get { throw null; } } - public Azure.AI.Vision.Face.LivenessWithVerifyImage VerifyImage { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Vision.Face.LivenessWithVerifyOutputs System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -1146,17 +1089,45 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class LivenessWithVerifyReference : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LivenessWithVerifyReference() { } + public Azure.AI.Vision.Face.FaceRectangle FaceRectangle { get { throw null; } } + public Azure.AI.Vision.Face.QualityForRecognition QualityForRecognition { get { throw null; } } + public Azure.AI.Vision.Face.FaceImageType ReferenceType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifyReference System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifyReference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LivenessWithVerifyResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LivenessWithVerifyResult() { } + public string Digest { get { throw null; } } + public Azure.AI.Vision.Face.FaceLivenessDecision? LivenessDecision { get { throw null; } } + public string SessionImageId { get { throw null; } } + public Azure.AI.Vision.Face.LivenessDecisionTargets Targets { get { throw null; } } + public string VerifyImageHash { get { throw null; } } + public Azure.AI.Vision.Face.LivenessWithVerifyOutputs VerifyResult { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifyResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifyResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class LivenessWithVerifySession : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal LivenessWithVerifySession() { } - public int? AuthTokenTimeToLiveInSeconds { get { throw null; } } - public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public string DeviceCorrelationId { get { throw null; } } - public string Id { get { throw null; } } - public Azure.AI.Vision.Face.LivenessSessionAuditEntry Result { get { throw null; } } - public bool SessionExpired { get { throw null; } } - public System.DateTimeOffset? SessionStartDateTime { get { throw null; } } - public Azure.AI.Vision.Face.FaceSessionStatus Status { get { throw null; } } + public string AuthToken { get { throw null; } } + public string ExpectedClientIpAddress { get { throw null; } } + public bool IsAbuseMonitoringEnabled { get { throw null; } } + public Azure.AI.Vision.Face.LivenessModel? ModelVersion { get { throw null; } } + public Azure.AI.Vision.Face.LivenessWithVerifySessionResults Results { get { throw null; } } + public string SessionId { get { throw null; } } + public Azure.AI.Vision.Face.OperationState Status { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Vision.Face.LivenessWithVerifySession System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -1164,6 +1135,34 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class LivenessWithVerifySessionAttempt : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LivenessWithVerifySessionAttempt() { } + public Azure.AI.Vision.Face.AbuseMonitoringResult AbuseMonitoringResult { get { throw null; } } + public int AttemptId { get { throw null; } } + public Azure.AI.Vision.Face.OperationState AttemptStatus { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ClientInformation { get { throw null; } } + public Azure.AI.Vision.Face.LivenessError Error { get { throw null; } } + public Azure.AI.Vision.Face.LivenessWithVerifyResult Result { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifySessionAttempt System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifySessionAttempt System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LivenessWithVerifySessionResults : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LivenessWithVerifySessionResults() { } + public System.Collections.Generic.IReadOnlyList Attempts { get { throw null; } } + public System.Collections.Generic.IReadOnlyList VerifyReferences { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifySessionResults System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.LivenessWithVerifySessionResults System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class MaskProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal MaskProperties() { } @@ -1241,6 +1240,40 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct OperationState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OperationState(string value) { throw null; } + public static Azure.AI.Vision.Face.OperationState Canceled { get { throw null; } } + public static Azure.AI.Vision.Face.OperationState Failed { get { throw null; } } + public static Azure.AI.Vision.Face.OperationState NotStarted { get { throw null; } } + public static Azure.AI.Vision.Face.OperationState Running { get { throw null; } } + public static Azure.AI.Vision.Face.OperationState Succeeded { get { throw null; } } + public bool Equals(Azure.AI.Vision.Face.OperationState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Vision.Face.OperationState left, Azure.AI.Vision.Face.OperationState right) { throw null; } + public static implicit operator Azure.AI.Vision.Face.OperationState (string value) { throw null; } + public static bool operator !=(Azure.AI.Vision.Face.OperationState left, Azure.AI.Vision.Face.OperationState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class OtherFlaggedSessions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal OtherFlaggedSessions() { } + public int AttemptId { get { throw null; } } + public string SessionId { get { throw null; } } + public string SessionImageId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.OtherFlaggedSessions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Vision.Face.OtherFlaggedSessions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct QualityForRecognition : System.IEquatable { private readonly object _dummy; diff --git a/sdk/face/Azure.AI.Vision.Face/assets.json b/sdk/face/Azure.AI.Vision.Face/assets.json index c127f0690dcb..97c83157d949 100644 --- a/sdk/face/Azure.AI.Vision.Face/assets.json +++ b/sdk/face/Azure.AI.Vision.Face/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/face/Azure.AI.Vision.Face", - "Tag": "net/face/Azure.AI.Vision.Face_3208a2f5ac" + "Tag": "net/face/Azure.AI.Vision.Face_a00e23f72f" } diff --git a/sdk/face/Azure.AI.Vision.Face/samples/Sample2_DetectLivenessWithSession.md b/sdk/face/Azure.AI.Vision.Face/samples/Sample2_DetectLivenessWithSession.md index c2a8a2e125c6..f4c4b4500d9c 100644 --- a/sdk/face/Azure.AI.Vision.Face/samples/Sample2_DetectLivenessWithSession.md +++ b/sdk/face/Azure.AI.Vision.Face/samples/Sample2_DetectLivenessWithSession.md @@ -30,8 +30,8 @@ Before you can detect liveness in a face, you need to create a liveness detectio ```C# Snippet:CreateLivenessSession var createContent = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, DeviceCorrelationId = Guid.NewGuid().ToString(), + UserCorrelationId = Guid.NewGuid().ToString(), }; var createResponse = sessionClient.CreateLivenessSession(createContent); @@ -56,69 +56,45 @@ After you've performed liveness detection, you can retrieve the result by provid ```C# Snippet:GetLivenessSessionResult var getResultResponse = sessionClient.GetLivenessSessionResult(sessionId); var sessionResult = getResultResponse.Value; -Console.WriteLine($"Id: {sessionResult.Id}"); -Console.WriteLine($"CreatedDateTime: {sessionResult.CreatedDateTime}"); -Console.WriteLine($"SessionExpired: {sessionResult.SessionExpired}"); -Console.WriteLine($"DeviceCorrelationId: {sessionResult.DeviceCorrelationId}"); -Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {sessionResult.AuthTokenTimeToLiveInSeconds}"); +Console.WriteLine($"Id: {sessionResult.SessionId}"); Console.WriteLine($"Status: {sessionResult.Status}"); -Console.WriteLine($"SessionStartDateTime: {sessionResult.SessionStartDateTime}"); -if (sessionResult.Result != null) { - WriteLivenessSessionAuditEntry(sessionResult.Result); -} -``` - -```C# Snippet:WriteLivenessSessionAuditEntry -public void WriteLivenessSessionAuditEntry(LivenessSessionAuditEntry auditEntry) -{ - Console.WriteLine($"Id: {auditEntry.Id}"); - Console.WriteLine($"SessionId: {auditEntry.SessionId}"); - Console.WriteLine($"RequestId: {auditEntry.RequestId}"); - Console.WriteLine($"ClientRequestId: {auditEntry.ClientRequestId}"); - Console.WriteLine($"ReceivedDateTime: {auditEntry.ReceivedDateTime}"); - Console.WriteLine($"Digest: {auditEntry.Digest}"); - - Console.WriteLine($" Request Url: {auditEntry.Request.Url}"); - Console.WriteLine($" Request Method: {auditEntry.Request.Method}"); - Console.WriteLine($" Request ContentLength: {auditEntry.Request.ContentLength}"); - Console.WriteLine($" Request ContentType: {auditEntry.Request.ContentType}"); - Console.WriteLine($" Request UserAgent: {auditEntry.Request.UserAgent}"); - - Console.WriteLine($" Response StatusCode: {auditEntry.Response.StatusCode}"); - Console.WriteLine($" Response LatencyInMilliseconds: {auditEntry.Response.LatencyInMilliseconds}"); - Console.WriteLine($" Response Body LivenessDecision: {auditEntry.Response.Body.LivenessDecision}"); - Console.WriteLine($" Response Body ModelVersionUsed: {auditEntry.Response.Body.ModelVersionUsed}"); - Console.WriteLine($" Response Body Target FaceRectangle: {auditEntry.Response.Body.Target.FaceRectangle.Top}, {auditEntry.Response.Body.Target.FaceRectangle.Left}, {auditEntry.Response.Body.Target.FaceRectangle.Width}, {auditEntry.Response.Body.Target.FaceRectangle.Height}"); - Console.WriteLine($" Response Body Target FileName: {auditEntry.Response.Body.Target.FileName}"); - Console.WriteLine($" Response Body Target TimeOffsetWithinFile: {auditEntry.Response.Body.Target.TimeOffsetWithinFile}"); - Console.WriteLine($" Response Body Target FaceImageType: {auditEntry.Response.Body.Target.ImageType}"); -} -``` - -If there are multiple liveness calls, you can retrieve the result by getting liveness audit entries. - -```C# Snippet:GetLivenessSessionAuditEntries -var getAuditEntriesResponse = sessionClient.GetLivenessSessionAuditEntries(sessionId); -foreach (var auditEntry in getAuditEntriesResponse.Value) +if (sessionResult.Results != null) { - WriteLivenessSessionAuditEntry(auditEntry); + WriteLivenessSessionResults(sessionResult.Results); } ``` -## List all liveness sessions - -All existing sessions can be listed by sending a request to the service. - -```C# Snippet:GetLivenessSessions -var listResponse = sessionClient.GetLivenessSessions(); -foreach (var session in listResponse.Value) +```C# Snippet:WriteLivenessSessionResults +public void WriteLivenessSessionResults(LivenessSessionResults results) { - Console.WriteLine($"SessionId: {session.Id}"); - Console.WriteLine($"CreatedDateTime: {session.CreatedDateTime}"); - Console.WriteLine($"SessionExpired: {session.SessionExpired}"); - Console.WriteLine($"DeviceCorrelationId: {session.DeviceCorrelationId}"); - Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {session.AuthTokenTimeToLiveInSeconds}"); - Console.WriteLine($"SessionStartDateTime: {session.SessionStartDateTime}"); + if (results.Attempts == null || results.Attempts.Count == 0) + { + Console.WriteLine("No attempts found in the session results."); + return; + } + + var firstAttempt = results.Attempts[0]; + Console.WriteLine($"Attempt ID: {firstAttempt.AttemptId}"); + Console.WriteLine($"Attempt Status: {firstAttempt.AttemptStatus}"); + + if (firstAttempt.Result != null) + { + var result = firstAttempt.Result; + Console.WriteLine($" Liveness Decision: {result.LivenessDecision}"); + Console.WriteLine($" Digest: {result.Digest}"); + Console.WriteLine($" Session Image ID: {result.SessionImageId}"); + + if (result.Targets?.Color?.FaceRectangle != null) + { + var faceRect = result.Targets.Color.FaceRectangle; + Console.WriteLine($" Face Rectangle: Top={faceRect.Top}, Left={faceRect.Left}, Width={faceRect.Width}, Height={faceRect.Height}"); + } + } + + if (firstAttempt.ClientInformation != null && firstAttempt.ClientInformation.Count > 0) + { + Console.WriteLine($" Client Information Count: {firstAttempt.ClientInformation.Count}"); + } } ``` diff --git a/sdk/face/Azure.AI.Vision.Face/samples/Sample2_DetectLivenessWithSessionAsync.md b/sdk/face/Azure.AI.Vision.Face/samples/Sample2_DetectLivenessWithSessionAsync.md index cf964ac7a042..0553e061caa5 100644 --- a/sdk/face/Azure.AI.Vision.Face/samples/Sample2_DetectLivenessWithSessionAsync.md +++ b/sdk/face/Azure.AI.Vision.Face/samples/Sample2_DetectLivenessWithSessionAsync.md @@ -30,8 +30,8 @@ Before you can detect liveness in a face, you need to create a liveness detectio ```C# Snippet:CreateLivenessSessionAsync var createContent = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, DeviceCorrelationId = Guid.NewGuid().ToString(), + UserCorrelationId = Guid.NewGuid().ToString(), }; var createResponse = await sessionClient.CreateLivenessSessionAsync(createContent); @@ -56,69 +56,45 @@ After you've performed liveness detection, you can retrieve the result by provid ```C# Snippet:GetLivenessSessionResultAsync var getResultResponse = await sessionClient.GetLivenessSessionResultAsync(sessionId); var sessionResult = getResultResponse.Value; -Console.WriteLine($"Id: {sessionResult.Id}"); -Console.WriteLine($"CreatedDateTime: {sessionResult.CreatedDateTime}"); -Console.WriteLine($"SessionExpired: {sessionResult.SessionExpired}"); -Console.WriteLine($"DeviceCorrelationId: {sessionResult.DeviceCorrelationId}"); -Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {sessionResult.AuthTokenTimeToLiveInSeconds}"); +Console.WriteLine($"Id: {sessionResult.SessionId}"); Console.WriteLine($"Status: {sessionResult.Status}"); -Console.WriteLine($"SessionStartDateTime: {sessionResult.SessionStartDateTime}"); -if (sessionResult.Result != null) { - WriteLivenessSessionAuditEntry(sessionResult.Result); -} -``` - -```C# Snippet:WriteLivenessSessionAuditEntry -public void WriteLivenessSessionAuditEntry(LivenessSessionAuditEntry auditEntry) -{ - Console.WriteLine($"Id: {auditEntry.Id}"); - Console.WriteLine($"SessionId: {auditEntry.SessionId}"); - Console.WriteLine($"RequestId: {auditEntry.RequestId}"); - Console.WriteLine($"ClientRequestId: {auditEntry.ClientRequestId}"); - Console.WriteLine($"ReceivedDateTime: {auditEntry.ReceivedDateTime}"); - Console.WriteLine($"Digest: {auditEntry.Digest}"); - - Console.WriteLine($" Request Url: {auditEntry.Request.Url}"); - Console.WriteLine($" Request Method: {auditEntry.Request.Method}"); - Console.WriteLine($" Request ContentLength: {auditEntry.Request.ContentLength}"); - Console.WriteLine($" Request ContentType: {auditEntry.Request.ContentType}"); - Console.WriteLine($" Request UserAgent: {auditEntry.Request.UserAgent}"); - - Console.WriteLine($" Response StatusCode: {auditEntry.Response.StatusCode}"); - Console.WriteLine($" Response LatencyInMilliseconds: {auditEntry.Response.LatencyInMilliseconds}"); - Console.WriteLine($" Response Body LivenessDecision: {auditEntry.Response.Body.LivenessDecision}"); - Console.WriteLine($" Response Body ModelVersionUsed: {auditEntry.Response.Body.ModelVersionUsed}"); - Console.WriteLine($" Response Body Target FaceRectangle: {auditEntry.Response.Body.Target.FaceRectangle.Top}, {auditEntry.Response.Body.Target.FaceRectangle.Left}, {auditEntry.Response.Body.Target.FaceRectangle.Width}, {auditEntry.Response.Body.Target.FaceRectangle.Height}"); - Console.WriteLine($" Response Body Target FileName: {auditEntry.Response.Body.Target.FileName}"); - Console.WriteLine($" Response Body Target TimeOffsetWithinFile: {auditEntry.Response.Body.Target.TimeOffsetWithinFile}"); - Console.WriteLine($" Response Body Target FaceImageType: {auditEntry.Response.Body.Target.ImageType}"); -} -``` - -If there are multiple liveness calls, you can retrieve the result by getting liveness audit entries. - -```C# Snippet:GetLivenessSessionAuditEntriesAsync -var getAuditEntriesResponse = await sessionClient.GetLivenessSessionAuditEntriesAsync(sessionId); -foreach (var auditEntry in getAuditEntriesResponse.Value) +if (sessionResult.Results != null) { - WriteLivenessSessionAuditEntry(auditEntry); + WriteLivenessSessionResults(sessionResult.Results); } ``` -## List all liveness sessions - -All existing sessions can be listed by sending a request to the service. - -```C# Snippet:GetLivenessSessionsAsync -var listResponse = await sessionClient.GetLivenessSessionsAsync(); -foreach (var session in listResponse.Value) +```C# Snippet:WriteLivenessSessionResults +public void WriteLivenessSessionResults(LivenessSessionResults results) { - Console.WriteLine($"SessionId: {session.Id}"); - Console.WriteLine($"CreatedDateTime: {session.CreatedDateTime}"); - Console.WriteLine($"SessionExpired: {session.SessionExpired}"); - Console.WriteLine($"DeviceCorrelationId: {session.DeviceCorrelationId}"); - Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {session.AuthTokenTimeToLiveInSeconds}"); - Console.WriteLine($"SessionStartDateTime: {session.SessionStartDateTime}"); + if (results.Attempts == null || results.Attempts.Count == 0) + { + Console.WriteLine("No attempts found in the session results."); + return; + } + + var firstAttempt = results.Attempts[0]; + Console.WriteLine($"Attempt ID: {firstAttempt.AttemptId}"); + Console.WriteLine($"Attempt Status: {firstAttempt.AttemptStatus}"); + + if (firstAttempt.Result != null) + { + var result = firstAttempt.Result; + Console.WriteLine($" Liveness Decision: {result.LivenessDecision}"); + Console.WriteLine($" Digest: {result.Digest}"); + Console.WriteLine($" Session Image ID: {result.SessionImageId}"); + + if (result.Targets?.Color?.FaceRectangle != null) + { + var faceRect = result.Targets.Color.FaceRectangle; + Console.WriteLine($" Face Rectangle: Top={faceRect.Top}, Left={faceRect.Left}, Width={faceRect.Width}, Height={faceRect.Height}"); + } + } + + if (firstAttempt.ClientInformation != null && firstAttempt.ClientInformation.Count > 0) + { + Console.WriteLine($" Client Information Count: {firstAttempt.ClientInformation.Count}"); + } } ``` diff --git a/sdk/face/Azure.AI.Vision.Face/samples/Sample3_DetectLivenessWithVerifyWithSession.md b/sdk/face/Azure.AI.Vision.Face/samples/Sample3_DetectLivenessWithVerifyWithSession.md index ac54d7b9e9cc..00261c10d90a 100644 --- a/sdk/face/Azure.AI.Vision.Face/samples/Sample3_DetectLivenessWithVerifyWithSession.md +++ b/sdk/face/Azure.AI.Vision.Face/samples/Sample3_DetectLivenessWithVerifyWithSession.md @@ -29,20 +29,24 @@ var sessionClient = new FaceSessionClient(endpoint, credential); Before you can detect liveness in a face, you need to create a liveness detection session with Azure AI Face Service. The service creates a liveness-session and responds back with a session-authorization-token. ```C# Snippet:CreateLivenessWithVerifySession -var parameters = new CreateLivenessWithVerifySessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, +using var fileStream = new FileStream(FaceTestConstant.LocalSampleImage, FileMode.Open, FileAccess.Read); +var parameters = new CreateLivenessWithVerifySessionContent(LivenessOperationMode.Passive, fileStream) +{ DeviceCorrelationId = Guid.NewGuid().ToString(), }; -using var fileStream = new FileStream(FaceTestConstant.LocalSampleImage, FileMode.Open, FileAccess.Read); - -var createResponse = sessionClient.CreateLivenessWithVerifySession(parameters, fileStream); +var createResponse = sessionClient.CreateLivenessWithVerifySession(parameters); var sessionId = createResponse.Value.SessionId; Console.WriteLine($"Session created, SessionId: {sessionId}"); Console.WriteLine($"AuthToken: {createResponse.Value.AuthToken}"); -Console.WriteLine($"VerifyImage.FaceRectangle: {createResponse.Value.VerifyImage.FaceRectangle.Top}, {createResponse.Value.VerifyImage.FaceRectangle.Left}, {createResponse.Value.VerifyImage.FaceRectangle.Width}, {createResponse.Value.VerifyImage.FaceRectangle.Height}"); -Console.WriteLine($"VerifyImage.QualityForRecognition: {createResponse.Value.VerifyImage.QualityForRecognition}"); +var results = createResponse.Value.Results; +if (results.VerifyReferences.Count > 0) +{ + var verifyReference = results.VerifyReferences[0]; + Console.WriteLine($"VerifyImage.FaceRectangle: {verifyReference.FaceRectangle.Top}, {verifyReference.FaceRectangle.Left}, {verifyReference.FaceRectangle.Width}, {verifyReference.FaceRectangle.Height}"); + Console.WriteLine($"VerifyImage.QualityForRecognition: {verifyReference.QualityForRecognition}"); +} ``` ## 3. Pass the AuthToken to client device @@ -61,74 +65,63 @@ After you've performed liveness detection with verification , you can retrieve t ```C# Snippet:GetLivenessWithVerifySessionResult var getResultResponse = sessionClient.GetLivenessWithVerifySessionResult(sessionId); var sessionResult = getResultResponse.Value; -Console.WriteLine($"Id: {sessionResult.Id}"); -Console.WriteLine($"CreatedDateTime: {sessionResult.CreatedDateTime}"); -Console.WriteLine($"SessionExpired: {sessionResult.SessionExpired}"); -Console.WriteLine($"DeviceCorrelationId: {sessionResult.DeviceCorrelationId}"); -Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {sessionResult.AuthTokenTimeToLiveInSeconds}"); +Console.WriteLine($"Id: {sessionResult.SessionId}"); Console.WriteLine($"Status: {sessionResult.Status}"); -Console.WriteLine($"SessionStartDateTime: {sessionResult.SessionStartDateTime}"); -if (sessionResult.Result != null) { - WriteLivenessWithVerifySessionAuditEntry(sessionResult.Result); -} -``` - -```C# Snippet:WriteLivenessWithVerifySessionAuditEntry -public void WriteLivenessWithVerifySessionAuditEntry(LivenessSessionAuditEntry auditEntry) -{ - Console.WriteLine($"Id: {auditEntry.Id}"); - Console.WriteLine($"SessionId: {auditEntry.SessionId}"); - Console.WriteLine($"RequestId: {auditEntry.RequestId}"); - Console.WriteLine($"ClientRequestId: {auditEntry.ClientRequestId}"); - Console.WriteLine($"ReceivedDateTime: {auditEntry.ReceivedDateTime}"); - Console.WriteLine($"Digest: {auditEntry.Digest}"); - - Console.WriteLine($" Request Url: {auditEntry.Request.Url}"); - Console.WriteLine($" Request Method: {auditEntry.Request.Method}"); - Console.WriteLine($" Request ContentLength: {auditEntry.Request.ContentLength}"); - Console.WriteLine($" Request ContentType: {auditEntry.Request.ContentType}"); - Console.WriteLine($" Request UserAgent: {auditEntry.Request.UserAgent}"); - - Console.WriteLine($" Response StatusCode: {auditEntry.Response.StatusCode}"); - Console.WriteLine($" Response LatencyInMilliseconds: {auditEntry.Response.LatencyInMilliseconds}"); - Console.WriteLine($" Response Body LivenessDecision: {auditEntry.Response.Body.LivenessDecision}"); - Console.WriteLine($" Response Body ModelVersionUsed: {auditEntry.Response.Body.ModelVersionUsed}"); - Console.WriteLine($" Response Body Target FaceRectangle: {auditEntry.Response.Body.Target.FaceRectangle.Top}, {auditEntry.Response.Body.Target.FaceRectangle.Left}, {auditEntry.Response.Body.Target.FaceRectangle.Width}, {auditEntry.Response.Body.Target.FaceRectangle.Height}"); - Console.WriteLine($" Response Body Target FileName: {auditEntry.Response.Body.Target.FileName}"); - Console.WriteLine($" Response Body Target TimeOffsetWithinFile: {auditEntry.Response.Body.Target.TimeOffsetWithinFile}"); - Console.WriteLine($" Response Body Target FaceImageType: {auditEntry.Response.Body.Target.ImageType}"); - - Console.WriteLine($" Response Body VerifyResult IsIdentical: {auditEntry.Response.Body.VerifyResult.IsIdentical}"); - Console.WriteLine($" Response Body VerifyResult MatchConfidence: {auditEntry.Response.Body.VerifyResult.MatchConfidence}"); - Console.WriteLine($" Response Body VerifyResult VerifyImage.FaceRectangle: {auditEntry.Response.Body.VerifyResult.VerifyImage.FaceRectangle.Top}, {auditEntry.Response.Body.VerifyResult.VerifyImage.FaceRectangle.Left}, {auditEntry.Response.Body.VerifyResult.VerifyImage.FaceRectangle.Width}, {auditEntry.Response.Body.VerifyResult.VerifyImage.FaceRectangle.Height}"); - Console.WriteLine($" Response Body VerifyResult VerifyImage.QualityForRecognition: {auditEntry.Response.Body.VerifyResult.VerifyImage.QualityForRecognition}"); -} -``` - -If there are multiple liveness calls, you can retrieve the result by getting liveness audit entries. - -```C# Snippet:GetLivenessWithVerifySessionAuditEntries -var getAuditEntriesResponse = sessionClient.GetLivenessWithVerifySessionAuditEntries(sessionId); -foreach (var auditEntry in getAuditEntriesResponse.Value) +if (sessionResult.Results != null) { - WriteLivenessWithVerifySessionAuditEntry(auditEntry); + WriteLivenessWithVerifySessionResults(sessionResult.Results); } ``` -## List all liveness sessions - -All existing sessions can be listed by sending a request to the service. - -```C# Snippet:GetLivenessWithVerifySessions -var listResponse = sessionClient.GetLivenessWithVerifySessions(); -foreach (var session in listResponse.Value) +```C# Snippet:WriteLivenessWithVerifySessionResults +public void WriteLivenessWithVerifySessionResults(LivenessWithVerifySessionResults results) { - Console.WriteLine($"SessionId: {session.Id}"); - Console.WriteLine($"CreatedDateTime: {session.CreatedDateTime}"); - Console.WriteLine($"SessionExpired: {session.SessionExpired}"); - Console.WriteLine($"DeviceCorrelationId: {session.DeviceCorrelationId}"); - Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {session.AuthTokenTimeToLiveInSeconds}"); - Console.WriteLine($"SessionStartDateTime: {session.SessionStartDateTime}"); + if (results.Attempts == null || results.Attempts.Count == 0) + { + Console.WriteLine("No attempts found in the session results."); + return; + } + + var firstAttempt = results.Attempts[0]; + Console.WriteLine($"Attempt ID: {firstAttempt.AttemptId}"); + Console.WriteLine($"Attempt Status: {firstAttempt.AttemptStatus}"); + + if (firstAttempt.Result != null) + { + var result = firstAttempt.Result; + Console.WriteLine($" Liveness Decision: {result.LivenessDecision}"); + Console.WriteLine($" Digest: {result.Digest}"); + Console.WriteLine($" Session Image ID: {result.SessionImageId}"); + + if (result.Targets?.Color?.FaceRectangle != null) + { + var faceRect = result.Targets.Color.FaceRectangle; + Console.WriteLine($" Target Face Rectangle: Top={faceRect.Top}, Left={faceRect.Left}, Width={faceRect.Width}, Height={faceRect.Height}"); + } + + if (result.VerifyResult != null) + { + Console.WriteLine($" Verify Result IsIdentical: {result.VerifyResult.IsIdentical}"); + Console.WriteLine($" Verify Result MatchConfidence: {result.VerifyResult.MatchConfidence}"); + } + + Console.WriteLine($" Verify Image Hash: {result.VerifyImageHash}"); + } + + if (results.VerifyReferences != null && results.VerifyReferences.Count > 0) + { + var verifyRef = results.VerifyReferences[0]; + if (verifyRef.FaceRectangle != null) + { + Console.WriteLine($" Verify Reference Face Rectangle: Top={verifyRef.FaceRectangle.Top}, Left={verifyRef.FaceRectangle.Left}, Width={verifyRef.FaceRectangle.Width}, Height={verifyRef.FaceRectangle.Height}"); + } + Console.WriteLine($" Verify Reference Quality For Recognition: {verifyRef.QualityForRecognition}"); + } + + if (firstAttempt.ClientInformation != null && firstAttempt.ClientInformation.Count > 0) + { + Console.WriteLine($" Client Information Count: {firstAttempt.ClientInformation.Count}"); + } } ``` diff --git a/sdk/face/Azure.AI.Vision.Face/samples/Sample3_DetectLivenessWithVerifyWithSessionAsync.md b/sdk/face/Azure.AI.Vision.Face/samples/Sample3_DetectLivenessWithVerifyWithSessionAsync.md index 0b18fbcb5109..d383d0046f38 100644 --- a/sdk/face/Azure.AI.Vision.Face/samples/Sample3_DetectLivenessWithVerifyWithSessionAsync.md +++ b/sdk/face/Azure.AI.Vision.Face/samples/Sample3_DetectLivenessWithVerifyWithSessionAsync.md @@ -29,20 +29,25 @@ var sessionClient = new FaceSessionClient(endpoint, credential); Before you can detect liveness in a face, you need to create a liveness detection session with Azure AI Face Service. The service creates a liveness-session and responds back with a session-authorization-token. ```C# Snippet:CreateLivenessWithVerifySessionAsync -var parameters = new CreateLivenessWithVerifySessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, +using var fileStream = new FileStream(FaceTestConstant.LocalSampleImage, FileMode.Open, FileAccess.Read); +var parameters = new CreateLivenessWithVerifySessionContent(LivenessOperationMode.Passive, fileStream) +{ DeviceCorrelationId = Guid.NewGuid().ToString(), }; -using var fileStream = new FileStream(FaceTestConstant.LocalSampleImage, FileMode.Open, FileAccess.Read); - -var createResponse = await sessionClient.CreateLivenessWithVerifySessionAsync(parameters, fileStream); +var createResponse = await sessionClient.CreateLivenessWithVerifySessionAsync(parameters); var sessionId = createResponse.Value.SessionId; Console.WriteLine($"Session created, SessionId: {sessionId}"); Console.WriteLine($"AuthToken: {createResponse.Value.AuthToken}"); -Console.WriteLine($"VerifyImage.FaceRectangle: {createResponse.Value.VerifyImage.FaceRectangle.Top}, {createResponse.Value.VerifyImage.FaceRectangle.Left}, {createResponse.Value.VerifyImage.FaceRectangle.Width}, {createResponse.Value.VerifyImage.FaceRectangle.Height}"); -Console.WriteLine($"VerifyImage.QualityForRecognition: {createResponse.Value.VerifyImage.QualityForRecognition}"); + +var results = createResponse.Value.Results; +if (results.VerifyReferences.Count > 0) +{ + var verifyReference = results.VerifyReferences[0]; + Console.WriteLine($"VerifyImage.FaceRectangle: {verifyReference.FaceRectangle.Top}, {verifyReference.FaceRectangle.Left}, {verifyReference.FaceRectangle.Width}, {verifyReference.FaceRectangle.Height}"); + Console.WriteLine($"VerifyImage.QualityForRecognition: {verifyReference.QualityForRecognition}"); +} ``` ## 3. Pass the AuthToken to client device @@ -61,74 +66,63 @@ After you've performed liveness detection with verification , you can retrieve t ```C# Snippet:GetLivenessWithVerifySessionResultAsync var getResultResponse = await sessionClient.GetLivenessWithVerifySessionResultAsync(sessionId); var sessionResult = getResultResponse.Value; -Console.WriteLine($"Id: {sessionResult.Id}"); -Console.WriteLine($"CreatedDateTime: {sessionResult.CreatedDateTime}"); -Console.WriteLine($"SessionExpired: {sessionResult.SessionExpired}"); -Console.WriteLine($"DeviceCorrelationId: {sessionResult.DeviceCorrelationId}"); -Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {sessionResult.AuthTokenTimeToLiveInSeconds}"); +Console.WriteLine($"Id: {sessionResult.SessionId}"); Console.WriteLine($"Status: {sessionResult.Status}"); -Console.WriteLine($"SessionStartDateTime: {sessionResult.SessionStartDateTime}"); -if (sessionResult.Result != null) { - WriteLivenessWithVerifySessionAuditEntry(sessionResult.Result); -} -``` - -```C# Snippet:WriteLivenessWithVerifySessionAuditEntry -public void WriteLivenessWithVerifySessionAuditEntry(LivenessSessionAuditEntry auditEntry) -{ - Console.WriteLine($"Id: {auditEntry.Id}"); - Console.WriteLine($"SessionId: {auditEntry.SessionId}"); - Console.WriteLine($"RequestId: {auditEntry.RequestId}"); - Console.WriteLine($"ClientRequestId: {auditEntry.ClientRequestId}"); - Console.WriteLine($"ReceivedDateTime: {auditEntry.ReceivedDateTime}"); - Console.WriteLine($"Digest: {auditEntry.Digest}"); - - Console.WriteLine($" Request Url: {auditEntry.Request.Url}"); - Console.WriteLine($" Request Method: {auditEntry.Request.Method}"); - Console.WriteLine($" Request ContentLength: {auditEntry.Request.ContentLength}"); - Console.WriteLine($" Request ContentType: {auditEntry.Request.ContentType}"); - Console.WriteLine($" Request UserAgent: {auditEntry.Request.UserAgent}"); - - Console.WriteLine($" Response StatusCode: {auditEntry.Response.StatusCode}"); - Console.WriteLine($" Response LatencyInMilliseconds: {auditEntry.Response.LatencyInMilliseconds}"); - Console.WriteLine($" Response Body LivenessDecision: {auditEntry.Response.Body.LivenessDecision}"); - Console.WriteLine($" Response Body ModelVersionUsed: {auditEntry.Response.Body.ModelVersionUsed}"); - Console.WriteLine($" Response Body Target FaceRectangle: {auditEntry.Response.Body.Target.FaceRectangle.Top}, {auditEntry.Response.Body.Target.FaceRectangle.Left}, {auditEntry.Response.Body.Target.FaceRectangle.Width}, {auditEntry.Response.Body.Target.FaceRectangle.Height}"); - Console.WriteLine($" Response Body Target FileName: {auditEntry.Response.Body.Target.FileName}"); - Console.WriteLine($" Response Body Target TimeOffsetWithinFile: {auditEntry.Response.Body.Target.TimeOffsetWithinFile}"); - Console.WriteLine($" Response Body Target FaceImageType: {auditEntry.Response.Body.Target.ImageType}"); - - Console.WriteLine($" Response Body VerifyResult IsIdentical: {auditEntry.Response.Body.VerifyResult.IsIdentical}"); - Console.WriteLine($" Response Body VerifyResult MatchConfidence: {auditEntry.Response.Body.VerifyResult.MatchConfidence}"); - Console.WriteLine($" Response Body VerifyResult VerifyImage.FaceRectangle: {auditEntry.Response.Body.VerifyResult.VerifyImage.FaceRectangle.Top}, {auditEntry.Response.Body.VerifyResult.VerifyImage.FaceRectangle.Left}, {auditEntry.Response.Body.VerifyResult.VerifyImage.FaceRectangle.Width}, {auditEntry.Response.Body.VerifyResult.VerifyImage.FaceRectangle.Height}"); - Console.WriteLine($" Response Body VerifyResult VerifyImage.QualityForRecognition: {auditEntry.Response.Body.VerifyResult.VerifyImage.QualityForRecognition}"); -} -``` - -If there are multiple liveness calls, you can retrieve the result by getting liveness audit entries. - -```C# Snippet:GetLivenessWithVerifySessionAuditEntriesAsync -var getAuditEntriesResponse = await sessionClient.GetLivenessWithVerifySessionAuditEntriesAsync(sessionId); -foreach (var auditEntry in getAuditEntriesResponse.Value) +if (sessionResult.Results != null) { - WriteLivenessWithVerifySessionAuditEntry(auditEntry); + WriteLivenessWithVerifySessionResults(sessionResult.Results); } ``` -## List all liveness sessions - -All existing sessions can be listed by sending a request to the service. - -```C# Snippet:GetLivenessWithVerifySessionsAsync -var listResponse = await sessionClient.GetLivenessWithVerifySessionsAsync(); -foreach (var session in listResponse.Value) +```C# Snippet:WriteLivenessWithVerifySessionResults +public void WriteLivenessWithVerifySessionResults(LivenessWithVerifySessionResults results) { - Console.WriteLine($"SessionId: {session.Id}"); - Console.WriteLine($"CreatedDateTime: {session.CreatedDateTime}"); - Console.WriteLine($"SessionExpired: {session.SessionExpired}"); - Console.WriteLine($"DeviceCorrelationId: {session.DeviceCorrelationId}"); - Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {session.AuthTokenTimeToLiveInSeconds}"); - Console.WriteLine($"SessionStartDateTime: {session.SessionStartDateTime}"); + if (results.Attempts == null || results.Attempts.Count == 0) + { + Console.WriteLine("No attempts found in the session results."); + return; + } + + var firstAttempt = results.Attempts[0]; + Console.WriteLine($"Attempt ID: {firstAttempt.AttemptId}"); + Console.WriteLine($"Attempt Status: {firstAttempt.AttemptStatus}"); + + if (firstAttempt.Result != null) + { + var result = firstAttempt.Result; + Console.WriteLine($" Liveness Decision: {result.LivenessDecision}"); + Console.WriteLine($" Digest: {result.Digest}"); + Console.WriteLine($" Session Image ID: {result.SessionImageId}"); + + if (result.Targets?.Color?.FaceRectangle != null) + { + var faceRect = result.Targets.Color.FaceRectangle; + Console.WriteLine($" Target Face Rectangle: Top={faceRect.Top}, Left={faceRect.Left}, Width={faceRect.Width}, Height={faceRect.Height}"); + } + + if (result.VerifyResult != null) + { + Console.WriteLine($" Verify Result IsIdentical: {result.VerifyResult.IsIdentical}"); + Console.WriteLine($" Verify Result MatchConfidence: {result.VerifyResult.MatchConfidence}"); + } + + Console.WriteLine($" Verify Image Hash: {result.VerifyImageHash}"); + } + + if (results.VerifyReferences != null && results.VerifyReferences.Count > 0) + { + var verifyRef = results.VerifyReferences[0]; + if (verifyRef.FaceRectangle != null) + { + Console.WriteLine($" Verify Reference Face Rectangle: Top={verifyRef.FaceRectangle.Top}, Left={verifyRef.FaceRectangle.Left}, Width={verifyRef.FaceRectangle.Width}, Height={verifyRef.FaceRectangle.Height}"); + } + Console.WriteLine($" Verify Reference Quality For Recognition: {verifyRef.QualityForRecognition}"); + } + + if (firstAttempt.ClientInformation != null && firstAttempt.ClientInformation.Count > 0) + { + Console.WriteLine($" Client Information Count: {firstAttempt.ClientInformation.Count}"); + } } ``` diff --git a/sdk/face/Azure.AI.Vision.Face/src/Custom/AbuseMonitoringResult.cs b/sdk/face/Azure.AI.Vision.Face/src/Custom/AbuseMonitoringResult.cs new file mode 100644 index 000000000000..287c626a15a2 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Custom/AbuseMonitoringResult.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +namespace Azure.AI.Vision.Face +{ + public partial class AbuseMonitoringResult + { + /// Denotes if abuse detection triggered during this liveness attempt. + public bool IsAbuseDetected { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Custom/CreateLivenessSessionContent.cs b/sdk/face/Azure.AI.Vision.Face/src/Custom/CreateLivenessSessionContent.cs new file mode 100644 index 000000000000..995383174f8f --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Custom/CreateLivenessSessionContent.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +namespace Azure.AI.Vision.Face +{ + public partial class CreateLivenessSessionContent + { + /// 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/Custom/FaceSessionClient.cs b/sdk/face/Azure.AI.Vision.Face/src/Custom/FaceSessionClient.cs index dd468dfa9589..69a2b15c2893 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Custom/FaceSessionClient.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Custom/FaceSessionClient.cs @@ -12,44 +12,5 @@ namespace Azure.AI.Vision.Face /// The FaceSession service client. public partial class FaceSessionClient { - /// Create a new liveness session with verify. Provide the verify image during session creation. - /// Parameters for liveness with verify session creation. - /// Image binary data for verify image, can be provided as session creation time or during the /detectLivenessWithVerify/singleModal /// - /// 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. - [ForwardsClientCalls] - public virtual async Task> CreateLivenessWithVerifySessionAsync(CreateLivenessWithVerifySessionContent jsonContent, Stream verifyImage, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(jsonContent, nameof(jsonContent)); - - if (verifyImage == null) - { - return await CreateLivenessWithVerifySessionAsync(jsonContent, cancellationToken).ConfigureAwait(false); - } - - CreateLivenessWithVerifySessionMultipartContent multipartContent = new CreateLivenessWithVerifySessionMultipartContent(jsonContent, verifyImage); - return await CreateLivenessWithVerifySessionWithVerifyImageAsync(multipartContent, cancellationToken).ConfigureAwait(false); - } - - /// Create a new liveness session with verify. Provide the verify image during session creation. - /// Parameters for liveness with verify session creation. - /// Image binary data for verify image, can be provided as session creation time or during the /detectLivenessWithVerify/singleModal /// - /// 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. - [ForwardsClientCalls] - public virtual Response CreateLivenessWithVerifySession(CreateLivenessWithVerifySessionContent jsonContent, Stream verifyImage, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(jsonContent, nameof(jsonContent)); - - if (verifyImage == null) - { - return CreateLivenessWithVerifySession(jsonContent, cancellationToken); - } - - CreateLivenessWithVerifySessionMultipartContent multipartContent = new CreateLivenessWithVerifySessionMultipartContent(jsonContent, verifyImage); - return CreateLivenessWithVerifySessionWithVerifyImage(multipartContent, cancellationToken); - } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Custom/LivenessSession.cs b/sdk/face/Azure.AI.Vision.Face/src/Custom/LivenessSession.cs new file mode 100644 index 000000000000..053cf4f857e3 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Custom/LivenessSession.cs @@ -0,0 +1,16 @@ +// 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 +{ + public partial class LivenessSession + { + /// Denotes if the abuse monitoring feature was enabled during this session. + public bool IsAbuseMonitoringEnabled { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Custom/LivenessWithVerifySession.cs b/sdk/face/Azure.AI.Vision.Face/src/Custom/LivenessWithVerifySession.cs new file mode 100644 index 000000000000..bce2d7533e3c --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Custom/LivenessWithVerifySession.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +namespace Azure.AI.Vision.Face +{ + public partial class LivenessWithVerifySession + { + /// Denotes if the abuse monitoring feature was enabled during this session. + public bool IsAbuseMonitoringEnabled { get; } + } +} 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..6e31592960f5 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,275 @@ 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. + /// Unique Guid per each end-user. This is to provide rate limiting and anti-hammering. If 'userCorrelationIdSetInClient' is true in this request, this 'userCorrelationId' must be null. + /// Whether or not to allow client to set their own 'userCorrelationId' via the Vision SDK. Default is false, and 'userCorrelationId' must be set in this request body. + /// Specify the expected IP address or CIDR block of the client that runs the liveness check. /// 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 = default, string userCorrelationId = null, bool? userCorrelationIdSetInClient = null, string expectedClientIpAddress = null) { return new CreateLivenessSessionContent( livenessOperationMode, - sendResultsToClient, deviceCorrelationIdSetInClient, enableSessionImage, - livenessSingleModalModel, + livenessModelVersion, deviceCorrelationId, authTokenTimeToLiveInSeconds, + numberOfClientAttemptsAllowed, + userCorrelationId, + userCorrelationIdSetInClient, + expectedClientIpAddress, 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 expected IP address or CIDR block of the client that runs the liveness check. + /// 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 = default, string expectedClientIpAddress = null, LivenessSessionResults results = null) { return new LivenessSession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + isAbuseMonitoringEnabled, + expectedClientIpAddress, + 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 expected IP address or CIDR block of the client that runs the liveness check. + /// 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 = default, string expectedClientIpAddress = null, LivenessWithVerifySessionResults results = null) { return new LivenessWithVerifySession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, + modelVersion, + isAbuseMonitoringEnabled, + expectedClientIpAddress, + 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 60b76e7961b6..3cab64f289d9 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, AzureAIVisionFaceContext.Default); 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..bf5dbee52ace --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/AbuseMonitoringResult.cs @@ -0,0 +1,79 @@ +// 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 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..1e38867638eb --- /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, AzureAIVisionFaceContext.Default); + 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 38fcb8112b22..deaea21eaae2 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,23 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("authTokenTimeToLiveInSeconds"u8); writer.WriteNumberValue(AuthTokenTimeToLiveInSeconds.Value); } + writer.WritePropertyName("numberOfClientAttemptsAllowed"u8); + writer.WriteNumberValue(NumberOfClientAttemptsAllowed); + if (Optional.IsDefined(UserCorrelationId)) + { + writer.WritePropertyName("userCorrelationId"u8); + writer.WriteStringValue(UserCorrelationId); + } + if (Optional.IsDefined(UserCorrelationIdSetInClient)) + { + writer.WritePropertyName("userCorrelationIdSetInClient"u8); + writer.WriteBooleanValue(UserCorrelationIdSetInClient.Value); + } + if (Optional.IsDefined(ExpectedClientIpAddress)) + { + writer.WritePropertyName("expectedClientIpAddress"u8); + writer.WriteStringValue(ExpectedClientIpAddress); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -104,12 +116,15 @@ 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; + string userCorrelationId = default; + bool? userCorrelationIdSetInClient = default; + string expectedClientIpAddress = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -119,15 +134,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 +152,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 +175,34 @@ 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 (property.NameEquals("userCorrelationId"u8)) + { + userCorrelationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("userCorrelationIdSetInClient"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userCorrelationIdSetInClient = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("expectedClientIpAddress"u8)) + { + expectedClientIpAddress = property.Value.GetString(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -177,12 +211,15 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon serializedAdditionalRawData = rawDataDictionary; return new CreateLivenessSessionContent( livenessOperationMode, - sendResultsToClient, deviceCorrelationIdSetInClient, enableSessionImage, - livenessSingleModalModel, + livenessModelVersion, deviceCorrelationId, authTokenTimeToLiveInSeconds, + numberOfClientAttemptsAllowed, + userCorrelationId, + userCorrelationIdSetInClient, + expectedClientIpAddress, 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..5d409183250d 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,28 @@ 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. + /// Unique Guid per each end-user. This is to provide rate limiting and anti-hammering. If 'userCorrelationIdSetInClient' is true in this request, this 'userCorrelationId' must be null. + /// Whether or not to allow client to set their own 'userCorrelationId' via the Vision SDK. Default is false, and 'userCorrelationId' must be set in this request body. + /// Specify the expected IP address or CIDR block of the client that runs the liveness check. /// 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, string userCorrelationId, bool? userCorrelationIdSetInClient, string expectedClientIpAddress, IDictionary serializedAdditionalRawData) { LivenessOperationMode = livenessOperationMode; - SendResultsToClient = sendResultsToClient; DeviceCorrelationIdSetInClient = deviceCorrelationIdSetInClient; EnableSessionImage = enableSessionImage; - LivenessSingleModalModel = livenessSingleModalModel; + LivenessModelVersion = livenessModelVersion; DeviceCorrelationId = deviceCorrelationId; AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; + NumberOfClientAttemptsAllowed = numberOfClientAttemptsAllowed; + UserCorrelationId = userCorrelationId; + UserCorrelationIdSetInClient = userCorrelationIdSetInClient; + ExpectedClientIpAddress = expectedClientIpAddress; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -80,17 +86,21 @@ 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; } + /// Unique Guid per each end-user. This is to provide rate limiting and anti-hammering. If 'userCorrelationIdSetInClient' is true in this request, this 'userCorrelationId' must be null. + public string UserCorrelationId { get; set; } + /// Whether or not to allow client to set their own 'userCorrelationId' via the Vision SDK. Default is false, and 'userCorrelationId' must be set in this request body. + public bool? UserCorrelationIdSetInClient { get; set; } + /// Specify the expected IP address or CIDR block of the client that runs the liveness check. + public string ExpectedClientIpAddress { 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 47c49f2f7bfa..cfb2ab5406c3 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, AzureAIVisionFaceContext.Default); + 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 03f5713ac4bf..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, AzureAIVisionFaceContext.Default), "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, AzureAIVisionFaceContext.Default); - 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..275b3f078843 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 @@ -9,14 +9,16 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); -CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) +CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.PassiveActive) { - SendResultsToClient = true, - DeviceCorrelationIdSetInClient = true, + DeviceCorrelationIdSetInClient = false, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, + UserCorrelationId = "your_user_correlation_id", + UserCorrelationIdSetInClient = false, + ExpectedClientIpAddress = "1.2.3.4", }; -Response response = await client.CreateLivenessSessionAsync(body); +Response response = await client.CreateLivenessSessionAsync(body); ]]> @@ -27,14 +29,16 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); -CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) +CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.PassiveActive) { - SendResultsToClient = true, - DeviceCorrelationIdSetInClient = true, + DeviceCorrelationIdSetInClient = false, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, + UserCorrelationId = "your_user_correlation_id", + UserCorrelationIdSetInClient = false, + ExpectedClientIpAddress = "1.2.3.4", }; -Response response = client.CreateLivenessSession(body); +Response response = client.CreateLivenessSession(body); ]]> @@ -47,17 +51,22 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { - livenessOperationMode = "Passive", - sendResultsToClient = true, - deviceCorrelationIdSetInClient = true, + livenessOperationMode = "PassiveActive", + deviceCorrelationIdSetInClient = false, deviceCorrelationId = "your_device_correlation_id", + userCorrelationIdSetInClient = false, + userCorrelationId = "your_user_correlation_id", authTokenTimeToLiveInSeconds = 60, + expectedClientIpAddress = "1.2.3.4", }); 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()); ]]> @@ -70,17 +79,22 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { - livenessOperationMode = "Passive", - sendResultsToClient = true, - deviceCorrelationIdSetInClient = true, + livenessOperationMode = "PassiveActive", + deviceCorrelationIdSetInClient = false, deviceCorrelationId = "your_device_correlation_id", + userCorrelationIdSetInClient = false, + userCorrelationId = "your_user_correlation_id", authTokenTimeToLiveInSeconds = 60, + expectedClientIpAddress = "1.2.3.4", }); 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 +156,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 +174,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 +314,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 +338,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 ca191b864de6..56606488ea01 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; return message; @@ -1595,79 +993,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; @@ -1676,7 +1009,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); @@ -1686,14 +1019,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; return message; @@ -1708,56 +1041,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; @@ -1817,7 +1102,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"); @@ -1837,5 +1122,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 92c3f88092ff..0c8a0028f6f4 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 aa214ebd5025..731c46de08e6 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 8900ad9794d7..13a9c4d12ea2 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, AzureAIVisionFaceContext.Default); 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..6ec5d8b4e927 --- /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, AzureAIVisionFaceContext.Default); + 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 aab45e8ef744..ccbf351a295f 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, AzureAIVisionFaceContext.Default); 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 6f39b336d2ec..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(); - } - - /// 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(LivenessResponseBody)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(LivenessDecision)) - { - writer.WritePropertyName("livenessDecision"u8); - writer.WriteStringValue(LivenessDecision.Value.ToString()); - } - if (Optional.IsDefined(Target)) - { - writer.WritePropertyName("target"u8); - writer.WriteObjectValue(Target, options); - } - if (Optional.IsDefined(ModelVersionUsed)) - { - writer.WritePropertyName("modelVersionUsed"u8); - writer.WriteStringValue(ModelVersionUsed.Value.ToString()); - } - if (Optional.IsDefined(VerifyResult)) - { - writer.WritePropertyName("verifyResult"u8); - writer.WriteObjectValue(VerifyResult, options); - } - foreach (var item in AdditionalProperties) - { - 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 - } - } - - LivenessResponseBody 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(LivenessResponseBody)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLivenessResponseBody(document.RootElement, options); - } - - internal static LivenessResponseBody DeserializeLivenessResponseBody(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - FaceLivenessDecision? livenessDecision = default; - LivenessOutputsTarget target = default; - LivenessModel? modelVersionUsed = default; - LivenessWithVerifyOutputs verifyResult = default; - IReadOnlyDictionary additionalProperties = default; - Dictionary additionalPropertiesDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("livenessDecision"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - livenessDecision = new FaceLivenessDecision(property.Value.GetString()); - continue; - } - if (property.NameEquals("target"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - target = LivenessOutputsTarget.DeserializeLivenessOutputsTarget(property.Value, options); - continue; - } - if (property.NameEquals("modelVersionUsed"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - modelVersionUsed = new LivenessModel(property.Value.GetString()); - continue; - } - if (property.NameEquals("verifyResult"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - verifyResult = LivenessWithVerifyOutputs.DeserializeLivenessWithVerifyOutputs(property.Value, options); - continue; - } - additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - additionalProperties = additionalPropertiesDictionary; - return new LivenessResponseBody(livenessDecision, target, modelVersionUsed, verifyResult, additionalProperties); - } - - 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, AzureAIVisionFaceContext.Default); - default: - throw new FormatException($"The model {nameof(LivenessResponseBody)} does not support writing '{options.Format}' format."); - } - } - - LivenessResponseBody 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 DeserializeLivenessResponseBody(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(LivenessResponseBody)} 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 LivenessResponseBody FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessResponseBody(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/LivenessResponseBody.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.cs deleted file mode 100644 index 5d831412b0a9..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.cs +++ /dev/null @@ -1,77 +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 -{ - /// The response body of detect liveness API call. - public partial class LivenessResponseBody - { - /// Initializes a new instance of . - internal LivenessResponseBody() - { - AdditionalProperties = new ChangeTrackingDictionary(); - } - - /// 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. - internal LivenessResponseBody(FaceLivenessDecision? livenessDecision, LivenessOutputsTarget target, LivenessModel? modelVersionUsed, LivenessWithVerifyOutputs verifyResult, IReadOnlyDictionary additionalProperties) - { - LivenessDecision = livenessDecision; - Target = target; - ModelVersionUsed = modelVersionUsed; - VerifyResult = verifyResult; - AdditionalProperties = additionalProperties; - } - - /// The liveness classification for the target face. - public FaceLivenessDecision? LivenessDecision { get; } - /// Specific targets used for liveness classification. - public LivenessOutputsTarget Target { get; } - /// The model version used for liveness classification. - public LivenessModel? ModelVersionUsed { get; } - /// The face verification output. Only available when the request is liveness with verify. - public LivenessWithVerifyOutputs VerifyResult { get; } - /// - /// Additional Properties - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary AdditionalProperties { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.Serialization.cs similarity index 55% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.Serialization.cs index 4f2dfa9c52f5..053a9f028bc8 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class AuditRequestInfo : IUtf8JsonSerializable, IJsonModel + public partial class LivenessResult : 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,27 +28,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// 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(AuditRequestInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Url); - writer.WritePropertyName("method"u8); - writer.WriteStringValue(Method); - if (Optional.IsDefined(ContentLength)) + if (Optional.IsDefined(LivenessDecision)) { - writer.WritePropertyName("contentLength"u8); - writer.WriteNumberValue(ContentLength.Value); + writer.WritePropertyName("livenessDecision"u8); + writer.WriteStringValue(LivenessDecision.Value.ToString()); } - writer.WritePropertyName("contentType"u8); - writer.WriteStringValue(ContentType); - if (Optional.IsDefined(UserAgent)) + writer.WritePropertyName("targets"u8); + writer.WriteObjectValue(Targets, options); + writer.WritePropertyName("digest"u8); + writer.WriteStringValue(Digest); + if (Optional.IsDefined(SessionImageId)) { - writer.WritePropertyName("userAgent"u8); - writer.WriteStringValue(UserAgent); + writer.WritePropertyName("sessionImageId"u8); + writer.WriteStringValue(SessionImageId); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -67,19 +65,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AuditRequestInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessResult 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(AuditRequestInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAuditRequestInfo(document.RootElement, options); + return DeserializeLivenessResult(document.RootElement, options); } - internal static AuditRequestInfo DeserializeAuditRequestInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessResult DeserializeLivenessResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -87,42 +85,36 @@ internal static AuditRequestInfo DeserializeAuditRequestInfo(JsonElement element { return null; } - string url = default; - string method = default; - long? contentLength = default; - string contentType = default; - string userAgent = default; + FaceLivenessDecision? livenessDecision = default; + LivenessDecisionTargets targets = default; + string digest = default; + string sessionImageId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("url"u8)) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("method"u8)) - { - method = property.Value.GetString(); - continue; - } - if (property.NameEquals("contentLength"u8)) + if (property.NameEquals("livenessDecision"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - contentLength = property.Value.GetInt64(); + livenessDecision = new FaceLivenessDecision(property.Value.GetString()); + continue; + } + if (property.NameEquals("targets"u8)) + { + targets = LivenessDecisionTargets.DeserializeLivenessDecisionTargets(property.Value, options); continue; } - if (property.NameEquals("contentType"u8)) + if (property.NameEquals("digest"u8)) { - contentType = property.Value.GetString(); + digest = property.Value.GetString(); continue; } - if (property.NameEquals("userAgent"u8)) + if (property.NameEquals("sessionImageId"u8)) { - userAgent = property.Value.GetString(); + sessionImageId = property.Value.GetString(); continue; } if (options.Format != "W") @@ -131,52 +123,46 @@ internal static AuditRequestInfo DeserializeAuditRequestInfo(JsonElement element } } serializedAdditionalRawData = rawDataDictionary; - return new AuditRequestInfo( - url, - method, - contentLength, - contentType, - userAgent, - serializedAdditionalRawData); + return new LivenessResult(livenessDecision, targets, digest, sessionImageId, 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, AzureAIVisionFaceContext.Default); default: - throw new FormatException($"The model {nameof(AuditRequestInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessResult)} does not support writing '{options.Format}' format."); } } - AuditRequestInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessResult 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 DeserializeAuditRequestInfo(document.RootElement, options); + return DeserializeLivenessResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AuditRequestInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessResult)} 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 AuditRequestInfo FromResponse(Response response) + internal static LivenessResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAuditRequestInfo(document.RootElement); + return DeserializeLivenessResult(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.cs new file mode 100644 index 000000000000..cf20e1fdeca9 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.cs @@ -0,0 +1,90 @@ +// 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 results of the liveness classification. + public partial class LivenessResult + { + /// + /// 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 . + /// 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. + /// or is null. + internal LivenessResult(LivenessDecisionTargets targets, string digest) + { + Argument.AssertNotNull(targets, nameof(targets)); + Argument.AssertNotNull(digest, nameof(digest)); + + Targets = targets; + Digest = digest; + } + + /// 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. + /// Keeps track of any properties unknown to the library. + internal LivenessResult(FaceLivenessDecision? livenessDecision, LivenessDecisionTargets targets, string digest, string sessionImageId, IDictionary serializedAdditionalRawData) + { + LivenessDecision = livenessDecision; + Targets = targets; + Digest = digest; + SessionImageId = sessionImageId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessResult() + { + } + + /// The liveness classification for the target face. + public FaceLivenessDecision? LivenessDecision { get; } + /// Targets used for liveness classification. + public LivenessDecisionTargets Targets { get; } + /// 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. + public string Digest { get; } + /// The image ID of the session request. + public string SessionImageId { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.Serialization.cs index a2f9c464b906..0768071d2b0a 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.Serialization.cs @@ -36,35 +36,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W") { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - writer.WritePropertyName("createdDateTime"u8); - writer.WriteStringValue(CreatedDateTime, "O"); - if (Optional.IsDefined(SessionStartDateTime)) - { - writer.WritePropertyName("sessionStartDateTime"u8); - writer.WriteStringValue(SessionStartDateTime.Value, "O"); - } - writer.WritePropertyName("sessionExpired"u8); - writer.WriteBooleanValue(SessionExpired); - if (Optional.IsDefined(DeviceCorrelationId)) - { - writer.WritePropertyName("deviceCorrelationId"u8); - writer.WriteStringValue(DeviceCorrelationId); - } - if (Optional.IsDefined(AuthTokenTimeToLiveInSeconds)) - { - writer.WritePropertyName("authTokenTimeToLiveInSeconds"u8); - writer.WriteNumberValue(AuthTokenTimeToLiveInSeconds.Value); + writer.WritePropertyName("sessionId"u8); + writer.WriteStringValue(SessionId); } + writer.WritePropertyName("authToken"u8); + writer.WriteStringValue(AuthToken); writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.ToString()); - if (Optional.IsDefined(Result)) + if (Optional.IsDefined(ModelVersion)) { - writer.WritePropertyName("result"u8); - writer.WriteObjectValue(Result, options); + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion.Value.ToString()); } + writer.WritePropertyName("isAbuseMonitoringEnabled"u8); + writer.WriteBooleanValue(IsAbuseMonitoringEnabled); + if (Optional.IsDefined(ExpectedClientIpAddress)) + { + writer.WritePropertyName("expectedClientIpAddress"u8); + writer.WriteStringValue(ExpectedClientIpAddress); + } + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -102,68 +94,58 @@ internal static LivenessSession DeserializeLivenessSession(JsonElement element, { return null; } - string id = default; - DateTimeOffset createdDateTime = default; - DateTimeOffset? sessionStartDateTime = default; - bool sessionExpired = default; - string deviceCorrelationId = default; - int? authTokenTimeToLiveInSeconds = default; - FaceSessionStatus status = default; - LivenessSessionAuditEntry result = default; + string sessionId = default; + string authToken = default; + OperationState status = default; + LivenessModel? modelVersion = default; + bool isAbuseMonitoringEnabled = default; + string expectedClientIpAddress = default; + LivenessSessionResults results = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (property.NameEquals("sessionId"u8)) + { + sessionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("authToken"u8)) { - id = property.Value.GetString(); + authToken = property.Value.GetString(); continue; } - if (property.NameEquals("createdDateTime"u8)) + if (property.NameEquals("status"u8)) { - createdDateTime = property.Value.GetDateTimeOffset("O"); + status = new OperationState(property.Value.GetString()); continue; } - if (property.NameEquals("sessionStartDateTime"u8)) + if (property.NameEquals("modelVersion"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sessionStartDateTime = property.Value.GetDateTimeOffset("O"); + modelVersion = new LivenessModel(property.Value.GetString()); continue; } - if (property.NameEquals("sessionExpired"u8)) - { - sessionExpired = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("deviceCorrelationId"u8)) - { - deviceCorrelationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("authTokenTimeToLiveInSeconds"u8)) + if (property.NameEquals("isAbuseMonitoringEnabled"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - authTokenTimeToLiveInSeconds = property.Value.GetInt32(); + isAbuseMonitoringEnabled = property.Value.GetBoolean(); continue; } - if (property.NameEquals("status"u8)) + if (property.NameEquals("expectedClientIpAddress"u8)) { - status = new FaceSessionStatus(property.Value.GetString()); + expectedClientIpAddress = property.Value.GetString(); continue; } - if (property.NameEquals("result"u8)) + if (property.NameEquals("results"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - result = LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(property.Value, options); + results = LivenessSessionResults.DeserializeLivenessSessionResults(property.Value, options); continue; } if (options.Format != "W") @@ -173,14 +155,13 @@ internal static LivenessSession DeserializeLivenessSession(JsonElement element, } serializedAdditionalRawData = rawDataDictionary; return new LivenessSession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + isAbuseMonitoringEnabled, + expectedClientIpAddress, + results, serializedAdditionalRawData); } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.cs index bda0898e67ff..d2696b459fc3 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.cs @@ -46,36 +46,38 @@ public partial class LivenessSession private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// DateTime when this session was created. - /// Whether or not the session is expired. + /// 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. - internal LivenessSession(DateTimeOffset createdDateTime, bool sessionExpired, FaceSessionStatus status) + /// The results of the liveness session. + /// or is null. + internal LivenessSession(string authToken, OperationState status, LivenessSessionResults results) { - CreatedDateTime = createdDateTime; - SessionExpired = sessionExpired; + Argument.AssertNotNull(authToken, nameof(authToken)); + Argument.AssertNotNull(results, nameof(results)); + + AuthToken = authToken; Status = status; + Results = results; } /// 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 expected IP address or CIDR block of the client that runs the liveness check. + /// The results of the liveness session. /// Keeps track of any properties unknown to the library. - internal LivenessSession(string id, DateTimeOffset createdDateTime, DateTimeOffset? sessionStartDateTime, bool sessionExpired, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, FaceSessionStatus status, LivenessSessionAuditEntry result, IDictionary serializedAdditionalRawData) + internal LivenessSession(string sessionId, string authToken, OperationState status, LivenessModel? modelVersion, bool isAbuseMonitoringEnabled, string expectedClientIpAddress, LivenessSessionResults results, IDictionary serializedAdditionalRawData) { - Id = id; - CreatedDateTime = createdDateTime; - SessionStartDateTime = sessionStartDateTime; - SessionExpired = sessionExpired; - DeviceCorrelationId = deviceCorrelationId; - AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; + SessionId = sessionId; + AuthToken = authToken; Status = status; - Result = result; + ModelVersion = modelVersion; + IsAbuseMonitoringEnabled = isAbuseMonitoringEnabled; + ExpectedClientIpAddress = expectedClientIpAddress; + Results = results; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -85,20 +87,16 @@ internal LivenessSession() } /// The unique ID to reference this session. - public string Id { get; } - /// DateTime when this session was created. - public DateTimeOffset CreatedDateTime { get; } - /// DateTime when this session was started by the client. - public DateTimeOffset? SessionStartDateTime { get; } - /// Whether or not the session is expired. - public bool SessionExpired { 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; } - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - public int? AuthTokenTimeToLiveInSeconds { get; } + 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 current status of the session. - public FaceSessionStatus Status { get; } - /// The latest session audit result only populated if status == 'ResultAvailable'. - public LivenessSessionAuditEntry Result { get; } + public OperationState Status { get; } + /// 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? ModelVersion { get; } + /// The expected IP address or CIDR block of the client that runs the liveness check. + public string ExpectedClientIpAddress { get; } + /// The results of the liveness session. + public LivenessSessionResults Results { get; } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.Serialization.cs new file mode 100644 index 000000000000..35985c40a7c6 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.Serialization.cs @@ -0,0 +1,227 @@ +// 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 LivenessSessionAttempt : 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(LivenessSessionAttempt)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("attemptId"u8); + writer.WriteNumberValue(AttemptId); + writer.WritePropertyName("attemptStatus"u8); + writer.WriteStringValue(AttemptStatus.ToString()); + if (Optional.IsDefined(Result)) + { + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error, options); + } + if (Optional.IsCollectionDefined(ClientInformation)) + { + writer.WritePropertyName("clientInformation"u8); + writer.WriteStartArray(); + foreach (var item in ClientInformation) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(AbuseMonitoringResult)) + { + writer.WritePropertyName("abuseMonitoringResult"u8); + writer.WriteObjectValue(AbuseMonitoringResult, 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 + } + } + } + + LivenessSessionAttempt 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(LivenessSessionAttempt)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLivenessSessionAttempt(document.RootElement, options); + } + + internal static LivenessSessionAttempt DeserializeLivenessSessionAttempt(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int attemptId = default; + OperationState attemptStatus = default; + LivenessResult result = default; + LivenessError error = default; + IReadOnlyList clientInformation = default; + AbuseMonitoringResult abuseMonitoringResult = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("attemptId"u8)) + { + attemptId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("attemptStatus"u8)) + { + attemptStatus = new OperationState(property.Value.GetString()); + continue; + } + if (property.NameEquals("result"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + result = LivenessResult.DeserializeLivenessResult(property.Value, options); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = LivenessError.DeserializeLivenessError(property.Value, options); + continue; + } + if (property.NameEquals("clientInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Face.ClientInformation.DeserializeClientInformation(item, options)); + } + clientInformation = array; + continue; + } + if (property.NameEquals("abuseMonitoringResult"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + abuseMonitoringResult = AbuseMonitoringResult.DeserializeAbuseMonitoringResult(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LivenessSessionAttempt( + attemptId, + attemptStatus, + result, + error, + clientInformation ?? new ChangeTrackingList(), + abuseMonitoringResult, + 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, AzureAIVisionFaceContext.Default); + default: + throw new FormatException($"The model {nameof(LivenessSessionAttempt)} does not support writing '{options.Format}' format."); + } + } + + LivenessSessionAttempt 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 DeserializeLivenessSessionAttempt(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LivenessSessionAttempt)} 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 LivenessSessionAttempt FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessSessionAttempt(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/LivenessSessionAttempt.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.cs new file mode 100644 index 000000000000..adf6d75637d2 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.cs @@ -0,0 +1,95 @@ +// 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 liveness session attempt. + public partial class LivenessSessionAttempt + { + /// + /// 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 attempt ID, start from 1. + /// The status of the attempt. + internal LivenessSessionAttempt(int attemptId, OperationState attemptStatus) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + ClientInformation = new ChangeTrackingList(); + } + + /// 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. + /// Keeps track of any properties unknown to the library. + internal LivenessSessionAttempt(int attemptId, OperationState attemptStatus, LivenessResult result, LivenessError error, IReadOnlyList clientInformation, AbuseMonitoringResult abuseMonitoringResult, IDictionary serializedAdditionalRawData) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + Result = result; + Error = error; + ClientInformation = clientInformation; + AbuseMonitoringResult = abuseMonitoringResult; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessSessionAttempt() + { + } + + /// The attempt ID, start from 1. + public int AttemptId { get; } + /// The status of the attempt. + public OperationState AttemptStatus { get; } + /// The result of the liveness call, will be null if there is error. + public LivenessResult Result { get; } + /// The error of the liveness call, will be null if there is result. + public LivenessError Error { get; } + /// The client information gathered during the liveness attempt. + public IReadOnlyList ClientInformation { get; } + /// The abuse monitoring result for the liveness attempt. + public AbuseMonitoringResult AbuseMonitoringResult { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.cs deleted file mode 100644 index 46b364a13ffd..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.cs +++ /dev/null @@ -1,130 +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 session. - public partial class LivenessSessionAuditEntry - { - /// - /// 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 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. - /// , , , , or is null. - internal LivenessSessionAuditEntry(long id, string sessionId, string requestId, string clientRequestId, DateTimeOffset receivedDateTime, AuditRequestInfo request, AuditLivenessResponseInfo response, string digest) - { - Argument.AssertNotNull(sessionId, nameof(sessionId)); - Argument.AssertNotNull(requestId, nameof(requestId)); - Argument.AssertNotNull(clientRequestId, nameof(clientRequestId)); - Argument.AssertNotNull(request, nameof(request)); - Argument.AssertNotNull(response, nameof(response)); - Argument.AssertNotNull(digest, nameof(digest)); - - Id = id; - SessionId = sessionId; - RequestId = requestId; - ClientRequestId = clientRequestId; - ReceivedDateTime = receivedDateTime; - Request = request; - Response = response; - Digest = digest; - } - - /// 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. - /// Keeps track of any properties unknown to the library. - internal LivenessSessionAuditEntry(long id, string sessionId, string requestId, string clientRequestId, DateTimeOffset receivedDateTime, AuditRequestInfo request, AuditLivenessResponseInfo response, string digest, string sessionImageId, string verifyImageHash, IDictionary serializedAdditionalRawData) - { - Id = id; - SessionId = sessionId; - RequestId = requestId; - ClientRequestId = clientRequestId; - ReceivedDateTime = receivedDateTime; - Request = request; - Response = response; - Digest = digest; - SessionImageId = sessionImageId; - VerifyImageHash = verifyImageHash; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal LivenessSessionAuditEntry() - { - } - - /// 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. - public long Id { get; } - /// 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. - public string SessionId { get; } - /// The unique requestId that is returned by the service to the client in the 'apim-request-id' header. - public string RequestId { get; } - /// The unique clientRequestId that is sent by the client in the 'client-request-id' header. - public string ClientRequestId { get; } - /// The UTC DateTime that the request was received. - public DateTimeOffset ReceivedDateTime { get; } - /// The request of this entry. - public AuditRequestInfo Request { get; } - /// The response of this entry. - public AuditLivenessResponseInfo Response { get; } - /// 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. - public string Digest { get; } - /// The image ID of the session request. - public string SessionImageId { get; } - /// The sha256 hash of the verify-image in the request. - public string VerifyImageHash { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.Serialization.cs deleted file mode 100644 index 36ce29345e30..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.Serialization.cs +++ /dev/null @@ -1,209 +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 LivenessSessionItem : 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(LivenessSessionItem)} does not support writing '{format}' format."); - } - - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - writer.WritePropertyName("createdDateTime"u8); - writer.WriteStringValue(CreatedDateTime, "O"); - if (Optional.IsDefined(SessionStartDateTime)) - { - writer.WritePropertyName("sessionStartDateTime"u8); - writer.WriteStringValue(SessionStartDateTime.Value, "O"); - } - writer.WritePropertyName("sessionExpired"u8); - writer.WriteBooleanValue(SessionExpired); - if (Optional.IsDefined(DeviceCorrelationId)) - { - writer.WritePropertyName("deviceCorrelationId"u8); - writer.WriteStringValue(DeviceCorrelationId); - } - if (Optional.IsDefined(AuthTokenTimeToLiveInSeconds)) - { - writer.WritePropertyName("authTokenTimeToLiveInSeconds"u8); - writer.WriteNumberValue(AuthTokenTimeToLiveInSeconds.Value); - } - 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 - } - } - } - - LivenessSessionItem 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(LivenessSessionItem)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLivenessSessionItem(document.RootElement, options); - } - - internal static LivenessSessionItem DeserializeLivenessSessionItem(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - DateTimeOffset createdDateTime = default; - DateTimeOffset? sessionStartDateTime = default; - bool sessionExpired = default; - string deviceCorrelationId = default; - int? authTokenTimeToLiveInSeconds = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("createdDateTime"u8)) - { - createdDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("sessionStartDateTime"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sessionStartDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("sessionExpired"u8)) - { - sessionExpired = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("deviceCorrelationId"u8)) - { - deviceCorrelationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("authTokenTimeToLiveInSeconds"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - authTokenTimeToLiveInSeconds = property.Value.GetInt32(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new LivenessSessionItem( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, - 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, AzureAIVisionFaceContext.Default); - default: - throw new FormatException($"The model {nameof(LivenessSessionItem)} does not support writing '{options.Format}' format."); - } - } - - LivenessSessionItem 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 DeserializeLivenessSessionItem(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(LivenessSessionItem)} 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 LivenessSessionItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessSessionItem(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/LivenessSessionItem.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.cs deleted file mode 100644 index e46e4901a8a1..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.cs +++ /dev/null @@ -1,94 +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 -{ - /// Session data returned for enumeration. - public partial class LivenessSessionItem - { - /// - /// 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 . - /// DateTime when this session was created. - /// Whether or not the session is expired. - internal LivenessSessionItem(DateTimeOffset createdDateTime, bool sessionExpired) - { - CreatedDateTime = createdDateTime; - SessionExpired = sessionExpired; - } - - /// 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. - /// Keeps track of any properties unknown to the library. - internal LivenessSessionItem(string id, DateTimeOffset createdDateTime, DateTimeOffset? sessionStartDateTime, bool sessionExpired, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, IDictionary serializedAdditionalRawData) - { - Id = id; - CreatedDateTime = createdDateTime; - SessionStartDateTime = sessionStartDateTime; - SessionExpired = sessionExpired; - DeviceCorrelationId = deviceCorrelationId; - AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal LivenessSessionItem() - { - } - - /// The unique ID to reference this session. - public string Id { get; } - /// DateTime when this session was created. - public DateTimeOffset CreatedDateTime { get; } - /// DateTime when this session was started by the client. - public DateTimeOffset? SessionStartDateTime { get; } - /// Whether or not the session is expired. - public bool SessionExpired { 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; } - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - public int? AuthTokenTimeToLiveInSeconds { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.Serialization.cs new file mode 100644 index 000000000000..cfdc2b8e8211 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.Serialization.cs @@ -0,0 +1,152 @@ +// 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 LivenessSessionResults : 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(LivenessSessionResults)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("attempts"u8); + writer.WriteStartArray(); + foreach (var item in Attempts) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + 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 + } + } + } + + LivenessSessionResults 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(LivenessSessionResults)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLivenessSessionResults(document.RootElement, options); + } + + internal static LivenessSessionResults DeserializeLivenessSessionResults(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList attempts = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("attempts"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LivenessSessionAttempt.DeserializeLivenessSessionAttempt(item, options)); + } + attempts = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LivenessSessionResults(attempts, 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, AzureAIVisionFaceContext.Default); + default: + throw new FormatException($"The model {nameof(LivenessSessionResults)} does not support writing '{options.Format}' format."); + } + } + + LivenessSessionResults 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 DeserializeLivenessSessionResults(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LivenessSessionResults)} 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 LivenessSessionResults FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessSessionResults(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/LivenessSessionResults.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.cs new file mode 100644 index 000000000000..1a3686a45577 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.cs @@ -0,0 +1,76 @@ +// 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 results of the liveness session. + public partial class LivenessSessionResults + { + /// + /// 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 attempts data of underlying liveness call with the session. + /// is null. + internal LivenessSessionResults(IEnumerable attempts) + { + Argument.AssertNotNull(attempts, nameof(attempts)); + + Attempts = attempts.ToList(); + } + + /// Initializes a new instance of . + /// The attempts data of underlying liveness call with the session. + /// Keeps track of any properties unknown to the library. + internal LivenessSessionResults(IReadOnlyList attempts, IDictionary serializedAdditionalRawData) + { + Attempts = attempts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessSessionResults() + { + } + + /// The attempts data of underlying liveness call with the session. + public IReadOnlyList Attempts { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.Serialization.cs index da40bfa7cee2..7ab2d358da9e 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.Serialization.cs @@ -34,8 +34,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(LivenessWithVerifyOutputs)} does not support writing '{format}' format."); } - writer.WritePropertyName("verifyImage"u8); - writer.WriteObjectValue(VerifyImage, options); writer.WritePropertyName("matchConfidence"u8); writer.WriteNumberValue(MatchConfidence); writer.WritePropertyName("isIdentical"u8); @@ -77,18 +75,12 @@ internal static LivenessWithVerifyOutputs DeserializeLivenessWithVerifyOutputs(J { return null; } - LivenessWithVerifyImage verifyImage = default; float matchConfidence = default; bool isIdentical = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("verifyImage"u8)) - { - verifyImage = LivenessWithVerifyImage.DeserializeLivenessWithVerifyImage(property.Value, options); - continue; - } if (property.NameEquals("matchConfidence"u8)) { matchConfidence = property.Value.GetSingle(); @@ -105,7 +97,7 @@ internal static LivenessWithVerifyOutputs DeserializeLivenessWithVerifyOutputs(J } } serializedAdditionalRawData = rawDataDictionary; - return new LivenessWithVerifyOutputs(verifyImage, matchConfidence, isIdentical, serializedAdditionalRawData); + return new LivenessWithVerifyOutputs(matchConfidence, isIdentical, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.cs index 45c6d6405b7f..3abf91ab403f 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.cs @@ -46,27 +46,20 @@ public partial class LivenessWithVerifyOutputs private IDictionary _serializedAdditionalRawData; /// 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. - /// is null. - internal LivenessWithVerifyOutputs(LivenessWithVerifyImage verifyImage, float matchConfidence, bool isIdentical) + internal LivenessWithVerifyOutputs(float matchConfidence, bool isIdentical) { - Argument.AssertNotNull(verifyImage, nameof(verifyImage)); - - VerifyImage = verifyImage; MatchConfidence = matchConfidence; IsIdentical = isIdentical; } /// 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. /// Keeps track of any properties unknown to the library. - internal LivenessWithVerifyOutputs(LivenessWithVerifyImage verifyImage, float matchConfidence, bool isIdentical, IDictionary serializedAdditionalRawData) + internal LivenessWithVerifyOutputs(float matchConfidence, bool isIdentical, IDictionary serializedAdditionalRawData) { - VerifyImage = verifyImage; MatchConfidence = matchConfidence; IsIdentical = isIdentical; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -77,8 +70,6 @@ internal LivenessWithVerifyOutputs() { } - /// The detail of face for verification. - public LivenessWithVerifyImage VerifyImage { get; } /// The target face liveness face and comparison image face verification confidence. public float MatchConfidence { get; } /// Whether the target liveness face and comparison image face match. diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.Serialization.cs similarity index 65% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.Serialization.cs index 35f8e8781aab..ba36b564c7cd 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class LivenessWithVerifyImage : IUtf8JsonSerializable, IJsonModel + public partial class LivenessWithVerifyReference : 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,12 +28,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// 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(LivenessWithVerifyImage)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyReference)} does not support writing '{format}' format."); } + writer.WritePropertyName("referenceType"u8); + writer.WriteStringValue(ReferenceType.ToString()); writer.WritePropertyName("faceRectangle"u8); writer.WriteObjectValue(FaceRectangle, options); writer.WritePropertyName("qualityForRecognition"u8); @@ -55,19 +57,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LivenessWithVerifyImage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessWithVerifyReference 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(LivenessWithVerifyImage)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyReference)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLivenessWithVerifyImage(document.RootElement, options); + return DeserializeLivenessWithVerifyReference(document.RootElement, options); } - internal static LivenessWithVerifyImage DeserializeLivenessWithVerifyImage(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessWithVerifyReference DeserializeLivenessWithVerifyReference(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -75,12 +77,18 @@ internal static LivenessWithVerifyImage DeserializeLivenessWithVerifyImage(JsonE { return null; } + FaceImageType referenceType = default; FaceRectangle faceRectangle = default; QualityForRecognition qualityForRecognition = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("referenceType"u8)) + { + referenceType = new FaceImageType(property.Value.GetString()); + continue; + } if (property.NameEquals("faceRectangle"u8)) { faceRectangle = FaceRectangle.DeserializeFaceRectangle(property.Value, options); @@ -97,46 +105,46 @@ internal static LivenessWithVerifyImage DeserializeLivenessWithVerifyImage(JsonE } } serializedAdditionalRawData = rawDataDictionary; - return new LivenessWithVerifyImage(faceRectangle, qualityForRecognition, serializedAdditionalRawData); + return new LivenessWithVerifyReference(referenceType, faceRectangle, qualityForRecognition, 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, AzureAIVisionFaceContext.Default); default: - throw new FormatException($"The model {nameof(LivenessWithVerifyImage)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyReference)} does not support writing '{options.Format}' format."); } } - LivenessWithVerifyImage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessWithVerifyReference 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 DeserializeLivenessWithVerifyImage(document.RootElement, options); + return DeserializeLivenessWithVerifyReference(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(LivenessWithVerifyImage)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyReference)} 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 LivenessWithVerifyImage FromResponse(Response response) + internal static LivenessWithVerifyReference FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessWithVerifyImage(document.RootElement); + return DeserializeLivenessWithVerifyReference(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.cs similarity index 73% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.cs index 2cb09a6725ef..fe5f68bc902c 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.cs @@ -11,7 +11,7 @@ namespace Azure.AI.Vision.Face { /// The detail of face for verification. - public partial class LivenessWithVerifyImage + public partial class LivenessWithVerifyReference { /// /// Keeps track of any properties unknown to the library. @@ -45,34 +45,40 @@ public partial class LivenessWithVerifyImage /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// 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. /// is null. - internal LivenessWithVerifyImage(FaceRectangle faceRectangle, QualityForRecognition qualityForRecognition) + internal LivenessWithVerifyReference(FaceImageType referenceType, FaceRectangle faceRectangle, QualityForRecognition qualityForRecognition) { Argument.AssertNotNull(faceRectangle, nameof(faceRectangle)); + ReferenceType = referenceType; FaceRectangle = faceRectangle; QualityForRecognition = qualityForRecognition; } - /// Initializes a new instance of . + /// 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. /// Keeps track of any properties unknown to the library. - internal LivenessWithVerifyImage(FaceRectangle faceRectangle, QualityForRecognition qualityForRecognition, IDictionary serializedAdditionalRawData) + internal LivenessWithVerifyReference(FaceImageType referenceType, FaceRectangle faceRectangle, QualityForRecognition qualityForRecognition, IDictionary serializedAdditionalRawData) { + ReferenceType = referenceType; FaceRectangle = faceRectangle; QualityForRecognition = qualityForRecognition; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal LivenessWithVerifyImage() + /// Initializes a new instance of for deserialization. + internal LivenessWithVerifyReference() { } + /// The image type which contains the face rectangle where the liveness classification was made on. + public FaceImageType ReferenceType { get; } /// The face region where the comparison image's classification was made. public FaceRectangle FaceRectangle { get; } /// Quality of face image for recognition. diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.Serialization.cs similarity index 55% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.Serialization.cs index b92c7c7e749b..a35ccf197e0a 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class LivenessSessionAuditEntry : IUtf8JsonSerializable, IJsonModel + public partial class LivenessWithVerifyResult : 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,26 +28,19 @@ 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(LivenessSessionAuditEntry)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("id"u8); - writer.WriteNumberValue(Id); - writer.WritePropertyName("sessionId"u8); - writer.WriteStringValue(SessionId); - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - writer.WritePropertyName("receivedDateTime"u8); - writer.WriteStringValue(ReceivedDateTime, "O"); - writer.WritePropertyName("request"u8); - writer.WriteObjectValue(Request, options); - writer.WritePropertyName("response"u8); - writer.WriteObjectValue(Response, options); + if (Optional.IsDefined(LivenessDecision)) + { + writer.WritePropertyName("livenessDecision"u8); + writer.WriteStringValue(LivenessDecision.Value.ToString()); + } + writer.WritePropertyName("targets"u8); + writer.WriteObjectValue(Targets, options); writer.WritePropertyName("digest"u8); writer.WriteStringValue(Digest); if (Optional.IsDefined(SessionImageId)) @@ -55,6 +48,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("sessionImageId"u8); writer.WriteStringValue(SessionImageId); } + if (Optional.IsDefined(VerifyResult)) + { + writer.WritePropertyName("verifyResult"u8); + writer.WriteObjectValue(VerifyResult, options); + } if (Optional.IsDefined(VerifyImageHash)) { writer.WritePropertyName("verifyImageHash"u8); @@ -77,19 +75,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LivenessSessionAuditEntry IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessWithVerifyResult 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(LivenessSessionAuditEntry)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLivenessSessionAuditEntry(document.RootElement, options); + return DeserializeLivenessWithVerifyResult(document.RootElement, options); } - internal static LivenessSessionAuditEntry DeserializeLivenessSessionAuditEntry(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessWithVerifyResult DeserializeLivenessWithVerifyResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -97,53 +95,28 @@ internal static LivenessSessionAuditEntry DeserializeLivenessSessionAuditEntry(J { return null; } - long id = default; - string sessionId = default; - string requestId = default; - string clientRequestId = default; - DateTimeOffset receivedDateTime = default; - AuditRequestInfo request = default; - AuditLivenessResponseInfo response = default; + FaceLivenessDecision? livenessDecision = default; + LivenessDecisionTargets targets = default; string digest = default; string sessionImageId = default; + LivenessWithVerifyOutputs verifyResult = default; string verifyImageHash = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("sessionId"u8)) - { - sessionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) + if (property.NameEquals("livenessDecision"u8)) { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("receivedDateTime"u8)) - { - receivedDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("request"u8)) - { - request = AuditRequestInfo.DeserializeAuditRequestInfo(property.Value, options); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + livenessDecision = new FaceLivenessDecision(property.Value.GetString()); continue; } - if (property.NameEquals("response"u8)) + if (property.NameEquals("targets"u8)) { - response = AuditLivenessResponseInfo.DeserializeAuditLivenessResponseInfo(property.Value, options); + targets = LivenessDecisionTargets.DeserializeLivenessDecisionTargets(property.Value, options); continue; } if (property.NameEquals("digest"u8)) @@ -156,6 +129,15 @@ internal static LivenessSessionAuditEntry DeserializeLivenessSessionAuditEntry(J sessionImageId = property.Value.GetString(); continue; } + if (property.NameEquals("verifyResult"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + verifyResult = LivenessWithVerifyOutputs.DeserializeLivenessWithVerifyOutputs(property.Value, options); + continue; + } if (property.NameEquals("verifyImageHash"u8)) { verifyImageHash = property.Value.GetString(); @@ -167,57 +149,53 @@ internal static LivenessSessionAuditEntry DeserializeLivenessSessionAuditEntry(J } } serializedAdditionalRawData = rawDataDictionary; - return new LivenessSessionAuditEntry( - id, - sessionId, - requestId, - clientRequestId, - receivedDateTime, - request, - response, + return new LivenessWithVerifyResult( + livenessDecision, + targets, digest, sessionImageId, + verifyResult, verifyImageHash, 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, AzureAIVisionFaceContext.Default); default: - throw new FormatException($"The model {nameof(LivenessSessionAuditEntry)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyResult)} does not support writing '{options.Format}' format."); } } - LivenessSessionAuditEntry IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessWithVerifyResult 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 DeserializeLivenessSessionAuditEntry(document.RootElement, options); + return DeserializeLivenessWithVerifyResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(LivenessSessionAuditEntry)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyResult)} 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 LivenessSessionAuditEntry FromResponse(Response response) + internal static LivenessWithVerifyResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessSessionAuditEntry(document.RootElement); + return DeserializeLivenessWithVerifyResult(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.cs new file mode 100644 index 000000000000..730d5cac8f3c --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.cs @@ -0,0 +1,98 @@ +// 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 results of the liveness with verify call. + public partial class LivenessWithVerifyResult + { + /// + /// 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 . + /// 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. + /// or is null. + internal LivenessWithVerifyResult(LivenessDecisionTargets targets, string digest) + { + Argument.AssertNotNull(targets, nameof(targets)); + Argument.AssertNotNull(digest, nameof(digest)); + + Targets = targets; + Digest = digest; + } + + /// 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. + /// Keeps track of any properties unknown to the library. + internal LivenessWithVerifyResult(FaceLivenessDecision? livenessDecision, LivenessDecisionTargets targets, string digest, string sessionImageId, LivenessWithVerifyOutputs verifyResult, string verifyImageHash, IDictionary serializedAdditionalRawData) + { + LivenessDecision = livenessDecision; + Targets = targets; + Digest = digest; + SessionImageId = sessionImageId; + VerifyResult = verifyResult; + VerifyImageHash = verifyImageHash; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessWithVerifyResult() + { + } + + /// The liveness classification for the target face. + public FaceLivenessDecision? LivenessDecision { get; } + /// Targets used for liveness classification. + public LivenessDecisionTargets Targets { get; } + /// 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. + public string Digest { get; } + /// The image ID of the session request. + public string SessionImageId { get; } + /// The face verification output. Only available when the request is liveness with verify. + public LivenessWithVerifyOutputs VerifyResult { get; } + /// The sha256 hash of the verify-image in the request. + public string VerifyImageHash { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.Serialization.cs index 3c806bcb364e..fa63d17d6055 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.Serialization.cs @@ -36,35 +36,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W") { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - writer.WritePropertyName("createdDateTime"u8); - writer.WriteStringValue(CreatedDateTime, "O"); - if (Optional.IsDefined(SessionStartDateTime)) - { - writer.WritePropertyName("sessionStartDateTime"u8); - writer.WriteStringValue(SessionStartDateTime.Value, "O"); - } - writer.WritePropertyName("sessionExpired"u8); - writer.WriteBooleanValue(SessionExpired); - if (Optional.IsDefined(DeviceCorrelationId)) - { - writer.WritePropertyName("deviceCorrelationId"u8); - writer.WriteStringValue(DeviceCorrelationId); - } - if (Optional.IsDefined(AuthTokenTimeToLiveInSeconds)) - { - writer.WritePropertyName("authTokenTimeToLiveInSeconds"u8); - writer.WriteNumberValue(AuthTokenTimeToLiveInSeconds.Value); + writer.WritePropertyName("sessionId"u8); + writer.WriteStringValue(SessionId); } + writer.WritePropertyName("authToken"u8); + writer.WriteStringValue(AuthToken); writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.ToString()); - if (Optional.IsDefined(Result)) + if (Optional.IsDefined(ModelVersion)) { - writer.WritePropertyName("result"u8); - writer.WriteObjectValue(Result, options); + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion.Value.ToString()); } + writer.WritePropertyName("isAbuseMonitoringEnabled"u8); + writer.WriteBooleanValue(IsAbuseMonitoringEnabled); + if (Optional.IsDefined(ExpectedClientIpAddress)) + { + writer.WritePropertyName("expectedClientIpAddress"u8); + writer.WriteStringValue(ExpectedClientIpAddress); + } + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -102,68 +94,58 @@ internal static LivenessWithVerifySession DeserializeLivenessWithVerifySession(J { return null; } - string id = default; - DateTimeOffset createdDateTime = default; - DateTimeOffset? sessionStartDateTime = default; - bool sessionExpired = default; - string deviceCorrelationId = default; - int? authTokenTimeToLiveInSeconds = default; - FaceSessionStatus status = default; - LivenessSessionAuditEntry result = default; + string sessionId = default; + string authToken = default; + OperationState status = default; + LivenessModel? modelVersion = default; + bool isAbuseMonitoringEnabled = default; + string expectedClientIpAddress = default; + LivenessWithVerifySessionResults results = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (property.NameEquals("sessionId"u8)) + { + sessionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("authToken"u8)) { - id = property.Value.GetString(); + authToken = property.Value.GetString(); continue; } - if (property.NameEquals("createdDateTime"u8)) + if (property.NameEquals("status"u8)) { - createdDateTime = property.Value.GetDateTimeOffset("O"); + status = new OperationState(property.Value.GetString()); continue; } - if (property.NameEquals("sessionStartDateTime"u8)) + if (property.NameEquals("modelVersion"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sessionStartDateTime = property.Value.GetDateTimeOffset("O"); + modelVersion = new LivenessModel(property.Value.GetString()); continue; } - if (property.NameEquals("sessionExpired"u8)) - { - sessionExpired = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("deviceCorrelationId"u8)) - { - deviceCorrelationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("authTokenTimeToLiveInSeconds"u8)) + if (property.NameEquals("isAbuseMonitoringEnabled"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - authTokenTimeToLiveInSeconds = property.Value.GetInt32(); + isAbuseMonitoringEnabled = property.Value.GetBoolean(); continue; } - if (property.NameEquals("status"u8)) + if (property.NameEquals("expectedClientIpAddress"u8)) { - status = new FaceSessionStatus(property.Value.GetString()); + expectedClientIpAddress = property.Value.GetString(); continue; } - if (property.NameEquals("result"u8)) + if (property.NameEquals("results"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - result = LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(property.Value, options); + results = LivenessWithVerifySessionResults.DeserializeLivenessWithVerifySessionResults(property.Value, options); continue; } if (options.Format != "W") @@ -173,14 +155,13 @@ internal static LivenessWithVerifySession DeserializeLivenessWithVerifySession(J } serializedAdditionalRawData = rawDataDictionary; return new LivenessWithVerifySession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + isAbuseMonitoringEnabled, + expectedClientIpAddress, + results, serializedAdditionalRawData); } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.cs index 9aaec1db8d47..d9ccff45e41a 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.cs @@ -46,36 +46,38 @@ public partial class LivenessWithVerifySession private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// DateTime when this session was created. - /// Whether or not the session is expired. + /// 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. - internal LivenessWithVerifySession(DateTimeOffset createdDateTime, bool sessionExpired, FaceSessionStatus status) + /// The results of the liveness with verify session. + /// or is null. + internal LivenessWithVerifySession(string authToken, OperationState status, LivenessWithVerifySessionResults results) { - CreatedDateTime = createdDateTime; - SessionExpired = sessionExpired; + Argument.AssertNotNull(authToken, nameof(authToken)); + Argument.AssertNotNull(results, nameof(results)); + + AuthToken = authToken; Status = status; + Results = results; } /// 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 expected IP address or CIDR block of the client that runs the liveness check. + /// The results of the liveness with verify session. /// Keeps track of any properties unknown to the library. - internal LivenessWithVerifySession(string id, DateTimeOffset createdDateTime, DateTimeOffset? sessionStartDateTime, bool sessionExpired, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, FaceSessionStatus status, LivenessSessionAuditEntry result, IDictionary serializedAdditionalRawData) + internal LivenessWithVerifySession(string sessionId, string authToken, OperationState status, LivenessModel? modelVersion, bool isAbuseMonitoringEnabled, string expectedClientIpAddress, LivenessWithVerifySessionResults results, IDictionary serializedAdditionalRawData) { - Id = id; - CreatedDateTime = createdDateTime; - SessionStartDateTime = sessionStartDateTime; - SessionExpired = sessionExpired; - DeviceCorrelationId = deviceCorrelationId; - AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; + SessionId = sessionId; + AuthToken = authToken; Status = status; - Result = result; + ModelVersion = modelVersion; + IsAbuseMonitoringEnabled = isAbuseMonitoringEnabled; + ExpectedClientIpAddress = expectedClientIpAddress; + Results = results; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -85,20 +87,16 @@ internal LivenessWithVerifySession() } /// The unique ID to reference this session. - public string Id { get; } - /// DateTime when this session was created. - public DateTimeOffset CreatedDateTime { get; } - /// DateTime when this session was started by the client. - public DateTimeOffset? SessionStartDateTime { get; } - /// Whether or not the session is expired. - public bool SessionExpired { 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; } - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - public int? AuthTokenTimeToLiveInSeconds { get; } + 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 current status of the session. - public FaceSessionStatus Status { get; } - /// The latest session audit result only populated if status == 'ResultAvailable'. - public LivenessSessionAuditEntry Result { get; } + public OperationState Status { get; } + /// 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? ModelVersion { get; } + /// The expected IP address or CIDR block of the client that runs the liveness check. + public string ExpectedClientIpAddress { get; } + /// The results of the liveness with verify session. + public LivenessWithVerifySessionResults Results { get; } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.Serialization.cs new file mode 100644 index 000000000000..242303933ff2 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.Serialization.cs @@ -0,0 +1,227 @@ +// 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 LivenessWithVerifySessionAttempt : 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(LivenessWithVerifySessionAttempt)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("attemptId"u8); + writer.WriteNumberValue(AttemptId); + writer.WritePropertyName("attemptStatus"u8); + writer.WriteStringValue(AttemptStatus.ToString()); + if (Optional.IsDefined(Result)) + { + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error, options); + } + if (Optional.IsCollectionDefined(ClientInformation)) + { + writer.WritePropertyName("clientInformation"u8); + writer.WriteStartArray(); + foreach (var item in ClientInformation) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(AbuseMonitoringResult)) + { + writer.WritePropertyName("abuseMonitoringResult"u8); + writer.WriteObjectValue(AbuseMonitoringResult, 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 + } + } + } + + LivenessWithVerifySessionAttempt 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(LivenessWithVerifySessionAttempt)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLivenessWithVerifySessionAttempt(document.RootElement, options); + } + + internal static LivenessWithVerifySessionAttempt DeserializeLivenessWithVerifySessionAttempt(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int attemptId = default; + OperationState attemptStatus = default; + LivenessWithVerifyResult result = default; + LivenessError error = default; + IReadOnlyList clientInformation = default; + AbuseMonitoringResult abuseMonitoringResult = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("attemptId"u8)) + { + attemptId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("attemptStatus"u8)) + { + attemptStatus = new OperationState(property.Value.GetString()); + continue; + } + if (property.NameEquals("result"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + result = LivenessWithVerifyResult.DeserializeLivenessWithVerifyResult(property.Value, options); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = LivenessError.DeserializeLivenessError(property.Value, options); + continue; + } + if (property.NameEquals("clientInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Face.ClientInformation.DeserializeClientInformation(item, options)); + } + clientInformation = array; + continue; + } + if (property.NameEquals("abuseMonitoringResult"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + abuseMonitoringResult = AbuseMonitoringResult.DeserializeAbuseMonitoringResult(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LivenessWithVerifySessionAttempt( + attemptId, + attemptStatus, + result, + error, + clientInformation ?? new ChangeTrackingList(), + abuseMonitoringResult, + 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, AzureAIVisionFaceContext.Default); + default: + throw new FormatException($"The model {nameof(LivenessWithVerifySessionAttempt)} does not support writing '{options.Format}' format."); + } + } + + LivenessWithVerifySessionAttempt 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 DeserializeLivenessWithVerifySessionAttempt(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LivenessWithVerifySessionAttempt)} 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 LivenessWithVerifySessionAttempt FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessWithVerifySessionAttempt(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/LivenessWithVerifySessionAttempt.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.cs new file mode 100644 index 000000000000..f071e8bf131c --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.cs @@ -0,0 +1,95 @@ +// 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 liveness with verify session attempt. + public partial class LivenessWithVerifySessionAttempt + { + /// + /// 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 attempt ID, start from 1. + /// The status of the attempt. + internal LivenessWithVerifySessionAttempt(int attemptId, OperationState attemptStatus) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + ClientInformation = new ChangeTrackingList(); + } + + /// 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. + /// Keeps track of any properties unknown to the library. + internal LivenessWithVerifySessionAttempt(int attemptId, OperationState attemptStatus, LivenessWithVerifyResult result, LivenessError error, IReadOnlyList clientInformation, AbuseMonitoringResult abuseMonitoringResult, IDictionary serializedAdditionalRawData) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + Result = result; + Error = error; + ClientInformation = clientInformation; + AbuseMonitoringResult = abuseMonitoringResult; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessWithVerifySessionAttempt() + { + } + + /// The attempt ID, start from 1. + public int AttemptId { get; } + /// The status of the attempt. + public OperationState AttemptStatus { get; } + /// The result of the liveness with verify call, will be null if there is error. + public LivenessWithVerifyResult Result { get; } + /// The error of the liveness with verify call, will be null if there is result. + public LivenessError Error { get; } + /// The client information gathered during the liveness attempt. + public IReadOnlyList ClientInformation { get; } + /// The abuse monitoring result for the liveness attempt. + public AbuseMonitoringResult AbuseMonitoringResult { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.Serialization.cs new file mode 100644 index 000000000000..c491ec5e81e2 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.Serialization.cs @@ -0,0 +1,170 @@ +// 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 LivenessWithVerifySessionResults : 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(LivenessWithVerifySessionResults)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("verifyReferences"u8); + writer.WriteStartArray(); + foreach (var item in VerifyReferences) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("attempts"u8); + writer.WriteStartArray(); + foreach (var item in Attempts) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + 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 + } + } + } + + LivenessWithVerifySessionResults 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(LivenessWithVerifySessionResults)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLivenessWithVerifySessionResults(document.RootElement, options); + } + + internal static LivenessWithVerifySessionResults DeserializeLivenessWithVerifySessionResults(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList verifyReferences = default; + IReadOnlyList attempts = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("verifyReferences"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LivenessWithVerifyReference.DeserializeLivenessWithVerifyReference(item, options)); + } + verifyReferences = array; + continue; + } + if (property.NameEquals("attempts"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LivenessWithVerifySessionAttempt.DeserializeLivenessWithVerifySessionAttempt(item, options)); + } + attempts = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LivenessWithVerifySessionResults(verifyReferences, attempts, 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, AzureAIVisionFaceContext.Default); + default: + throw new FormatException($"The model {nameof(LivenessWithVerifySessionResults)} does not support writing '{options.Format}' format."); + } + } + + LivenessWithVerifySessionResults 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 DeserializeLivenessWithVerifySessionResults(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LivenessWithVerifySessionResults)} 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 LivenessWithVerifySessionResults FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessWithVerifySessionResults(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/LivenessWithVerifySessionResults.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.cs new file mode 100644 index 000000000000..570a83f964c2 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.cs @@ -0,0 +1,83 @@ +// 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 results of the liveness with verify session. + public partial class LivenessWithVerifySessionResults + { + /// + /// 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 references used for face verification. + /// The attempts data of underlying liveness with verify call with the session. + /// or is null. + internal LivenessWithVerifySessionResults(IEnumerable verifyReferences, IEnumerable attempts) + { + Argument.AssertNotNull(verifyReferences, nameof(verifyReferences)); + Argument.AssertNotNull(attempts, nameof(attempts)); + + VerifyReferences = verifyReferences.ToList(); + Attempts = attempts.ToList(); + } + + /// Initializes a new instance of . + /// The references used for face verification. + /// The attempts data of underlying liveness with verify call with the session. + /// Keeps track of any properties unknown to the library. + internal LivenessWithVerifySessionResults(IReadOnlyList verifyReferences, IReadOnlyList attempts, IDictionary serializedAdditionalRawData) + { + VerifyReferences = verifyReferences; + Attempts = attempts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessWithVerifySessionResults() + { + } + + /// The references used for face verification. + public IReadOnlyList VerifyReferences { get; } + /// The attempts data of underlying liveness with verify call with the session. + public IReadOnlyList Attempts { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/Models/AzureAIVisionFaceContext.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/Models/AzureAIVisionFaceContext.cs index ee9c895bbaa3..2bc6152e861d 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/Models/AzureAIVisionFaceContext.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/Models/AzureAIVisionFaceContext.cs @@ -13,18 +13,15 @@ namespace Azure.AI.Vision.Face /// Context class which will be filled in by the System.ClientModel.SourceGeneration. /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' /// + [ModelReaderWriterBuildable(typeof(AbuseMonitoringResult))] [ModelReaderWriterBuildable(typeof(AccessoryItem))] [ModelReaderWriterBuildable(typeof(AddFaceFromUrlRequest1))] [ModelReaderWriterBuildable(typeof(AddFaceFromUrlRequest2))] [ModelReaderWriterBuildable(typeof(AddFaceResult))] - [ModelReaderWriterBuildable(typeof(AuditLivenessResponseInfo))] - [ModelReaderWriterBuildable(typeof(AuditRequestInfo))] [ModelReaderWriterBuildable(typeof(BlurProperties))] + [ModelReaderWriterBuildable(typeof(ClientInformation))] [ModelReaderWriterBuildable(typeof(CreateLivenessSessionContent))] - [ModelReaderWriterBuildable(typeof(CreateLivenessSessionResult))] [ModelReaderWriterBuildable(typeof(CreateLivenessWithVerifySessionContent))] - [ModelReaderWriterBuildable(typeof(CreateLivenessWithVerifySessionMultipartContent))] - [ModelReaderWriterBuildable(typeof(CreateLivenessWithVerifySessionResult))] [ModelReaderWriterBuildable(typeof(CreatePersonRequest))] [ModelReaderWriterBuildable(typeof(CreatePersonResult))] [ModelReaderWriterBuildable(typeof(CreateRequest))] @@ -56,17 +53,23 @@ namespace Azure.AI.Vision.Face [ModelReaderWriterBuildable(typeof(LargePersonGroup))] [ModelReaderWriterBuildable(typeof(LargePersonGroupPerson))] [ModelReaderWriterBuildable(typeof(LargePersonGroupPersonFace))] - [ModelReaderWriterBuildable(typeof(LivenessOutputsTarget))] - [ModelReaderWriterBuildable(typeof(LivenessResponseBody))] + [ModelReaderWriterBuildable(typeof(LivenessColorDecisionTarget))] + [ModelReaderWriterBuildable(typeof(LivenessDecisionTargets))] + [ModelReaderWriterBuildable(typeof(LivenessError))] + [ModelReaderWriterBuildable(typeof(LivenessResult))] [ModelReaderWriterBuildable(typeof(LivenessSession))] - [ModelReaderWriterBuildable(typeof(LivenessSessionAuditEntry))] - [ModelReaderWriterBuildable(typeof(LivenessSessionItem))] - [ModelReaderWriterBuildable(typeof(LivenessWithVerifyImage))] + [ModelReaderWriterBuildable(typeof(LivenessSessionAttempt))] + [ModelReaderWriterBuildable(typeof(LivenessSessionResults))] [ModelReaderWriterBuildable(typeof(LivenessWithVerifyOutputs))] + [ModelReaderWriterBuildable(typeof(LivenessWithVerifyReference))] + [ModelReaderWriterBuildable(typeof(LivenessWithVerifyResult))] [ModelReaderWriterBuildable(typeof(LivenessWithVerifySession))] + [ModelReaderWriterBuildable(typeof(LivenessWithVerifySessionAttempt))] + [ModelReaderWriterBuildable(typeof(LivenessWithVerifySessionResults))] [ModelReaderWriterBuildable(typeof(MaskProperties))] [ModelReaderWriterBuildable(typeof(NoiseProperties))] [ModelReaderWriterBuildable(typeof(OcclusionProperties))] + [ModelReaderWriterBuildable(typeof(OtherFlaggedSessions))] [ModelReaderWriterBuildable(typeof(VerifyFaceToFaceRequest))] [ModelReaderWriterBuildable(typeof(VerifyFromLargePersonGroupRequest))] public partial class AzureAIVisionFaceContext : ModelReaderWriterContext diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/OperationState.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/OperationState.cs new file mode 100644 index 000000000000..11c8033fba6a --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/OperationState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Vision.Face +{ + /// Enum describing allowed operation states. + public readonly partial struct OperationState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OperationState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotStartedValue = "NotStarted"; + private const string RunningValue = "Running"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// The operation has not started. + public static OperationState NotStarted { get; } = new OperationState(NotStartedValue); + /// The operation is in progress. + public static OperationState Running { get; } = new OperationState(RunningValue); + /// The operation has completed successfully. + public static OperationState Succeeded { get; } = new OperationState(SucceededValue); + /// The operation has failed. + public static OperationState Failed { get; } = new OperationState(FailedValue); + /// The operation has been canceled by the user. + public static OperationState Canceled { get; } = new OperationState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(OperationState left, OperationState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OperationState left, OperationState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OperationState(string value) => new OperationState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OperationState other && Equals(other); + /// + public bool Equals(OperationState 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/CreateLivenessWithVerifySessionResult.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/OtherFlaggedSessions.Serialization.cs similarity index 56% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/OtherFlaggedSessions.Serialization.cs index a16585cb02e0..f84269a48f41 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/OtherFlaggedSessions.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class CreateLivenessWithVerifySessionResult : IUtf8JsonSerializable, IJsonModel + public partial class OtherFlaggedSessions : 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,20 @@ void IJsonModel.Write(Utf8JsonWriter writ /// 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(CreateLivenessWithVerifySessionResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(OtherFlaggedSessions)} does not support writing '{format}' format."); } + writer.WritePropertyName("attemptId"u8); + writer.WriteNumberValue(AttemptId); writer.WritePropertyName("sessionId"u8); writer.WriteStringValue(SessionId); - writer.WritePropertyName("authToken"u8); - writer.WriteStringValue(AuthToken); - if (Optional.IsDefined(VerifyImage)) + if (Optional.IsDefined(SessionImageId)) { - writer.WritePropertyName("verifyImage"u8); - writer.WriteObjectValue(VerifyImage, options); + writer.WritePropertyName("sessionImageId"u8); + writer.WriteStringValue(SessionImageId); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -60,19 +60,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CreateLivenessWithVerifySessionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + OtherFlaggedSessions 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(CreateLivenessWithVerifySessionResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(OtherFlaggedSessions)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateLivenessWithVerifySessionResult(document.RootElement, options); + return DeserializeOtherFlaggedSessions(document.RootElement, options); } - internal static CreateLivenessWithVerifySessionResult DeserializeCreateLivenessWithVerifySessionResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static OtherFlaggedSessions DeserializeOtherFlaggedSessions(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -80,30 +80,26 @@ internal static CreateLivenessWithVerifySessionResult DeserializeCreateLivenessW { return null; } + int attemptId = default; string sessionId = default; - string authToken = default; - LivenessWithVerifyImage verifyImage = default; + string sessionImageId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sessionId"u8)) + if (property.NameEquals("attemptId"u8)) { - sessionId = property.Value.GetString(); + attemptId = property.Value.GetInt32(); continue; } - if (property.NameEquals("authToken"u8)) + if (property.NameEquals("sessionId"u8)) { - authToken = property.Value.GetString(); + sessionId = property.Value.GetString(); continue; } - if (property.NameEquals("verifyImage"u8)) + if (property.NameEquals("sessionImageId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - verifyImage = LivenessWithVerifyImage.DeserializeLivenessWithVerifyImage(property.Value, options); + sessionImageId = property.Value.GetString(); continue; } if (options.Format != "W") @@ -112,46 +108,46 @@ internal static CreateLivenessWithVerifySessionResult DeserializeCreateLivenessW } } serializedAdditionalRawData = rawDataDictionary; - return new CreateLivenessWithVerifySessionResult(sessionId, authToken, verifyImage, serializedAdditionalRawData); + return new OtherFlaggedSessions(attemptId, sessionId, sessionImageId, 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, AzureAIVisionFaceContext.Default); default: - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(OtherFlaggedSessions)} does not support writing '{options.Format}' format."); } } - CreateLivenessWithVerifySessionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + OtherFlaggedSessions 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 DeserializeCreateLivenessWithVerifySessionResult(document.RootElement, options); + return DeserializeOtherFlaggedSessions(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(OtherFlaggedSessions)} 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 CreateLivenessWithVerifySessionResult FromResponse(Response response) + internal static OtherFlaggedSessions FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateLivenessWithVerifySessionResult(document.RootElement); + return DeserializeOtherFlaggedSessions(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/OtherFlaggedSessions.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/OtherFlaggedSessions.cs new file mode 100644 index 000000000000..cd9641d93e30 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/OtherFlaggedSessions.cs @@ -0,0 +1,85 @@ +// 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 other sessions flagged as abuse based on the information gathered during this attempt. + public partial class OtherFlaggedSessions + { + /// + /// 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 attempt ID, start from 1. + /// The unique session ID of the flagged session. + /// is null. + internal OtherFlaggedSessions(int attemptId, string sessionId) + { + Argument.AssertNotNull(sessionId, nameof(sessionId)); + + AttemptId = attemptId; + SessionId = sessionId; + } + + /// 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. + /// Keeps track of any properties unknown to the library. + internal OtherFlaggedSessions(int attemptId, string sessionId, string sessionImageId, IDictionary serializedAdditionalRawData) + { + AttemptId = attemptId; + SessionId = sessionId; + SessionImageId = sessionImageId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OtherFlaggedSessions() + { + } + + /// The attempt ID, start from 1. + public int AttemptId { get; } + /// The unique session ID of the flagged session. + public string SessionId { get; } + /// The image ID from the flagged session. + public string SessionImageId { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/tests/FaceSessionClient/FaceSessionClientTests.cs b/sdk/face/Azure.AI.Vision.Face/tests/FaceSessionClient/FaceSessionClientTests.cs index 49c92be1ef92..78c51d118fdd 100644 --- a/sdk/face/Azure.AI.Vision.Face/tests/FaceSessionClient/FaceSessionClientTests.cs +++ b/sdk/face/Azure.AI.Vision.Face/tests/FaceSessionClient/FaceSessionClientTests.cs @@ -1,15 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Threading.Tasks; -using Azure.AI.Vision.Face; -using Azure.AI.Vision.Face.Tests; using Azure.Core.TestFramework; -using Azure.Core.Tests.TestFramework; using NUnit.Framework; namespace Azure.AI.Vision.Face.Tests @@ -23,6 +18,7 @@ internal enum SessionType { // Pre-generated random device correlation id private const string DeviceCorrelationId = "11902120-3636-1876-4916-073bdc0f9b12"; + private const string UserCorrelationId = "eab3f6b7-baab-4a72-abee-d76eba620f6c"; private List<(SessionType, string)> _createdSessions = new(); public FaceSessionClientTests(bool isAsync) : base(isAsync) { @@ -70,40 +66,58 @@ protected async Task Cleanup() _createdSessions.Clear(); } - protected void AssertAuditEntry(LivenessSessionAuditEntry auditEntry, string sessionId) + protected void AssertLivenessWithVerifySessionResults(LivenessWithVerifySessionResults results, string sessionId) { - Assert.IsNotNull(auditEntry.Id); - Assert.IsNotNull(auditEntry.RequestId); - Assert.IsNotNull(auditEntry.ReceivedDateTime); - Assert.IsNotNull(auditEntry.Digest); - Assert.AreEqual(auditEntry.SessionId, sessionId); - - Assert.IsNotNull(auditEntry.Request.Url); - Assert.IsNotNull(auditEntry.Request.Method); - Assert.IsNotNull(auditEntry.Request.ContentLength); - Assert.IsNotNull(auditEntry.Request.ContentType); - - Assert.IsNotNull(auditEntry.Response.StatusCode); - Assert.IsNotNull(auditEntry.Response.LatencyInMilliseconds); - - Assert.IsNotNull(auditEntry.Response.Body.LivenessDecision); - Assert.IsNotNull(auditEntry.Response.Body.Target.FaceRectangle.Top); - Assert.IsNotNull(auditEntry.Response.Body.Target.FaceRectangle.Left); - Assert.IsNotNull(auditEntry.Response.Body.Target.FaceRectangle.Width); - Assert.IsNotNull(auditEntry.Response.Body.Target.FaceRectangle.Height); - Assert.IsNotNull(auditEntry.Response.Body.Target.FileName); - Assert.IsNotNull(auditEntry.Response.Body.Target.TimeOffsetWithinFile); - Assert.IsNotNull(auditEntry.Response.Body.Target.ImageType); + // Assert that we have attempts + Assert.IsNotNull(results.Attempts); + Assert.IsTrue(results.Attempts.Count > 0, "Expected at least one attempt in the session results"); + + // Get the first attempt + var firstAttempt = results.Attempts[0]; + Assert.IsNotNull(firstAttempt); + Assert.IsNotNull(firstAttempt.AttemptId); + Assert.IsNotNull(firstAttempt.AttemptStatus); + + Assert.IsNotNull(firstAttempt.Result, "Expected result to be present in the first attempt"); + var result = firstAttempt.Result; + + Assert.IsNotNull(result.Digest); + Assert.IsNotNull(result.LivenessDecision); + Assert.IsNotNull(result.SessionImageId); + + Assert.IsNotNull(result.Targets); + Assert.IsNotNull(result.Targets.Color); + Assert.IsNotNull(result.Targets.Color.FaceRectangle); + var faceRect = result.Targets.Color.FaceRectangle; + Assert.IsNotNull(faceRect.Top); + Assert.IsNotNull(faceRect.Left); + Assert.IsNotNull(faceRect.Width); + Assert.IsNotNull(faceRect.Height); + + Assert.IsNotNull(result.VerifyResult, "Expected verify result to be present"); + Assert.IsNotNull(result.VerifyResult.IsIdentical); + Assert.IsNotNull(result.VerifyResult.MatchConfidence); + + Assert.IsNotNull(results.VerifyReferences); + Assert.IsTrue(results.VerifyReferences.Count > 0, "Expected at least one verify reference"); + var verifyRef = results.VerifyReferences[0]; + Assert.IsNotNull(verifyRef.FaceRectangle); + Assert.IsNotNull(verifyRef.FaceRectangle.Top); + Assert.IsNotNull(verifyRef.FaceRectangle.Left); + Assert.IsNotNull(verifyRef.FaceRectangle.Width); + Assert.IsNotNull(verifyRef.FaceRectangle.Height); + Assert.IsNotNull(verifyRef.QualityForRecognition); } #region LivenessSession - protected async Task CreateLivenessSession(bool nonRecordingClient = false) + protected async Task CreateLivenessSession(bool nonRecordingClient = false) { var client = CreateSessionClient(nonRecordingClient: nonRecordingClient); var createContent = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { DeviceCorrelationId = DeviceCorrelationId, + UserCorrelationId = UserCorrelationId, }; var createResponse = await client.CreateLivenessSessionAsync(createContent); @@ -123,65 +137,18 @@ public async Task TestCreateLivenessSession() Assert.IsNotNull(createResult.AuthToken); var getResponse = await client.GetLivenessSessionResultAsync(createResult.SessionId); - Assert.AreEqual(DeviceCorrelationId, getResponse.Value.DeviceCorrelationId); + Assert.AreEqual(createResult.SessionId, getResponse.Value.SessionId); } [RecordedTest] - public async Task TestListLivenessSessions() + public async Task TestGetSessionResult() { - if (Mode != RecordedTestMode.Playback) - { - await CreateLivenessSession(nonRecordingClient: true); - await CreateLivenessSession(nonRecordingClient: true); - } - var client = CreateSessionClient(); - - var listResponse = await client.GetLivenessSessionsAsync(); - var sessionList = listResponse.Value; - Assert.GreaterOrEqual(sessionList.Count, 2); - Assert.Greater(sessionList[1].Id, sessionList[0].Id); - - foreach (var session in sessionList) - { - Assert.IsNotNull(session.CreatedDateTime); - Assert.IsNotNull(session.DeviceCorrelationId); - Assert.IsTrue(session.AuthTokenTimeToLiveInSeconds >= 60); - Assert.IsTrue(session.AuthTokenTimeToLiveInSeconds <= 86400); - } - } - - [PlaybackOnly("Requiring other components to send underlying liveness request.")] - [TestCase("4aeb437b-d9a1-4408-9731-15f79c2e4862")] - public async Task TestGetSessionResult(string sessionId) - { - var client = CreateSessionClient(); - var response = await client.GetLivenessSessionResultAsync(sessionId); + var createResult = await CreateLivenessSession(); + var response = await client.GetLivenessSessionResultAsync(createResult.SessionId); var session = response.Value; - Assert.AreEqual(sessionId, session.Id); - Assert.IsNotNull(session.CreatedDateTime); - Assert.IsNotNull(session.DeviceCorrelationId); - Assert.IsTrue(session.AuthTokenTimeToLiveInSeconds >= 60); - Assert.IsTrue(session.AuthTokenTimeToLiveInSeconds <= 86400); - Assert.IsNotNull(session.SessionStartDateTime); - Assert.IsNotNull(session.SessionExpired); - Assert.AreEqual(FaceSessionStatus.ResultAvailable, session.Status); - - AssertAuditEntry(session.Result, sessionId); - } - - [PlaybackOnly("Requiring other components to send underlying liveness request.")] - [TestCase("4aeb437b-d9a1-4408-9731-15f79c2e4862")] - public async Task TestGetSessionAuditEntries(string sessionId) - { - var client = CreateSessionClient(); - var response = await client.GetLivenessSessionAuditEntriesAsync(sessionId); - - foreach (var auditEntry in response.Value) - { - AssertAuditEntry(auditEntry, sessionId); - } + Assert.AreEqual(createResult.SessionId, session.SessionId); } [RecordedTest] @@ -196,26 +163,17 @@ public async Task TestDeleteLivenessSessions() #endregion #region LivenessWithVerifySession - protected async Task CreateLivenessWithVerifySession(bool withVerifyImage, bool nonRecordingClient = false) + protected async Task CreateLivenessWithVerifySession(bool nonRecordingClient = false) { var client = CreateSessionClient(nonRecordingClient: nonRecordingClient); - - var createContent = new CreateLivenessWithVerifySessionContent(LivenessOperationMode.Passive) + using var fileStream = new FileStream(FaceTestConstant.LocalSampleImage, FileMode.Open, FileAccess.Read); + var createContent = new CreateLivenessWithVerifySessionContent(LivenessOperationMode.Passive, fileStream) { DeviceCorrelationId = DeviceCorrelationId, }; - Response createResponse = null; - - if (withVerifyImage) - { - using var fileStream = new FileStream(FaceTestConstant.LocalSampleImage, FileMode.Open, FileAccess.Read); - createResponse = await client.CreateLivenessWithVerifySessionAsync(createContent, fileStream); - } - else - { - createResponse = await client.CreateLivenessWithVerifySessionAsync(createContent, null); - } + Response createResponse = null; + createResponse = await client.CreateLivenessWithVerifySessionAsync(createContent); _createdSessions.Add((SessionType.LivenessWithVerify, createResponse.Value.SessionId)); @@ -226,66 +184,26 @@ protected void AssertVerifyResult(LivenessWithVerifyOutputs verifyResult) { Assert.IsNotNull(verifyResult.IsIdentical); Assert.IsNotNull(verifyResult.MatchConfidence); - Assert.IsNotNull(verifyResult.VerifyImage.FaceRectangle.Top); - Assert.IsNotNull(verifyResult.VerifyImage.FaceRectangle.Left); - Assert.IsNotNull(verifyResult.VerifyImage.FaceRectangle.Width); - Assert.IsNotNull(verifyResult.VerifyImage.FaceRectangle.Height); - Assert.IsNotNull(verifyResult.VerifyImage.QualityForRecognition); } [LiveOnly] // Unable to playback multipart request. [AsyncOnly] // Sync MFD request will throw in debug build [RecordedTest] - [TestCase(true)] - [TestCase(false)] - public async Task TestCreateLivenessWithVerifySession(bool withVerifyImage) + [Ignore("API is returning a bad request for user correlation id missing. Requires investigation https://github.com/Azure/azure-sdk-for-net/issues/53289.")] + public async Task TestCreateLivenessWithVerifySession() { var client = CreateSessionClient(); - var createResult = await CreateLivenessWithVerifySession(withVerifyImage); + var createResult = await CreateLivenessWithVerifySession(); Assert.IsNotNull(createResult.SessionId); Assert.IsNotNull(createResult.AuthToken); - if (withVerifyImage) - { - Assert.IsNotNull(createResult.VerifyImage); - Assert.IsNotNull(createResult.VerifyImage.FaceRectangle.Top); - Assert.IsNotNull(createResult.VerifyImage.FaceRectangle.Left); - Assert.IsNotNull(createResult.VerifyImage.FaceRectangle.Width); - Assert.IsNotNull(createResult.VerifyImage.FaceRectangle.Height); - Assert.IsNotNull(createResult.VerifyImage.QualityForRecognition); - } - var getResponse = await client.GetLivenessWithVerifySessionResultAsync(createResult.SessionId); - Assert.AreEqual(DeviceCorrelationId, getResponse.Value.DeviceCorrelationId); - } - - [RecordedTest] - public async Task TestListLivenessWithVerifySessions() - { - if (Mode != RecordedTestMode.Playback) - { - await CreateLivenessWithVerifySession(true, nonRecordingClient: true); - await CreateLivenessWithVerifySession(false, nonRecordingClient: true); - } - - var client = CreateSessionClient(); - - var listResponse = await client.GetLivenessWithVerifySessionsAsync(); - var sessionList = listResponse.Value; - Assert.GreaterOrEqual(sessionList.Count, 2); - Assert.Greater(sessionList[1].Id, sessionList[0].Id); - - foreach (var session in sessionList) - { - Assert.IsNotNull(session.CreatedDateTime); - Assert.IsNotNull(session.DeviceCorrelationId); - Assert.IsTrue(session.AuthTokenTimeToLiveInSeconds >= 60); - Assert.IsTrue(session.AuthTokenTimeToLiveInSeconds <= 86400); - } + Assert.IsNotNull(getResponse.Value.ExpectedClientIpAddress); } + [Ignore("API is returning a bad request for user correlation id missing. Requires investigation https://github.com/Azure/azure-sdk-for-net/issues/53289.")] [PlaybackOnly("Requiring other components to send underlying liveness request.")] [TestCase("56d976a9-130a-44e2-bb25-e84410f05b05")] public async Task TestGetLivenessWithVerifySessionResult(string sessionId) @@ -294,34 +212,19 @@ public async Task TestGetLivenessWithVerifySessionResult(string sessionId) var response = await client.GetLivenessWithVerifySessionResultAsync(sessionId); var session = response.Value; - Assert.AreEqual(sessionId, session.Id); - Assert.IsNotNull(session.CreatedDateTime); - Assert.IsNotNull(session.DeviceCorrelationId); - Assert.IsTrue(session.AuthTokenTimeToLiveInSeconds >= 60); - Assert.IsTrue(session.AuthTokenTimeToLiveInSeconds <= 86400); - Assert.IsNotNull(session.SessionStartDateTime); - Assert.IsNotNull(session.SessionExpired); - Assert.AreEqual(FaceSessionStatus.ResultAvailable, session.Status); - - AssertAuditEntry(session.Result, sessionId); - AssertVerifyResult(session.Result.Response.Body.VerifyResult); - } - - [PlaybackOnly("Requiring other components to send underlying liveness request.")] - [TestCase("56d976a9-130a-44e2-bb25-e84410f05b05")] - public async Task TestGetLivenessWithVerifySessionAuditEntries(string sessionId) - { - var client = CreateSessionClient(); - var response = await client.GetLivenessWithVerifySessionAuditEntriesAsync(sessionId); + Assert.AreEqual(sessionId, session.SessionId); + Assert.AreEqual(OperationState.Succeeded, session.Status); - foreach (var auditEntry in response.Value) - { - AssertAuditEntry(auditEntry, sessionId); - AssertVerifyResult(auditEntry.Response.Body.VerifyResult); - } + AssertLivenessWithVerifySessionResults(session.Results, sessionId); + var attempts = session.Results.Attempts; + Assert.IsTrue(attempts.Count > 0); + var verifyResult = attempts[0].Result.VerifyResult; + Assert.IsNotNull(verifyResult); + AssertVerifyResult(verifyResult); } [RecordedTest] + [Ignore("API is returning a bad request for missing user correlation id which is not defined in payload. Requires investigation https://github.com/Azure/azure-sdk-for-net/issues/53289.")] public async Task TestDeleteLivenessWithVerifySessions() { var result = await CreateLivenessWithVerifySession(false); diff --git a/sdk/face/Azure.AI.Vision.Face/tests/Generated/Samples/Samples_FaceSessionClient.cs b/sdk/face/Azure.AI.Vision.Face/tests/Generated/Samples/Samples_FaceSessionClient.cs index b793cf92c5e9..5cf5fa23b694 100644 --- a/sdk/face/Azure.AI.Vision.Face/tests/Generated/Samples/Samples_FaceSessionClient.cs +++ b/sdk/face/Azure.AI.Vision.Face/tests/Generated/Samples/Samples_FaceSessionClient.cs @@ -27,17 +27,22 @@ public void Example_LivenessSession_CreateLivenessSession_CreateLivenessSession( using RequestContent content = RequestContent.Create(new { - livenessOperationMode = "Passive", - sendResultsToClient = true, - deviceCorrelationIdSetInClient = true, + livenessOperationMode = "PassiveActive", + deviceCorrelationIdSetInClient = false, deviceCorrelationId = "your_device_correlation_id", + userCorrelationIdSetInClient = false, + userCorrelationId = "your_user_correlation_id", authTokenTimeToLiveInSeconds = 60, + expectedClientIpAddress = "1.2.3.4", }); 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()); } [Test] @@ -50,17 +55,22 @@ public async Task Example_LivenessSession_CreateLivenessSession_CreateLivenessSe using RequestContent content = RequestContent.Create(new { - livenessOperationMode = "Passive", - sendResultsToClient = true, - deviceCorrelationIdSetInClient = true, + livenessOperationMode = "PassiveActive", + deviceCorrelationIdSetInClient = false, deviceCorrelationId = "your_device_correlation_id", + userCorrelationIdSetInClient = false, + userCorrelationId = "your_user_correlation_id", authTokenTimeToLiveInSeconds = 60, + expectedClientIpAddress = "1.2.3.4", }); 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()); } [Test] @@ -71,14 +81,16 @@ public void Example_LivenessSession_CreateLivenessSession_CreateLivenessSession_ AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); - CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) + CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.PassiveActive) { - SendResultsToClient = true, - DeviceCorrelationIdSetInClient = true, + DeviceCorrelationIdSetInClient = false, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, + UserCorrelationId = "your_user_correlation_id", + UserCorrelationIdSetInClient = false, + ExpectedClientIpAddress = "1.2.3.4", }; - Response response = client.CreateLivenessSession(body); + Response response = client.CreateLivenessSession(body); } [Test] @@ -89,14 +101,16 @@ public async Task Example_LivenessSession_CreateLivenessSession_CreateLivenessSe AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); - CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) + CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.PassiveActive) { - SendResultsToClient = true, - DeviceCorrelationIdSetInClient = true, + DeviceCorrelationIdSetInClient = false, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, + UserCorrelationId = "your_user_correlation_id", + UserCorrelationIdSetInClient = false, + ExpectedClientIpAddress = "1.2.3.4", }; - Response response = await client.CreateLivenessSessionAsync(body); + Response response = await client.CreateLivenessSessionAsync(body); } [Test] @@ -136,10 +150,11 @@ public void Example_LivenessSession_GetLivenessSessionResult_GetLivenessSessionR 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()); } [Test] @@ -153,10 +168,11 @@ public async Task Example_LivenessSession_GetLivenessSessionResult_GetLivenessSe 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()); } [Test] @@ -183,128 +199,76 @@ public async Task Example_LivenessSession_GetLivenessSessionResult_GetLivenessSe [Test] [Ignore("Only validating compilation of examples")] - public void Example_LivenessSession_GetLivenessSessions_GetLivenessSessions() - { - Uri endpoint = new Uri(""); - 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()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LivenessSession_GetLivenessSessions_GetLivenessSessions_Async() - { - Uri endpoint = new Uri(""); - 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()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LivenessSession_GetLivenessSessions_GetLivenessSessions_Convenience() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = client.GetLivenessSessions(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LivenessSession_GetLivenessSessions_GetLivenessSessions_Convenience_Async() + public void Example_LivenessWithVerifySession_CreateLivenessWithVerifySession_CreateLivenessWithVerifySession() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); - Response> response = await client.GetLivenessSessionsAsync(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_FaceSessionClient_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries() - { - Uri endpoint = new Uri(""); - 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()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_FaceSessionClient_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries_Async() + public async Task Example_LivenessWithVerifySession_CreateLivenessWithVerifySession_CreateLivenessWithVerifySession_Async() { Uri endpoint = new Uri(""); 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()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_FaceSessionClient_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries_Convenience() + public void Example_LivenessWithVerifySession_CreateLivenessWithVerifySession_CreateLivenessWithVerifySession_Convenience() { Uri endpoint = new Uri(""); 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); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_FaceSessionClient_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries_Convenience_Async() + public async Task Example_LivenessWithVerifySession_CreateLivenessWithVerifySession_CreateLivenessWithVerifySession_Convenience_Async() { Uri endpoint = new Uri(""); 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); } [Test] @@ -344,10 +308,17 @@ public void Example_LivenessWithVerifySession_GetLivenessWithVerifySessionResult 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()); + 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()); } [Test] @@ -361,10 +332,17 @@ public async Task Example_LivenessWithVerifySession_GetLivenessWithVerifySession 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()); } [Test] @@ -389,132 +367,6 @@ public async Task Example_LivenessWithVerifySession_GetLivenessWithVerifySession Response response = await client.GetLivenessWithVerifySessionResultAsync("b12e033e-bda7-4b83-a211-e721c661f30e"); } - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LivenessWithVerifySession_GetLivenessWithVerifySessions_GetLivenessWithVerifySessions() - { - Uri endpoint = new Uri(""); - 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()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LivenessWithVerifySession_GetLivenessWithVerifySessions_GetLivenessWithVerifySessions_Async() - { - Uri endpoint = new Uri(""); - 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()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LivenessWithVerifySession_GetLivenessWithVerifySessions_GetLivenessWithVerifySessions_Convenience() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = client.GetLivenessWithVerifySessions(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LivenessWithVerifySession_GetLivenessWithVerifySessions_GetLivenessWithVerifySessions_Convenience_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = await client.GetLivenessWithVerifySessionsAsync(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_FaceSessionClient_GetLivenessWithVerifySessionAuditEntries_GetLivenessWithVerifySessionAuditEntries() - { - Uri endpoint = new Uri(""); - 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()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_FaceSessionClient_GetLivenessWithVerifySessionAuditEntries_GetLivenessWithVerifySessionAuditEntries_Async() - { - Uri endpoint = new Uri(""); - 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()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_FaceSessionClient_GetLivenessWithVerifySessionAuditEntries_GetLivenessWithVerifySessionAuditEntries_Convenience() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = client.GetLivenessWithVerifySessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_FaceSessionClient_GetLivenessWithVerifySessionAuditEntries_GetLivenessWithVerifySessionAuditEntries_Convenience_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = await client.GetLivenessWithVerifySessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e"); - } - [Test] [Ignore("Only validating compilation of examples")] public void Example_FaceSessionClient_DetectFromSessionImage_DetectFromSessionImageId() diff --git a/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample2_DetectLivenessWithSession.cs b/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample2_DetectLivenessWithSession.cs index e67219e9f3d1..9ee72b02dbf2 100644 --- a/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample2_DetectLivenessWithSession.cs +++ b/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample2_DetectLivenessWithSession.cs @@ -2,8 +2,6 @@ // Licensed under the MIT License. using System; -using System.Threading.Tasks; -using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.AI.Vision.Face.Samples @@ -18,8 +16,8 @@ public void CreateDetectLivenessSession(bool deleteSession) #region Snippet:CreateLivenessSession var createContent = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, DeviceCorrelationId = Guid.NewGuid().ToString(), + UserCorrelationId = Guid.NewGuid().ToString(), }; var createResponse = sessionClient.CreateLivenessSession(createContent); @@ -46,69 +44,46 @@ public void GetDetectLivenessSessionResult(string sessionId) #region Snippet:GetLivenessSessionResult var getResultResponse = sessionClient.GetLivenessSessionResult(sessionId); var sessionResult = getResultResponse.Value; - Console.WriteLine($"Id: {sessionResult.Id}"); - Console.WriteLine($"CreatedDateTime: {sessionResult.CreatedDateTime}"); - Console.WriteLine($"SessionExpired: {sessionResult.SessionExpired}"); - Console.WriteLine($"DeviceCorrelationId: {sessionResult.DeviceCorrelationId}"); - Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {sessionResult.AuthTokenTimeToLiveInSeconds}"); + Console.WriteLine($"Id: {sessionResult.SessionId}"); Console.WriteLine($"Status: {sessionResult.Status}"); - Console.WriteLine($"SessionStartDateTime: {sessionResult.SessionStartDateTime}"); - if (sessionResult.Result != null) { - WriteLivenessSessionAuditEntry(sessionResult.Result); - } - #endregion - - #region Snippet:GetLivenessSessionAuditEntries - var getAuditEntriesResponse = sessionClient.GetLivenessSessionAuditEntries(sessionId); - foreach (var auditEntry in getAuditEntriesResponse.Value) + if (sessionResult.Results != null) { - WriteLivenessSessionAuditEntry(auditEntry); + WriteLivenessSessionResults(sessionResult.Results); } #endregion } - public void ListDetectLivenessSessions() + #region Snippet:WriteLivenessSessionResults + public void WriteLivenessSessionResults(LivenessSessionResults results) { - var sessionClient = CreateSessionClient(); - - #region Snippet:GetLivenessSessions - var listResponse = sessionClient.GetLivenessSessions(); - foreach (var session in listResponse.Value) + if (results.Attempts == null || results.Attempts.Count == 0) { - Console.WriteLine($"SessionId: {session.Id}"); - Console.WriteLine($"CreatedDateTime: {session.CreatedDateTime}"); - Console.WriteLine($"SessionExpired: {session.SessionExpired}"); - Console.WriteLine($"DeviceCorrelationId: {session.DeviceCorrelationId}"); - Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {session.AuthTokenTimeToLiveInSeconds}"); - Console.WriteLine($"SessionStartDateTime: {session.SessionStartDateTime}"); + Console.WriteLine("No attempts found in the session results."); + return; } - #endregion - } - #region Snippet:WriteLivenessSessionAuditEntry - public void WriteLivenessSessionAuditEntry(LivenessSessionAuditEntry auditEntry) - { - Console.WriteLine($"Id: {auditEntry.Id}"); - Console.WriteLine($"SessionId: {auditEntry.SessionId}"); - Console.WriteLine($"RequestId: {auditEntry.RequestId}"); - Console.WriteLine($"ClientRequestId: {auditEntry.ClientRequestId}"); - Console.WriteLine($"ReceivedDateTime: {auditEntry.ReceivedDateTime}"); - Console.WriteLine($"Digest: {auditEntry.Digest}"); + var firstAttempt = results.Attempts[0]; + Console.WriteLine($"Attempt ID: {firstAttempt.AttemptId}"); + Console.WriteLine($"Attempt Status: {firstAttempt.AttemptStatus}"); + + if (firstAttempt.Result != null) + { + var result = firstAttempt.Result; + Console.WriteLine($" Liveness Decision: {result.LivenessDecision}"); + Console.WriteLine($" Digest: {result.Digest}"); + Console.WriteLine($" Session Image ID: {result.SessionImageId}"); - Console.WriteLine($" Request Url: {auditEntry.Request.Url}"); - Console.WriteLine($" Request Method: {auditEntry.Request.Method}"); - Console.WriteLine($" Request ContentLength: {auditEntry.Request.ContentLength}"); - Console.WriteLine($" Request ContentType: {auditEntry.Request.ContentType}"); - Console.WriteLine($" Request UserAgent: {auditEntry.Request.UserAgent}"); + if (result.Targets?.Color?.FaceRectangle != null) + { + var faceRect = result.Targets.Color.FaceRectangle; + Console.WriteLine($" Face Rectangle: Top={faceRect.Top}, Left={faceRect.Left}, Width={faceRect.Width}, Height={faceRect.Height}"); + } + } - Console.WriteLine($" Response StatusCode: {auditEntry.Response.StatusCode}"); - Console.WriteLine($" Response LatencyInMilliseconds: {auditEntry.Response.LatencyInMilliseconds}"); - Console.WriteLine($" Response Body LivenessDecision: {auditEntry.Response.Body.LivenessDecision}"); - Console.WriteLine($" Response Body ModelVersionUsed: {auditEntry.Response.Body.ModelVersionUsed}"); - Console.WriteLine($" Response Body Target FaceRectangle: {auditEntry.Response.Body.Target.FaceRectangle.Top}, {auditEntry.Response.Body.Target.FaceRectangle.Left}, {auditEntry.Response.Body.Target.FaceRectangle.Width}, {auditEntry.Response.Body.Target.FaceRectangle.Height}"); - Console.WriteLine($" Response Body Target FileName: {auditEntry.Response.Body.Target.FileName}"); - Console.WriteLine($" Response Body Target TimeOffsetWithinFile: {auditEntry.Response.Body.Target.TimeOffsetWithinFile}"); - Console.WriteLine($" Response Body Target FaceImageType: {auditEntry.Response.Body.Target.ImageType}"); + if (firstAttempt.ClientInformation != null && firstAttempt.ClientInformation.Count > 0) + { + Console.WriteLine($" Client Information Count: {firstAttempt.ClientInformation.Count}"); + } } #endregion } diff --git a/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample2_DetectLivenessWithSessionAsync.cs b/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample2_DetectLivenessWithSessionAsync.cs index 36ccaba19085..9d2afbd9ed47 100644 --- a/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample2_DetectLivenessWithSessionAsync.cs +++ b/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample2_DetectLivenessWithSessionAsync.cs @@ -3,7 +3,6 @@ using System; using System.Threading.Tasks; -using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.AI.Vision.Face.Samples @@ -18,8 +17,8 @@ public async Task CreateDetectLivenessSessionAsync(bool deleteSession) #region Snippet:CreateLivenessSessionAsync var createContent = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, DeviceCorrelationId = Guid.NewGuid().ToString(), + UserCorrelationId = Guid.NewGuid().ToString(), }; var createResponse = await sessionClient.CreateLivenessSessionAsync(createContent); @@ -46,41 +45,11 @@ public async Task GetDetectLivenessSessionResultAsync(string sessionId) #region Snippet:GetLivenessSessionResultAsync var getResultResponse = await sessionClient.GetLivenessSessionResultAsync(sessionId); var sessionResult = getResultResponse.Value; - Console.WriteLine($"Id: {sessionResult.Id}"); - Console.WriteLine($"CreatedDateTime: {sessionResult.CreatedDateTime}"); - Console.WriteLine($"SessionExpired: {sessionResult.SessionExpired}"); - Console.WriteLine($"DeviceCorrelationId: {sessionResult.DeviceCorrelationId}"); - Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {sessionResult.AuthTokenTimeToLiveInSeconds}"); + Console.WriteLine($"Id: {sessionResult.SessionId}"); Console.WriteLine($"Status: {sessionResult.Status}"); - Console.WriteLine($"SessionStartDateTime: {sessionResult.SessionStartDateTime}"); - if (sessionResult.Result != null) { - WriteLivenessSessionAuditEntry(sessionResult.Result); - } - #endregion - - #region Snippet:GetLivenessSessionAuditEntriesAsync - var getAuditEntriesResponse = await sessionClient.GetLivenessSessionAuditEntriesAsync(sessionId); - foreach (var auditEntry in getAuditEntriesResponse.Value) - { - WriteLivenessSessionAuditEntry(auditEntry); - } - #endregion - } - - public async Task ListDetectLivenessSessionsAsync() - { - var sessionClient = CreateSessionClient(); - - #region Snippet:GetLivenessSessionsAsync - var listResponse = await sessionClient.GetLivenessSessionsAsync(); - foreach (var session in listResponse.Value) + if (sessionResult.Results != null) { - Console.WriteLine($"SessionId: {session.Id}"); - Console.WriteLine($"CreatedDateTime: {session.CreatedDateTime}"); - Console.WriteLine($"SessionExpired: {session.SessionExpired}"); - Console.WriteLine($"DeviceCorrelationId: {session.DeviceCorrelationId}"); - Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {session.AuthTokenTimeToLiveInSeconds}"); - Console.WriteLine($"SessionStartDateTime: {session.SessionStartDateTime}"); + WriteLivenessSessionResults(sessionResult.Results); } #endregion } diff --git a/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample3_DetectLivenessWithVerifyWithSession.cs b/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample3_DetectLivenessWithVerifyWithSession.cs index bdbfd2144031..be18e28d7157 100644 --- a/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample3_DetectLivenessWithVerifyWithSession.cs +++ b/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample3_DetectLivenessWithVerifyWithSession.cs @@ -3,9 +3,7 @@ using System; using System.IO; -using System.Threading.Tasks; using Azure.AI.Vision.Face.Tests; -using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.AI.Vision.Face.Samples @@ -20,20 +18,24 @@ public void CreateDetectLivenessWithVerifySession(bool deleteSession) var sessionClient = CreateSessionClient(); #region Snippet:CreateLivenessWithVerifySession - var parameters = new CreateLivenessWithVerifySessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, + using var fileStream = new FileStream(FaceTestConstant.LocalSampleImage, FileMode.Open, FileAccess.Read); + var parameters = new CreateLivenessWithVerifySessionContent(LivenessOperationMode.Passive, fileStream) + { DeviceCorrelationId = Guid.NewGuid().ToString(), }; - using var fileStream = new FileStream(FaceTestConstant.LocalSampleImage, FileMode.Open, FileAccess.Read); - - var createResponse = sessionClient.CreateLivenessWithVerifySession(parameters, fileStream); + var createResponse = sessionClient.CreateLivenessWithVerifySession(parameters); var sessionId = createResponse.Value.SessionId; Console.WriteLine($"Session created, SessionId: {sessionId}"); Console.WriteLine($"AuthToken: {createResponse.Value.AuthToken}"); - Console.WriteLine($"VerifyImage.FaceRectangle: {createResponse.Value.VerifyImage.FaceRectangle.Top}, {createResponse.Value.VerifyImage.FaceRectangle.Left}, {createResponse.Value.VerifyImage.FaceRectangle.Width}, {createResponse.Value.VerifyImage.FaceRectangle.Height}"); - Console.WriteLine($"VerifyImage.QualityForRecognition: {createResponse.Value.VerifyImage.QualityForRecognition}"); + var results = createResponse.Value.Results; + if (results.VerifyReferences.Count > 0) + { + var verifyReference = results.VerifyReferences[0]; + Console.WriteLine($"VerifyImage.FaceRectangle: {verifyReference.FaceRectangle.Top}, {verifyReference.FaceRectangle.Left}, {verifyReference.FaceRectangle.Width}, {verifyReference.FaceRectangle.Height}"); + Console.WriteLine($"VerifyImage.QualityForRecognition: {verifyReference.QualityForRecognition}"); + } #endregion if (deleteSession) @@ -53,74 +55,64 @@ public void GetDetectLivenessWithVerifySessionResult(string sessionId) #region Snippet:GetLivenessWithVerifySessionResult var getResultResponse = sessionClient.GetLivenessWithVerifySessionResult(sessionId); var sessionResult = getResultResponse.Value; - Console.WriteLine($"Id: {sessionResult.Id}"); - Console.WriteLine($"CreatedDateTime: {sessionResult.CreatedDateTime}"); - Console.WriteLine($"SessionExpired: {sessionResult.SessionExpired}"); - Console.WriteLine($"DeviceCorrelationId: {sessionResult.DeviceCorrelationId}"); - Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {sessionResult.AuthTokenTimeToLiveInSeconds}"); + Console.WriteLine($"Id: {sessionResult.SessionId}"); Console.WriteLine($"Status: {sessionResult.Status}"); - Console.WriteLine($"SessionStartDateTime: {sessionResult.SessionStartDateTime}"); - if (sessionResult.Result != null) { - WriteLivenessWithVerifySessionAuditEntry(sessionResult.Result); - } - #endregion - - #region Snippet:GetLivenessWithVerifySessionAuditEntries - var getAuditEntriesResponse = sessionClient.GetLivenessWithVerifySessionAuditEntries(sessionId); - foreach (var auditEntry in getAuditEntriesResponse.Value) + if (sessionResult.Results != null) { - WriteLivenessWithVerifySessionAuditEntry(auditEntry); + WriteLivenessWithVerifySessionResults(sessionResult.Results); } #endregion } - public void ListDetectLivenessWithVerifySessions() + #region Snippet:WriteLivenessWithVerifySessionResults + public void WriteLivenessWithVerifySessionResults(LivenessWithVerifySessionResults results) { - var sessionClient = CreateSessionClient(); + if (results.Attempts == null || results.Attempts.Count == 0) + { + Console.WriteLine("No attempts found in the session results."); + return; + } + + var firstAttempt = results.Attempts[0]; + Console.WriteLine($"Attempt ID: {firstAttempt.AttemptId}"); + Console.WriteLine($"Attempt Status: {firstAttempt.AttemptStatus}"); - #region Snippet:GetLivenessWithVerifySessions - var listResponse = sessionClient.GetLivenessWithVerifySessions(); - foreach (var session in listResponse.Value) + if (firstAttempt.Result != null) { - Console.WriteLine($"SessionId: {session.Id}"); - Console.WriteLine($"CreatedDateTime: {session.CreatedDateTime}"); - Console.WriteLine($"SessionExpired: {session.SessionExpired}"); - Console.WriteLine($"DeviceCorrelationId: {session.DeviceCorrelationId}"); - Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {session.AuthTokenTimeToLiveInSeconds}"); - Console.WriteLine($"SessionStartDateTime: {session.SessionStartDateTime}"); + var result = firstAttempt.Result; + Console.WriteLine($" Liveness Decision: {result.LivenessDecision}"); + Console.WriteLine($" Digest: {result.Digest}"); + Console.WriteLine($" Session Image ID: {result.SessionImageId}"); + + if (result.Targets?.Color?.FaceRectangle != null) + { + var faceRect = result.Targets.Color.FaceRectangle; + Console.WriteLine($" Target Face Rectangle: Top={faceRect.Top}, Left={faceRect.Left}, Width={faceRect.Width}, Height={faceRect.Height}"); + } + + if (result.VerifyResult != null) + { + Console.WriteLine($" Verify Result IsIdentical: {result.VerifyResult.IsIdentical}"); + Console.WriteLine($" Verify Result MatchConfidence: {result.VerifyResult.MatchConfidence}"); + } + + Console.WriteLine($" Verify Image Hash: {result.VerifyImageHash}"); } - #endregion - } - #region Snippet:WriteLivenessWithVerifySessionAuditEntry - public void WriteLivenessWithVerifySessionAuditEntry(LivenessSessionAuditEntry auditEntry) - { - Console.WriteLine($"Id: {auditEntry.Id}"); - Console.WriteLine($"SessionId: {auditEntry.SessionId}"); - Console.WriteLine($"RequestId: {auditEntry.RequestId}"); - Console.WriteLine($"ClientRequestId: {auditEntry.ClientRequestId}"); - Console.WriteLine($"ReceivedDateTime: {auditEntry.ReceivedDateTime}"); - Console.WriteLine($"Digest: {auditEntry.Digest}"); - - Console.WriteLine($" Request Url: {auditEntry.Request.Url}"); - Console.WriteLine($" Request Method: {auditEntry.Request.Method}"); - Console.WriteLine($" Request ContentLength: {auditEntry.Request.ContentLength}"); - Console.WriteLine($" Request ContentType: {auditEntry.Request.ContentType}"); - Console.WriteLine($" Request UserAgent: {auditEntry.Request.UserAgent}"); - - Console.WriteLine($" Response StatusCode: {auditEntry.Response.StatusCode}"); - Console.WriteLine($" Response LatencyInMilliseconds: {auditEntry.Response.LatencyInMilliseconds}"); - Console.WriteLine($" Response Body LivenessDecision: {auditEntry.Response.Body.LivenessDecision}"); - Console.WriteLine($" Response Body ModelVersionUsed: {auditEntry.Response.Body.ModelVersionUsed}"); - Console.WriteLine($" Response Body Target FaceRectangle: {auditEntry.Response.Body.Target.FaceRectangle.Top}, {auditEntry.Response.Body.Target.FaceRectangle.Left}, {auditEntry.Response.Body.Target.FaceRectangle.Width}, {auditEntry.Response.Body.Target.FaceRectangle.Height}"); - Console.WriteLine($" Response Body Target FileName: {auditEntry.Response.Body.Target.FileName}"); - Console.WriteLine($" Response Body Target TimeOffsetWithinFile: {auditEntry.Response.Body.Target.TimeOffsetWithinFile}"); - Console.WriteLine($" Response Body Target FaceImageType: {auditEntry.Response.Body.Target.ImageType}"); - - Console.WriteLine($" Response Body VerifyResult IsIdentical: {auditEntry.Response.Body.VerifyResult.IsIdentical}"); - Console.WriteLine($" Response Body VerifyResult MatchConfidence: {auditEntry.Response.Body.VerifyResult.MatchConfidence}"); - Console.WriteLine($" Response Body VerifyResult VerifyImage.FaceRectangle: {auditEntry.Response.Body.VerifyResult.VerifyImage.FaceRectangle.Top}, {auditEntry.Response.Body.VerifyResult.VerifyImage.FaceRectangle.Left}, {auditEntry.Response.Body.VerifyResult.VerifyImage.FaceRectangle.Width}, {auditEntry.Response.Body.VerifyResult.VerifyImage.FaceRectangle.Height}"); - Console.WriteLine($" Response Body VerifyResult VerifyImage.QualityForRecognition: {auditEntry.Response.Body.VerifyResult.VerifyImage.QualityForRecognition}"); + if (results.VerifyReferences != null && results.VerifyReferences.Count > 0) + { + var verifyRef = results.VerifyReferences[0]; + if (verifyRef.FaceRectangle != null) + { + Console.WriteLine($" Verify Reference Face Rectangle: Top={verifyRef.FaceRectangle.Top}, Left={verifyRef.FaceRectangle.Left}, Width={verifyRef.FaceRectangle.Width}, Height={verifyRef.FaceRectangle.Height}"); + } + Console.WriteLine($" Verify Reference Quality For Recognition: {verifyRef.QualityForRecognition}"); + } + + if (firstAttempt.ClientInformation != null && firstAttempt.ClientInformation.Count > 0) + { + Console.WriteLine($" Client Information Count: {firstAttempt.ClientInformation.Count}"); + } } #endregion } diff --git a/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample3_DetectLivenessWithVerifyWithSessionAsync.cs b/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample3_DetectLivenessWithVerifyWithSessionAsync.cs index 39e220103bae..95e377f0bf7e 100644 --- a/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample3_DetectLivenessWithVerifyWithSessionAsync.cs +++ b/sdk/face/Azure.AI.Vision.Face/tests/samples/Sample3_DetectLivenessWithVerifyWithSessionAsync.cs @@ -12,6 +12,7 @@ namespace Azure.AI.Vision.Face.Samples { public partial class Sample5_DetectLivenessWithVerifyWithSession : FaceSamplesBase { + [Ignore("API requires user correlation id - requires investigation. https://github.com/Azure/azure-sdk-for-net/issues/53289")] [Test] [TestCase(true)] // Change deleteSession to false to keep the session and perform liveness detection with liveness SDK public async Task CreateDetectLivenessWithVerifySessionAsync(bool deleteSession) @@ -19,20 +20,25 @@ public async Task CreateDetectLivenessWithVerifySessionAsync(bool deleteSession) var sessionClient = CreateSessionClient(); #region Snippet:CreateLivenessWithVerifySessionAsync - var parameters = new CreateLivenessWithVerifySessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, + using var fileStream = new FileStream(FaceTestConstant.LocalSampleImage, FileMode.Open, FileAccess.Read); + var parameters = new CreateLivenessWithVerifySessionContent(LivenessOperationMode.Passive, fileStream) + { DeviceCorrelationId = Guid.NewGuid().ToString(), }; - using var fileStream = new FileStream(FaceTestConstant.LocalSampleImage, FileMode.Open, FileAccess.Read); - - var createResponse = await sessionClient.CreateLivenessWithVerifySessionAsync(parameters, fileStream); + var createResponse = await sessionClient.CreateLivenessWithVerifySessionAsync(parameters); var sessionId = createResponse.Value.SessionId; Console.WriteLine($"Session created, SessionId: {sessionId}"); Console.WriteLine($"AuthToken: {createResponse.Value.AuthToken}"); - Console.WriteLine($"VerifyImage.FaceRectangle: {createResponse.Value.VerifyImage.FaceRectangle.Top}, {createResponse.Value.VerifyImage.FaceRectangle.Left}, {createResponse.Value.VerifyImage.FaceRectangle.Width}, {createResponse.Value.VerifyImage.FaceRectangle.Height}"); - Console.WriteLine($"VerifyImage.QualityForRecognition: {createResponse.Value.VerifyImage.QualityForRecognition}"); + + var results = createResponse.Value.Results; + if (results.VerifyReferences.Count > 0) + { + var verifyReference = results.VerifyReferences[0]; + Console.WriteLine($"VerifyImage.FaceRectangle: {verifyReference.FaceRectangle.Top}, {verifyReference.FaceRectangle.Left}, {verifyReference.FaceRectangle.Width}, {verifyReference.FaceRectangle.Height}"); + Console.WriteLine($"VerifyImage.QualityForRecognition: {verifyReference.QualityForRecognition}"); + } #endregion if (deleteSession) @@ -52,41 +58,11 @@ public async Task GetDetectLivenessWithVerifySessionResultAsync(string sessionId #region Snippet:GetLivenessWithVerifySessionResultAsync var getResultResponse = await sessionClient.GetLivenessWithVerifySessionResultAsync(sessionId); var sessionResult = getResultResponse.Value; - Console.WriteLine($"Id: {sessionResult.Id}"); - Console.WriteLine($"CreatedDateTime: {sessionResult.CreatedDateTime}"); - Console.WriteLine($"SessionExpired: {sessionResult.SessionExpired}"); - Console.WriteLine($"DeviceCorrelationId: {sessionResult.DeviceCorrelationId}"); - Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {sessionResult.AuthTokenTimeToLiveInSeconds}"); + Console.WriteLine($"Id: {sessionResult.SessionId}"); Console.WriteLine($"Status: {sessionResult.Status}"); - Console.WriteLine($"SessionStartDateTime: {sessionResult.SessionStartDateTime}"); - if (sessionResult.Result != null) { - WriteLivenessWithVerifySessionAuditEntry(sessionResult.Result); - } - #endregion - - #region Snippet:GetLivenessWithVerifySessionAuditEntriesAsync - var getAuditEntriesResponse = await sessionClient.GetLivenessWithVerifySessionAuditEntriesAsync(sessionId); - foreach (var auditEntry in getAuditEntriesResponse.Value) - { - WriteLivenessWithVerifySessionAuditEntry(auditEntry); - } - #endregion - } - - public async Task ListDetectLivenessWithVerifySessionsAsync() - { - var sessionClient = CreateSessionClient(); - - #region Snippet:GetLivenessWithVerifySessionsAsync - var listResponse = await sessionClient.GetLivenessWithVerifySessionsAsync(); - foreach (var session in listResponse.Value) + if (sessionResult.Results != null) { - Console.WriteLine($"SessionId: {session.Id}"); - Console.WriteLine($"CreatedDateTime: {session.CreatedDateTime}"); - Console.WriteLine($"SessionExpired: {session.SessionExpired}"); - Console.WriteLine($"DeviceCorrelationId: {session.DeviceCorrelationId}"); - Console.WriteLine($"AuthTokenTimeToLiveInSeconds: {session.AuthTokenTimeToLiveInSeconds}"); - Console.WriteLine($"SessionStartDateTime: {session.SessionStartDateTime}"); + WriteLivenessWithVerifySessionResults(sessionResult.Results); } #endregion } diff --git a/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml b/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml index bfbd3f1cd930..1f7578892965 100644 --- a/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml +++ b/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml @@ -1,4 +1,3 @@ directory: specification/ai/Face -commit: 4436f0b7bb0ed03342eb26eab3db396acf69850e -repo: Azure/azure-rest-api-specs - +commit: a0a2a2ccc3b8cbf61d6044db2b434091ec769acf +repo: Azure/azure-rest-api-specs \ No newline at end of file