From 7ee728914ed34aa06057ee3e226b638205e19f6a Mon Sep 17 00:00:00 2001 From: Yuan Yang Date: Thu, 26 Jul 2018 11:25:01 -0700 Subject: [PATCH 1/2] Update Face C# SDK auto-generated code. --- .../Vision/Face/Face.Tests/BaseTests.cs | 5 +- .../Vision/Face/Face/Generated/FaceClient.cs | 124 ++---------------- .../Face/Face/Generated/FaceListOperations.cs | 78 ++++++++--- .../Face/Face/Generated/FaceOperations.cs | 75 +++++++++-- .../Vision/Face/Face/Generated/IFaceClient.cs | 7 +- .../Face/Generated/IFaceListOperations.cs | 3 + .../Face/Face/Generated/IFaceOperations.cs | 6 + .../Face/Generated/IPersonGroupOperations.cs | 3 + .../Face/Generated/PersonGroupOperations.cs | 69 ++++++++-- .../Face/Face/Generated/PersonGroupPerson.cs | 90 ++++++++++--- .../cognitiveservices_data-plane_Face.txt | 6 +- 11 files changed, 281 insertions(+), 185 deletions(-) diff --git a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face.Tests/BaseTests.cs b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face.Tests/BaseTests.cs index d5d70e359bce3..cc97865175014 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face.Tests/BaseTests.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face.Tests/BaseTests.cs @@ -17,7 +17,10 @@ static BaseTests() protected IFaceClient GetFaceClient(DelegatingHandler handler) { - IFaceClient client = new FaceClient(new ApiKeyServiceClientCredentials(FaceSubscriptionKey), handlers: handler); + IFaceClient client = new FaceClient(new ApiKeyServiceClientCredentials(FaceSubscriptionKey), handlers: handler) + { + Endpoint = "https://westus.api.cognitive.microsoft.com" + }; return client; } diff --git a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/FaceClient.cs b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/FaceClient.cs index b33b1ce7578c2..e6eccdad40839 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/FaceClient.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/FaceClient.cs @@ -27,7 +27,7 @@ public partial class FaceClient : ServiceClient, IFaceClient /// /// The base URI of the service. /// - public System.Uri BaseUri { get; set; } + internal string BaseUri {get; set;} /// /// Gets or sets json serialization settings. @@ -39,6 +39,12 @@ public partial class FaceClient : ServiceClient, IFaceClient /// public JsonSerializerSettings DeserializationSettings { get; private set; } + /// + /// Supported Cognitive Services endpoints (protocol and hostname, for example: + /// https://westus.api.cognitive.microsoft.com). + /// + public string Endpoint { get; set; } + /// /// Subscription credentials which uniquely identify client subscription. /// @@ -89,51 +95,6 @@ protected FaceClient(HttpClientHandler rootHandler, params DelegatingHandler[] h Initialize(); } - /// - /// Initializes a new instance of the FaceClient class. - /// - /// - /// Optional. The base URI of the service. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - protected FaceClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) - { - if (baseUri == null) - { - throw new System.ArgumentNullException("baseUri"); - } - BaseUri = baseUri; - } - - /// - /// Initializes a new instance of the FaceClient class. - /// - /// - /// Optional. The base URI of the service. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - protected FaceClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) - { - if (baseUri == null) - { - throw new System.ArgumentNullException("baseUri"); - } - BaseUri = baseUri; - } - /// /// Initializes a new instance of the FaceClient class. /// @@ -187,75 +148,6 @@ public FaceClient(ServiceClientCredentials credentials, HttpClientHandler rootHa } } - /// - /// Initializes a new instance of the FaceClient class. - /// - /// - /// Optional. The base URI of the service. - /// - /// - /// Required. Subscription credentials which uniquely identify client subscription. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - public FaceClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) - { - if (baseUri == null) - { - throw new System.ArgumentNullException("baseUri"); - } - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - BaseUri = baseUri; - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// Initializes a new instance of the FaceClient class. - /// - /// - /// Optional. The base URI of the service. - /// - /// - /// Required. Subscription credentials which uniquely identify client subscription. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - public FaceClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) - { - if (baseUri == null) - { - throw new System.ArgumentNullException("baseUri"); - } - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - BaseUri = baseUri; - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - /// /// An optional partial-method to perform custom initialization. /// @@ -269,7 +161,7 @@ private void Initialize() PersonGroupPerson = new PersonGroupPerson(this); PersonGroup = new PersonGroupOperations(this); FaceList = new FaceListOperations(this); - BaseUri = new System.Uri("https://api.cognitive.microsoft.com/face/v1.0"); + BaseUri = "{Endpoint}/face/v1.0"; SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, diff --git a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/FaceListOperations.cs b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/FaceListOperations.cs index f28aff527ca0f..662d9ec890414 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/FaceListOperations.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/FaceListOperations.cs @@ -83,6 +83,10 @@ public FaceListOperations(FaceClient client) /// public async Task CreateWithHttpMessagesAsync(string faceListId, string name = default(string), string userData = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (faceListId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "faceListId"); @@ -131,8 +135,9 @@ public FaceListOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "facelists/{faceListId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "facelists/{faceListId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{faceListId}", System.Uri.EscapeDataString(faceListId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); @@ -251,6 +256,10 @@ public FaceListOperations(FaceClient client) /// public async Task> GetWithHttpMessagesAsync(string faceListId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (faceListId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "faceListId"); @@ -278,8 +287,9 @@ public FaceListOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "facelists/{faceListId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "facelists/{faceListId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{faceListId}", System.Uri.EscapeDataString(faceListId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); @@ -413,6 +423,10 @@ public FaceListOperations(FaceClient client) /// public async Task UpdateWithHttpMessagesAsync(string faceListId, string name = default(string), string userData = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (faceListId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "faceListId"); @@ -461,8 +475,9 @@ public FaceListOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "facelists/{faceListId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "facelists/{faceListId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{faceListId}", System.Uri.EscapeDataString(faceListId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); @@ -579,6 +594,10 @@ public FaceListOperations(FaceClient client) /// public async Task DeleteWithHttpMessagesAsync(string faceListId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (faceListId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "faceListId"); @@ -606,8 +625,9 @@ public FaceListOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "facelists/{faceListId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "facelists/{faceListId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{faceListId}", System.Uri.EscapeDataString(faceListId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); @@ -707,11 +727,21 @@ public FaceListOperations(FaceClient client) /// /// Thrown when unable to deserialize the response /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -723,8 +753,9 @@ public FaceListOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "facelists").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "facelists"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -855,6 +886,10 @@ public FaceListOperations(FaceClient client) /// public async Task DeleteFaceWithHttpMessagesAsync(string faceListId, System.Guid persistedFaceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (faceListId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "faceListId"); @@ -883,8 +918,9 @@ public FaceListOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "DeleteFace", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "facelists/{faceListId}/persistedFaces/{persistedFaceId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "facelists/{faceListId}/persistedFaces/{persistedFaceId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{faceListId}", System.Uri.EscapeDataString(faceListId)); _url = _url.Replace("{persistedFaceId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(persistedFaceId, Client.SerializationSettings).Trim('"'))); // Create HTTP transport objects @@ -1014,6 +1050,10 @@ public FaceListOperations(FaceClient client) /// public async Task> AddFaceFromUrlWithHttpMessagesAsync(string faceListId, string url, string userData = default(string), IList targetFace = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (faceListId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "faceListId"); @@ -1060,8 +1100,9 @@ public FaceListOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "AddFaceFromUrl", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "facelists/{faceListId}/persistedFaces").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "facelists/{faceListId}/persistedFaces"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{faceListId}", System.Uri.EscapeDataString(faceListId)); List _queryParameters = new List(); if (userData != null) @@ -1227,6 +1268,10 @@ public FaceListOperations(FaceClient client) /// public async Task> AddFaceFromStreamWithHttpMessagesAsync(string faceListId, Stream image, string userData = default(string), IList targetFace = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (faceListId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "faceListId"); @@ -1268,8 +1313,9 @@ public FaceListOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "AddFaceFromStream", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "facelists/{faceListId}/persistedFaces").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "facelists/{faceListId}/persistedFaces"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{faceListId}", System.Uri.EscapeDataString(faceListId)); List _queryParameters = new List(); if (userData != null) diff --git a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/FaceOperations.cs b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/FaceOperations.cs index 95a6b780dd3cd..7a4916535f7cf 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/FaceOperations.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/FaceOperations.cs @@ -88,11 +88,21 @@ public FaceOperations(FaceClient client) /// /// Thrown when unable to deserialize the response /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// public async Task>> FindSimilarWithHttpMessagesAsync(System.Guid faceId, string faceListId = default(string), IList faceIds = default(IList), int? maxNumOfCandidatesReturned = 20, FindSimilarMatchMode mode = default(FindSimilarMatchMode), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (faceListId != null) { if (faceListId.Length > 64) @@ -140,8 +150,9 @@ public FaceOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "FindSimilar", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "findsimilars").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "findsimilars"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -278,6 +289,10 @@ public FaceOperations(FaceClient client) /// public async Task> GroupWithHttpMessagesAsync(IList faceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (faceIds == null) { throw new ValidationException(ValidationRules.CannotBeNull, "faceIds"); @@ -306,8 +321,9 @@ public FaceOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Group", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "group").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "group"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -456,6 +472,10 @@ public FaceOperations(FaceClient client) /// public async Task>> IdentifyWithHttpMessagesAsync(string personGroupId, IList faceIds, int? maxNumOfCandidatesReturned = 1, double? confidenceThreshold = default(double?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -510,8 +530,9 @@ public FaceOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Identify", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "identify").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "identify"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -640,11 +661,21 @@ public FaceOperations(FaceClient client) /// /// Thrown when unable to deserialize the response /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// public async Task> VerifyFaceToFaceWithHttpMessagesAsync(System.Guid faceId1, System.Guid faceId2, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } VerifyFaceToFaceRequest body = new VerifyFaceToFaceRequest(); body.FaceId1 = faceId1; body.FaceId2 = faceId2; @@ -660,8 +691,9 @@ public FaceOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "VerifyFaceToFace", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "verify").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "verify"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -813,6 +845,10 @@ public FaceOperations(FaceClient client) /// public async Task>> DetectWithUrlWithHttpMessagesAsync(string url, bool? returnFaceId = true, bool? returnFaceLandmarks = false, IList returnFaceAttributes = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (url == null) { throw new ValidationException(ValidationRules.CannotBeNull, "url"); @@ -837,8 +873,9 @@ public FaceOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "DetectWithUrl", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "detect").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "detect"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); List _queryParameters = new List(); if (returnFaceId != null) { @@ -1000,6 +1037,10 @@ public FaceOperations(FaceClient client) /// public async Task> VerifyFaceToPersonWithHttpMessagesAsync(System.Guid faceId, string personGroupId, System.Guid personId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -1034,8 +1075,9 @@ public FaceOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "VerifyFaceToPerson", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "verify").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "verify"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -1187,6 +1229,10 @@ public FaceOperations(FaceClient client) /// public async Task>> DetectWithStreamWithHttpMessagesAsync(Stream image, bool? returnFaceId = true, bool? returnFaceLandmarks = false, IList returnFaceAttributes = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (image == null) { throw new ValidationException(ValidationRules.CannotBeNull, "image"); @@ -1206,8 +1252,9 @@ public FaceOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "DetectWithStream", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "detect").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "detect"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); List _queryParameters = new List(); if (returnFaceId != null) { diff --git a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IFaceClient.cs b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IFaceClient.cs index 49a6f3239a846..c4e2551bbeb64 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IFaceClient.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IFaceClient.cs @@ -22,7 +22,6 @@ public partial interface IFaceClient : System.IDisposable /// /// The base URI of the service. /// - System.Uri BaseUri { get; set; } /// /// Gets or sets json serialization settings. @@ -34,6 +33,12 @@ public partial interface IFaceClient : System.IDisposable /// JsonSerializerSettings DeserializationSettings { get; } + /// + /// Supported Cognitive Services endpoints (protocol and hostname, for + /// example: https://westus.api.cognitive.microsoft.com). + /// + string Endpoint { get; set; } + /// /// Subscription credentials which uniquely identify client /// subscription. diff --git a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IFaceListOperations.cs b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IFaceListOperations.cs index 7c9e0fa181ade..1ed9a3f60022e 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IFaceListOperations.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IFaceListOperations.cs @@ -132,6 +132,9 @@ public partial interface IFaceListOperations /// /// Thrown when unable to deserialize the response /// + /// + /// Thrown when a required parameter is null + /// Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete an existing face from a face list (given by a diff --git a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IFaceOperations.cs b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IFaceOperations.cs index 10bf2c4928650..ac28c3b80c2dc 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IFaceOperations.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IFaceOperations.cs @@ -64,6 +64,9 @@ public partial interface IFaceOperations /// /// Thrown when unable to deserialize the response /// + /// + /// Thrown when a required parameter is null + /// Task>> FindSimilarWithHttpMessagesAsync(System.Guid faceId, string faceListId = default(string), IList faceIds = default(IList), int? maxNumOfCandidatesReturned = 20, FindSimilarMatchMode mode = default(FindSimilarMatchMode), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Divide candidate faces into groups based on face similarity. @@ -147,6 +150,9 @@ public partial interface IFaceOperations /// /// Thrown when unable to deserialize the response /// + /// + /// Thrown when a required parameter is null + /// Task> VerifyFaceToFaceWithHttpMessagesAsync(System.Guid faceId1, System.Guid faceId2, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Detect human faces in an image and returns face locations, and diff --git a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IPersonGroupOperations.cs b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IPersonGroupOperations.cs index c5e8b816437b1..7ec63eb607ad7 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IPersonGroupOperations.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/IPersonGroupOperations.cs @@ -163,6 +163,9 @@ public partial interface IPersonGroupOperations /// /// Thrown when unable to deserialize the response /// + /// + /// Thrown when a required parameter is null + /// Task>> ListWithHttpMessagesAsync(string start = default(string), int? top = 1000, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Queue a person group training task, the training task may not be diff --git a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/PersonGroupOperations.cs b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/PersonGroupOperations.cs index e3bbf5e3d0971..2e4e40712697e 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/PersonGroupOperations.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/PersonGroupOperations.cs @@ -83,6 +83,10 @@ public PersonGroupOperations(FaceClient client) /// public async Task CreateWithHttpMessagesAsync(string personGroupId, string name = default(string), string userData = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -131,8 +135,9 @@ public PersonGroupOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); @@ -249,6 +254,10 @@ public PersonGroupOperations(FaceClient client) /// public async Task DeleteWithHttpMessagesAsync(string personGroupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -276,8 +285,9 @@ public PersonGroupOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); @@ -391,6 +401,10 @@ public PersonGroupOperations(FaceClient client) /// public async Task> GetWithHttpMessagesAsync(string personGroupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -418,8 +432,9 @@ public PersonGroupOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); @@ -554,6 +569,10 @@ public PersonGroupOperations(FaceClient client) /// public async Task UpdateWithHttpMessagesAsync(string personGroupId, string name = default(string), string userData = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -602,8 +621,9 @@ public PersonGroupOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); @@ -722,6 +742,10 @@ public PersonGroupOperations(FaceClient client) /// public async Task> GetTrainingStatusWithHttpMessagesAsync(string personGroupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -749,8 +773,9 @@ public PersonGroupOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "GetTrainingStatus", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}/training").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}/training"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); @@ -873,11 +898,21 @@ public PersonGroupOperations(FaceClient client) /// /// Thrown when unable to deserialize the response /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// public async Task>> ListWithHttpMessagesAsync(string start = default(string), int? top = 1000, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (start != null) { if (start.Length > 64) @@ -906,8 +941,9 @@ public PersonGroupOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); List _queryParameters = new List(); if (start != null) { @@ -1048,6 +1084,10 @@ public PersonGroupOperations(FaceClient client) /// public async Task TrainWithHttpMessagesAsync(string personGroupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -1075,8 +1115,9 @@ public PersonGroupOperations(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Train", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}/train").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}/train"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); diff --git a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/PersonGroupPerson.cs b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/PersonGroupPerson.cs index 348ad7d718396..a276b317146f2 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/PersonGroupPerson.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Generated/PersonGroupPerson.cs @@ -85,6 +85,10 @@ public PersonGroupPerson(FaceClient client) /// public async Task> CreateWithHttpMessagesAsync(string personGroupId, string name = default(string), string userData = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -133,8 +137,9 @@ public PersonGroupPerson(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}/persons").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}/persons"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); @@ -280,6 +285,10 @@ public PersonGroupPerson(FaceClient client) /// public async Task>> ListWithHttpMessagesAsync(string personGroupId, string start = default(string), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -317,8 +326,9 @@ public PersonGroupPerson(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}/persons").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}/persons"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); List _queryParameters = new List(); if (start != null) @@ -463,6 +473,10 @@ public PersonGroupPerson(FaceClient client) /// public async Task DeleteWithHttpMessagesAsync(string personGroupId, System.Guid personId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -491,8 +505,9 @@ public PersonGroupPerson(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}/persons/{personId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}/persons/{personId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); _url = _url.Replace("{personId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(personId, Client.SerializationSettings).Trim('"'))); // Create HTTP transport objects @@ -610,6 +625,10 @@ public PersonGroupPerson(FaceClient client) /// public async Task> GetWithHttpMessagesAsync(string personGroupId, System.Guid personId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -638,8 +657,9 @@ public PersonGroupPerson(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}/persons/{personId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}/persons/{personId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); _url = _url.Replace("{personId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(personId, Client.SerializationSettings).Trim('"'))); // Create HTTP transport objects @@ -777,6 +797,10 @@ public PersonGroupPerson(FaceClient client) /// public async Task UpdateWithHttpMessagesAsync(string personGroupId, System.Guid personId, string name = default(string), string userData = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -826,8 +850,9 @@ public PersonGroupPerson(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}/persons/{personId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}/persons/{personId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); _url = _url.Replace("{personId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(personId, Client.SerializationSettings).Trim('"'))); // Create HTTP transport objects @@ -951,6 +976,10 @@ public PersonGroupPerson(FaceClient client) /// public async Task DeleteFaceWithHttpMessagesAsync(string personGroupId, System.Guid personId, System.Guid persistedFaceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -980,8 +1009,9 @@ public PersonGroupPerson(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "DeleteFace", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); _url = _url.Replace("{personId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(personId, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{persistedFaceId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(persistedFaceId, Client.SerializationSettings).Trim('"'))); @@ -1103,6 +1133,10 @@ public PersonGroupPerson(FaceClient client) /// public async Task> GetFaceWithHttpMessagesAsync(string personGroupId, System.Guid personId, System.Guid persistedFaceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -1132,8 +1166,9 @@ public PersonGroupPerson(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "GetFace", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); _url = _url.Replace("{personId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(personId, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{persistedFaceId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(persistedFaceId, Client.SerializationSettings).Trim('"'))); @@ -1272,6 +1307,10 @@ public PersonGroupPerson(FaceClient client) /// public async Task UpdateFaceWithHttpMessagesAsync(string personGroupId, System.Guid personId, System.Guid persistedFaceId, string userData = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -1314,8 +1353,9 @@ public PersonGroupPerson(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "UpdateFace", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); _url = _url.Replace("{personId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(personId, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{persistedFaceId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(persistedFaceId, Client.SerializationSettings).Trim('"'))); @@ -1454,6 +1494,10 @@ public PersonGroupPerson(FaceClient client) /// public async Task> AddPersonFaceFromUrlWithHttpMessagesAsync(string personGroupId, System.Guid personId, string url, string userData = default(string), IList targetFace = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -1501,8 +1545,9 @@ public PersonGroupPerson(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "AddPersonFaceFromUrl", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}/persons/{personId}/persistedFaces").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}/persons/{personId}/persistedFaces"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); _url = _url.Replace("{personId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(personId, Client.SerializationSettings).Trim('"'))); List _queryParameters = new List(); @@ -1671,6 +1716,10 @@ public PersonGroupPerson(FaceClient client) /// public async Task> AddPersonFaceFromStreamWithHttpMessagesAsync(string personGroupId, System.Guid personId, Stream image, string userData = default(string), IList targetFace = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } if (personGroupId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "personGroupId"); @@ -1713,8 +1762,9 @@ public PersonGroupPerson(FaceClient client) ServiceClientTracing.Enter(_invocationId, this, "AddPersonFaceFromStream", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "persongroups/{personGroupId}/persons/{personId}/persistedFaces").ToString(); + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "persongroups/{personGroupId}/persons/{personId}/persistedFaces"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); _url = _url.Replace("{personGroupId}", System.Uri.EscapeDataString(personGroupId)); _url = _url.Replace("{personId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(personId, Client.SerializationSettings).Trim('"'))); List _queryParameters = new List(); diff --git a/src/SDKs/_metadata/cognitiveservices_data-plane_Face.txt b/src/SDKs/_metadata/cognitiveservices_data-plane_Face.txt index 1d0f96d1d4b14..38539f334e345 100644 --- a/src/SDKs/_metadata/cognitiveservices_data-plane_Face.txt +++ b/src/SDKs/_metadata/cognitiveservices_data-plane_Face.txt @@ -4,15 +4,15 @@ Commencing code generation Generating CSharp code Executing AutoRest command cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cognitiveservices/data-plane/Face/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=E:\azure-sdk-for-net\src\SDKs -2018-07-06 17:36:25 UTC +2018-07-26 16:40:58 UTC 1) azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: 38e7746765ea9bfc0cd7b88ca79b50c565bc6a13 +Commit: 041b654bf0a93b81460a1fa4f0ae5b7c5a3ef00c 2) AutoRest information Requested version: latest -Bootstrapper version: autorest@2.0.4280 +Bootstrapper version: autorest@2.0.4282 Latest installed version: From 3046fabbbf93c81286209d166a57a4464ae98193 Mon Sep 17 00:00:00 2001 From: Yuan Yang Date: Thu, 26 Jul 2018 11:59:29 -0700 Subject: [PATCH 2/2] Bump version and update release notes. --- .../Face/Microsoft.Azure.CognitiveServices.Vision.Face.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Microsoft.Azure.CognitiveServices.Vision.Face.csproj b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Microsoft.Azure.CognitiveServices.Vision.Face.csproj index c199c42e33c42..c40fae52c6368 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Microsoft.Azure.CognitiveServices.Vision.Face.csproj +++ b/src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face/Microsoft.Azure.CognitiveServices.Vision.Face.csproj @@ -6,14 +6,14 @@ Microsoft.Azure.CognitiveServices.Vision.Face This client library provides access to the Microsoft Cognitive Services Face APIs. - 2.0.0-preview + 2.1.0-preview Microsoft.Azure.CognitiveServices.Vision.Face Microsoft Cognitive Services;Cognitive Services;Cognitive Services SDK;REST HTTP client;Face;Face API;Face SDK;Vision;netcore451511