Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update Face C# SDK auto-generated code. #4588

Merged
merged 2 commits into from Jul 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public partial class FaceClient : ServiceClient<FaceClient>, IFaceClient
/// <summary>
/// The base URI of the service.
/// </summary>
public System.Uri BaseUri { get; set; }
internal string BaseUri {get; set;}

/// <summary>
/// Gets or sets json serialization settings.
Expand All @@ -39,6 +39,12 @@ public partial class FaceClient : ServiceClient<FaceClient>, IFaceClient
/// </summary>
public JsonSerializerSettings DeserializationSettings { get; private set; }

/// <summary>
/// Supported Cognitive Services endpoints (protocol and hostname, for example:
/// https://westus.api.cognitive.microsoft.com).
/// </summary>
public string Endpoint { get; set; }

/// <summary>
/// Subscription credentials which uniquely identify client subscription.
/// </summary>
Expand Down Expand Up @@ -89,51 +95,6 @@ protected FaceClient(HttpClientHandler rootHandler, params DelegatingHandler[] h
Initialize();
}

/// <summary>
/// Initializes a new instance of the FaceClient class.
/// </summary>
/// <param name='baseUri'>
/// Optional. The base URI of the service.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
protected FaceClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers)
{
if (baseUri == null)
{
throw new System.ArgumentNullException("baseUri");
}
BaseUri = baseUri;
}

/// <summary>
/// Initializes a new instance of the FaceClient class.
/// </summary>
/// <param name='baseUri'>
/// Optional. The base URI of the service.
/// </param>
/// <param name='rootHandler'>
/// Optional. The http client handler used to handle http transport.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
protected FaceClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
{
if (baseUri == null)
{
throw new System.ArgumentNullException("baseUri");
}
BaseUri = baseUri;
}

/// <summary>
/// Initializes a new instance of the FaceClient class.
/// </summary>
Expand Down Expand Up @@ -187,75 +148,6 @@ public FaceClient(ServiceClientCredentials credentials, HttpClientHandler rootHa
}
}

/// <summary>
/// Initializes a new instance of the FaceClient class.
/// </summary>
/// <param name='baseUri'>
/// Optional. The base URI of the service.
/// </param>
/// <param name='credentials'>
/// Required. Subscription credentials which uniquely identify client subscription.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
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);
}
}

/// <summary>
/// Initializes a new instance of the FaceClient class.
/// </summary>
/// <param name='baseUri'>
/// Optional. The base URI of the service.
/// </param>
/// <param name='credentials'>
/// Required. Subscription credentials which uniquely identify client subscription.
/// </param>
/// <param name='rootHandler'>
/// Optional. The http client handler used to handle http transport.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
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);
}
}

/// <summary>
/// An optional partial-method to perform custom initialization.
///</summary>
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public FaceListOperations(FaceClient client)
/// </return>
public async Task<HttpOperationResponse> CreateWithHttpMessagesAsync(string faceListId, string name = default(string), string userData = default(string), Dictionary<string, List<string>> 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");
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -251,6 +256,10 @@ public FaceListOperations(FaceClient client)
/// </return>
public async Task<HttpOperationResponse<FaceList>> GetWithHttpMessagesAsync(string faceListId, Dictionary<string, List<string>> 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");
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -413,6 +423,10 @@ public FaceListOperations(FaceClient client)
/// </return>
public async Task<HttpOperationResponse> UpdateWithHttpMessagesAsync(string faceListId, string name = default(string), string userData = default(string), Dictionary<string, List<string>> 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");
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -579,6 +594,10 @@ public FaceListOperations(FaceClient client)
/// </return>
public async Task<HttpOperationResponse> DeleteWithHttpMessagesAsync(string faceListId, Dictionary<string, List<string>> 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");
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -707,11 +727,21 @@ public FaceListOperations(FaceClient client)
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<HttpOperationResponse<IList<FaceList>>> ListWithHttpMessagesAsync(Dictionary<string, List<string>> 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;
Expand All @@ -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;
Expand Down Expand Up @@ -855,6 +886,10 @@ public FaceListOperations(FaceClient client)
/// </return>
public async Task<HttpOperationResponse> DeleteFaceWithHttpMessagesAsync(string faceListId, System.Guid persistedFaceId, Dictionary<string, List<string>> 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");
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1014,6 +1050,10 @@ public FaceListOperations(FaceClient client)
/// </return>
public async Task<HttpOperationResponse<PersistedFace>> AddFaceFromUrlWithHttpMessagesAsync(string faceListId, string url, string userData = default(string), IList<int> targetFace = default(IList<int>), Dictionary<string, List<string>> 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");
Expand Down Expand Up @@ -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<string> _queryParameters = new List<string>();
if (userData != null)
Expand Down Expand Up @@ -1227,6 +1268,10 @@ public FaceListOperations(FaceClient client)
/// </return>
public async Task<HttpOperationResponse<PersistedFace>> AddFaceFromStreamWithHttpMessagesAsync(string faceListId, Stream image, string userData = default(string), IList<int> targetFace = default(IList<int>), Dictionary<string, List<string>> 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");
Expand Down Expand Up @@ -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<string> _queryParameters = new List<string>();
if (userData != null)
Expand Down
Loading