From 031564f2fe3d7d511f36b55d9d74a2e768c37215 Mon Sep 17 00:00:00 2001 From: Han Chiang Date: Mon, 18 Nov 2024 08:03:24 +0000 Subject: [PATCH 1/3] Regen --- .../src/Generated/AIVisionFaceModelFactory.cs | 285 ++++---- .../src/Generated/AttemptStatus.cs | 54 ++ .../Generated/AuditLivenessResponseInfo.cs | 87 --- .../src/Generated/AuditRequestInfo.cs | 97 --- .../AzureAIVisionFaceClientOptions.cs | 5 +- ...ateLivenessSessionContent.Serialization.cs | 30 +- .../Generated/CreateLivenessSessionContent.cs | 12 +- .../Generated/CreateLivenessSessionResult.cs | 82 --- ...sWithVerifySessionContent.Serialization.cs | 30 +- .../CreateLivenessWithVerifySessionContent.cs | 16 +- .../CreateLivenessWithVerifySessionResult.cs | 86 --- .../src/Generated/Docs/FaceSessionClient.xml | 306 +-------- .../src/Generated/FaceSessionClient.cs | 642 +----------------- .../src/Generated/FaceSessionStatus.cs | 54 -- .../src/Generated/LargeFaceListClient.cs | 2 +- .../src/Generated/LargePersonGroupClient.cs | 2 +- ...enessColorDecisionTarget.Serialization.cs} | 60 +- ...rget.cs => LivenessColorDecisionTarget.cs} | 37 +- .../LivenessDecisionTargets.Serialization.cs | 142 ++++ .../src/Generated/LivenessDecisionTargets.cs | 75 ++ ...tion.cs => LivenessError.Serialization.cs} | 72 +- .../src/Generated/LivenessError.cs | 89 +++ .../src/Generated/LivenessModel.cs | 9 +- .../LivenessResponseBody.Serialization.cs | 188 ----- .../src/Generated/LivenessResponseBody.cs | 77 --- ...ion.cs => LivenessResult.Serialization.cs} | 92 +-- .../src/Generated/LivenessResult.cs | 90 +++ .../LivenessSession.Serialization.cs | 100 +-- .../src/Generated/LivenessSession.cs | 60 +- ...> LivenessSessionAttempt.Serialization.cs} | 104 ++- .../src/Generated/LivenessSessionAttempt.cs | 86 +++ .../Generated/LivenessSessionAuditEntry.cs | 130 ---- .../LivenessSessionItem.Serialization.cs | 209 ------ .../src/Generated/LivenessSessionItem.cs | 94 --- .../LivenessSessionResults.Serialization.cs | 152 +++++ .../src/Generated/LivenessSessionResults.cs | 76 +++ ...LivenessWithVerifyOutputs.Serialization.cs | 10 +- .../Generated/LivenessWithVerifyOutputs.cs | 13 +- ...enessWithVerifyReference.Serialization.cs} | 50 +- ...mage.cs => LivenessWithVerifyReference.cs} | 20 +- ...LivenessWithVerifyResult.Serialization.cs} | 134 ++-- .../src/Generated/LivenessWithVerifyResult.cs | 98 +++ ...LivenessWithVerifySession.Serialization.cs | 100 +-- .../Generated/LivenessWithVerifySession.cs | 60 +- ...WithVerifySessionAttempt.Serialization.cs} | 89 ++- .../LivenessWithVerifySessionAttempt.cs | 86 +++ ...sWithVerifySessionResults.Serialization.cs | 170 +++++ .../LivenessWithVerifySessionResults.cs | 83 +++ .../src/Generated/OperationState.cs | 60 ++ .../Samples/Samples_FaceSessionClient.cs | 306 +-------- .../Azure.AI.Vision.Face/tsp-location.yaml | 2 +- 51 files changed, 1946 insertions(+), 3067 deletions(-) create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/AttemptStatus.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionStatus.cs rename sdk/face/Azure.AI.Vision.Face/src/Generated/{CreateLivenessSessionResult.Serialization.cs => LivenessColorDecisionTarget.Serialization.cs} (64%) rename sdk/face/Azure.AI.Vision.Face/src/Generated/{LivenessOutputsTarget.cs => LivenessColorDecisionTarget.cs} (51%) create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.Serialization.cs create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.cs rename sdk/face/Azure.AI.Vision.Face/src/Generated/{AuditLivenessResponseInfo.Serialization.cs => LivenessError.Serialization.cs} (56%) create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.Serialization.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.cs rename sdk/face/Azure.AI.Vision.Face/src/Generated/{LivenessOutputsTarget.Serialization.cs => LivenessResult.Serialization.cs} (54%) create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.cs rename sdk/face/Azure.AI.Vision.Face/src/Generated/{AuditRequestInfo.Serialization.cs => LivenessSessionAttempt.Serialization.cs} (53%) create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.Serialization.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.cs create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.Serialization.cs create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.cs rename sdk/face/Azure.AI.Vision.Face/src/Generated/{LivenessWithVerifyImage.Serialization.cs => LivenessWithVerifyReference.Serialization.cs} (64%) rename sdk/face/Azure.AI.Vision.Face/src/Generated/{LivenessWithVerifyImage.cs => LivenessWithVerifyReference.cs} (73%) rename sdk/face/Azure.AI.Vision.Face/src/Generated/{LivenessSessionAuditEntry.Serialization.cs => LivenessWithVerifyResult.Serialization.cs} (54%) create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.cs rename sdk/face/Azure.AI.Vision.Face/src/Generated/{CreateLivenessWithVerifySessionResult.Serialization.cs => LivenessWithVerifySessionAttempt.Serialization.cs} (50%) create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.cs create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.Serialization.cs create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.cs create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/OperationState.cs 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 49e4e7fad35a3..27e0bcf9a894a 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AIVisionFaceModelFactory.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/AIVisionFaceModelFactory.cs @@ -386,198 +386,117 @@ 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. /// 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) { return new CreateLivenessSessionContent( livenessOperationMode, - sendResultsToClient, deviceCorrelationIdSetInClient, enableSessionImage, - livenessSingleModalModel, + livenessModelVersion, deviceCorrelationId, authTokenTimeToLiveInSeconds, 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. + /// 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, LivenessSessionResults results = null) { return new LivenessSession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + 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. + /// A new instance for mocking. + public static LivenessSessionAttempt LivenessSessionAttempt(int attemptId = default, AttemptStatus attemptStatus = default, LivenessResult result = null, LivenessError error = null) { - return new AuditLivenessResponseInfo(body, statusCode, latencyInMilliseconds, serializedAdditionalRawData: null); + return new LivenessSessionAttempt(attemptId, attemptStatus, result, error, 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 LivenessResponseBody(livenessDecision, target, modelVersionUsed, verifyResult, additionalProperties); + return new LivenessResult(livenessDecision, targets, digest, sessionImageId, serializedAdditionalRawData: null); } - /// 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) + /// 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 LivenessOutputsTarget(faceRectangle, fileName, timeOffsetWithinFile, imageType, serializedAdditionalRawData: null); + return new LivenessDecisionTargets(color, 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) - { - return new LivenessWithVerifyOutputs(verifyImage, matchConfidence, isIdentical, 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 face region where the liveness classification was made on. + /// A new instance for mocking. + public static LivenessColorDecisionTarget LivenessColorDecisionTarget(FaceRectangle faceRectangle = null) { - return new LivenessWithVerifyImage(faceRectangle, qualityForRecognition, serializedAdditionalRawData: null); + return new LivenessColorDecisionTarget(faceRectangle, 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 . + /// 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 LivenessSessionItem( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, - serializedAdditionalRawData: null); + return new LivenessError(code, message, targets, 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. /// 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. + /// 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. /// 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, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null, bool? returnVerifyImageHash = null, float? verifyConfidenceThreshold = null) { return new CreateLivenessWithVerifySessionContent( livenessOperationMode, - sendResultsToClient, deviceCorrelationIdSetInClient, enableSessionImage, - livenessSingleModalModel, + livenessModelVersion, deviceCorrelationId, authTokenTimeToLiveInSeconds, returnVerifyImageHash, @@ -585,38 +504,84 @@ public static CreateLivenessWithVerifySessionContent CreateLivenessWithVerifySes 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. + /// 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, LivenessWithVerifySessionResults results = null) { return new LivenessWithVerifySession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + 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. + /// A new instance for mocking. + public static LivenessWithVerifySessionAttempt LivenessWithVerifySessionAttempt(int attemptId = default, AttemptStatus attemptStatus = default, LivenessWithVerifyResult result = null, LivenessError error = null) + { + return new LivenessWithVerifySessionAttempt(attemptId, attemptStatus, result, error, 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); + } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AttemptStatus.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AttemptStatus.cs new file mode 100644 index 0000000000000..febd4acc28fc7 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/AttemptStatus.cs @@ -0,0 +1,54 @@ +// 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 status of the liveness classification attempt. + public readonly partial struct AttemptStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AttemptStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SuccessValue = "Success"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// The attempt is successful. + public static AttemptStatus Success { get; } = new AttemptStatus(SuccessValue); + /// The attempt is failed. + public static AttemptStatus Failed { get; } = new AttemptStatus(FailedValue); + /// The attempt is canceled. + public static AttemptStatus Canceled { get; } = new AttemptStatus(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(AttemptStatus left, AttemptStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AttemptStatus left, AttemptStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AttemptStatus(string value) => new AttemptStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AttemptStatus other && Equals(other); + /// + public bool Equals(AttemptStatus 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/AuditLivenessResponseInfo.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.cs deleted file mode 100644 index 3448b284f8e3c..0000000000000 --- 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 39356d1eb8f8a..0000000000000 --- 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 a27f25f2a0088..6790ac9378868 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_2; /// The version of the service to use. public enum ServiceVersion @@ -22,6 +22,8 @@ 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, } internal string Version { get; } @@ -33,6 +35,7 @@ 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", _ => throw new NotSupportedException() }; } 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 d3cf3fa9ac98f..9e4178471832c 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)) { @@ -104,10 +99,9 @@ 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; IDictionary serializedAdditionalRawData = default; @@ -119,15 +113,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 +131,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)) @@ -177,10 +162,9 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon serializedAdditionalRawData = rawDataDictionary; return new CreateLivenessSessionContent( livenessOperationMode, - sendResultsToClient, deviceCorrelationIdSetInClient, enableSessionImage, - livenessSingleModalModel, + livenessModelVersion, deviceCorrelationId, authTokenTimeToLiveInSeconds, 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 9de38ee841c68..66e9ce0ec2277 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.cs @@ -54,20 +54,18 @@ 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. /// 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, IDictionary serializedAdditionalRawData) { LivenessOperationMode = livenessOperationMode; - SendResultsToClient = sendResultsToClient; DeviceCorrelationIdSetInClient = deviceCorrelationIdSetInClient; EnableSessionImage = enableSessionImage; - LivenessSingleModalModel = livenessSingleModalModel; + LivenessModelVersion = livenessModelVersion; DeviceCorrelationId = deviceCorrelationId; AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -80,14 +78,12 @@ 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. 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 cf8e5b8e2c7fa..0000000000000 --- 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 ffcb60dcdbce0..a3a6b1f8c62c2 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 @@ -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)) { @@ -114,10 +109,9 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness 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; bool? returnVerifyImageHash = default; @@ -131,15 +125,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,13 +143,13 @@ 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)) @@ -207,10 +192,9 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness serializedAdditionalRawData = rawDataDictionary; return new CreateLivenessWithVerifySessionContent( livenessOperationMode, - sendResultsToClient, deviceCorrelationIdSetInClient, enableSessionImage, - livenessSingleModalModel, + livenessModelVersion, deviceCorrelationId, authTokenTimeToLiveInSeconds, returnVerifyImageHash, 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 99e890eaf7e3d..a0c8884fb08a5 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.cs @@ -54,22 +54,20 @@ public CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOper /// 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. /// Whether or not return the verify image hash. - /// Threshold for confidence of the face verification. + /// 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. /// 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, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, bool? returnVerifyImageHash, float? verifyConfidenceThreshold, IDictionary serializedAdditionalRawData) { LivenessOperationMode = livenessOperationMode; - SendResultsToClient = sendResultsToClient; DeviceCorrelationIdSetInClient = deviceCorrelationIdSetInClient; EnableSessionImage = enableSessionImage; - LivenessSingleModalModel = livenessSingleModalModel; + LivenessModelVersion = livenessModelVersion; DeviceCorrelationId = deviceCorrelationId; AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; ReturnVerifyImageHash = returnVerifyImageHash; @@ -84,21 +82,19 @@ 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; } /// 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. + /// 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; } } } 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 b969512f54ce7..0000000000000 --- 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 3754a02174790..7cdaf46074afb 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/Docs/FaceSessionClient.xml +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/Docs/FaceSessionClient.xml @@ -11,12 +11,11 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, DeviceCorrelationIdSetInClient = true, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, }; -Response response = await client.CreateLivenessSessionAsync(body); +Response response = await client.CreateLivenessSessionAsync(body); ]]> @@ -29,12 +28,11 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, DeviceCorrelationIdSetInClient = true, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, }; -Response response = client.CreateLivenessSession(body); +Response response = client.CreateLivenessSession(body); ]]> @@ -48,7 +46,6 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { livenessOperationMode = "Passive", - sendResultsToClient = true, deviceCorrelationIdSetInClient = true, deviceCorrelationId = "your_device_correlation_id", authTokenTimeToLiveInSeconds = 60, @@ -58,6 +55,9 @@ Response response = await client.CreateLivenessSessionAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("sessionId").ToString()); Console.WriteLine(result.GetProperty("authToken").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> @@ -71,7 +71,6 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { livenessOperationMode = "Passive", - sendResultsToClient = true, deviceCorrelationIdSetInClient = true, deviceCorrelationId = "your_device_correlation_id", authTokenTimeToLiveInSeconds = 60, @@ -81,6 +80,9 @@ 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 +144,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 +162,11 @@ 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()); -]]> - - - -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. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response> response = await client.GetLivenessSessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e"); -]]> - - - -This sample shows how to call GetLivenessSessionAuditEntries. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response> response = client.GetLivenessSessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e"); -]]> - - - -This sample shows how to call GetLivenessSessionAuditEntriesAsync 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); - -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 GetLivenessSessionAuditEntries 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); - -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("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> @@ -350,10 +228,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 +252,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 f3f4c70329eeb..adbfcc65c8554 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); } /// @@ -394,269 +394,19 @@ public virtual Response GetLivenessSessionResult(string sessionId, RequestContex } } - /// 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, default, 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); - 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, default, 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); - 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) + 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); + return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response); } /// Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call. @@ -664,14 +414,14 @@ internal virtual async Task> Cre /// 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) + 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); + return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response); } /// @@ -755,14 +505,14 @@ internal virtual Response CreateLivenessWithVerifySession(RequestContent content /// 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) + 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); + return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response); } /// Create a new liveness session with verify. Provide the verify image during session creation. @@ -770,14 +520,14 @@ internal virtual async Task> Cre /// 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) + 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); + return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response); } /// @@ -1040,256 +790,6 @@ 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, default, 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); - 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 /detectLivenessWithVerify/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 GetLivenessWithVerifySessionsAsync(string start, int? top, RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessions"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessWithVerifySessionsRequest(start, top, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Lists sessions for /detectLivenessWithVerify/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 GetLivenessWithVerifySessions(string start, int? top, RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessions"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessWithVerifySessionsRequest(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-with-verify-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>> GetLivenessWithVerifySessionAuditEntriesAsync(string sessionId, string start = null, int? top = null, 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, default, 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-with-verify-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> GetLivenessWithVerifySessionAuditEntries(string sessionId, string start = null, int? top = null, 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); - 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-with-verify-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 GetLivenessWithVerifySessionAuditEntriesAsync(string sessionId, string start, int? top, RequestContext context) - { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionAuditEntries"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessWithVerifySessionAuditEntriesRequest(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-with-verify-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 GetLivenessWithVerifySessionAuditEntries(string sessionId, string start, int? top, RequestContext context) - { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionAuditEntries"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessWithVerifySessionAuditEntriesRequest(sessionId, start, top, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - /// Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and attributes. /// Id of session image. /// The 'detectionModel' associated with the detected faceIds. Supported 'detectionModel' values include 'detection_01', 'detection_02' and 'detection_03'. The default value is 'detection_01'. 'detection_03' is recommended since its accuracy is improved on smaller faces (64x64 pixels) and rotated face orientations. @@ -1563,7 +1063,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 +1073,14 @@ internal HttpMessage CreateCreateLivenessSessionRequest(RequestContent content, internal HttpMessage CreateDeleteLivenessSessionRequest(string sessionId, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLiveness/singleModal/sessions/", false); + uri.AppendPath("/detectLiveness-sessions/", false); uri.AppendPath(sessionId, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1596,61 +1096,13 @@ 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("/detectLiveness-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(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); @@ -1660,7 +1112,7 @@ internal HttpMessage CreateCreateLivenessWithVerifySessionRequest(RequestContent 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", "application/json"); @@ -1677,7 +1129,7 @@ internal HttpMessage CreateCreateLivenessWithVerifySessionWithVerifyImageRequest uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions", false); + uri.AppendPath("/detectLivenessWithVerify-sessions", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", contentType); @@ -1687,14 +1139,14 @@ internal HttpMessage CreateCreateLivenessWithVerifySessionWithVerifyImageRequest internal HttpMessage CreateDeleteLivenessWithVerifySessionRequest(string sessionId, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions/", false); + uri.AppendPath("/detectLivenessWithVerify-sessions/", false); uri.AppendPath(sessionId, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1710,56 +1162,8 @@ internal HttpMessage CreateGetLivenessWithVerifySessionResultRequest(string sess uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions/", false); - uri.AppendPath(sessionId, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetLivenessWithVerifySessionsRequest(string start, int? top, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/face/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions", false); - if (start != null) - { - uri.AppendQuery("start", start, true); - } - if (top != null) - { - uri.AppendQuery("top", top.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetLivenessWithVerifySessionAuditEntriesRequest(string sessionId, string start, int? top, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/face/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions/", false); + uri.AppendPath("/detectLivenessWithVerify-sessions/", false); uri.AppendPath(sessionId, true); - uri.AppendPath("/audit", false); - if (start != null) - { - uri.AppendQuery("start", start, true); - } - if (top != null) - { - uri.AppendQuery("top", top.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1819,7 +1223,7 @@ internal HttpMessage CreateGetSessionImageRequest(string sessionImageId, Request uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/session/sessionImages/", false); + uri.AppendPath("/sessionImages/", false); uri.AppendPath(sessionImageId, true); request.Uri = uri; request.Headers.Add("Accept", "application/octet-stream"); @@ -1839,5 +1243,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 6c583b3333536..0000000000000 --- 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 2d63f135f43cb..3b5dcf4360c22 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". 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 0944da52e3a81..a64efc9894194 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". 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 64% 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 438a65f6179a8..d2fe8b67e4b5a 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class CreateLivenessSessionResult : IUtf8JsonSerializable, IJsonModel + public partial class LivenessColorDecisionTarget : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,16 +28,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CreateLivenessSessionResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support writing '{format}' format."); } - writer.WritePropertyName("sessionId"u8); - writer.WriteStringValue(SessionId); - writer.WritePropertyName("authToken"u8); - writer.WriteStringValue(AuthToken); + writer.WritePropertyName("faceRectangle"u8); + writer.WriteObjectValue(FaceRectangle, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -55,19 +53,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CreateLivenessSessionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessColorDecisionTarget IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CreateLivenessSessionResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateLivenessSessionResult(document.RootElement, options); + return DeserializeLivenessColorDecisionTarget(document.RootElement, options); } - internal static CreateLivenessSessionResult DeserializeCreateLivenessSessionResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessColorDecisionTarget DeserializeLivenessColorDecisionTarget(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -75,20 +73,14 @@ internal static CreateLivenessSessionResult DeserializeCreateLivenessSessionResu { return null; } - string sessionId = default; - string authToken = default; + FaceRectangle faceRectangle = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sessionId"u8)) + if (property.NameEquals("faceRectangle"u8)) { - sessionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("authToken"u8)) - { - authToken = property.Value.GetString(); + faceRectangle = FaceRectangle.DeserializeFaceRectangle(property.Value, options); continue; } if (options.Format != "W") @@ -97,46 +89,46 @@ internal static CreateLivenessSessionResult DeserializeCreateLivenessSessionResu } } serializedAdditionalRawData = rawDataDictionary; - return new CreateLivenessSessionResult(sessionId, authToken, serializedAdditionalRawData); + return new LivenessColorDecisionTarget(faceRectangle, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(CreateLivenessSessionResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support writing '{options.Format}' format."); } } - CreateLivenessSessionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessColorDecisionTarget IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - 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); - 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 4469cf9f8d50f..9a04763a6e3d6 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 0000000000000..24712d6eadad4 --- /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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LivenessDecisionTargets IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LivenessDecisionTargets)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLivenessDecisionTargets(document.RootElement, options); + } + + internal static LivenessDecisionTargets DeserializeLivenessDecisionTargets(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + LivenessColorDecisionTarget color = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("color"u8)) + { + color = LivenessColorDecisionTarget.DeserializeLivenessColorDecisionTarget(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LivenessDecisionTargets(color, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LivenessDecisionTargets)} does not support writing '{options.Format}' format."); + } + } + + LivenessDecisionTargets IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + 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); + 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 0000000000000..8e64b0560f732 --- /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 56% 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 52dec9c3870d5..cd842d62758d8 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class AuditLivenessResponseInfo : IUtf8JsonSerializable, IJsonModel + public partial class LivenessError : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,18 +28,18 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AuditLivenessResponseInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessError)} does not support writing '{format}' format."); } - writer.WritePropertyName("body"u8); - writer.WriteObjectValue(Body, options); - writer.WritePropertyName("statusCode"u8); - writer.WriteNumberValue(StatusCode); - writer.WritePropertyName("latencyInMilliseconds"u8); - writer.WriteNumberValue(LatencyInMilliseconds); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + writer.WritePropertyName("targets"u8); + writer.WriteObjectValue(Targets, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -57,19 +57,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AuditLivenessResponseInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AuditLivenessResponseInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessError)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAuditLivenessResponseInfo(document.RootElement, options); + return DeserializeLivenessError(document.RootElement, options); } - internal static AuditLivenessResponseInfo DeserializeAuditLivenessResponseInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessError DeserializeLivenessError(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -77,26 +77,26 @@ internal static AuditLivenessResponseInfo DeserializeAuditLivenessResponseInfo(J { return null; } - LivenessResponseBody body = default; - int statusCode = default; - long latencyInMilliseconds = default; + string code = default; + string message = default; + LivenessDecisionTargets targets = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("body"u8)) + if (property.NameEquals("code"u8)) { - body = LivenessResponseBody.DeserializeLivenessResponseBody(property.Value, options); + code = property.Value.GetString(); continue; } - if (property.NameEquals("statusCode"u8)) + if (property.NameEquals("message"u8)) { - statusCode = property.Value.GetInt32(); + message = property.Value.GetString(); continue; } - if (property.NameEquals("latencyInMilliseconds"u8)) + if (property.NameEquals("targets"u8)) { - latencyInMilliseconds = property.Value.GetInt64(); + targets = LivenessDecisionTargets.DeserializeLivenessDecisionTargets(property.Value, options); continue; } if (options.Format != "W") @@ -105,46 +105,46 @@ internal static AuditLivenessResponseInfo DeserializeAuditLivenessResponseInfo(J } } serializedAdditionalRawData = rawDataDictionary; - return new AuditLivenessResponseInfo(body, statusCode, latencyInMilliseconds, serializedAdditionalRawData); + return new LivenessError(code, message, targets, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AuditLivenessResponseInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessError)} does not support writing '{options.Format}' format."); } } - AuditLivenessResponseInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - 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); - 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 0000000000000..4b38aa3b72607 --- /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 f5a0af9fc9671..8cf63b9317137 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 8f16749b1abde..0000000000000 --- 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)) - { - 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); - 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); - 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); - 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 5d831412b0a9a..0000000000000 --- 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/LivenessOutputsTarget.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.Serialization.cs similarity index 54% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.Serialization.cs index 0209b90744f9c..ec05f2c0f3af2 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.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 LivenessOutputsTarget : 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,20 +28,26 @@ 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(LivenessResult)} 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()); + 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)) + { + writer.WritePropertyName("sessionImageId"u8); + writer.WriteStringValue(SessionImageId); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -59,19 +65,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LivenessOutputsTarget 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(LivenessOutputsTarget)} 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 DeserializeLivenessOutputsTarget(document.RootElement, options); + return DeserializeLivenessResult(document.RootElement, options); } - internal static LivenessOutputsTarget DeserializeLivenessOutputsTarget(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessResult DeserializeLivenessResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -79,32 +85,36 @@ internal static LivenessOutputsTarget DeserializeLivenessOutputsTarget(JsonEleme { return null; } - FaceRectangle faceRectangle = default; - string fileName = default; - int timeOffsetWithinFile = default; - FaceImageType imageType = 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("faceRectangle"u8)) + if (property.NameEquals("livenessDecision"u8)) { - faceRectangle = FaceRectangle.DeserializeFaceRectangle(property.Value, options); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + livenessDecision = new FaceLivenessDecision(property.Value.GetString()); continue; } - if (property.NameEquals("fileName"u8)) + if (property.NameEquals("targets"u8)) { - fileName = property.Value.GetString(); + targets = LivenessDecisionTargets.DeserializeLivenessDecisionTargets(property.Value, options); continue; } - if (property.NameEquals("timeOffsetWithinFile"u8)) + if (property.NameEquals("digest"u8)) { - timeOffsetWithinFile = property.Value.GetInt32(); + digest = property.Value.GetString(); continue; } - if (property.NameEquals("imageType"u8)) + if (property.NameEquals("sessionImageId"u8)) { - imageType = new FaceImageType(property.Value.GetString()); + sessionImageId = property.Value.GetString(); continue; } if (options.Format != "W") @@ -113,46 +123,46 @@ internal static LivenessOutputsTarget DeserializeLivenessOutputsTarget(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new LivenessOutputsTarget(faceRectangle, fileName, timeOffsetWithinFile, imageType, 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); default: - throw new FormatException($"The model {nameof(LivenessOutputsTarget)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessResult)} does not support writing '{options.Format}' format."); } } - LivenessOutputsTarget 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); - return DeserializeLivenessOutputsTarget(document.RootElement, options); + return DeserializeLivenessResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(LivenessOutputsTarget)} 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 LivenessOutputsTarget FromResponse(Response response) + internal static LivenessResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeLivenessOutputsTarget(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 0000000000000..cf20e1fdeca9d --- /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 d246e8c5b8e3a..99b5f1ed89d7a 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,20 @@ 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("results"u8); + writer.WriteObjectValue(Results, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -102,68 +87,42 @@ 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; + 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)) { - id = property.Value.GetString(); + sessionId = property.Value.GetString(); continue; } - if (property.NameEquals("createdDateTime"u8)) + if (property.NameEquals("authToken"u8)) { - createdDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("sessionStartDateTime"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sessionStartDateTime = property.Value.GetDateTimeOffset("O"); + authToken = property.Value.GetString(); continue; } - if (property.NameEquals("sessionExpired"u8)) - { - sessionExpired = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("deviceCorrelationId"u8)) + if (property.NameEquals("status"u8)) { - deviceCorrelationId = property.Value.GetString(); + status = new OperationState(property.Value.GetString()); continue; } - if (property.NameEquals("authTokenTimeToLiveInSeconds"u8)) + if (property.NameEquals("modelVersion"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - authTokenTimeToLiveInSeconds = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new FaceSessionStatus(property.Value.GetString()); + modelVersion = new LivenessModel(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 +132,11 @@ internal static LivenessSession DeserializeLivenessSession(JsonElement element, } serializedAdditionalRawData = rawDataDictionary; return new LivenessSession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + 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 bda0898e67ff5..7a073ee5cd14e 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,34 @@ 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. + /// 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, 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; + Results = results; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -85,20 +83,14 @@ 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 results of the liveness session. + public LivenessSessionResults Results { get; } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.Serialization.cs similarity index 53% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.Serialization.cs index 66533f9170d96..624fd3a6a0aff 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class AuditRequestInfo : IUtf8JsonSerializable, IJsonModel + public partial class LivenessSessionAttempt : 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(LivenessSessionAttempt)} does not support writing '{format}' format."); } - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Url); - writer.WritePropertyName("method"u8); - writer.WriteStringValue(Method); - if (Optional.IsDefined(ContentLength)) + writer.WritePropertyName("attemptId"u8); + writer.WriteNumberValue(AttemptId); + writer.WritePropertyName("attemptStatus"u8); + writer.WriteStringValue(AttemptStatus.ToString()); + if (Optional.IsDefined(Result)) { - writer.WritePropertyName("contentLength"u8); - writer.WriteNumberValue(ContentLength.Value); + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); } - writer.WritePropertyName("contentType"u8); - writer.WriteStringValue(ContentType); - if (Optional.IsDefined(UserAgent)) + if (Optional.IsDefined(Error)) { - writer.WritePropertyName("userAgent"u8); - writer.WriteStringValue(UserAgent); + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error, options); } 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) + LivenessSessionAttempt 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(LivenessSessionAttempt)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAuditRequestInfo(document.RootElement, options); + return DeserializeLivenessSessionAttempt(document.RootElement, options); } - internal static AuditRequestInfo DeserializeAuditRequestInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessSessionAttempt DeserializeLivenessSessionAttempt(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -87,42 +85,40 @@ internal static AuditRequestInfo DeserializeAuditRequestInfo(JsonElement element { return null; } - string url = default; - string method = default; - long? contentLength = default; - string contentType = default; - string userAgent = default; + int attemptId = default; + AttemptStatus attemptStatus = default; + LivenessResult result = default; + LivenessError error = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("url"u8)) + if (property.NameEquals("attemptId"u8)) { - url = property.Value.GetString(); + attemptId = property.Value.GetInt32(); continue; } - if (property.NameEquals("method"u8)) + if (property.NameEquals("attemptStatus"u8)) { - method = property.Value.GetString(); + attemptStatus = new AttemptStatus(property.Value.GetString()); continue; } - if (property.NameEquals("contentLength"u8)) + if (property.NameEquals("result"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - contentLength = property.Value.GetInt64(); + result = LivenessResult.DeserializeLivenessResult(property.Value, options); continue; } - if (property.NameEquals("contentType"u8)) + if (property.NameEquals("error"u8)) { - contentType = property.Value.GetString(); - continue; - } - if (property.NameEquals("userAgent"u8)) - { - userAgent = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = LivenessError.DeserializeLivenessError(property.Value, options); continue; } if (options.Format != "W") @@ -131,52 +127,46 @@ internal static AuditRequestInfo DeserializeAuditRequestInfo(JsonElement element } } serializedAdditionalRawData = rawDataDictionary; - return new AuditRequestInfo( - url, - method, - contentLength, - contentType, - userAgent, - serializedAdditionalRawData); + return new LivenessSessionAttempt(attemptId, attemptStatus, result, error, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AuditRequestInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessSessionAttempt)} does not support writing '{options.Format}' format."); } } - AuditRequestInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessSessionAttempt 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); - return DeserializeAuditRequestInfo(document.RootElement, options); + return DeserializeLivenessSessionAttempt(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AuditRequestInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessSessionAttempt)} 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 LivenessSessionAttempt FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeAuditRequestInfo(document.RootElement); + return DeserializeLivenessSessionAttempt(document.RootElement); } /// Convert into a . 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 0000000000000..ee054f17f8cee --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.cs @@ -0,0 +1,86 @@ +// 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, AttemptStatus attemptStatus) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + } + + /// 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. + /// Keeps track of any properties unknown to the library. + internal LivenessSessionAttempt(int attemptId, AttemptStatus attemptStatus, LivenessResult result, LivenessError error, IDictionary serializedAdditionalRawData) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + Result = result; + Error = error; + _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 AttemptStatus 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; } + } +} 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 46b364a13ffde..0000000000000 --- 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 453bf02974ef5..0000000000000 --- 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)) - { - 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); - 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); - 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); - 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 e46e4901a8a14..0000000000000 --- 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 0000000000000..5b2653c22dc03 --- /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)) + { + 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); + 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); + 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); + 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 0000000000000..1a3686a455775 --- /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 200d8861c932a..b25d56c5ed04f 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 45c6d6405b7fa..3abf91ab403f2 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 64% 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 df2fa817889b9..5088f9af37dec 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); 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); - 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); - 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 2cb09a6725eff..fe5f68bc902c3 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 54% 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 1c696b7056ace..306c7732a82e7 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); 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); - 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); - 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 0000000000000..730d5cac8f3c5 --- /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 667ff29fe29b8..70d71c35f34dc 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,20 @@ 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("results"u8); + writer.WriteObjectValue(Results, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -102,68 +87,42 @@ 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; + 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)) { - id = property.Value.GetString(); + sessionId = property.Value.GetString(); continue; } - if (property.NameEquals("createdDateTime"u8)) + if (property.NameEquals("authToken"u8)) { - createdDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("sessionStartDateTime"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sessionStartDateTime = property.Value.GetDateTimeOffset("O"); + authToken = property.Value.GetString(); continue; } - if (property.NameEquals("sessionExpired"u8)) - { - sessionExpired = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("deviceCorrelationId"u8)) + if (property.NameEquals("status"u8)) { - deviceCorrelationId = property.Value.GetString(); + status = new OperationState(property.Value.GetString()); continue; } - if (property.NameEquals("authTokenTimeToLiveInSeconds"u8)) + if (property.NameEquals("modelVersion"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - authTokenTimeToLiveInSeconds = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new FaceSessionStatus(property.Value.GetString()); + modelVersion = new LivenessModel(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 +132,11 @@ internal static LivenessWithVerifySession DeserializeLivenessWithVerifySession(J } serializedAdditionalRawData = rawDataDictionary; return new LivenessWithVerifySession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + 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 9aaec1db8d474..5db8b918edbcf 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,34 @@ 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. + /// 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, 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; + Results = results; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -85,20 +83,14 @@ 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 results of the liveness with verify session. + public LivenessWithVerifySessionResults Results { get; } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.Serialization.cs similarity index 50% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.Serialization.cs index 3d7966b973a18..7b04661b624b3 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class CreateLivenessWithVerifySessionResult : IUtf8JsonSerializable, IJsonModel + public partial class LivenessWithVerifySessionAttempt : 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,25 @@ 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(LivenessWithVerifySessionAttempt)} does not support writing '{format}' format."); } - writer.WritePropertyName("sessionId"u8); - writer.WriteStringValue(SessionId); - writer.WritePropertyName("authToken"u8); - writer.WriteStringValue(AuthToken); - if (Optional.IsDefined(VerifyImage)) + writer.WritePropertyName("attemptId"u8); + writer.WriteNumberValue(AttemptId); + writer.WritePropertyName("attemptStatus"u8); + writer.WriteStringValue(AttemptStatus.ToString()); + if (Optional.IsDefined(Result)) { - writer.WritePropertyName("verifyImage"u8); - writer.WriteObjectValue(VerifyImage, options); + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error, options); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -60,19 +65,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CreateLivenessWithVerifySessionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessWithVerifySessionAttempt 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(LivenessWithVerifySessionAttempt)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateLivenessWithVerifySessionResult(document.RootElement, options); + return DeserializeLivenessWithVerifySessionAttempt(document.RootElement, options); } - internal static CreateLivenessWithVerifySessionResult DeserializeCreateLivenessWithVerifySessionResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessWithVerifySessionAttempt DeserializeLivenessWithVerifySessionAttempt(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -80,30 +85,40 @@ internal static CreateLivenessWithVerifySessionResult DeserializeCreateLivenessW { return null; } - string sessionId = default; - string authToken = default; - LivenessWithVerifyImage verifyImage = default; + int attemptId = default; + AttemptStatus attemptStatus = default; + LivenessWithVerifyResult result = default; + LivenessError error = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sessionId"u8)) + if (property.NameEquals("attemptId"u8)) + { + attemptId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("attemptStatus"u8)) { - sessionId = property.Value.GetString(); + attemptStatus = new AttemptStatus(property.Value.GetString()); continue; } - if (property.NameEquals("authToken"u8)) + if (property.NameEquals("result"u8)) { - authToken = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + result = LivenessWithVerifyResult.DeserializeLivenessWithVerifyResult(property.Value, options); continue; } - if (property.NameEquals("verifyImage"u8)) + if (property.NameEquals("error"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - verifyImage = LivenessWithVerifyImage.DeserializeLivenessWithVerifyImage(property.Value, options); + error = LivenessError.DeserializeLivenessError(property.Value, options); continue; } if (options.Format != "W") @@ -112,46 +127,46 @@ internal static CreateLivenessWithVerifySessionResult DeserializeCreateLivenessW } } serializedAdditionalRawData = rawDataDictionary; - return new CreateLivenessWithVerifySessionResult(sessionId, authToken, verifyImage, serializedAdditionalRawData); + return new LivenessWithVerifySessionAttempt(attemptId, attemptStatus, result, error, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifySessionAttempt)} does not support writing '{options.Format}' format."); } } - CreateLivenessWithVerifySessionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessWithVerifySessionAttempt 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); - return DeserializeCreateLivenessWithVerifySessionResult(document.RootElement, options); + return DeserializeLivenessWithVerifySessionAttempt(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifySessionAttempt)} 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 LivenessWithVerifySessionAttempt FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeCreateLivenessWithVerifySessionResult(document.RootElement); + return DeserializeLivenessWithVerifySessionAttempt(document.RootElement); } /// Convert into a . 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 0000000000000..2ec1f61b0c411 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.cs @@ -0,0 +1,86 @@ +// 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, AttemptStatus attemptStatus) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + } + + /// 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. + /// Keeps track of any properties unknown to the library. + internal LivenessWithVerifySessionAttempt(int attemptId, AttemptStatus attemptStatus, LivenessWithVerifyResult result, LivenessError error, IDictionary serializedAdditionalRawData) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + Result = result; + Error = error; + _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 AttemptStatus 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; } + } +} 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 0000000000000..0ba6c5568cf6a --- /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)) + { + 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); + 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); + 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); + 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 0000000000000..570a83f964c25 --- /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/OperationState.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/OperationState.cs new file mode 100644 index 0000000000000..11c8033fba6ad --- /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/tests/Generated/Samples/Samples_FaceSessionClient.cs b/sdk/face/Azure.AI.Vision.Face/tests/Generated/Samples/Samples_FaceSessionClient.cs index b793cf92c5e98..e83c30d430079 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 @@ -28,7 +28,6 @@ public void Example_LivenessSession_CreateLivenessSession_CreateLivenessSession( using RequestContent content = RequestContent.Create(new { livenessOperationMode = "Passive", - sendResultsToClient = true, deviceCorrelationIdSetInClient = true, deviceCorrelationId = "your_device_correlation_id", authTokenTimeToLiveInSeconds = 60, @@ -38,6 +37,9 @@ public void Example_LivenessSession_CreateLivenessSession_CreateLivenessSession( 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] @@ -51,7 +53,6 @@ public async Task Example_LivenessSession_CreateLivenessSession_CreateLivenessSe using RequestContent content = RequestContent.Create(new { livenessOperationMode = "Passive", - sendResultsToClient = true, deviceCorrelationIdSetInClient = true, deviceCorrelationId = "your_device_correlation_id", authTokenTimeToLiveInSeconds = 60, @@ -61,6 +62,9 @@ public async Task Example_LivenessSession_CreateLivenessSession_CreateLivenessSe 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] @@ -73,12 +77,11 @@ public void Example_LivenessSession_CreateLivenessSession_CreateLivenessSession_ CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, DeviceCorrelationIdSetInClient = true, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, }; - Response response = client.CreateLivenessSession(body); + Response response = client.CreateLivenessSession(body); } [Test] @@ -91,12 +94,11 @@ public async Task Example_LivenessSession_CreateLivenessSession_CreateLivenessSe CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, DeviceCorrelationIdSetInClient = true, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, }; - Response response = await client.CreateLivenessSessionAsync(body); + Response response = await client.CreateLivenessSessionAsync(body); } [Test] @@ -136,10 +138,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 +156,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] @@ -181,132 +185,6 @@ public async Task Example_LivenessSession_GetLivenessSessionResult_GetLivenessSe Response response = await client.GetLivenessSessionResultAsync("b12e033e-bda7-4b83-a211-e721c661f30e"); } - [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() - { - 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); - - 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_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries_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); - - 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_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries_Convenience() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = client.GetLivenessSessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_FaceSessionClient_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries_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"); - } - [Test] [Ignore("Only validating compilation of examples")] public void Example_LivenessWithVerifySession_DeleteLivenessWithVerifySession_DeleteLivenessWithVerifySession() @@ -344,10 +222,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 +246,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 +281,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/tsp-location.yaml b/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml index aa57e9f301423..6324559561d21 100644 --- a/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml +++ b/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/ai/Face -commit: 4037b28c1014648f4cfa6f8c965e45f2476652e2 +commit: 90209b38e895b0eaa776285ce8bfa7224e04e571 repo: Azure/azure-rest-api-specs additionalDirectories: [] From e911871dde212bd8cae9f20db578af5d01a17204 Mon Sep 17 00:00:00 2001 From: Han Chiang Date: Mon, 18 Nov 2024 08:12:20 +0000 Subject: [PATCH 2/3] Fix customization and temporary remove test and sample --- .../src/Custom/FaceSessionClient.cs | 4 +- .../FaceSessionClientTests.cs | 274 +++++++++--------- .../Sample2_DetectLivenessWithSession.cs | 96 +++--- .../Sample2_DetectLivenessWithSessionAsync.cs | 64 ++-- ...le3_DetectLivenessWithVerifyWithSession.cs | 114 ++++---- ...etectLivenessWithVerifyWithSessionAsync.cs | 68 ++--- 6 files changed, 310 insertions(+), 310 deletions(-) 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 dd468dfa95894..36d63cd4e99e4 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Custom/FaceSessionClient.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Custom/FaceSessionClient.cs @@ -19,7 +19,7 @@ public partial class FaceSessionClient /// 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) + public virtual async Task> CreateLivenessWithVerifySessionAsync(CreateLivenessWithVerifySessionContent jsonContent, Stream verifyImage, CancellationToken cancellationToken = default) { Argument.AssertNotNull(jsonContent, nameof(jsonContent)); @@ -39,7 +39,7 @@ public virtual async Task> Creat /// 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) + public virtual Response CreateLivenessWithVerifySession(CreateLivenessWithVerifySessionContent jsonContent, Stream verifyImage, CancellationToken cancellationToken = default) { Argument.AssertNotNull(jsonContent, nameof(jsonContent)); 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 49c92be1ef924..1fa3a7e578534 100644 --- a/sdk/face/Azure.AI.Vision.Face/tests/FaceSessionClient/FaceSessionClientTests.cs +++ b/sdk/face/Azure.AI.Vision.Face/tests/FaceSessionClient/FaceSessionClientTests.cs @@ -70,34 +70,34 @@ protected async Task Cleanup() _createdSessions.Clear(); } - protected void AssertAuditEntry(LivenessSessionAuditEntry auditEntry, 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); - } + // protected void AssertAuditEntry(LivenessSessionAuditEntry auditEntry, 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); + // } #region LivenessSession - protected async Task CreateLivenessSession(bool nonRecordingClient = false) + protected async Task CreateLivenessSession(bool nonRecordingClient = false) { var client = CreateSessionClient(nonRecordingClient: nonRecordingClient); @@ -123,7 +123,7 @@ public async Task TestCreateLivenessSession() Assert.IsNotNull(createResult.AuthToken); var getResponse = await client.GetLivenessSessionResultAsync(createResult.SessionId); - Assert.AreEqual(DeviceCorrelationId, getResponse.Value.DeviceCorrelationId); + // Assert.AreEqual(DeviceCorrelationId, getResponse.Value.DeviceCorrelationId); } [RecordedTest] @@ -137,18 +137,18 @@ public async Task TestListLivenessSessions() 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); - } + // 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.")] @@ -159,30 +159,30 @@ public async Task TestGetSessionResult(string sessionId) var response = await client.GetLivenessSessionResultAsync(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); + // 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); + // 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); + // [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); - } - } + // foreach (var auditEntry in response.Value) + // { + // AssertAuditEntry(auditEntry, sessionId); + // } + // } [RecordedTest] public async Task TestDeleteLivenessSessions() @@ -196,7 +196,7 @@ public async Task TestDeleteLivenessSessions() #endregion #region LivenessWithVerifySession - protected async Task CreateLivenessWithVerifySession(bool withVerifyImage, bool nonRecordingClient = false) + protected async Task CreateLivenessWithVerifySession(bool withVerifyImage, bool nonRecordingClient = false) { var client = CreateSessionClient(nonRecordingClient: nonRecordingClient); @@ -205,7 +205,7 @@ protected async Task CreateLivenessWithVe DeviceCorrelationId = DeviceCorrelationId, }; - Response createResponse = null; + Response createResponse = null; if (withVerifyImage) { @@ -222,16 +222,16 @@ protected async Task CreateLivenessWithVe return createResponse.Value; } - 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); - } + // 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 @@ -249,77 +249,77 @@ public async Task TestCreateLivenessWithVerifySession(bool withVerifyImage) 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); + // 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); + // 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); - } - } - - [PlaybackOnly("Requiring other components to send underlying liveness request.")] - [TestCase("56d976a9-130a-44e2-bb25-e84410f05b05")] - public async Task TestGetLivenessWithVerifySessionResult(string sessionId) - { - var client = CreateSessionClient(); - 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); - - foreach (var auditEntry in response.Value) - { - AssertAuditEntry(auditEntry, sessionId); - AssertVerifyResult(auditEntry.Response.Body.VerifyResult); - } - } + // [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); + // } + // } + + // [PlaybackOnly("Requiring other components to send underlying liveness request.")] + // [TestCase("56d976a9-130a-44e2-bb25-e84410f05b05")] + // public async Task TestGetLivenessWithVerifySessionResult(string sessionId) + // { + // var client = CreateSessionClient(); + // 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); + + // foreach (var auditEntry in response.Value) + // { + // AssertAuditEntry(auditEntry, sessionId); + // AssertVerifyResult(auditEntry.Response.Body.VerifyResult); + // } + // } [RecordedTest] public async Task TestDeleteLivenessWithVerifySessions() 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 e67219e9f3d14..9c9f1bca71ebf 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 @@ -18,7 +18,7 @@ public void CreateDetectLivenessSession(bool deleteSession) #region Snippet:CreateLivenessSession var createContent = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, + //SendResultsToClient = true, DeviceCorrelationId = Guid.NewGuid().ToString(), }; @@ -46,24 +46,24 @@ 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($"Status: {sessionResult.Status}"); - Console.WriteLine($"SessionStartDateTime: {sessionResult.SessionStartDateTime}"); - if (sessionResult.Result != null) { - WriteLivenessSessionAuditEntry(sessionResult.Result); - } + // 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($"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) - { - WriteLivenessSessionAuditEntry(auditEntry); - } + // var getAuditEntriesResponse = sessionClient.GetLivenessSessionAuditEntries(sessionId); + // foreach (var auditEntry in getAuditEntriesResponse.Value) + // { + // WriteLivenessSessionAuditEntry(auditEntry); + // } #endregion } @@ -72,44 +72,44 @@ public void ListDetectLivenessSessions() var sessionClient = CreateSessionClient(); #region Snippet:GetLivenessSessions - var listResponse = sessionClient.GetLivenessSessions(); - foreach (var session in listResponse.Value) - { - 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 listResponse = sessionClient.GetLivenessSessions(); + // foreach (var session in listResponse.Value) + // { + // 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}"); + // } #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}"); + // 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($" 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 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}"); + // } #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 36ccaba19085c..c9ea89019b998 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 @@ -18,7 +18,7 @@ public async Task CreateDetectLivenessSessionAsync(bool deleteSession) #region Snippet:CreateLivenessSessionAsync var createContent = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, + // SendResultsToClient = true, DeviceCorrelationId = Guid.NewGuid().ToString(), }; @@ -46,43 +46,43 @@ 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($"Status: {sessionResult.Status}"); - Console.WriteLine($"SessionStartDateTime: {sessionResult.SessionStartDateTime}"); - if (sessionResult.Result != null) { - WriteLivenessSessionAuditEntry(sessionResult.Result); - } + // 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($"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); - } + // var getAuditEntriesResponse = await sessionClient.GetLivenessSessionAuditEntriesAsync(sessionId); + // foreach (var auditEntry in getAuditEntriesResponse.Value) + // { + // WriteLivenessSessionAuditEntry(auditEntry); + // } #endregion } - public async Task ListDetectLivenessSessionsAsync() - { - var sessionClient = CreateSessionClient(); + // public async Task ListDetectLivenessSessionsAsync() + // { + // var sessionClient = CreateSessionClient(); - #region Snippet:GetLivenessSessionsAsync - var listResponse = await sessionClient.GetLivenessSessionsAsync(); - foreach (var session in listResponse.Value) - { - 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}"); - } - #endregion - } + // #region Snippet:GetLivenessSessionsAsync + // var listResponse = await sessionClient.GetLivenessSessionsAsync(); + // foreach (var session in listResponse.Value) + // { + // 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}"); + // } + // #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 bdbfd21440318..70ce0c9d37f0d 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 @@ -21,7 +21,7 @@ public void CreateDetectLivenessWithVerifySession(bool deleteSession) #region Snippet:CreateLivenessWithVerifySession var parameters = new CreateLivenessWithVerifySessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, + // SendResultsToClient = true, DeviceCorrelationId = Guid.NewGuid().ToString(), }; @@ -32,8 +32,8 @@ public void CreateDetectLivenessWithVerifySession(bool deleteSession) 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}"); + // 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}"); #endregion if (deleteSession) @@ -53,24 +53,24 @@ 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($"Status: {sessionResult.Status}"); - Console.WriteLine($"SessionStartDateTime: {sessionResult.SessionStartDateTime}"); - if (sessionResult.Result != null) { - WriteLivenessWithVerifySessionAuditEntry(sessionResult.Result); - } + // 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($"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) - { - WriteLivenessWithVerifySessionAuditEntry(auditEntry); - } + // var getAuditEntriesResponse = sessionClient.GetLivenessWithVerifySessionAuditEntries(sessionId); + // foreach (var auditEntry in getAuditEntriesResponse.Value) + // { + // WriteLivenessWithVerifySessionAuditEntry(auditEntry); + // } #endregion } @@ -79,49 +79,49 @@ public void ListDetectLivenessWithVerifySessions() var sessionClient = CreateSessionClient(); #region Snippet:GetLivenessWithVerifySessions - var listResponse = sessionClient.GetLivenessWithVerifySessions(); - foreach (var session in listResponse.Value) - { - 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 listResponse = sessionClient.GetLivenessWithVerifySessions(); + // foreach (var session in listResponse.Value) + // { + // 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}"); + // } #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}"); - } + // 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}"); + // } #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 39e220103bae2..cf68ca2e9928f 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 @@ -20,7 +20,7 @@ public async Task CreateDetectLivenessWithVerifySessionAsync(bool deleteSession) #region Snippet:CreateLivenessWithVerifySessionAsync var parameters = new CreateLivenessWithVerifySessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, + // SendResultsToClient = true, DeviceCorrelationId = Guid.NewGuid().ToString(), }; @@ -31,8 +31,8 @@ public async Task CreateDetectLivenessWithVerifySessionAsync(bool deleteSession) 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}"); + // 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}"); #endregion if (deleteSession) @@ -52,43 +52,43 @@ 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($"Status: {sessionResult.Status}"); - Console.WriteLine($"SessionStartDateTime: {sessionResult.SessionStartDateTime}"); - if (sessionResult.Result != null) { - WriteLivenessWithVerifySessionAuditEntry(sessionResult.Result); - } + // 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($"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); - } + // var getAuditEntriesResponse = await sessionClient.GetLivenessWithVerifySessionAuditEntriesAsync(sessionId); + // foreach (var auditEntry in getAuditEntriesResponse.Value) + // { + // WriteLivenessWithVerifySessionAuditEntry(auditEntry); + // } #endregion } - public async Task ListDetectLivenessWithVerifySessionsAsync() - { - var sessionClient = CreateSessionClient(); + // public async Task ListDetectLivenessWithVerifySessionsAsync() + // { + // var sessionClient = CreateSessionClient(); - #region Snippet:GetLivenessWithVerifySessionsAsync - var listResponse = await sessionClient.GetLivenessWithVerifySessionsAsync(); - foreach (var session in listResponse.Value) - { - 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}"); - } - #endregion - } + // #region Snippet:GetLivenessWithVerifySessionsAsync + // var listResponse = await sessionClient.GetLivenessWithVerifySessionsAsync(); + // foreach (var session in listResponse.Value) + // { + // 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}"); + // } + // #endregion + // } } } From 89ef8df84bc0e77835187aee364d04f247ff0f7d Mon Sep 17 00:00:00 2001 From: Han Chiang Date: Mon, 18 Nov 2024 08:18:12 +0000 Subject: [PATCH 3/3] Export API --- .../Azure.AI.Vision.Face.netstandard2.0.cs | 386 +++++++++--------- 1 file changed, 191 insertions(+), 195 deletions(-) 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 7394546e904f1..bccd672f299eb 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 @@ -46,13 +46,9 @@ public static partial class AIVisionFaceModelFactory { 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.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?)) { 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?), string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = default(int?), bool? returnVerifyImageHash = default(bool?), float? verifyConfidenceThreshold = default(float?)) { 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 +71,50 @@ 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?), Azure.AI.Vision.Face.LivenessSessionResults results = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessSessionAttempt LivenessSessionAttempt(int attemptId = 0, Azure.AI.Vision.Face.AttemptStatus attemptStatus = default(Azure.AI.Vision.Face.AttemptStatus), Azure.AI.Vision.Face.LivenessResult result = null, Azure.AI.Vision.Face.LivenessError error = 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?), Azure.AI.Vision.Face.LivenessWithVerifySessionResults results = null) { throw null; } + public static Azure.AI.Vision.Face.LivenessWithVerifySessionAttempt LivenessWithVerifySessionAttempt(int attemptId = 0, Azure.AI.Vision.Face.AttemptStatus attemptStatus = default(Azure.AI.Vision.Face.AttemptStatus), Azure.AI.Vision.Face.LivenessWithVerifyResult result = null, Azure.AI.Vision.Face.LivenessError error = 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 + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AttemptStatus : System.IEquatable { - 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; } + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AttemptStatus(string value) { throw null; } + public static Azure.AI.Vision.Face.AttemptStatus Canceled { get { throw null; } } + public static Azure.AI.Vision.Face.AttemptStatus Failed { get { throw null; } } + public static Azure.AI.Vision.Face.AttemptStatus Success { get { throw null; } } + public bool Equals(Azure.AI.Vision.Face.AttemptStatus 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.AttemptStatus left, Azure.AI.Vision.Face.AttemptStatus right) { throw null; } + public static implicit operator Azure.AI.Vision.Face.AttemptStatus (string value) { throw null; } + public static bool operator !=(Azure.AI.Vision.Face.AttemptStatus left, Azure.AI.Vision.Face.AttemptStatus right) { throw null; } + public override string ToString() { 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_2) { } public enum ServiceVersion { V1_1_Preview_1 = 1, V1_2_Preview_1 = 2, + V1_2 = 3, } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -162,9 +155,8 @@ 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 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 { } } 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) { } @@ -172,18 +164,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 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) { } @@ -191,10 +171,9 @@ public CreateLivenessWithVerifySessionContent(Azure.AI.Vision.Face.LivenessOpera 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 bool? ReturnVerifyImageHash { get { throw null; } set { } } - public bool? SendResultsToClient { get { throw null; } set { } } public float? VerifyConfidenceThreshold { get { throw null; } set { } } 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; } @@ -203,19 +182,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() { } @@ -606,12 +572,12 @@ 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 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 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; } @@ -620,54 +586,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() { } @@ -996,14 +927,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; } @@ -1032,46 +997,28 @@ 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 + public partial class LivenessResult : 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 - { - 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 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) { } @@ -1079,60 +1026,36 @@ 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 int AttemptId { get { throw null; } } + public Azure.AI.Vision.Face.AttemptStatus AttemptStatus { 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) { } @@ -1140,17 +1063,43 @@ 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 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) { } @@ -1158,6 +1107,32 @@ 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 int AttemptId { get { throw null; } } + public Azure.AI.Vision.Face.AttemptStatus AttemptStatus { 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() { } @@ -1235,6 +1210,27 @@ 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; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct QualityForRecognition : System.IEquatable { private readonly object _dummy;