From 109e062666e48049f9cdd6f7803989bd3c893297 Mon Sep 17 00:00:00 2001 From: Evgeny Okhrimenko Date: Wed, 21 Dec 2022 15:49:18 +0200 Subject: [PATCH] PT-9563: use platform API for tokens --- .../AutoRestClients/PlatformModuleApi.cs | 11694 +++++++++------- .../Domain/Security/CustomUserManager.cs | 49 +- 2 files changed, 6465 insertions(+), 5278 deletions(-) diff --git a/VirtoCommerce.Storefront/AutoRestClients/PlatformModuleApi.cs b/VirtoCommerce.Storefront/AutoRestClients/PlatformModuleApi.cs index a40a40ac8..31fecf6ba 100644 --- a/VirtoCommerce.Storefront/AutoRestClients/PlatformModuleApi.cs +++ b/VirtoCommerce.Storefront/AutoRestClients/PlatformModuleApi.cs @@ -54,14 +54,9 @@ public partial class PlatformModuleClient : ServiceClient, public virtual IExternalSignIn ExternalSignIn { get; private set; } /// - /// Gets the IAssetEntryOperations. + /// Gets the IApps. /// - public virtual IAssetEntryOperations AssetEntry { get; private set; } - - /// - /// Gets the IAssets. - /// - public virtual IAssets Assets { get; private set; } + public virtual IApps Apps { get; private set; } /// /// Gets the IChangeLog. @@ -351,8 +346,7 @@ private void Initialize() { Authorization = new Authorization(this); ExternalSignIn = new ExternalSignIn(this); - AssetEntry = new AssetEntryOperations(this); - Assets = new Assets(this); + Apps = new Apps(this); ChangeLog = new ChangeLog(this); Diagnostics = new Diagnostics(this); DynamicProperties = new DynamicProperties(this); @@ -450,14 +444,9 @@ public partial interface IPlatformModuleClient : System.IDisposable IExternalSignIn ExternalSignIn { get; } /// - /// Gets the IAssetEntryOperations. - /// - IAssetEntryOperations AssetEntry { get; } - - /// - /// Gets the IAssets. + /// Gets the IApps. /// - IAssets Assets { get; } + IApps Apps { get; } /// /// Gets the IChangeLog. @@ -555,6 +544,8 @@ public Authorization(PlatformModuleClient client) /// public PlatformModuleClient Client { get; private set; } + /// + /// /// /// Headers that will be added to request. /// @@ -564,11 +555,28 @@ public Authorization(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// 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 ExchangeWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ExchangeWithHttpMessagesAsync(Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -576,6 +584,7 @@ public Authorization(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Exchange", tracingParameters); } @@ -604,6 +613,12 @@ public Authorization(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -624,7 +639,7 @@ public Authorization(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 400) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -647,9 +662,45 @@ public Authorization(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 400) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -683,6 +734,8 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi /// public partial interface IAuthorization { + /// + /// /// /// The headers that will be added to request. /// @@ -692,7 +745,13 @@ public partial interface IAuthorization /// /// Thrown when the operation returned an invalid status code /// - Task ExchangeWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ExchangeWithHttpMessagesAsync(Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // @@ -722,20 +781,27 @@ public static partial class AuthorizationExtensions /// /// The operations group for this extension method. /// - public static void Exchange(this IAuthorization operations) + /// + /// + public static OpenIddictResponse Exchange(this IAuthorization operations, Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema body) { - operations.ExchangeAsync().GetAwaiter().GetResult(); + return operations.ExchangeAsync(body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// + /// + /// /// /// The cancellation token. /// - public static async Task ExchangeAsync(this IAuthorization operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ExchangeAsync(this IAuthorization operations, Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema body, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.ExchangeWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ExchangeWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } } @@ -1294,12 +1360,12 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi using System.Threading.Tasks; /// - /// AssetEntryOperations operations. + /// Apps operations. /// - public partial class AssetEntryOperations : IServiceOperations, IAssetEntryOperations + public partial class Apps : IServiceOperations, IApps { /// - /// Initializes a new instance of the AssetEntryOperations class. + /// Initializes a new instance of the Apps class. /// /// /// Reference to the service client. @@ -1307,7 +1373,7 @@ public partial class AssetEntryOperations : IServiceOperations /// Thrown when a required parameter is null /// - public AssetEntryOperations(PlatformModuleClient client) + public Apps(PlatformModuleClient client) { if (client == null) { @@ -1321,11 +1387,6 @@ public AssetEntryOperations(PlatformModuleClient client) /// public PlatformModuleClient Client { get; private set; } - /// - /// SearchAsync for AssetEntries by AssetEntrySearchCriteria - /// - /// - /// /// /// Headers that will be added to request. /// @@ -1341,7 +1402,7 @@ public AssetEntryOperations(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> SearchWithHttpMessagesAsync(AssetEntrySearchCriteria body = default(AssetEntrySearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> GetAppsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1350,17 +1411,16 @@ public AssetEntryOperations(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Search", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetApps", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/assetentries/search").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/apps").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -1379,12 +1439,6 @@ public AssetEntryOperations(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -1405,7 +1459,7 @@ public AssetEntryOperations(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -1428,7 +1482,7 @@ public AssetEntryOperations(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -1437,7 +1491,7 @@ public AssetEntryOperations(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1456,12 +1510,148 @@ public AssetEntryOperations(PlatformModuleClient client) return _result; } + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Apps operations. + /// + public partial interface IApps + { + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task>> GetAppsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Apps. + /// + public static partial class AppsExtensions + { + /// + /// The operations group for this extension method. + /// + public static IList GetApps(this IApps operations) + { + return operations.GetAppsAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> GetAppsAsync(this IApps operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetAppsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ChangeLog operations. + /// + public partial class ChangeLog : IServiceOperations, IChangeLog + { /// - /// Get asset details by id + /// Initializes a new instance of the ChangeLog class. /// - /// + /// + /// Reference to the service client. /// - /// + /// + /// Thrown when a required parameter is null + /// + public ChangeLog(PlatformModuleClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PlatformModuleClient + /// + public PlatformModuleClient Client { get; private set; } + + /// + /// Force set changes last modified date + /// + /// /// /// /// Headers that will be added to request. @@ -1472,24 +1662,11 @@ public AssetEntryOperations(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// 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> GetWithHttpMessagesAsync(string id1, string id = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ForceChangesWithHttpMessagesAsync(string scope = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (id1 == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "id1"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1497,19 +1674,17 @@ public AssetEntryOperations(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("id", id); - tracingParameters.Add("id1", id1); + tracingParameters.Add("scope", scope); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ForceChanges", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/assetentries/{id}").ToString(); - _url = _url.Replace("{id}", System.Uri.EscapeDataString(id1)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/changes/force").ToString(); List _queryParameters = new List(); - if (id != null) + if (scope != null) { - _queryParameters.Add(string.Format("id={0}", System.Uri.EscapeDataString(id))); + _queryParameters.Add(string.Format("Scope={0}", System.Uri.EscapeDataString(scope))); } if (_queryParameters.Count > 0) { @@ -1518,7 +1693,7 @@ public AssetEntryOperations(PlatformModuleClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -1557,7 +1732,7 @@ public AssetEntryOperations(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -1580,39 +1755,16 @@ public AssetEntryOperations(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) + if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } - /// - /// Create / Update asset entry - /// - /// - /// /// /// Headers that will be added to request. /// @@ -1625,7 +1777,7 @@ public AssetEntryOperations(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(AssetEntry body = default(AssetEntry), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ResetPlatformCacheWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1634,17 +1786,16 @@ public AssetEntryOperations(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ResetPlatformCache", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/assetentries").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform-cache/reset").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -1663,12 +1814,6 @@ public AssetEntryOperations(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -1723,9 +1868,11 @@ public AssetEntryOperations(PlatformModuleClient client) } /// - /// Delete asset entries by ids + /// Get last modified date for given scope + /// Used for signal of what something changed and for cache invalidation in + /// external platform clients /// - /// + /// /// /// /// Headers that will be added to request. @@ -1736,10 +1883,13 @@ public AssetEntryOperations(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetLastModifiedDateWithHttpMessagesAsync(string scope = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1748,17 +1898,17 @@ public AssetEntryOperations(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("ids", ids); + tracingParameters.Add("scope", scope); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetLastModifiedDate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/assetentries").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/changes/lastmodifieddate").ToString(); List _queryParameters = new List(); - if (ids != null) + if (scope != null) { - _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); + _queryParameters.Add(string.Format("scope={0}", System.Uri.EscapeDataString(scope))); } if (_queryParameters.Count > 0) { @@ -1767,7 +1917,7 @@ public AssetEntryOperations(PlatformModuleClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -1806,7 +1956,7 @@ public AssetEntryOperations(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -1829,9 +1979,27 @@ public AssetEntryOperations(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1839,310 +2007,140 @@ public AssetEntryOperations(PlatformModuleClient client) return _result; } - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// AssetEntryOperations operations. - /// - public partial interface IAssetEntryOperations - { - /// - /// SearchAsync for AssetEntries by AssetEntrySearchCriteria - /// /// /// /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task> SearchWithHttpMessagesAsync(AssetEntrySearchCriteria body = default(AssetEntrySearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get asset details by id - /// - /// - /// - /// - /// - /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string id1, string id = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create / Update asset entry - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - Task UpdateWithHttpMessagesAsync(AssetEntry body = default(AssetEntry), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete asset entries by ids - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - Task DeleteWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for AssetEntryOperations. - /// - public static partial class AssetEntryOperationsExtensions - { - /// - /// SearchAsync for AssetEntries by AssetEntrySearchCriteria - /// - /// - /// The operations group for this extension method. - /// - /// - /// - public static AssetEntrySearchResult Search(this IAssetEntryOperations operations, AssetEntrySearchCriteria body = default(AssetEntrySearchCriteria)) + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetChangedEntitiesWithHttpMessagesAsync(ChangedEntitiesRequest body = default(ChangedEntitiesRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) { - return operations.SearchAsync(body).GetAwaiter().GetResult(); + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetChangedEntities", tracingParameters); } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/changes/changed-entities").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers - /// - /// SearchAsync for AssetEntries by AssetEntrySearchCriteria - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task SearchAsync(this IAssetEntryOperations operations, AssetEntrySearchCriteria body = default(AssetEntrySearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) + + if (customHeaders != null) { - using (var _result = await operations.SearchWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + foreach(var _header in customHeaders) { - return _result.Body; + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - /// - /// Get asset details by id - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// - public static AssetEntry Get(this IAssetEntryOperations operations, string id1, string id = default(string)) + // Serialize Request + string _requestContent = null; + if(body != null) { - return operations.GetAsync(id1, id).GetAwaiter().GetResult(); + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } - - /// - /// Get asset details by id - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAssetEntryOperations operations, string id1, string id = default(string), CancellationToken cancellationToken = default(CancellationToken)) + // Set Credentials + if (Client.Credentials != null) { - using (var _result = await operations.GetWithHttpMessagesAsync(id1, id, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } - - /// - /// Create / Update asset entry - /// - /// - /// The operations group for this extension method. - /// - /// - /// - public static void Update(this IAssetEntryOperations operations, AssetEntry body = default(AssetEntry)) - { - operations.UpdateAsync(body).GetAwaiter().GetResult(); + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } - - /// - /// Create / Update asset entry - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IAssetEntryOperations operations, AssetEntry body = default(AssetEntry), CancellationToken cancellationToken = default(CancellationToken)) + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) { - (await operations.UpdateWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - - /// - /// Delete asset entries by ids - /// - /// - /// The operations group for this extension method. - /// - /// - /// - public static void Delete(this IAssetEntryOperations operations, IList ids = default(IList)) + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) { - operations.DeleteAsync(ids).GetAwaiter().GetResult(); + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; } - - /// - /// Delete asset entries by ids - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IAssetEntryOperations operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) { - (await operations.DeleteWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } } - - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Assets operations. - /// - public partial class Assets : IServiceOperations, IAssets - { - /// - /// Initializes a new instance of the Assets class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public Assets(PlatformModuleClient client) - { - if (client == null) + if (_shouldTrace) { - throw new System.ArgumentNullException("client"); + ServiceClientTracing.Exit(_invocationId, _result); } - Client = client; + return _result; } - /// - /// Gets a reference to the PlatformModuleClient - /// - public PlatformModuleClient Client { get; private set; } - - /// - /// This method used to upload files on local disk storage in special uploads - /// folder - /// + /// + /// /// /// Headers that will be added to request. /// @@ -2152,13 +2150,10 @@ public Assets(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// A response object containing the response body and response headers. /// - public async Task>> UploadAssetToLocalFileSystemAsyncWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ResetChangedEntitiesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -2167,12 +2162,13 @@ public Assets(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UploadAssetToLocalFileSystemAsync", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ResetChangedEntities", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/assets/localstorage").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/changes/changed-entities/reset").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -2195,6 +2191,12 @@ public Assets(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -2215,7 +2217,7 @@ public Assets(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -2238,27 +2240,9 @@ public Assets(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse>(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -2266,23 +2250,7 @@ public Assets(PlatformModuleClient client) return _result; } - /// - /// Upload assets to the folder - /// - /// - /// Request body can contain multiple files. - /// - /// - /// Parent folder url (relative or absolute). - /// - /// - /// Url for uploaded remote resource (optional) - /// - /// - /// File name - /// - /// - /// Upload File + /// /// /// /// Headers that will be added to request. @@ -2299,7 +2267,7 @@ public Assets(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> UploadAssetAsyncWithHttpMessagesAsync(string folderUrl = default(string), string url = default(string), string name = default(string), string uploadedFile = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> SearchChangesWithHttpMessagesAsync(ChangeLogSearchCriteria body = default(ChangeLogSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -2308,37 +2276,13 @@ public Assets(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("folderUrl", folderUrl); - tracingParameters.Add("url", url); - tracingParameters.Add("name", name); - tracingParameters.Add("uploadedFile", uploadedFile); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UploadAssetAsync", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "SearchChanges", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/assets").ToString(); - List _queryParameters = new List(); - if (folderUrl != null) - { - _queryParameters.Add(string.Format("folderUrl={0}", System.Uri.EscapeDataString(folderUrl))); - } - if (url != null) - { - _queryParameters.Add(string.Format("url={0}", System.Uri.EscapeDataString(url))); - } - if (name != null) - { - _queryParameters.Add(string.Format("name={0}", System.Uri.EscapeDataString(name))); - } - if (uploadedFile != null) - { - _queryParameters.Add(string.Format("uploadedFile={0}", System.Uri.EscapeDataString(uploadedFile))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/changelog/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -2361,6 +2305,12 @@ public Assets(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -2404,7 +2354,7 @@ public Assets(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse>(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -2413,7 +2363,7 @@ public Assets(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2432,10 +2382,11 @@ public Assets(PlatformModuleClient client) return _result; } - /// - /// Delete blobs by urls - /// - /// + /// + /// + /// + /// + /// /// /// /// Headers that will be added to request. @@ -2446,11 +2397,24 @@ public Assets(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// 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 DeleteBlobsAsyncWithHttpMessagesAsync(IList urls = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> SearchTypeChangeHistoryWithHttpMessagesAsync(string type, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "type"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2458,17 +2422,24 @@ public Assets(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("urls", urls); + tracingParameters.Add("type", type); + tracingParameters.Add("start", start); + tracingParameters.Add("end", end); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteBlobsAsync", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "SearchTypeChangeHistory", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/assets").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/changelog/{type}/changes").ToString(); + _url = _url.Replace("{type}", System.Uri.EscapeDataString(type)); List _queryParameters = new List(); - if (urls != null) + if (start != null) + { + _queryParameters.Add(string.Format("start={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(start, Client.SerializationSettings).Trim('"')))); + } + if (end != null) { - _queryParameters.Add(string.Format("urls={0}", System.Uri.EscapeDataString(string.Join(",", urls)))); + _queryParameters.Add(string.Format("end={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(end, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { @@ -2477,7 +2448,7 @@ public Assets(PlatformModuleClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -2516,7 +2487,7 @@ public Assets(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -2539,268 +2510,27 @@ public Assets(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// SearchAsync asset folders and blobs - /// - /// - /// - /// - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> SearchAssetItemsAsyncWithHttpMessagesAsync(string folderUrl = default(string), string keyword = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("folderUrl", folderUrl); - tracingParameters.Add("keyword", keyword); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SearchAssetItemsAsync", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/assets").ToString(); - List _queryParameters = new List(); - if (folderUrl != null) - { - _queryParameters.Add(string.Format("folderUrl={0}", System.Uri.EscapeDataString(folderUrl))); - } - if (keyword != null) - { - _queryParameters.Add(string.Format("keyword={0}", System.Uri.EscapeDataString(keyword))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) - { - var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Create new blob folder - /// - /// - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task CreateBlobFolderAsyncWithHttpMessagesAsync(BlobFolder body = default(BlobFolder), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateBlobFolderAsync", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/assets/folder").ToString(); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 204 && (int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403) - { - var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -2830,14 +2560,15 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi using System.Threading.Tasks; /// - /// Assets operations. + /// ChangeLog operations. /// - public partial interface IAssets + public partial interface IChangeLog { /// - /// This method used to upload files on local disk storage in special - /// uploads folder + /// Force set changes last modified date /// + /// + /// /// /// The headers that will be added to request. /// @@ -2847,28 +2578,7 @@ public partial interface IAssets /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// - Task>> UploadAssetToLocalFileSystemAsyncWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Upload assets to the folder - /// - /// - /// Request body can contain multiple files. - /// - /// - /// Parent folder url (relative or absolute). - /// - /// - /// Url for uploaded remote resource (optional) - /// - /// - /// File name - /// - /// - /// Upload File - /// + Task ForceChangesWithHttpMessagesAsync(string scope = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The headers that will be added to request. /// @@ -2878,14 +2588,13 @@ public partial interface IAssets /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// - Task>> UploadAssetAsyncWithHttpMessagesAsync(string folderUrl = default(string), string url = default(string), string name = default(string), string uploadedFile = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task ResetPlatformCacheWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete blobs by urls + /// Get last modified date for given scope + /// Used for signal of what something changed and for cache + /// invalidation in external platform clients /// - /// + /// /// /// /// The headers that will be added to request. @@ -2896,13 +2605,11 @@ public partial interface IAssets /// /// Thrown when the operation returned an invalid status code /// - Task DeleteBlobsAsyncWithHttpMessagesAsync(IList urls = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// SearchAsync asset folders and blobs - /// - /// - /// - /// + /// + /// Thrown when unable to deserialize the response + /// + Task> GetLastModifiedDateWithHttpMessagesAsync(string scope = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// /// /// The headers that will be added to request. @@ -2916,10 +2623,19 @@ public partial interface IAssets /// /// Thrown when unable to deserialize the response /// - Task> SearchAssetItemsAsyncWithHttpMessagesAsync(string folderUrl = default(string), string keyword = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create new blob folder - /// + Task> GetChangedEntitiesWithHttpMessagesAsync(ChangedEntitiesRequest body = default(ChangedEntitiesRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + Task ResetChangedEntitiesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// @@ -2931,7 +2647,32 @@ public partial interface IAssets /// /// Thrown when the operation returned an invalid status code /// - Task CreateBlobFolderAsyncWithHttpMessagesAsync(BlobFolder body = default(BlobFolder), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Thrown when unable to deserialize the response + /// + Task> SearchChangesWithHttpMessagesAsync(ChangeLogSearchCriteria body = default(ChangeLogSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> SearchTypeChangeHistoryWithHttpMessagesAsync(string type, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // @@ -2954,190 +2695,201 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi using System.Threading.Tasks; /// - /// Extension methods for Assets. + /// Extension methods for ChangeLog. /// - public static partial class AssetsExtensions + public static partial class ChangeLogExtensions { /// - /// This method used to upload files on local disk storage in special uploads - /// folder + /// Force set changes last modified date /// /// /// The operations group for this extension method. /// - public static IList UploadAssetToLocalFileSystemAsync(this IAssets operations) + /// + /// + public static void ForceChanges(this IChangeLog operations, string scope = default(string)) { - return operations.UploadAssetToLocalFileSystemAsyncAsync().GetAwaiter().GetResult(); + operations.ForceChangesAsync(scope).GetAwaiter().GetResult(); } /// - /// This method used to upload files on local disk storage in special uploads - /// folder + /// Force set changes last modified date /// /// /// The operations group for this extension method. /// + /// + /// /// /// The cancellation token. /// - public static async Task> UploadAssetToLocalFileSystemAsyncAsync(this IAssets operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ForceChangesAsync(this IChangeLog operations, string scope = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UploadAssetToLocalFileSystemAsyncWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.ForceChangesWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)).Dispose(); } - /// - /// Upload assets to the folder - /// - /// - /// Request body can contain multiple files. - /// /// /// The operations group for this extension method. /// - /// - /// Parent folder url (relative or absolute). + public static void ResetPlatformCache(this IChangeLog operations) + { + operations.ResetPlatformCacheAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. /// - /// - /// Url for uploaded remote resource (optional) + /// + /// The cancellation token. /// - /// - /// File name + public static async Task ResetPlatformCacheAsync(this IChangeLog operations, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ResetPlatformCacheWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get last modified date for given scope + /// Used for signal of what something changed and for cache invalidation in + /// external platform clients + /// + /// + /// The operations group for this extension method. /// - /// - /// Upload File + /// /// - public static IList UploadAssetAsync(this IAssets operations, string folderUrl = default(string), string url = default(string), string name = default(string), string uploadedFile = default(string)) + public static LastModifiedResponse GetLastModifiedDate(this IChangeLog operations, string scope = default(string)) { - return operations.UploadAssetAsyncAsync(folderUrl, url, name, uploadedFile).GetAwaiter().GetResult(); + return operations.GetLastModifiedDateAsync(scope).GetAwaiter().GetResult(); } /// - /// Upload assets to the folder + /// Get last modified date for given scope + /// Used for signal of what something changed and for cache invalidation in + /// external platform clients /// - /// - /// Request body can contain multiple files. - /// /// /// The operations group for this extension method. /// - /// - /// Parent folder url (relative or absolute). + /// /// - /// - /// Url for uploaded remote resource (optional) + /// + /// The cancellation token. /// - /// - /// File name + public static async Task GetLastModifiedDateAsync(this IChangeLog operations, string scope = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetLastModifiedDateWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static ChangedEntitiesResponse GetChangedEntities(this IChangeLog operations, ChangedEntitiesRequest body = default(ChangedEntitiesRequest)) + { + return operations.GetChangedEntitiesAsync(body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. /// - /// - /// Upload File + /// /// /// /// The cancellation token. /// - public static async Task> UploadAssetAsyncAsync(this IAssets operations, string folderUrl = default(string), string url = default(string), string name = default(string), string uploadedFile = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetChangedEntitiesAsync(this IChangeLog operations, ChangedEntitiesRequest body = default(ChangedEntitiesRequest), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UploadAssetAsyncWithHttpMessagesAsync(folderUrl, url, name, uploadedFile, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetChangedEntitiesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } - /// - /// Delete blobs by urls - /// /// /// The operations group for this extension method. /// - /// + /// /// - public static void DeleteBlobsAsync(this IAssets operations, IList urls = default(IList)) + public static void ResetChangedEntities(this IChangeLog operations, IList body = default(IList)) { - operations.DeleteBlobsAsyncAsync(urls).GetAwaiter().GetResult(); + operations.ResetChangedEntitiesAsync(body).GetAwaiter().GetResult(); } - /// - /// Delete blobs by urls - /// /// /// The operations group for this extension method. /// - /// + /// /// /// /// The cancellation token. /// - public static async Task DeleteBlobsAsyncAsync(this IAssets operations, IList urls = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ResetChangedEntitiesAsync(this IChangeLog operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteBlobsAsyncWithHttpMessagesAsync(urls, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.ResetChangedEntitiesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } - /// - /// SearchAsync asset folders and blobs - /// /// /// The operations group for this extension method. /// - /// - /// - /// + /// /// - public static BlobEntrySearchResult SearchAssetItemsAsync(this IAssets operations, string folderUrl = default(string), string keyword = default(string)) + public static ChangeLogSearchResult SearchChanges(this IChangeLog operations, ChangeLogSearchCriteria body = default(ChangeLogSearchCriteria)) { - return operations.SearchAssetItemsAsyncAsync(folderUrl, keyword).GetAwaiter().GetResult(); + return operations.SearchChangesAsync(body).GetAwaiter().GetResult(); } - /// - /// SearchAsync asset folders and blobs - /// /// /// The operations group for this extension method. /// - /// - /// - /// + /// /// /// /// The cancellation token. /// - public static async Task SearchAssetItemsAsyncAsync(this IAssets operations, string folderUrl = default(string), string keyword = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task SearchChangesAsync(this IChangeLog operations, ChangeLogSearchCriteria body = default(ChangeLogSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.SearchAssetItemsAsyncWithHttpMessagesAsync(folderUrl, keyword, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.SearchChangesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } - /// - /// Create new blob folder - /// /// /// The operations group for this extension method. /// - /// + /// + /// + /// /// - public static void CreateBlobFolderAsync(this IAssets operations, BlobFolder body = default(BlobFolder)) + /// + /// + public static IList SearchTypeChangeHistory(this IChangeLog operations, string type, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?)) { - operations.CreateBlobFolderAsyncAsync(body).GetAwaiter().GetResult(); + return operations.SearchTypeChangeHistoryAsync(type, start, end).GetAwaiter().GetResult(); } - /// - /// Create new blob folder - /// /// /// The operations group for this extension method. /// - /// + /// + /// + /// + /// + /// /// /// /// The cancellation token. /// - public static async Task CreateBlobFolderAsyncAsync(this IAssets operations, BlobFolder body = default(BlobFolder), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> SearchTypeChangeHistoryAsync(this IChangeLog operations, string type, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.CreateBlobFolderAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.SearchTypeChangeHistoryWithHttpMessagesAsync(type, start, end, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } } @@ -3164,12 +2916,12 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi using System.Threading.Tasks; /// - /// ChangeLog operations. + /// Diagnostics operations. /// - public partial class ChangeLog : IServiceOperations, IChangeLog + public partial class Diagnostics : IServiceOperations, IDiagnostics { /// - /// Initializes a new instance of the ChangeLog class. + /// Initializes a new instance of the Diagnostics class. /// /// /// Reference to the service client. @@ -3177,7 +2929,7 @@ public partial class ChangeLog : IServiceOperations, IChan /// /// Thrown when a required parameter is null /// - public ChangeLog(PlatformModuleClient client) + public Diagnostics(PlatformModuleClient client) { if (client == null) { @@ -3191,11 +2943,6 @@ public ChangeLog(PlatformModuleClient client) /// public PlatformModuleClient Client { get; private set; } - /// - /// Force set changes last modified date - /// - /// - /// /// /// Headers that will be added to request. /// @@ -3205,10 +2952,13 @@ public ChangeLog(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// - public async Task ForceChangesWithHttpMessagesAsync(string scope = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetSystemInfoWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -3217,26 +2967,16 @@ public ChangeLog(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("scope", scope); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ForceChanges", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetSystemInfo", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/changes/force").ToString(); - List _queryParameters = new List(); - if (scope != null) - { - _queryParameters.Add(string.Format("Scope={0}", System.Uri.EscapeDataString(scope))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/diagnostics/systeminfo").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -3275,7 +3015,7 @@ public ChangeLog(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -3298,9 +3038,27 @@ public ChangeLog(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -3309,12 +3067,8 @@ public ChangeLog(PlatformModuleClient client) } /// - /// Get last modified date for given scope - /// Used for signal of what something changed and for cache invalidation in - /// external platform clients + /// Get installed modules with errors /// - /// - /// /// /// Headers that will be added to request. /// @@ -3330,7 +3084,7 @@ public ChangeLog(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetLastModifiedDateWithHttpMessagesAsync(string scope = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> GetModulesErrorsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -3339,22 +3093,12 @@ public ChangeLog(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("scope", scope); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetLastModifiedDate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetModulesErrors", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/changes/lastmodifieddate").ToString(); - List _queryParameters = new List(); - if (scope != null) - { - _queryParameters.Add(string.Format("scope={0}", System.Uri.EscapeDataString(scope))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/diagnostics/errors").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -3420,7 +3164,7 @@ public ChangeLog(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -3429,7 +3173,7 @@ public ChangeLog(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3448,24 +3192,207 @@ public ChangeLog(PlatformModuleClient client) return _result; } - /// - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> SearchChangesWithHttpMessagesAsync(ChangeLogSearchCriteria body = default(ChangeLogSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Diagnostics operations. + /// + public partial interface IDiagnostics + { + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> GetSystemInfoWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get installed modules with errors + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task>> GetModulesErrorsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Diagnostics. + /// + public static partial class DiagnosticsExtensions + { + /// + /// The operations group for this extension method. + /// + public static SystemInfo GetSystemInfo(this IDiagnostics operations) + { + return operations.GetSystemInfoAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetSystemInfoAsync(this IDiagnostics operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetSystemInfoWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get installed modules with errors + /// + /// + /// The operations group for this extension method. + /// + public static IList GetModulesErrors(this IDiagnostics operations) + { + return operations.GetModulesErrorsAsync().GetAwaiter().GetResult(); + } + + /// + /// Get installed modules with errors + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> GetModulesErrorsAsync(this IDiagnostics operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetModulesErrorsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DynamicProperties operations. + /// + public partial class DynamicProperties : IServiceOperations, IDynamicProperties + { + /// + /// Initializes a new instance of the DynamicProperties class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public DynamicProperties(PlatformModuleClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PlatformModuleClient + /// + public PlatformModuleClient Client { get; private set; } + + /// + /// Get object types which support dynamic properties + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetObjectTypesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -3474,17 +3401,16 @@ public ChangeLog(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SearchChanges", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetObjectTypes", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/changelog/search").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/types").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -3503,12 +3429,6 @@ public ChangeLog(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -3552,7 +3472,7 @@ public ChangeLog(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -3561,7 +3481,7 @@ public ChangeLog(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3580,11 +3500,10 @@ public ChangeLog(PlatformModuleClient client) return _result; } - /// - /// - /// - /// - /// + /// + /// Get dynamic properties registered for object type + /// + /// /// /// /// Headers that will be added to request. @@ -3598,21 +3517,11 @@ public ChangeLog(PlatformModuleClient 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>> SearchTypeChangeHistoryWithHttpMessagesAsync(string type, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> SearchDynamicPropertiesWithHttpMessagesAsync(DynamicPropertySearchCriteria body = default(DynamicPropertySearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (type == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "type"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3620,33 +3529,17 @@ public ChangeLog(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("type", type); - tracingParameters.Add("start", start); - tracingParameters.Add("end", end); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SearchTypeChangeHistory", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "SearchDynamicProperties", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/changelog/{type}/changes").ToString(); - _url = _url.Replace("{type}", System.Uri.EscapeDataString(type)); - List _queryParameters = new List(); - if (start != null) - { - _queryParameters.Add(string.Format("start={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(start, Client.SerializationSettings).Trim('"')))); - } - if (end != null) - { - _queryParameters.Add(string.Format("end={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(end, Client.SerializationSettings).Trim('"')))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/properties/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -3665,6 +3558,12 @@ public ChangeLog(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -3708,7 +3607,7 @@ public ChangeLog(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse>(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -3717,7 +3616,7 @@ public ChangeLog(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3736,306 +3635,146 @@ public ChangeLog(PlatformModuleClient client) return _result; } - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ChangeLog operations. - /// - public partial interface IChangeLog - { - /// - /// Force set changes last modified date - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - Task ForceChangesWithHttpMessagesAsync(string scope = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get last modified date for given scope - /// Used for signal of what something changed and for cache - /// invalidation in external platform clients + /// Add new dynamic property /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task> GetLastModifiedDateWithHttpMessagesAsync(string scope = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task> SearchChangesWithHttpMessagesAsync(ChangeLogSearchCriteria body = default(ChangeLogSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// - /// - /// - /// - /// - /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> SearchTypeChangeHistoryWithHttpMessagesAsync(string type, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ChangeLog. - /// - public static partial class ChangeLogExtensions - { - /// - /// Force set changes last modified date - /// - /// - /// The operations group for this extension method. - /// - /// - /// - public static void ForceChanges(this IChangeLog operations, string scope = default(string)) - { - operations.ForceChangesAsync(scope).GetAwaiter().GetResult(); - } - - /// - /// Force set changes last modified date - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task ForceChangesAsync(this IChangeLog operations, string scope = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreatePropertyAsyncWithHttpMessagesAsync(DynamicProperty body = default(DynamicProperty), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) { - (await operations.ForceChangesWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)).Dispose(); + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreatePropertyAsync", tracingParameters); } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/properties").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers - /// - /// Get last modified date for given scope - /// Used for signal of what something changed and for cache invalidation in - /// external platform clients - /// - /// - /// The operations group for this extension method. - /// - /// - /// - public static LastModifiedResponse GetLastModifiedDate(this IChangeLog operations, string scope = default(string)) - { - return operations.GetLastModifiedDateAsync(scope).GetAwaiter().GetResult(); - } - /// - /// Get last modified date for given scope - /// Used for signal of what something changed and for cache invalidation in - /// external platform clients - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task GetLastModifiedDateAsync(this IChangeLog operations, string scope = default(string), CancellationToken cancellationToken = default(CancellationToken)) + if (customHeaders != null) { - using (var _result = await operations.GetLastModifiedDateWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + foreach(var _header in customHeaders) { - return _result.Body; + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - /// - /// The operations group for this extension method. - /// - /// - /// - public static ChangeLogSearchResult SearchChanges(this IChangeLog operations, ChangeLogSearchCriteria body = default(ChangeLogSearchCriteria)) + // Serialize Request + string _requestContent = null; + if(body != null) { - return operations.SearchChangesAsync(body).GetAwaiter().GetResult(); + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } - - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task SearchChangesAsync(this IChangeLog operations, ChangeLogSearchCriteria body = default(ChangeLogSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) + // Set Credentials + if (Client.Credentials != null) { - using (var _result = await operations.SearchChangesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } - - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// - /// - /// - public static IList SearchTypeChangeHistory(this IChangeLog operations, string type, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?)) + // Send Request + if (_shouldTrace) { - return operations.SearchTypeChangeHistoryAsync(type, start, end).GetAwaiter().GetResult(); + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } - - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task> SearchTypeChangeHistoryAsync(this IChangeLog operations, string type, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), CancellationToken cancellationToken = default(CancellationToken)) + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) { - using (var _result = await operations.SearchTypeChangeHistoryWithHttpMessagesAsync(type, start, end, null, cancellationToken).ConfigureAwait(false)) + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) { - return _result.Body; + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); } + throw ex; } - - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Diagnostics operations. - /// - public partial class Diagnostics : IServiceOperations, IDiagnostics - { - /// - /// Initializes a new instance of the Diagnostics class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public Diagnostics(PlatformModuleClient client) - { - if (client == null) + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) { - throw new System.ArgumentNullException("client"); + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } } - Client = client; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; } /// - /// Gets a reference to the PlatformModuleClient + /// Update existing dynamic property /// - public PlatformModuleClient Client { get; private set; } - + /// + /// /// /// Headers that will be added to request. /// @@ -4045,13 +3784,10 @@ public Diagnostics(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// A response object containing the response body and response headers. /// - public async Task> GetSystemInfoWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task UpdatePropertyAsyncWithHttpMessagesAsync(DynamicProperty body = default(DynamicProperty), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -4060,16 +3796,17 @@ public Diagnostics(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetSystemInfo", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "UpdatePropertyAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/diagnostics/systeminfo").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/properties").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -4088,6 +3825,12 @@ public Diagnostics(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -4108,7 +3851,7 @@ public Diagnostics(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -4131,27 +3874,9 @@ public Diagnostics(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -4159,181 +3884,52 @@ public Diagnostics(PlatformModuleClient client) return _result; } - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Diagnostics operations. - /// - public partial interface IDiagnostics - { + /// + /// Delete dynamic property + /// + /// + /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// - Task> GetSystemInfoWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for Diagnostics. - /// - public static partial class DiagnosticsExtensions - { - /// - /// The operations group for this extension method. - /// - public static SystemInfo GetSystemInfo(this IDiagnostics operations) + /// + /// A response object containing the response body and response headers. + /// + public async Task DeletePropertyAsyncWithHttpMessagesAsync(IList propertyIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) { - return operations.GetSystemInfoAsync().GetAwaiter().GetResult(); + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("propertyIds", propertyIds); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeletePropertyAsync", tracingParameters); } - - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task GetSystemInfoAsync(this IDiagnostics operations, CancellationToken cancellationToken = default(CancellationToken)) + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/properties").ToString(); + List _queryParameters = new List(); + if (propertyIds != null) { - using (var _result = await operations.GetSystemInfoWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// DynamicProperties operations. - /// - public partial class DynamicProperties : IServiceOperations, IDynamicProperties - { - /// - /// Initializes a new instance of the DynamicProperties class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public DynamicProperties(PlatformModuleClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); + _queryParameters.Add(string.Format("propertyIds={0}", System.Uri.EscapeDataString(string.Join(",", propertyIds)))); } - Client = client; - } - - /// - /// Gets a reference to the PlatformModuleClient - /// - public PlatformModuleClient Client { get; private set; } - - /// - /// Get object types which support dynamic properties - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> GetObjectTypesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) + if (_queryParameters.Count > 0) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetObjectTypes", tracingParameters); + _url += "?" + string.Join("&", _queryParameters); } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/types").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -4372,7 +3968,7 @@ public DynamicProperties(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -4395,27 +3991,9 @@ public DynamicProperties(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse>(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -4424,10 +4002,8 @@ public DynamicProperties(PlatformModuleClient client) } /// - /// Get dynamic properties registered for object type + /// Does nothing. Just a way to expose DynamicObjectProperty thru Swagger. /// - /// - /// /// /// Headers that will be added to request. /// @@ -4443,7 +4019,7 @@ public DynamicProperties(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> SearchDynamicPropertiesWithHttpMessagesAsync(DynamicPropertySearchCriteria body = default(DynamicPropertySearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ExposeDynamicObjectPropertyWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -4452,13 +4028,12 @@ public DynamicProperties(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SearchDynamicProperties", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ExposeDynamicObjectProperty", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/properties/search").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -4481,12 +4056,6 @@ public DynamicProperties(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -4507,7 +4076,7 @@ public DynamicProperties(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200 && (int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -4530,7 +4099,7 @@ public DynamicProperties(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -4539,7 +4108,7 @@ public DynamicProperties(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -4559,7 +4128,7 @@ public DynamicProperties(PlatformModuleClient client) } /// - /// Add new dynamic property + /// Get dictionary items /// /// /// @@ -4578,7 +4147,7 @@ public DynamicProperties(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreatePropertyAsyncWithHttpMessagesAsync(DynamicProperty body = default(DynamicProperty), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> SearchDictionaryItemsWithHttpMessagesAsync(DynamicPropertyDictionaryItemSearchCriteria body = default(DynamicPropertyDictionaryItemSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -4589,11 +4158,11 @@ public DynamicProperties(PlatformModuleClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreatePropertyAsync", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "SearchDictionaryItems", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/properties").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/dictionaryitems/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -4665,7 +4234,7 @@ public DynamicProperties(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -4674,7 +4243,7 @@ public DynamicProperties(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -4694,8 +4263,12 @@ public DynamicProperties(PlatformModuleClient client) } /// - /// Update existing dynamic property + /// Add or update dictionary items /// + /// + /// Fill item ID to update existing item or leave it empty to create a new + /// item. + /// /// /// /// @@ -4710,7 +4283,7 @@ public DynamicProperties(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdatePropertyAsyncWithHttpMessagesAsync(DynamicProperty body = default(DynamicProperty), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task SaveDictionaryItemsAsyncWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -4721,15 +4294,15 @@ public DynamicProperties(PlatformModuleClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdatePropertyAsync", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "SaveDictionaryItemsAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/properties").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/dictionaryitems").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -4808,9 +4381,10 @@ public DynamicProperties(PlatformModuleClient client) } /// - /// Delete dynamic property + /// Delete dictionary items /// - /// + /// + /// IDs of dictionary items to delete. /// /// /// Headers that will be added to request. @@ -4824,7 +4398,7 @@ public DynamicProperties(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeletePropertyAsyncWithHttpMessagesAsync(IList propertyIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteDictionaryItemAsyncWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -4833,17 +4407,17 @@ public DynamicProperties(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("propertyIds", propertyIds); + tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeletePropertyAsync", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteDictionaryItemAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/properties").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/dictionaryitems").ToString(); List _queryParameters = new List(); - if (propertyIds != null) + if (ids != null) { - _queryParameters.Add(string.Format("propertyIds={0}", System.Uri.EscapeDataString(string.Join(",", propertyIds)))); + _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { @@ -4924,64 +4498,894 @@ public DynamicProperties(PlatformModuleClient client) return _result; } + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DynamicProperties operations. + /// + public partial interface IDynamicProperties + { /// - /// Does nothing. Just a way to expose DynamicObjectProperty thru Swagger. + /// Get object types which support dynamic properties /// /// - /// Headers that will be added to request. + /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> ExposeDynamicObjectPropertyWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ExposeDynamicObjectProperty", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic").ToString(); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { + Task>> GetObjectTypesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get dynamic properties registered for object type + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> SearchDynamicPropertiesWithHttpMessagesAsync(DynamicPropertySearchCriteria body = default(DynamicPropertySearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Add new dynamic property + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> CreatePropertyAsyncWithHttpMessagesAsync(DynamicProperty body = default(DynamicProperty), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update existing dynamic property + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + Task UpdatePropertyAsyncWithHttpMessagesAsync(DynamicProperty body = default(DynamicProperty), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete dynamic property + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + Task DeletePropertyAsyncWithHttpMessagesAsync(IList propertyIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Does nothing. Just a way to expose DynamicObjectProperty thru + /// Swagger. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> ExposeDynamicObjectPropertyWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get dictionary items + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> SearchDictionaryItemsWithHttpMessagesAsync(DynamicPropertyDictionaryItemSearchCriteria body = default(DynamicPropertyDictionaryItemSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Add or update dictionary items + /// + /// + /// Fill item ID to update existing item or leave it empty to create a + /// new item. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + Task SaveDictionaryItemsAsyncWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete dictionary items + /// + /// + /// IDs of dictionary items to delete. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + Task DeleteDictionaryItemAsyncWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DynamicProperties. + /// + public static partial class DynamicPropertiesExtensions + { + /// + /// Get object types which support dynamic properties + /// + /// + /// The operations group for this extension method. + /// + public static IList GetObjectTypes(this IDynamicProperties operations) + { + return operations.GetObjectTypesAsync().GetAwaiter().GetResult(); + } + + /// + /// Get object types which support dynamic properties + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> GetObjectTypesAsync(this IDynamicProperties operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetObjectTypesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get dynamic properties registered for object type + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static DynamicPropertySearchResult SearchDynamicProperties(this IDynamicProperties operations, DynamicPropertySearchCriteria body = default(DynamicPropertySearchCriteria)) + { + return operations.SearchDynamicPropertiesAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Get dynamic properties registered for object type + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task SearchDynamicPropertiesAsync(this IDynamicProperties operations, DynamicPropertySearchCriteria body = default(DynamicPropertySearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.SearchDynamicPropertiesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Add new dynamic property + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static DynamicProperty CreatePropertyAsync(this IDynamicProperties operations, DynamicProperty body = default(DynamicProperty)) + { + return operations.CreatePropertyAsyncAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Add new dynamic property + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreatePropertyAsyncAsync(this IDynamicProperties operations, DynamicProperty body = default(DynamicProperty), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreatePropertyAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update existing dynamic property + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static void UpdatePropertyAsync(this IDynamicProperties operations, DynamicProperty body = default(DynamicProperty)) + { + operations.UpdatePropertyAsyncAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Update existing dynamic property + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task UpdatePropertyAsyncAsync(this IDynamicProperties operations, DynamicProperty body = default(DynamicProperty), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdatePropertyAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Delete dynamic property + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static void DeletePropertyAsync(this IDynamicProperties operations, IList propertyIds = default(IList)) + { + operations.DeletePropertyAsyncAsync(propertyIds).GetAwaiter().GetResult(); + } + + /// + /// Delete dynamic property + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeletePropertyAsyncAsync(this IDynamicProperties operations, IList propertyIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeletePropertyAsyncWithHttpMessagesAsync(propertyIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Does nothing. Just a way to expose DynamicObjectProperty thru Swagger. + /// + /// + /// The operations group for this extension method. + /// + public static DynamicObjectProperty ExposeDynamicObjectProperty(this IDynamicProperties operations) + { + return operations.ExposeDynamicObjectPropertyAsync().GetAwaiter().GetResult(); + } + + /// + /// Does nothing. Just a way to expose DynamicObjectProperty thru Swagger. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ExposeDynamicObjectPropertyAsync(this IDynamicProperties operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExposeDynamicObjectPropertyWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get dictionary items + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static DynamicPropertyDictionaryItemSearchResult SearchDictionaryItems(this IDynamicProperties operations, DynamicPropertyDictionaryItemSearchCriteria body = default(DynamicPropertyDictionaryItemSearchCriteria)) + { + return operations.SearchDictionaryItemsAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Get dictionary items + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task SearchDictionaryItemsAsync(this IDynamicProperties operations, DynamicPropertyDictionaryItemSearchCriteria body = default(DynamicPropertyDictionaryItemSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.SearchDictionaryItemsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Add or update dictionary items + /// + /// + /// Fill item ID to update existing item or leave it empty to create a new + /// item. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static void SaveDictionaryItemsAsync(this IDynamicProperties operations, IList body = default(IList)) + { + operations.SaveDictionaryItemsAsyncAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Add or update dictionary items + /// + /// + /// Fill item ID to update existing item or leave it empty to create a new + /// item. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task SaveDictionaryItemsAsyncAsync(this IDynamicProperties operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.SaveDictionaryItemsAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Delete dictionary items + /// + /// + /// The operations group for this extension method. + /// + /// + /// IDs of dictionary items to delete. + /// + public static void DeleteDictionaryItemAsync(this IDynamicProperties operations, IList ids = default(IList)) + { + operations.DeleteDictionaryItemAsyncAsync(ids).GetAwaiter().GetResult(); + } + + /// + /// Delete dictionary items + /// + /// + /// The operations group for this extension method. + /// + /// + /// IDs of dictionary items to delete. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteDictionaryItemAsyncAsync(this IDynamicProperties operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteDictionaryItemAsyncWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Jobs operations. + /// + public partial class Jobs : IServiceOperations, IJobs + { + /// + /// Initializes a new instance of the Jobs class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Jobs(PlatformModuleClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PlatformModuleClient + /// + public PlatformModuleClient Client { get; private set; } + + /// + /// Get background job status + /// + /// + /// Job ID. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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> GetStatusWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetStatus", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/jobs/{id}").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Jobs operations. + /// + public partial interface IJobs + { + /// + /// Get background job status + /// + /// + /// Job ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetStatusWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Jobs. + /// + public static partial class JobsExtensions + { + /// + /// Get background job status + /// + /// + /// The operations group for this extension method. + /// + /// + /// Job ID. + /// + public static Job GetStatus(this IJobs operations, string id) + { + return operations.GetStatusAsync(id).GetAwaiter().GetResult(); + } + + /// + /// Get background job status + /// + /// + /// The operations group for this extension method. + /// + /// + /// Job ID. + /// + /// + /// The cancellation token. + /// + public static async Task GetStatusAsync(this IJobs operations, string id, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetStatusWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Modules operations. + /// + public partial class Modules : IServiceOperations, IModules + { + /// + /// Initializes a new instance of the Modules class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Modules(PlatformModuleClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PlatformModuleClient + /// + public PlatformModuleClient Client { get; private set; } + + /// + /// Reload modules + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task ReloadModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ReloadModules", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/reload").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } @@ -4999,7 +5403,7 @@ public DynamicProperties(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -5012,37 +5416,19 @@ public DynamicProperties(PlatformModuleClient client) ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); } + throw ex; } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -5051,10 +5437,8 @@ public DynamicProperties(PlatformModuleClient client) } /// - /// Get dictionary items + /// Get installed modules /// - /// - /// /// /// Headers that will be added to request. /// @@ -5070,7 +5454,7 @@ public DynamicProperties(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> SearchDictionaryItemsWithHttpMessagesAsync(DynamicPropertyDictionaryItemSearchCriteria body = default(DynamicPropertyDictionaryItemSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> GetModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -5079,17 +5463,16 @@ public DynamicProperties(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SearchDictionaryItems", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetModules", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/dictionaryitems/search").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -5108,12 +5491,6 @@ public DynamicProperties(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -5157,7 +5534,7 @@ public DynamicProperties(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -5166,7 +5543,7 @@ public DynamicProperties(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -5186,13 +5563,10 @@ public DynamicProperties(PlatformModuleClient client) } /// - /// Add or update dictionary items + /// Get all dependent modules for module /// - /// - /// Fill item ID to update existing item or leave it empty to create a new - /// item. - /// /// + /// modules descriptors /// /// /// Headers that will be added to request. @@ -5203,10 +5577,13 @@ public DynamicProperties(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// - public async Task SaveDictionaryItemsAsyncWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> GetDependingModulesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -5217,11 +5594,11 @@ public DynamicProperties(PlatformModuleClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SaveDictionaryItemsAsync", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetDependingModules", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/dictionaryitems").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/getdependents").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -5270,7 +5647,7 @@ public DynamicProperties(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -5293,9 +5670,27 @@ public DynamicProperties(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -5304,10 +5699,10 @@ public DynamicProperties(PlatformModuleClient client) } /// - /// Delete dictionary items + /// Returns a flat expanded list of modules that depend on passed modules /// - /// - /// IDs of dictionary items to delete. + /// + /// modules descriptors /// /// /// Headers that will be added to request. @@ -5318,10 +5713,13 @@ public DynamicProperties(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// - public async Task DeleteDictionaryItemAsyncWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> GetMissingDependenciesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -5330,26 +5728,17 @@ public DynamicProperties(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("ids", ids); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteDictionaryItemAsync", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetMissingDependencies", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/dynamic/dictionaryitems").ToString(); - List _queryParameters = new List(); - if (ids != null) - { - _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/getmissingdependencies").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -5368,6 +5757,12 @@ public DynamicProperties(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -5388,7 +5783,7 @@ public DynamicProperties(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -5411,555 +5806,540 @@ public DynamicProperties(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } - return _result; - } - - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// DynamicProperties operations. - /// - public partial interface IDynamicProperties - { - /// - /// Get object types which support dynamic properties - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task>> GetObjectTypesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get dynamic properties registered for object type - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task> SearchDynamicPropertiesWithHttpMessagesAsync(DynamicPropertySearchCriteria body = default(DynamicPropertySearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Add new dynamic property - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task> CreatePropertyAsyncWithHttpMessagesAsync(DynamicProperty body = default(DynamicProperty), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Update existing dynamic property - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - Task UpdatePropertyAsyncWithHttpMessagesAsync(DynamicProperty body = default(DynamicProperty), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete dynamic property - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - Task DeletePropertyAsyncWithHttpMessagesAsync(IList propertyIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Does nothing. Just a way to expose DynamicObjectProperty thru - /// Swagger. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task> ExposeDynamicObjectPropertyWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + return _result; + } + /// - /// Get dictionary items + /// Upload module package for installation or update /// - /// - /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - Task> SearchDictionaryItemsWithHttpMessagesAsync(DynamicPropertyDictionaryItemSearchCriteria body = default(DynamicPropertyDictionaryItemSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// A response object containing the response body and response headers. + /// + public async Task> UploadModuleArchiveWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UploadModuleArchive", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/localstorage").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// - /// Add or update dictionary items + /// Install modules /// - /// - /// Fill item ID to update existing item or leave it empty to create a - /// new item. - /// /// + /// modules for install /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - Task SaveDictionaryItemsAsyncWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete dictionary items - /// - /// - /// IDs of dictionary items to delete. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code + /// + /// Thrown when unable to deserialize the response /// - Task DeleteDictionaryItemAsyncWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// + /// + /// A response object containing the response body and response headers. + /// + public async Task> InstallModulesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "InstallModules", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/install").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - /// - /// Extension methods for DynamicProperties. - /// - public static partial class DynamicPropertiesExtensions - { - /// - /// Get object types which support dynamic properties - /// - /// - /// The operations group for this extension method. - /// - public static IList GetObjectTypes(this IDynamicProperties operations) + if (customHeaders != null) { - return operations.GetObjectTypesAsync().GetAwaiter().GetResult(); + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } } - /// - /// Get object types which support dynamic properties - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> GetObjectTypesAsync(this IDynamicProperties operations, CancellationToken cancellationToken = default(CancellationToken)) + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { - using (var _result = await operations.GetObjectTypesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) { - return _result.Body; + ServiceClientTracing.Error(_invocationId, ex); } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; } - - /// - /// Get dynamic properties registered for object type - /// - /// - /// The operations group for this extension method. - /// - /// - /// - public static DynamicPropertySearchResult SearchDynamicProperties(this IDynamicProperties operations, DynamicPropertySearchCriteria body = default(DynamicPropertySearchCriteria)) - { - return operations.SearchDynamicPropertiesAsync(body).GetAwaiter().GetResult(); - } - - /// - /// Get dynamic properties registered for object type - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task SearchDynamicPropertiesAsync(this IDynamicProperties operations, DynamicPropertySearchCriteria body = default(DynamicPropertySearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) { - using (var _result = await operations.SearchDynamicPropertiesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try { - return _result.Body; + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } - /// - /// Add new dynamic property - /// - /// - /// The operations group for this extension method. - /// - /// - /// - public static DynamicProperty CreatePropertyAsync(this IDynamicProperties operations, DynamicProperty body = default(DynamicProperty)) + /// + /// Uninstall module + /// + /// + /// modules + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UninstallModuleWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) { - return operations.CreatePropertyAsyncAsync(body).GetAwaiter().GetResult(); + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UninstallModule", tracingParameters); } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/uninstall").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers - /// - /// Add new dynamic property - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task CreatePropertyAsyncAsync(this IDynamicProperties operations, DynamicProperty body = default(DynamicProperty), CancellationToken cancellationToken = default(CancellationToken)) + + if (customHeaders != null) { - using (var _result = await operations.CreatePropertyAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + foreach(var _header in customHeaders) { - return _result.Body; + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - /// - /// Update existing dynamic property - /// - /// - /// The operations group for this extension method. - /// - /// - /// - public static void UpdatePropertyAsync(this IDynamicProperties operations, DynamicProperty body = default(DynamicProperty)) + // Serialize Request + string _requestContent = null; + if(body != null) { - operations.UpdatePropertyAsyncAsync(body).GetAwaiter().GetResult(); + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } - - /// - /// Update existing dynamic property - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task UpdatePropertyAsyncAsync(this IDynamicProperties operations, DynamicProperty body = default(DynamicProperty), CancellationToken cancellationToken = default(CancellationToken)) + // Set Credentials + if (Client.Credentials != null) { - (await operations.UpdatePropertyAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } - - /// - /// Delete dynamic property - /// - /// - /// The operations group for this extension method. - /// - /// - /// - public static void DeletePropertyAsync(this IDynamicProperties operations, IList propertyIds = default(IList)) + // Send Request + if (_shouldTrace) { - operations.DeletePropertyAsyncAsync(propertyIds).GetAwaiter().GetResult(); + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } - - /// - /// Delete dynamic property - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task DeletePropertyAsyncAsync(this IDynamicProperties operations, IList propertyIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) { - (await operations.DeletePropertyAsyncWithHttpMessagesAsync(propertyIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - - /// - /// Does nothing. Just a way to expose DynamicObjectProperty thru Swagger. - /// - /// - /// The operations group for this extension method. - /// - public static DynamicObjectProperty ExposeDynamicObjectProperty(this IDynamicProperties operations) + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { - return operations.ExposeDynamicObjectPropertyAsync().GetAwaiter().GetResult(); - } - - /// - /// Does nothing. Just a way to expose DynamicObjectProperty thru Swagger. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task ExposeDynamicObjectPropertyAsync(this IDynamicProperties operations, CancellationToken cancellationToken = default(CancellationToken)) + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) { - using (var _result = await operations.ExposeDynamicObjectPropertyWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try { - return _result.Body; + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } - /// - /// Get dictionary items - /// - /// - /// The operations group for this extension method. - /// - /// - /// - public static DynamicPropertyDictionaryItemSearchResult SearchDictionaryItems(this IDynamicProperties operations, DynamicPropertyDictionaryItemSearchCriteria body = default(DynamicPropertyDictionaryItemSearchCriteria)) + /// + /// Restart web application + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task RestartWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) { - return operations.SearchDictionaryItemsAsync(body).GetAwaiter().GetResult(); + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Restart", tracingParameters); } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/restart").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers - /// - /// Get dictionary items - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task SearchDictionaryItemsAsync(this IDynamicProperties operations, DynamicPropertyDictionaryItemSearchCriteria body = default(DynamicPropertyDictionaryItemSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) + + if (customHeaders != null) { - using (var _result = await operations.SearchDictionaryItemsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + foreach(var _header in customHeaders) { - return _result.Body; + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - /// - /// Add or update dictionary items - /// - /// - /// Fill item ID to update existing item or leave it empty to create a new - /// item. - /// - /// - /// The operations group for this extension method. - /// - /// - /// - public static void SaveDictionaryItemsAsync(this IDynamicProperties operations, IList body = default(IList)) + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) { - operations.SaveDictionaryItemsAsyncAsync(body).GetAwaiter().GetResult(); + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } - - /// - /// Add or update dictionary items - /// - /// - /// Fill item ID to update existing item or leave it empty to create a new - /// item. - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task SaveDictionaryItemsAsyncAsync(this IDynamicProperties operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + // Send Request + if (_shouldTrace) { - (await operations.SaveDictionaryItemsAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } - - /// - /// Delete dictionary items - /// - /// - /// The operations group for this extension method. - /// - /// - /// IDs of dictionary items to delete. - /// - public static void DeleteDictionaryItemAsync(this IDynamicProperties operations, IList ids = default(IList)) + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) { - operations.DeleteDictionaryItemAsyncAsync(ids).GetAwaiter().GetResult(); + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - - /// - /// Delete dictionary items - /// - /// - /// The operations group for this extension method. - /// - /// - /// IDs of dictionary items to delete. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteDictionaryItemAsyncAsync(this IDynamicProperties operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { - (await operations.DeleteDictionaryItemAsyncWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; } - - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Jobs operations. - /// - public partial class Jobs : IServiceOperations, IJobs - { - /// - /// Initializes a new instance of the Jobs class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public Jobs(PlatformModuleClient client) - { - if (client == null) + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) { - throw new System.ArgumentNullException("client"); + ServiceClientTracing.Exit(_invocationId, _result); } - Client = client; + return _result; } /// - /// Gets a reference to the PlatformModuleClient - /// - public PlatformModuleClient Client { get; private set; } - - /// - /// Get background job status + /// Auto-install modules with specified groups /// - /// - /// Job ID. - /// /// /// Headers that will be added to request. /// @@ -5972,21 +6352,11 @@ public Jobs(PlatformModuleClient 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> GetStatusWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> TryToAutoInstallModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "id"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -5994,18 +6364,16 @@ public Jobs(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetStatus", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "TryToAutoInstallModules", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/jobs/{id}").ToString(); - _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/autoinstall").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -6067,7 +6435,7 @@ public Jobs(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -6076,7 +6444,7 @@ public Jobs(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -6117,16 +6485,26 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi using System.Threading.Tasks; /// - /// Jobs operations. + /// Modules operations. /// - public partial interface IJobs + public partial interface IModules { /// - /// Get background job status + /// Reload modules /// - /// - /// Job ID. + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + Task ReloadModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get installed modules + /// /// /// The headers that will be added to request. /// @@ -6139,10 +6517,129 @@ public partial interface IJobs /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null + Task>> GetModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all dependent modules for module + /// + /// + /// modules descriptors + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code /// - Task> GetStatusWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Thrown when unable to deserialize the response + /// + Task>> GetDependingModulesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a flat expanded list of modules that depend on passed + /// modules + /// + /// + /// modules descriptors + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task>> GetMissingDependenciesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Upload module package for installation or update + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> UploadModuleArchiveWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Install modules + /// + /// + /// modules for install + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> InstallModulesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Uninstall module + /// + /// + /// modules + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> UninstallModuleWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restart web application + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + Task RestartWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Auto-install modules with specified groups + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> TryToAutoInstallModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // @@ -6165,332 +6662,331 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi using System.Threading.Tasks; /// - /// Extension methods for Jobs. + /// Extension methods for Modules. /// - public static partial class JobsExtensions + public static partial class ModulesExtensions { /// - /// Get background job status + /// Reload modules /// /// /// The operations group for this extension method. /// - /// - /// Job ID. + public static void ReloadModules(this IModules operations) + { + operations.ReloadModulesAsync().GetAwaiter().GetResult(); + } + + /// + /// Reload modules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ReloadModulesAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReloadModulesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get installed modules + /// + /// + /// The operations group for this extension method. + /// + public static IList GetModules(this IModules operations) + { + return operations.GetModulesAsync().GetAwaiter().GetResult(); + } + + /// + /// Get installed modules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> GetModulesAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetModulesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all dependent modules for module + /// + /// + /// The operations group for this extension method. + /// + /// + /// modules descriptors + /// + public static IList GetDependingModules(this IModules operations, IList body = default(IList)) + { + return operations.GetDependingModulesAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Get all dependent modules for module + /// + /// + /// The operations group for this extension method. + /// + /// + /// modules descriptors + /// + /// + /// The cancellation token. + /// + public static async Task> GetDependingModulesAsync(this IModules operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDependingModulesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a flat expanded list of modules that depend on passed modules + /// + /// + /// The operations group for this extension method. /// - public static Job GetStatus(this IJobs operations, string id) + /// + /// modules descriptors + /// + public static IList GetMissingDependencies(this IModules operations, IList body = default(IList)) { - return operations.GetStatusAsync(id).GetAwaiter().GetResult(); + return operations.GetMissingDependenciesAsync(body).GetAwaiter().GetResult(); } /// - /// Get background job status + /// Returns a flat expanded list of modules that depend on passed modules /// /// /// The operations group for this extension method. /// - /// - /// Job ID. + /// + /// modules descriptors /// /// /// The cancellation token. /// - public static async Task GetStatusAsync(this IJobs operations, string id, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> GetMissingDependenciesAsync(this IModules operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetStatusWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetMissingDependenciesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Modules operations. - /// - public partial class Modules : IServiceOperations, IModules - { - /// - /// Initializes a new instance of the Modules class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public Modules(PlatformModuleClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the PlatformModuleClient - /// - public PlatformModuleClient Client { get; private set; } - - /// - /// Reload modules - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task ReloadModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) + /// + /// Upload module package for installation or update + /// + /// + /// The operations group for this extension method. + /// + public static ModuleDescriptor UploadModuleArchive(this IModules operations) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ReloadModules", tracingParameters); + return operations.UploadModuleArchiveAsync().GetAwaiter().GetResult(); } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/reload").ToString(); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - if (customHeaders != null) + /// + /// Upload module package for installation or update + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task UploadModuleArchiveAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) { - foreach(var _header in customHeaders) + using (var _result = await operations.UploadModuleArchiveWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + return _result.Body; } } - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) + /// + /// Install modules + /// + /// + /// The operations group for this extension method. + /// + /// + /// modules for install + /// + public static ModulePushNotification InstallModules(this IModules operations, IList body = default(IList)) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + return operations.InstallModulesAsync(body).GetAwaiter().GetResult(); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) + + /// + /// Install modules + /// + /// + /// The operations group for this extension method. + /// + /// + /// modules for install + /// + /// + /// The cancellation token. + /// + public static async Task InstallModulesAsync(this IModules operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { - var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) + using (var _result = await operations.InstallModulesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { - _httpResponse.Dispose(); + return _result.Body; } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); } - return _result; - } - /// - /// Get installed modules - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> GetModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) + /// + /// Uninstall module + /// + /// + /// The operations group for this extension method. + /// + /// + /// modules + /// + public static ModulePushNotification UninstallModule(this IModules operations, IList body = default(IList)) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetModules", tracingParameters); + return operations.UninstallModuleAsync(body).GetAwaiter().GetResult(); } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules").ToString(); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - if (customHeaders != null) + /// + /// Uninstall module + /// + /// + /// The operations group for this extension method. + /// + /// + /// modules + /// + /// + /// The cancellation token. + /// + public static async Task UninstallModuleAsync(this IModules operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { - foreach(var _header in customHeaders) + using (var _result = await operations.UninstallModuleWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + return _result.Body; } } - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) + /// + /// Restart web application + /// + /// + /// The operations group for this extension method. + /// + public static void Restart(this IModules operations) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + operations.RestartAsync().GetAwaiter().GetResult(); } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) + + /// + /// Restart web application + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + (await operations.RestartWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + + /// + /// Auto-install modules with specified groups + /// + /// + /// The operations group for this extension method. + /// + public static ModuleAutoInstallPushNotification TryToAutoInstallModules(this IModules operations) { - var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; + return operations.TryToAutoInstallModulesAsync().GetAwaiter().GetResult(); } - // Create Result - var _result = new HttpOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) + + /// + /// Auto-install modules with specified groups + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task TryToAutoInstallModulesAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) + using (var _result = await operations.TryToAutoInstallModulesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + return _result.Body; } } - if (_shouldTrace) + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OAuthApps operations. + /// + public partial class OAuthApps : IServiceOperations, IOAuthApps + { + /// + /// Initializes a new instance of the OAuthApps class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public OAuthApps(PlatformModuleClient client) + { + if (client == null) { - ServiceClientTracing.Exit(_invocationId, _result); + throw new System.ArgumentNullException("client"); } - return _result; + Client = client; } /// - /// Get all dependent modules for module + /// Gets a reference to the PlatformModuleClient /// - /// - /// modules descriptors - /// + public PlatformModuleClient Client { get; private set; } + /// /// Headers that will be added to request. /// @@ -6506,7 +7002,7 @@ public Modules(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> GetDependingModulesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> NewOperationWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -6515,17 +7011,16 @@ public Modules(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDependingModules", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "NewOperation", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/getdependents").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/oauthapps/new").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -6544,12 +7039,6 @@ public Modules(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -6593,7 +7082,7 @@ public Modules(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse>(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -6602,7 +7091,7 @@ public Modules(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -6621,11 +7110,7 @@ public Modules(PlatformModuleClient client) return _result; } - /// - /// Returns a flat expanded list of modules that depend on passed modules - /// /// - /// modules descriptors /// /// /// Headers that will be added to request. @@ -6642,7 +7127,7 @@ public Modules(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> GetMissingDependenciesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> SaveAsyncWithHttpMessagesAsync(OpenIddictApplicationDescriptor body = default(OpenIddictApplicationDescriptor), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -6653,11 +7138,11 @@ public Modules(PlatformModuleClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetMissingDependencies", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "SaveAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/getmissingdependencies").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/oauthapps").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -6729,7 +7214,7 @@ public Modules(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse>(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -6738,7 +7223,7 @@ public Modules(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -6757,9 +7242,8 @@ public Modules(PlatformModuleClient client) return _result; } - /// - /// Upload module package for installation or update - /// + /// + /// /// /// Headers that will be added to request. /// @@ -6769,13 +7253,10 @@ public Modules(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// A response object containing the response body and response headers. /// - public async Task> UploadModuleArchiveWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteAsyncWithHttpMessagesAsync(IList clientIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -6784,16 +7265,26 @@ public Modules(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("clientIds", clientIds); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UploadModuleArchive", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/localstorage").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/oauthapps").ToString(); + List _queryParameters = new List(); + if (clientIds != null) + { + _queryParameters.Add(string.Format("clientIds={0}", System.Uri.EscapeDataString(string.Join(",", clientIds)))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -6855,27 +7346,9 @@ public Modules(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -6883,11 +7356,7 @@ public Modules(PlatformModuleClient client) return _result; } - /// - /// Install modules - /// /// - /// modules for install /// /// /// Headers that will be added to request. @@ -6904,7 +7373,7 @@ public Modules(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> InstallModulesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> SearchAsyncWithHttpMessagesAsync(OAuthAppSearchCriteria body = default(OAuthAppSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -6915,11 +7384,11 @@ public Modules(PlatformModuleClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "InstallModules", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "SearchAsync", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/install").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/oauthapps/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -6991,7 +7460,7 @@ public Modules(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -7000,7 +7469,7 @@ public Modules(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -7014,16 +7483,271 @@ public Modules(PlatformModuleClient client) } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OAuthApps operations. + /// + public partial interface IOAuthApps + { + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> NewOperationWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> SaveAsyncWithHttpMessagesAsync(OpenIddictApplicationDescriptor body = default(OpenIddictApplicationDescriptor), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + Task DeleteAsyncWithHttpMessagesAsync(IList clientIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> SearchAsyncWithHttpMessagesAsync(OAuthAppSearchCriteria body = default(OAuthAppSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OAuthApps. + /// + public static partial class OAuthAppsExtensions + { + /// + /// The operations group for this extension method. + /// + public static OpenIddictApplicationDescriptor NewOperation(this IOAuthApps operations) + { + return operations.NewOperationAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task NewOperationAsync(this IOAuthApps operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.NewOperationWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static OpenIddictApplicationDescriptor SaveAsync(this IOAuthApps operations, OpenIddictApplicationDescriptor body = default(OpenIddictApplicationDescriptor)) + { + return operations.SaveAsyncAsync(body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task SaveAsyncAsync(this IOAuthApps operations, OpenIddictApplicationDescriptor body = default(OpenIddictApplicationDescriptor), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.SaveAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static void DeleteAsync(this IOAuthApps operations, IList clientIds = default(IList)) + { + operations.DeleteAsyncAsync(clientIds).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsyncAsync(this IOAuthApps operations, IList clientIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteAsyncWithHttpMessagesAsync(clientIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static OAuthAppSearchResult SearchAsync(this IOAuthApps operations, OAuthAppSearchCriteria body = default(OAuthAppSearchCriteria)) + { + return operations.SearchAsyncAsync(body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task SearchAsyncAsync(this IOAuthApps operations, OAuthAppSearchCriteria body = default(OAuthAppSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.SearchAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PushNotificationOperations operations. + /// + public partial class PushNotificationOperations : IServiceOperations, IPushNotificationOperations + { + /// + /// Initializes a new instance of the PushNotificationOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public PushNotificationOperations(PlatformModuleClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); } - return _result; + Client = client; } /// - /// Uninstall module + /// Gets a reference to the PlatformModuleClient + /// + public PlatformModuleClient Client { get; private set; } + + /// + /// SearchAsync push notifications /// /// - /// modules + /// SearchAsync parameters. /// /// /// Headers that will be added to request. @@ -7040,7 +7764,7 @@ public Modules(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UninstallModuleWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> SearchPushNotificationWithHttpMessagesAsync(PushNotificationSearchCriteria body = default(PushNotificationSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -7051,11 +7775,11 @@ public Modules(PlatformModuleClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UninstallModule", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "SearchPushNotification", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/uninstall").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/pushnotifications").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -7127,7 +7851,7 @@ public Modules(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -7136,7 +7860,7 @@ public Modules(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -7156,112 +7880,7 @@ public Modules(PlatformModuleClient client) } /// - /// Restart web application - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task RestartWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Restart", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/restart").ToString(); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) - { - var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Auto-install modules with specified groups + /// Mark all notifications as read /// /// /// Headers that will be added to request. @@ -7278,7 +7897,7 @@ public Modules(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> TryToAutoInstallModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> MarkAllAsReadWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -7288,11 +7907,11 @@ public Modules(PlatformModuleClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "TryToAutoInstallModules", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "MarkAllAsRead", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/modules/autoinstall").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/pushnotifications/markAllAsRead").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -7358,7 +7977,7 @@ public Modules(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -7367,7 +7986,7 @@ public Modules(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -7400,126 +8019,23 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Modules operations. - /// - public partial interface IModules - { - /// - /// Reload modules - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - Task ReloadModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get installed modules - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task>> GetModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get all dependent modules for module - /// - /// - /// modules descriptors - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task>> GetDependingModulesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a flat expanded list of modules that depend on passed - /// modules - /// - /// - /// modules descriptors - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task>> GetMissingDependenciesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Upload module package for installation or update - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task> UploadModuleArchiveWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Install modules - /// - /// - /// modules for install - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task> InstallModulesWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PushNotificationOperations operations. + /// + public partial interface IPushNotificationOperations + { /// - /// Uninstall module + /// SearchAsync push notifications /// /// - /// modules + /// SearchAsync parameters. /// /// /// The headers that will be added to request. @@ -7533,22 +8049,9 @@ public partial interface IModules /// /// Thrown when unable to deserialize the response /// - Task> UninstallModuleWithHttpMessagesAsync(IList body = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Restart web application - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - Task RestartWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> SearchPushNotificationWithHttpMessagesAsync(PushNotificationSearchCriteria body = default(PushNotificationSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Auto-install modules with specified groups + /// Mark all notifications as read /// /// /// The headers that will be added to request. @@ -7562,7 +8065,7 @@ public partial interface IModules /// /// Thrown when unable to deserialize the response /// - Task> TryToAutoInstallModulesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> MarkAllAsReadWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // @@ -7585,265 +8088,57 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi using System.Threading.Tasks; /// - /// Extension methods for Modules. + /// Extension methods for PushNotificationOperations. /// - public static partial class ModulesExtensions - { - /// - /// Reload modules - /// - /// - /// The operations group for this extension method. - /// - public static void ReloadModules(this IModules operations) - { - operations.ReloadModulesAsync().GetAwaiter().GetResult(); - } - - /// - /// Reload modules - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task ReloadModulesAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.ReloadModulesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Get installed modules - /// - /// - /// The operations group for this extension method. - /// - public static IList GetModules(this IModules operations) - { - return operations.GetModulesAsync().GetAwaiter().GetResult(); - } - - /// - /// Get installed modules - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> GetModulesAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetModulesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get all dependent modules for module - /// - /// - /// The operations group for this extension method. - /// - /// - /// modules descriptors - /// - public static IList GetDependingModules(this IModules operations, IList body = default(IList)) - { - return operations.GetDependingModulesAsync(body).GetAwaiter().GetResult(); - } - - /// - /// Get all dependent modules for module - /// - /// - /// The operations group for this extension method. - /// - /// - /// modules descriptors - /// - /// - /// The cancellation token. - /// - public static async Task> GetDependingModulesAsync(this IModules operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDependingModulesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns a flat expanded list of modules that depend on passed modules - /// - /// - /// The operations group for this extension method. - /// - /// - /// modules descriptors - /// - public static IList GetMissingDependencies(this IModules operations, IList body = default(IList)) - { - return operations.GetMissingDependenciesAsync(body).GetAwaiter().GetResult(); - } - - /// - /// Returns a flat expanded list of modules that depend on passed modules - /// - /// - /// The operations group for this extension method. - /// - /// - /// modules descriptors - /// - /// - /// The cancellation token. - /// - public static async Task> GetMissingDependenciesAsync(this IModules operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetMissingDependenciesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Upload module package for installation or update - /// - /// - /// The operations group for this extension method. - /// - public static ModuleDescriptor UploadModuleArchive(this IModules operations) - { - return operations.UploadModuleArchiveAsync().GetAwaiter().GetResult(); - } - - /// - /// Upload module package for installation or update - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task UploadModuleArchiveAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UploadModuleArchiveWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Install modules - /// - /// - /// The operations group for this extension method. - /// - /// - /// modules for install - /// - public static ModulePushNotification InstallModules(this IModules operations, IList body = default(IList)) - { - return operations.InstallModulesAsync(body).GetAwaiter().GetResult(); - } - - /// - /// Install modules - /// - /// - /// The operations group for this extension method. - /// - /// - /// modules for install - /// - /// - /// The cancellation token. - /// - public static async Task InstallModulesAsync(this IModules operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.InstallModulesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Uninstall module - /// - /// - /// The operations group for this extension method. - /// - /// - /// modules - /// - public static ModulePushNotification UninstallModule(this IModules operations, IList body = default(IList)) - { - return operations.UninstallModuleAsync(body).GetAwaiter().GetResult(); - } - - /// - /// Uninstall module - /// - /// - /// The operations group for this extension method. - /// - /// - /// modules - /// - /// - /// The cancellation token. - /// - public static async Task UninstallModuleAsync(this IModules operations, IList body = default(IList), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UninstallModuleWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + public static partial class PushNotificationOperationsExtensions + { /// - /// Restart web application + /// SearchAsync push notifications /// /// /// The operations group for this extension method. /// - public static void Restart(this IModules operations) + /// + /// SearchAsync parameters. + /// + public static PushNotificationSearchResult SearchPushNotification(this IPushNotificationOperations operations, PushNotificationSearchCriteria body = default(PushNotificationSearchCriteria)) { - operations.RestartAsync().GetAwaiter().GetResult(); + return operations.SearchPushNotificationAsync(body).GetAwaiter().GetResult(); } /// - /// Restart web application + /// SearchAsync push notifications /// /// /// The operations group for this extension method. /// + /// + /// SearchAsync parameters. + /// /// /// The cancellation token. /// - public static async Task RestartAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task SearchPushNotificationAsync(this IPushNotificationOperations operations, PushNotificationSearchCriteria body = default(PushNotificationSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.RestartWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.SearchPushNotificationWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Auto-install modules with specified groups + /// Mark all notifications as read /// /// /// The operations group for this extension method. /// - public static ModuleAutoInstallPushNotification TryToAutoInstallModules(this IModules operations) + public static PushNotificationSearchResult MarkAllAsRead(this IPushNotificationOperations operations) { - return operations.TryToAutoInstallModulesAsync().GetAwaiter().GetResult(); + return operations.MarkAllAsReadAsync().GetAwaiter().GetResult(); } /// - /// Auto-install modules with specified groups + /// Mark all notifications as read /// /// /// The operations group for this extension method. @@ -7851,9 +8146,9 @@ public static ModuleAutoInstallPushNotification TryToAutoInstallModules(this IMo /// /// The cancellation token. /// - public static async Task TryToAutoInstallModulesAsync(this IModules operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task MarkAllAsReadAsync(this IPushNotificationOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.TryToAutoInstallModulesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.MarkAllAsReadWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -7883,12 +8178,12 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi using System.Threading.Tasks; /// - /// OAuthApps operations. + /// Security operations. /// - public partial class OAuthApps : IServiceOperations, IOAuthApps + public partial class Security : IServiceOperations, ISecurity { /// - /// Initializes a new instance of the OAuthApps class. + /// Initializes a new instance of the Security class. /// /// /// Reference to the service client. @@ -7896,7 +8191,7 @@ public partial class OAuthApps : IServiceOperations, IOAut /// /// Thrown when a required parameter is null /// - public OAuthApps(PlatformModuleClient client) + public Security(PlatformModuleClient client) { if (client == null) { @@ -7910,6 +8205,16 @@ public OAuthApps(PlatformModuleClient client) /// public PlatformModuleClient Client { get; private set; } + /// + /// Sign in with user name and password + /// + /// + /// Verifies provided credentials and if succeeded returns full user details, + /// otherwise returns 401 Unauthorized. + /// + /// + /// Login request. + /// /// /// Headers that will be added to request. /// @@ -7925,7 +8230,7 @@ public OAuthApps(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> NewOperationWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> LoginWithHttpMessagesAsync(LoginRequest body = default(LoginRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -7934,16 +8239,17 @@ public OAuthApps(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "NewOperation", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Login", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/oauthapps/new").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/login").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -7962,6 +8268,12 @@ public OAuthApps(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -7982,7 +8294,7 @@ public OAuthApps(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -8005,7 +8317,7 @@ public OAuthApps(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -8014,7 +8326,7 @@ public OAuthApps(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -8033,8 +8345,9 @@ public OAuthApps(PlatformModuleClient client) return _result; } - /// - /// + /// + /// Sign out + /// /// /// Headers that will be added to request. /// @@ -8044,13 +8357,10 @@ public OAuthApps(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// A response object containing the response body and response headers. /// - public async Task> SaveAsyncWithHttpMessagesAsync(OpenIddictApplicationDescriptor body = default(OpenIddictApplicationDescriptor), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task LogoutWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -8059,17 +8369,16 @@ public OAuthApps(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SaveAsync", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Logout", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/oauthapps").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/logout").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -8088,12 +8397,6 @@ public OAuthApps(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -8114,7 +8417,7 @@ public OAuthApps(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -8137,27 +8440,9 @@ public OAuthApps(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -8165,8 +8450,9 @@ public OAuthApps(PlatformModuleClient client) return _result; } - /// - /// + /// + /// Get current user details + /// /// /// Headers that will be added to request. /// @@ -8176,10 +8462,13 @@ public OAuthApps(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// - public async Task DeleteAsyncWithHttpMessagesAsync(IList clientIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetCurrentUserWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -8188,26 +8477,16 @@ public OAuthApps(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("clientIds", clientIds); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteAsync", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetCurrentUser", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/oauthapps").ToString(); - List _queryParameters = new List(); - if (clientIds != null) - { - _queryParameters.Add(string.Format("clientIds={0}", System.Uri.EscapeDataString(string.Join(",", clientIds)))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/currentuser").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -8269,9 +8548,27 @@ public OAuthApps(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -8279,8 +8576,6 @@ public OAuthApps(PlatformModuleClient client) return _result; } - /// - /// /// /// Headers that will be added to request. /// @@ -8296,7 +8591,7 @@ public OAuthApps(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> SearchAsyncWithHttpMessagesAsync(OAuthAppSearchCriteria body = default(OAuthAppSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> UserinfoWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -8305,17 +8600,16 @@ public OAuthApps(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SearchAsync", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Userinfo", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/oauthapps/search").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/userinfo").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -8334,12 +8628,6 @@ public OAuthApps(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -8383,7 +8671,7 @@ public OAuthApps(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -8392,7 +8680,7 @@ public OAuthApps(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -8404,300 +8692,144 @@ public OAuthApps(PlatformModuleClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// OAuthApps operations. - /// - public partial interface IOAuthApps - { - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task> NewOperationWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task> SaveAsyncWithHttpMessagesAsync(OpenIddictApplicationDescriptor body = default(OpenIddictApplicationDescriptor), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - Task DeleteAsyncWithHttpMessagesAsync(IList clientIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get all registered permissions + /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - Task> SearchAsyncWithHttpMessagesAsync(OAuthAppSearchCriteria body = default(OAuthAppSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for OAuthApps. - /// - public static partial class OAuthAppsExtensions - { - /// - /// The operations group for this extension method. - /// - public static OpenIddictApplicationDescriptor NewOperation(this IOAuthApps operations) + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetAllRegisteredPermissionsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) { - return operations.NewOperationAsync().GetAwaiter().GetResult(); + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetAllRegisteredPermissions", tracingParameters); } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/permissions").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task NewOperationAsync(this IOAuthApps operations, CancellationToken cancellationToken = default(CancellationToken)) + + if (customHeaders != null) { - using (var _result = await operations.NewOperationWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + foreach(var _header in customHeaders) { - return _result.Body; + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - /// - /// The operations group for this extension method. - /// - /// - /// - public static OpenIddictApplicationDescriptor SaveAsync(this IOAuthApps operations, OpenIddictApplicationDescriptor body = default(OpenIddictApplicationDescriptor)) - { - return operations.SaveAsyncAsync(body).GetAwaiter().GetResult(); - } - - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task SaveAsyncAsync(this IOAuthApps operations, OpenIddictApplicationDescriptor body = default(OpenIddictApplicationDescriptor), CancellationToken cancellationToken = default(CancellationToken)) + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) { - using (var _result = await operations.SaveAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } - - /// - /// The operations group for this extension method. - /// - /// - /// - public static void DeleteAsync(this IOAuthApps operations, IList clientIds = default(IList)) + // Send Request + if (_shouldTrace) { - operations.DeleteAsyncAsync(clientIds).GetAwaiter().GetResult(); + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } - - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsyncAsync(this IOAuthApps operations, IList clientIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) { - (await operations.DeleteAsyncWithHttpMessagesAsync(clientIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - - /// - /// The operations group for this extension method. - /// - /// - /// - public static OAuthAppSearchResult SearchAsync(this IOAuthApps operations, OAuthAppSearchCriteria body = default(OAuthAppSearchCriteria)) + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { - return operations.SearchAsyncAsync(body).GetAwaiter().GetResult(); + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; } - - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task SearchAsyncAsync(this IOAuthApps operations, OAuthAppSearchCriteria body = default(OAuthAppSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) { - using (var _result = await operations.SearchAsyncWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try { - return _result.Body; + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } - - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PushNotificationOperations operations. - /// - public partial class PushNotificationOperations : IServiceOperations, IPushNotificationOperations - { - /// - /// Initializes a new instance of the PushNotificationOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public PushNotificationOperations(PlatformModuleClient client) - { - if (client == null) + if (_shouldTrace) { - throw new System.ArgumentNullException("client"); + ServiceClientTracing.Exit(_invocationId, _result); } - Client = client; + return _result; } /// - /// Gets a reference to the PlatformModuleClient - /// - public PlatformModuleClient Client { get; private set; } - - /// - /// SearchAsync push notifications + /// SearchAsync roles by keyword /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// + /// + /// SearchAsync parameters. /// /// /// Headers that will be added to request. @@ -8714,7 +8846,7 @@ public PushNotificationOperations(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> SearchPushNotificationWithHttpMessagesAsync(IList ids = default(IList), bool? onlyNew = default(bool?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> SearchRolesWithHttpMessagesAsync(RoleSearchCriteria body = default(RoleSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -8723,87 +8855,290 @@ public PushNotificationOperations(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("ids", ids); - tracingParameters.Add("onlyNew", onlyNew); - tracingParameters.Add("startDate", startDate); - tracingParameters.Add("endDate", endDate); - tracingParameters.Add("responseGroup", responseGroup); - tracingParameters.Add("objectType", objectType); - tracingParameters.Add("objectTypes", objectTypes); - tracingParameters.Add("objectIds", objectIds); - tracingParameters.Add("keyword", keyword); - tracingParameters.Add("searchPhrase", searchPhrase); - tracingParameters.Add("languageCode", languageCode); - tracingParameters.Add("sort", sort); - tracingParameters.Add("sortInfos", sortInfos); - tracingParameters.Add("skip", skip); - tracingParameters.Add("take", take); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SearchPushNotification", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "SearchRoles", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/pushnotifications").ToString(); - List _queryParameters = new List(); - if (ids != null) + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/roles/search").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) { - _queryParameters.Add(string.Format("Ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - if (onlyNew != null) + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { - _queryParameters.Add(string.Format("OnlyNew={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(onlyNew, Client.SerializationSettings).Trim('"')))); + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; } - if (startDate != null) + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) { - _queryParameters.Add(string.Format("StartDate={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(startDate, Client.SerializationSettings).Trim('"')))); + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } } - if (endDate != null) + if (_shouldTrace) { - _queryParameters.Add(string.Format("EndDate={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(endDate, Client.SerializationSettings).Trim('"')))); + ServiceClientTracing.Exit(_invocationId, _result); } - if (responseGroup != null) + return _result; + } + + /// + /// Get role by ID + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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> GetRoleWithHttpMessagesAsync(string roleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleName == null) { - _queryParameters.Add(string.Format("ResponseGroup={0}", System.Uri.EscapeDataString(responseGroup))); + throw new ValidationException(ValidationRules.CannotBeNull, "roleName"); } - if (objectType != null) + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) { - _queryParameters.Add(string.Format("ObjectType={0}", System.Uri.EscapeDataString(objectType))); + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleName", roleName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetRole", tracingParameters); } - if (objectTypes != null) + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/roles/{roleName}").ToString(); + _url = _url.Replace("{roleName}", System.Uri.EscapeDataString(roleName)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) { - _queryParameters.Add(string.Format("ObjectTypes={0}", System.Uri.EscapeDataString(string.Join(",", objectTypes)))); + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } } - if (objectIds != null) + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) { - _queryParameters.Add(string.Format("ObjectIds={0}", System.Uri.EscapeDataString(string.Join(",", objectIds)))); + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } - if (keyword != null) + // Send Request + if (_shouldTrace) { - _queryParameters.Add(string.Format("Keyword={0}", System.Uri.EscapeDataString(keyword))); + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } - if (searchPhrase != null) + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) { - _queryParameters.Add(string.Format("SearchPhrase={0}", System.Uri.EscapeDataString(searchPhrase))); + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - if (languageCode != null) + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { - _queryParameters.Add(string.Format("LanguageCode={0}", System.Uri.EscapeDataString(languageCode))); + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; } - if (sort != null) + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) { - _queryParameters.Add(string.Format("Sort={0}", System.Uri.EscapeDataString(sort))); + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } } - if (sortInfos != null) + if (_shouldTrace) { - _queryParameters.Add(string.Format("SortInfos={0}", System.Uri.EscapeDataString(string.Join(",", sortInfos)))); + ServiceClientTracing.Exit(_invocationId, _result); } - if (skip != null) + return _result; + } + + /// + /// Delete roles by ID + /// + /// + /// An array of role IDs. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteRolesWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) { - _queryParameters.Add(string.Format("Skip={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("ids", ids); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteRoles", tracingParameters); } - if (take != null) + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/roles").ToString(); + List _queryParameters = new List(); + if (ids != null) { - _queryParameters.Add(string.Format("Take={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(take, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); } if (_queryParameters.Count > 0) { @@ -8812,7 +9147,7 @@ public PushNotificationOperations(PlatformModuleClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -8851,7 +9186,7 @@ public PushNotificationOperations(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -8874,27 +9209,9 @@ public PushNotificationOperations(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -8903,8 +9220,10 @@ public PushNotificationOperations(PlatformModuleClient client) } /// - /// Mark all notifications as read + /// Update an existing role or create new /// + /// + /// /// /// Headers that will be added to request. /// @@ -8920,7 +9239,7 @@ public PushNotificationOperations(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> MarkAllAsReadWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateRoleWithHttpMessagesAsync(Role body = default(Role), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -8929,16 +9248,17 @@ public PushNotificationOperations(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "MarkAllAsRead", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "UpdateRole", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/pushnotifications/markAllAsRead").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/roles").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -8957,6 +9277,12 @@ public PushNotificationOperations(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -9000,7 +9326,7 @@ public PushNotificationOperations(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -9009,7 +9335,7 @@ public PushNotificationOperations(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -9017,307 +9343,22 @@ public PushNotificationOperations(PlatformModuleClient client) if (_httpResponse != null) { _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PushNotificationOperations operations. - /// - public partial interface IPushNotificationOperations - { - /// - /// SearchAsync push notifications - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task> SearchPushNotificationWithHttpMessagesAsync(IList ids = default(IList), bool? onlyNew = default(bool?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Mark all notifications as read - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task> MarkAllAsReadWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PushNotificationOperations. - /// - public static partial class PushNotificationOperationsExtensions - { - /// - /// SearchAsync push notifications - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static PushNotificationSearchResult SearchPushNotification(this IPushNotificationOperations operations, IList ids = default(IList), bool? onlyNew = default(bool?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) - { - return operations.SearchPushNotificationAsync(ids, onlyNew, startDate, endDate, responseGroup, objectType, objectTypes, objectIds, keyword, searchPhrase, languageCode, sort, sortInfos, skip, take).GetAwaiter().GetResult(); - } - - /// - /// SearchAsync push notifications - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task SearchPushNotificationAsync(this IPushNotificationOperations operations, IList ids = default(IList), bool? onlyNew = default(bool?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.SearchPushNotificationWithHttpMessagesAsync(ids, onlyNew, startDate, endDate, responseGroup, objectType, objectTypes, objectIds, keyword, searchPhrase, languageCode, sort, sortInfos, skip, take, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Mark all notifications as read - /// - /// - /// The operations group for this extension method. - /// - public static PushNotificationSearchResult MarkAllAsRead(this IPushNotificationOperations operations) - { - return operations.MarkAllAsReadAsync().GetAwaiter().GetResult(); - } - - /// - /// Mark all notifications as read - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task MarkAllAsReadAsync(this IPushNotificationOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.MarkAllAsReadWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } - - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Security operations. - /// - public partial class Security : IServiceOperations, ISecurity - { - /// - /// Initializes a new instance of the Security class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public Security(PlatformModuleClient client) - { - if (client == null) + if (_shouldTrace) { - throw new System.ArgumentNullException("client"); + ServiceClientTracing.Exit(_invocationId, _result); } - Client = client; + return _result; } /// - /// Gets a reference to the PlatformModuleClient - /// - public PlatformModuleClient Client { get; private set; } - - /// - /// Sign in with user name and password + /// SearchAsync users by keyword /// - /// - /// Verifies provided credentials and if succeeded returns full user details, - /// otherwise returns 401 Unauthorized. - /// /// - /// Login request. + /// Search criteria. /// /// /// Headers that will be added to request. @@ -9334,7 +9375,7 @@ public Security(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> LoginWithHttpMessagesAsync(LoginRequest body = default(LoginRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> SearchUsersWithHttpMessagesAsync(UserSearchCriteria body = default(UserSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -9345,11 +9386,11 @@ public Security(PlatformModuleClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Login", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "SearchUsers", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/login").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/search").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -9398,7 +9439,7 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -9421,7 +9462,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -9430,7 +9471,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -9450,8 +9491,10 @@ public Security(PlatformModuleClient client) } /// - /// Sign out + /// Get user details by user name /// + /// + /// /// /// Headers that will be added to request. /// @@ -9461,11 +9504,24 @@ public Security(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// 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 LogoutWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetUserByNameWithHttpMessagesAsync(string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -9473,12 +9529,14 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("userName", userName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Logout", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetUserByName", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/logout").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userName}").ToString(); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -9521,7 +9579,147 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get user details by user ID + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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> GetUserByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetUserById", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/id/{id}").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -9539,14 +9737,32 @@ public Security(PlatformModuleClient client) _httpRequest.Dispose(); if (_httpResponse != null) { - _httpResponse.Dispose(); + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } - throw ex; } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -9555,8 +9771,10 @@ public Security(PlatformModuleClient client) } /// - /// Get current user details + /// Get user details by user email /// + /// + /// /// /// Headers that will be added to request. /// @@ -9569,11 +9787,21 @@ public Security(PlatformModuleClient 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> GetCurrentUserWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetUserByEmailWithHttpMessagesAsync(string email, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (email == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "email"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -9581,12 +9809,14 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("email", email); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetCurrentUser", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetUserByEmail", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/currentuser").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/email/{email}").ToString(); + _url = _url.Replace("{email}", System.Uri.EscapeDataString(email)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -9652,7 +9882,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -9661,7 +9891,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -9680,6 +9910,13 @@ public Security(PlatformModuleClient client) return _result; } + /// + /// Get user details by external login provider + /// + /// + /// + /// + /// /// /// Headers that will be added to request. /// @@ -9692,11 +9929,25 @@ public Security(PlatformModuleClient 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>> UserinfoWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetUserByLoginWithHttpMessagesAsync(string loginProvider, string providerKey, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (loginProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "loginProvider"); + } + if (providerKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "providerKey"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -9704,12 +9955,16 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("loginProvider", loginProvider); + tracingParameters.Add("providerKey", providerKey); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Userinfo", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetUserByLogin", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/userinfo").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/login/external/{loginProvider}/{providerKey}").ToString(); + _url = _url.Replace("{loginProvider}", System.Uri.EscapeDataString(loginProvider)); + _url = _url.Replace("{providerKey}", System.Uri.EscapeDataString(providerKey)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -9775,7 +10030,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse>(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -9784,7 +10039,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -9804,8 +10059,10 @@ public Security(PlatformModuleClient client) } /// - /// Get all registered permissions + /// Create new user /// + /// + /// /// /// Headers that will be added to request. /// @@ -9821,7 +10078,7 @@ public Security(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> GetAllRegisteredPermissionsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateWithHttpMessagesAsync(ApplicationUser body = default(ApplicationUser), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -9830,16 +10087,17 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetAllRegisteredPermissions", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/permissions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/create").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -9858,6 +10116,12 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -9901,7 +10165,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse>(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -9910,7 +10174,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -9930,10 +10194,10 @@ public Security(PlatformModuleClient client) } /// - /// SearchAsync roles by keyword + /// Change password for current user. /// /// - /// SearchAsync parameters. + /// Old and new passwords. /// /// /// Headers that will be added to request. @@ -9950,7 +10214,7 @@ public Security(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> SearchRolesWithHttpMessagesAsync(RoleSearchCriteria body = default(RoleSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ChangeCurrentUserPasswordWithHttpMessagesAsync(ChangePasswordRequest body = default(ChangePasswordRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -9961,11 +10225,11 @@ public Security(PlatformModuleClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SearchRoles", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ChangeCurrentUserPassword", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/roles/search").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/currentuser/changepassword").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -10014,7 +10278,7 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200 && (int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -10037,7 +10301,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -10046,7 +10310,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -10066,9 +10330,13 @@ public Security(PlatformModuleClient client) } /// - /// Get role by ID + /// Change password /// - /// + /// + /// user name + /// + /// + /// Old and new passwords. /// /// /// Headers that will be added to request. @@ -10091,11 +10359,11 @@ public Security(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetRoleWithHttpMessagesAsync(string roleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ChangePasswordWithHttpMessagesAsync(string userName, ChangePasswordRequest body = default(ChangePasswordRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (roleName == null) + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "roleName"); + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -10104,18 +10372,19 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("roleName", roleName); + tracingParameters.Add("body", body); + tracingParameters.Add("userName", userName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetRole", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ChangePassword", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/roles/{roleName}").ToString(); - _url = _url.Replace("{roleName}", System.Uri.EscapeDataString(roleName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userName}/changepassword").ToString(); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -10134,6 +10403,12 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -10154,7 +10429,7 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200 && (int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -10177,7 +10452,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -10186,7 +10461,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -10206,10 +10481,12 @@ public Security(PlatformModuleClient client) } /// - /// Delete roles by ID + /// Reset password confirmation /// - /// - /// An array of role IDs. + /// + /// + /// + /// Password reset information containing new password. /// /// /// Headers that will be added to request. @@ -10220,11 +10497,24 @@ public Security(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// 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 DeleteRolesWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ResetPasswordWithHttpMessagesAsync(string userName, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -10232,26 +10522,19 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("ids", ids); + tracingParameters.Add("body", body); + tracingParameters.Add("userName", userName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteRoles", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ResetPassword", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/roles").ToString(); - List _queryParameters = new List(); - if (ids != null) - { - _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userName}/resetpassword").ToString(); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -10270,6 +10553,12 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -10290,7 +10579,7 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -10313,9 +10602,27 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -10324,9 +10631,12 @@ public Security(PlatformModuleClient client) } /// - /// Update an existing role or create new + /// Reset password confirmation /// + /// + /// /// + /// New password. /// /// /// Headers that will be added to request. @@ -10340,11 +10650,21 @@ public Security(PlatformModuleClient 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> UpdateRoleWithHttpMessagesAsync(Role body = default(Role), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ResetPasswordByTokenWithHttpMessagesAsync(string userId, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (userId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userId"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -10353,16 +10673,18 @@ public Security(PlatformModuleClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); + tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateRole", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ResetPasswordByToken", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/roles").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/resetpasswordconfirm").ToString(); + _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -10407,7 +10729,7 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -10459,10 +10781,11 @@ public Security(PlatformModuleClient client) } /// - /// SearchAsync users by keyword + /// Validate password reset token /// + /// + /// /// - /// Search criteria. /// /// /// Headers that will be added to request. @@ -10476,11 +10799,21 @@ public Security(PlatformModuleClient 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> SearchUsersWithHttpMessagesAsync(UserSearchCriteria body = default(UserSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ValidatePasswordResetTokenWithHttpMessagesAsync(string userId, ValidatePasswordResetTokenRequest body = default(ValidatePasswordResetTokenRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (userId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userId"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -10489,12 +10822,14 @@ public Security(PlatformModuleClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); + tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SearchUsers", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ValidatePasswordResetToken", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/validatepasswordresettoken").ToString(); + _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -10543,7 +10878,7 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -10566,7 +10901,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -10575,7 +10910,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -10595,10 +10930,12 @@ public Security(PlatformModuleClient client) } /// - /// Update user details by user ID + /// Send email with instructions on how to reset user password. /// - /// - /// User details. + /// + /// Verifies provided userName and (if succeeded) sends email. + /// + /// /// /// /// Headers that will be added to request. @@ -10609,14 +10946,21 @@ public Security(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// 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> UpdateWithHttpMessagesAsync(ApplicationUser body = default(ApplicationUser), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task RequestPasswordResetWithHttpMessagesAsync(string loginOrEmail, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (loginOrEmail == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "loginOrEmail"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -10624,17 +10968,18 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); + tracingParameters.Add("loginOrEmail", loginOrEmail); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "RequestPasswordReset", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{loginOrEmail}/requestpasswordreset").ToString(); + _url = _url.Replace("{loginOrEmail}", System.Uri.EscapeDataString(loginOrEmail)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -10653,12 +10998,6 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -10679,7 +11018,7 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -10702,27 +11041,9 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -10730,11 +11051,7 @@ public Security(PlatformModuleClient client) return _result; } - /// - /// Delete users by name - /// - /// - /// An array of user names. + /// /// /// /// Headers that will be added to request. @@ -10745,10 +11062,13 @@ public Security(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(IList names = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ValidatePasswordWithHttpMessagesAsync(string body = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -10757,26 +11077,17 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("names", names); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ValidatePassword", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users").ToString(); - List _queryParameters = new List(); - if (names != null) - { - _queryParameters.Add(string.Format("names={0}", System.Uri.EscapeDataString(string.Join(",", names)))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/validatepassword").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -10795,6 +11106,12 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -10815,7 +11132,7 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -10838,9 +11155,27 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -10848,10 +11183,7 @@ public Security(PlatformModuleClient client) return _result; } - /// - /// Get user details by user name - /// - /// + /// /// /// /// Headers that will be added to request. @@ -10865,21 +11197,11 @@ public Security(PlatformModuleClient 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> GetUserByNameWithHttpMessagesAsync(string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ValidateUserPasswordWithHttpMessagesAsync(ChangePasswordRequest body = default(ChangePasswordRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -10887,18 +11209,17 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("userName", userName); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetUserByName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ValidateUserPassword", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userName}").ToString(); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/validateuserpassword").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -10917,6 +11238,12 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -10960,7 +11287,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -10969,7 +11296,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -10989,9 +11316,10 @@ public Security(PlatformModuleClient client) } /// - /// Get user details by user ID + /// Update user details by user ID /// - /// + /// + /// User details. /// /// /// Headers that will be added to request. @@ -11005,21 +11333,11 @@ public Security(PlatformModuleClient 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> GetUserByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(ApplicationUser body = default(ApplicationUser), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "id"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -11027,18 +11345,17 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("id", id); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetUserById", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/id/{id}").ToString(); - _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -11057,6 +11374,12 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -11100,7 +11423,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -11109,7 +11432,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -11129,9 +11452,10 @@ public Security(PlatformModuleClient client) } /// - /// Get user details by user email + /// Delete users by name /// - /// + /// + /// An array of user names. /// /// /// Headers that will be added to request. @@ -11142,24 +11466,11 @@ public Security(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// 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> GetUserByEmailWithHttpMessagesAsync(string email, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(IList names = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (email == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "email"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -11167,18 +11478,26 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("email", email); + tracingParameters.Add("names", names); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetUserByEmail", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/email/{email}").ToString(); - _url = _url.Replace("{email}", System.Uri.EscapeDataString(email)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users").ToString(); + List _queryParameters = new List(); + if (names != null) + { + _queryParameters.Add(string.Format("names={0}", System.Uri.EscapeDataString(string.Join(",", names)))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -11240,27 +11559,9 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -11269,11 +11570,10 @@ public Security(PlatformModuleClient client) } /// - /// Get user details by external login provider + /// Checks if user locked /// - /// - /// - /// + /// + /// User id /// /// /// Headers that will be added to request. @@ -11296,15 +11596,11 @@ public Security(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetUserByLoginWithHttpMessagesAsync(string loginProvider, string providerKey, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> IsUserLockedWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (loginProvider == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "loginProvider"); - } - if (providerKey == null) + if (id == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "providerKey"); + throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -11313,16 +11609,14 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("loginProvider", loginProvider); - tracingParameters.Add("providerKey", providerKey); + tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetUserByLogin", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "IsUserLocked", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/login/external/{loginProvider}/{providerKey}").ToString(); - _url = _url.Replace("{loginProvider}", System.Uri.EscapeDataString(loginProvider)); - _url = _url.Replace("{providerKey}", System.Uri.EscapeDataString(providerKey)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{id}/locked").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -11388,7 +11682,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -11397,7 +11691,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -11417,10 +11711,8 @@ public Security(PlatformModuleClient client) } /// - /// Create new user + /// Checks if manual password change is enabled /// - /// - /// /// /// Headers that will be added to request. /// @@ -11436,7 +11728,7 @@ public Security(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateWithHttpMessagesAsync(ApplicationUser body = default(ApplicationUser), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> PasswordChangeEnabledWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -11445,17 +11737,16 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "PasswordChangeEnabled", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/create").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/passwordchangeenabled").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -11474,12 +11765,6 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -11523,7 +11808,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -11532,7 +11817,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -11552,12 +11837,10 @@ public Security(PlatformModuleClient client) } /// - /// Change password + /// Lock user /// - /// - /// - /// - /// Old and new passwords. + /// + /// >User id /// /// /// Headers that will be added to request. @@ -11568,6 +11851,9 @@ public Security(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -11577,11 +11863,11 @@ public Security(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task ChangePasswordWithHttpMessagesAsync(string userName, ChangePasswordRequest body = default(ChangePasswordRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> LockUserWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (userName == null) + if (id == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -11590,15 +11876,14 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); - tracingParameters.Add("userName", userName); + tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ChangePassword", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "LockUser", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userName}/changepassword").ToString(); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{id}/lock").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -11621,12 +11906,6 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -11647,7 +11926,7 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -11670,9 +11949,27 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -11681,10 +11978,10 @@ public Security(PlatformModuleClient client) } /// - /// Resets password for current user. + /// Unlock user /// - /// - /// Password reset information containing new password. + /// + /// >User id /// /// /// Headers that will be added to request. @@ -11698,11 +11995,21 @@ public Security(PlatformModuleClient 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> ResetCurrentUserPasswordWithHttpMessagesAsync(ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UnlockUserWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -11710,13 +12017,14 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); + tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ResetCurrentUserPassword", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "UnlockUser", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/currentuser/resetpassword").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{id}/unlock").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -11739,12 +12047,6 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -11765,7 +12067,7 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -11816,13 +12118,7 @@ public Security(PlatformModuleClient client) return _result; } - /// - /// Reset password confirmation - /// - /// - /// - /// - /// New password. + /// /// /// /// Headers that will be added to request. @@ -11845,11 +12141,11 @@ public Security(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ResetPasswordWithHttpMessagesAsync(string userName, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> GetUserApiKeysWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (userName == null) + if (id == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new ValidationException(ValidationRules.CannotBeNull, "id"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -11858,19 +12154,18 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); - tracingParameters.Add("userName", userName); + tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ResetPassword", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetUserApiKeys", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userName}/resetpassword").ToString(); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{id}/apikeys").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -11889,12 +12184,6 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -11938,7 +12227,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -11947,7 +12236,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -11966,13 +12255,7 @@ public Security(PlatformModuleClient client) return _result; } - /// - /// Reset password confirmation - /// - /// - /// /// - /// New password. /// /// /// Headers that will be added to request. @@ -11986,21 +12269,11 @@ public Security(PlatformModuleClient 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> ResetPasswordByTokenWithHttpMessagesAsync(string userId, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> SaveUserApiKeyWithHttpMessagesAsync(UserApiKey body = default(UserApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (userId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userId"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -12009,14 +12282,12 @@ public Security(PlatformModuleClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); - tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ResetPasswordByToken", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "SaveUserApiKey", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/resetpasswordconfirm").ToString(); - _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/apikeys").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -12065,7 +12336,7 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -12088,7 +12359,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -12097,7 +12368,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -12116,11 +12387,6 @@ public Security(PlatformModuleClient client) return _result; } - /// - /// Validate password reset token - /// - /// - /// /// /// /// @@ -12135,21 +12401,11 @@ public Security(PlatformModuleClient 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> ValidatePasswordResetTokenWithHttpMessagesAsync(string userId, ValidatePasswordResetTokenRequest body = default(ValidatePasswordResetTokenRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> UpdateUserApiKeyWithHttpMessagesAsync(UserApiKey body = default(UserApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (userId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userId"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -12158,18 +12414,16 @@ public Security(PlatformModuleClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); - tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ValidatePasswordResetToken", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "UpdateUserApiKey", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/validatepasswordresettoken").ToString(); - _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/apikeys").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -12214,7 +12468,7 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -12237,7 +12491,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -12246,7 +12500,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -12265,13 +12519,7 @@ public Security(PlatformModuleClient client) return _result; } - /// - /// Send email with instructions on how to reset user password. - /// - /// - /// Verifies provided userName and (if succeeded) sends email. - /// - /// + /// /// /// /// Headers that will be added to request. @@ -12282,21 +12530,14 @@ public Security(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null + /// + /// Thrown when unable to deserialize the response /// /// /// A response object containing the response body and response headers. /// - public async Task RequestPasswordResetWithHttpMessagesAsync(string loginOrEmail, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> DeleteUserApiKeysWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (loginOrEmail == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "loginOrEmail"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -12304,18 +12545,26 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("loginOrEmail", loginOrEmail); + tracingParameters.Add("ids", ids); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "RequestPasswordReset", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteUserApiKeys", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/apikeys").ToString(); + List _queryParameters = new List(); + if (ids != null) + { + _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{loginOrEmail}/requestpasswordreset").ToString(); - _url = _url.Replace("{loginOrEmail}", System.Uri.EscapeDataString(loginOrEmail)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -12354,7 +12603,7 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -12377,9 +12626,27 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -12387,8 +12654,9 @@ public Security(PlatformModuleClient client) return _result; } - /// - /// + /// + /// Get allowed login types + /// /// /// Headers that will be added to request. /// @@ -12398,13 +12666,10 @@ public Security(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// A response object containing the response body and response headers. /// - public async Task> ValidatePasswordWithHttpMessagesAsync(string body = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task GetLoginTypesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -12413,17 +12678,16 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ValidatePassword", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetLoginTypes", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/validatepassword").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/logintypes").ToString(); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -12442,12 +12706,6 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -12468,7 +12726,7 @@ public Security(PlatformModuleClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) + if ((int)_statusCode != 200) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { @@ -12491,27 +12749,9 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -12520,10 +12760,9 @@ public Security(PlatformModuleClient client) } /// - /// Checks if user locked + /// Verify user email /// - /// - /// User id + /// /// /// /// Headers that will be added to request. @@ -12534,9 +12773,6 @@ public Security(PlatformModuleClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -12546,11 +12782,11 @@ public Security(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> IsUserLockedWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task SendVerificationEmailWithHttpMessagesAsync(string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (id == null) + if (userId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "id"); + throw new ValidationException(ValidationRules.CannotBeNull, "userId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -12559,18 +12795,18 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("id", id); + tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "IsUserLocked", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "SendVerificationEmail", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{id}/locked").ToString(); - _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/sendVerificationEmail").ToString(); + _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -12632,27 +12868,9 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -12660,11 +12878,9 @@ public Security(PlatformModuleClient client) return _result; } - /// - /// Lock user - /// - /// - /// >User id + /// + /// + /// /// /// /// Headers that will be added to request. @@ -12687,11 +12903,11 @@ public Security(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> LockUserWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ConfirmEmailWithHttpMessagesAsync(string userId, ConfirmEmailRequest body = default(ConfirmEmailRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (id == null) + if (userId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "id"); + throw new ValidationException(ValidationRules.CannotBeNull, "userId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -12700,14 +12916,15 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("id", id); + tracingParameters.Add("body", body); + tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "LockUser", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ConfirmEmail", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{id}/lock").ToString(); - _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/confirmEmail").ToString(); + _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -12730,6 +12947,12 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -12801,11 +13024,9 @@ public Security(PlatformModuleClient client) return _result; } - /// - /// Unlock user - /// - /// - /// >User id + /// + /// + /// /// /// /// Headers that will be added to request. @@ -12828,11 +13049,11 @@ public Security(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UnlockUserWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GenerateChangeEmailTokenWithHttpMessagesAsync(string userId, string newEmail = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (id == null) + if (userId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "id"); + throw new ValidationException(ValidationRules.CannotBeNull, "userId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -12841,18 +13062,28 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("id", id); + tracingParameters.Add("userId", userId); + tracingParameters.Add("newEmail", newEmail); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UnlockUser", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GenerateChangeEmailToken", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{id}/unlock").ToString(); - _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/generateChangeEmailToken").ToString(); + _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); + List _queryParameters = new List(); + if (newEmail != null) + { + _queryParameters.Add(string.Format("newEmail={0}", System.Uri.EscapeDataString(newEmail))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -12914,7 +13145,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -12923,7 +13154,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -12942,7 +13173,7 @@ public Security(PlatformModuleClient client) return _result; } - /// + /// /// /// /// Headers that will be added to request. @@ -12965,11 +13196,11 @@ public Security(PlatformModuleClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> GetUserApiKeysWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GenerateEmailConfirmationTokenWithHttpMessagesAsync(string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (id == null) + if (userId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "id"); + throw new ValidationException(ValidationRules.CannotBeNull, "userId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -12978,14 +13209,14 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("id", id); + tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetUserApiKeys", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GenerateEmailConfirmationToken", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{id}/apikeys").ToString(); - _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/generateEmailConfirmationToken").ToString(); + _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; @@ -13051,7 +13282,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse>(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -13060,7 +13291,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -13079,7 +13310,7 @@ public Security(PlatformModuleClient client) return _result; } - /// + /// /// /// /// Headers that will be added to request. @@ -13093,11 +13324,21 @@ public Security(PlatformModuleClient 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>> SaveUserApiKeyWithHttpMessagesAsync(UserApiKey body = default(UserApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GeneratePasswordResetTokenWithHttpMessagesAsync(string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (userId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userId"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -13105,17 +13346,18 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); + tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SaveUserApiKey", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GeneratePasswordResetToken", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/apikeys").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/generatePasswordResetToken").ToString(); + _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -13134,12 +13376,6 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -13183,7 +13419,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse>(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -13192,7 +13428,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -13211,7 +13447,11 @@ public Security(PlatformModuleClient client) return _result; } - /// + /// + /// + /// + /// + /// /// /// /// Headers that will be added to request. @@ -13225,11 +13465,21 @@ public Security(PlatformModuleClient 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>> UpdateUserApiKeyWithHttpMessagesAsync(UserApiKey body = default(UserApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GenerateUserTokenWithHttpMessagesAsync(string userId, string tokenProvider = default(string), string purpose = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (userId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userId"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -13237,17 +13487,33 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); + tracingParameters.Add("userId", userId); + tracingParameters.Add("tokenProvider", tokenProvider); + tracingParameters.Add("purpose", purpose); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateUserApiKey", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GenerateUserToken", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/apikeys").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/generateToken").ToString(); + _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); + List _queryParameters = new List(); + if (tokenProvider != null) + { + _queryParameters.Add(string.Format("tokenProvider={0}", System.Uri.EscapeDataString(tokenProvider))); + } + if (purpose != null) + { + _queryParameters.Add(string.Format("purpose={0}", System.Uri.EscapeDataString(purpose))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -13266,12 +13532,6 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -13315,7 +13575,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse>(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -13324,7 +13584,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -13343,7 +13603,9 @@ public Security(PlatformModuleClient client) return _result; } - /// + /// + /// + /// /// /// /// Headers that will be added to request. @@ -13357,11 +13619,21 @@ public Security(PlatformModuleClient 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>> DeleteUserApiKeysWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> VerifyUserTokenWithHttpMessagesAsync(string userId, VerifyTokenRequest body = default(VerifyTokenRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (userId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userId"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -13369,26 +13641,19 @@ public Security(PlatformModuleClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("ids", ids); + tracingParameters.Add("body", body); + tracingParameters.Add("userId", userId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteUserApiKeys", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "VerifyUserToken", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/apikeys").ToString(); - List _queryParameters = new List(); - if (ids != null) - { - _queryParameters.Add(string.Format("ids={0}", System.Uri.EscapeDataString(string.Join(",", ids)))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/platform/security/users/{userId}/generateToken").ToString(); + _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -13407,6 +13672,12 @@ public Security(PlatformModuleClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -13450,7 +13721,7 @@ public Security(PlatformModuleClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse>(); + var _result = new HttpOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -13459,7 +13730,7 @@ public Security(PlatformModuleClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -13679,10 +13950,95 @@ public partial interface ISecurity /// Task> SearchUsersWithHttpMessagesAsync(UserSearchCriteria body = default(UserSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Update user details by user ID + /// Get user details by user name + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetUserByNameWithHttpMessagesAsync(string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get user details by user ID + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetUserByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get user details by user email + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetUserByEmailWithHttpMessagesAsync(string email, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get user details by external login provider + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetUserByLoginWithHttpMessagesAsync(string loginProvider, string providerKey, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create new user /// /// - /// User details. /// /// /// The headers that will be added to request. @@ -13696,12 +14052,12 @@ public partial interface ISecurity /// /// Thrown when unable to deserialize the response /// - Task> UpdateWithHttpMessagesAsync(ApplicationUser body = default(ApplicationUser), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateWithHttpMessagesAsync(ApplicationUser body = default(ApplicationUser), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete users by name + /// Change password for current user. /// - /// - /// An array of user names. + /// + /// Old and new passwords. /// /// /// The headers that will be added to request. @@ -13712,11 +14068,18 @@ public partial interface ISecurity /// /// Thrown when the operation returned an invalid status code /// - Task DeleteWithHttpMessagesAsync(IList names = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Thrown when unable to deserialize the response + /// + Task> ChangeCurrentUserPasswordWithHttpMessagesAsync(ChangePasswordRequest body = default(ChangePasswordRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get user details by user name + /// Change password /// /// + /// user name + /// + /// + /// Old and new passwords. /// /// /// The headers that will be added to request. @@ -13733,11 +14096,14 @@ public partial interface ISecurity /// /// Thrown when a required parameter is null /// - Task> GetUserByNameWithHttpMessagesAsync(string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ChangePasswordWithHttpMessagesAsync(string userName, ChangePasswordRequest body = default(ChangePasswordRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get user details by user ID + /// Reset password confirmation /// - /// + /// + /// + /// + /// Password reset information containing new password. /// /// /// The headers that will be added to request. @@ -13754,11 +14120,37 @@ public partial interface ISecurity /// /// Thrown when a required parameter is null /// - Task> GetUserByIdWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ResetPasswordWithHttpMessagesAsync(string userName, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get user details by user email + /// Reset password confirmation /// - /// + /// + /// + /// + /// New password. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ResetPasswordByTokenWithHttpMessagesAsync(string userId, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Validate password reset token + /// + /// + /// + /// /// /// /// The headers that will be added to request. @@ -13775,13 +14167,98 @@ public partial interface ISecurity /// /// Thrown when a required parameter is null /// - Task> GetUserByEmailWithHttpMessagesAsync(string email, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ValidatePasswordResetTokenWithHttpMessagesAsync(string userId, ValidatePasswordResetTokenRequest body = default(ValidatePasswordResetTokenRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Send email with instructions on how to reset user password. + /// + /// + /// Verifies provided userName and (if succeeded) sends email. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RequestPasswordResetWithHttpMessagesAsync(string loginOrEmail, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> ValidatePasswordWithHttpMessagesAsync(string body = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> ValidateUserPasswordWithHttpMessagesAsync(ChangePasswordRequest body = default(ChangePasswordRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update user details by user ID + /// + /// + /// User details. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> UpdateWithHttpMessagesAsync(ApplicationUser body = default(ApplicationUser), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete users by name + /// + /// + /// An array of user names. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + Task DeleteWithHttpMessagesAsync(IList names = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get user details by external login provider + /// Checks if user locked /// - /// - /// - /// + /// + /// User id /// /// /// The headers that will be added to request. @@ -13798,12 +14275,10 @@ public partial interface ISecurity /// /// Thrown when a required parameter is null /// - Task> GetUserByLoginWithHttpMessagesAsync(string loginProvider, string providerKey, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> IsUserLockedWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Create new user + /// Checks if manual password change is enabled /// - /// - /// /// /// The headers that will be added to request. /// @@ -13816,14 +14291,12 @@ public partial interface ISecurity /// /// Thrown when unable to deserialize the response /// - Task> CreateWithHttpMessagesAsync(ApplicationUser body = default(ApplicationUser), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> PasswordChangeEnabledWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Change password + /// Lock user /// - /// - /// - /// - /// Old and new passwords. + /// + /// >User id /// /// /// The headers that will be added to request. @@ -13834,15 +14307,18 @@ public partial interface ISecurity /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task ChangePasswordWithHttpMessagesAsync(string userName, ChangePasswordRequest body = default(ChangePasswordRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> LockUserWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Resets password for current user. + /// Unlock user /// - /// - /// Password reset information containing new password. + /// + /// >User id /// /// /// The headers that will be added to request. @@ -13856,14 +14332,11 @@ public partial interface ISecurity /// /// Thrown when unable to deserialize the response /// - Task> ResetCurrentUserPasswordWithHttpMessagesAsync(ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Reset password confirmation - /// - /// - /// - /// - /// New password. + /// + /// Thrown when a required parameter is null + /// + Task> UnlockUserWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// /// /// The headers that will be added to request. @@ -13880,14 +14353,8 @@ public partial interface ISecurity /// /// Thrown when a required parameter is null /// - Task> ResetPasswordWithHttpMessagesAsync(string userName, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Reset password confirmation - /// - /// - /// + Task>> GetUserApiKeysWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// New password. /// /// /// The headers that will be added to request. @@ -13901,15 +14368,7 @@ public partial interface ISecurity /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> ResetPasswordByTokenWithHttpMessagesAsync(string userId, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Validate password reset token - /// - /// - /// + Task>> SaveUserApiKeyWithHttpMessagesAsync(UserApiKey body = default(UserApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// @@ -13924,17 +14383,8 @@ public partial interface ISecurity /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> ValidatePasswordResetTokenWithHttpMessagesAsync(string userId, ValidatePasswordResetTokenRequest body = default(ValidatePasswordResetTokenRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Send email with instructions on how to reset user password. - /// - /// - /// Verifies provided userName and (if succeeded) sends email. - /// - /// + Task>> UpdateUserApiKeyWithHttpMessagesAsync(UserApiKey body = default(UserApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// /// /// The headers that will be added to request. @@ -13945,12 +14395,13 @@ public partial interface ISecurity /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null + /// + /// Thrown when unable to deserialize the response /// - Task RequestPasswordResetWithHttpMessagesAsync(string loginOrEmail, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// + Task>> DeleteUserApiKeysWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get allowed login types + /// /// /// The headers that will be added to request. /// @@ -13960,15 +14411,11 @@ public partial interface ISecurity /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// - Task> ValidatePasswordWithHttpMessagesAsync(string body = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task GetLoginTypesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Checks if user locked + /// Verify user email /// - /// - /// User id + /// /// /// /// The headers that will be added to request. @@ -13979,18 +14426,13 @@ public partial interface ISecurity /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> IsUserLockedWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lock user - /// - /// - /// >User id + Task SendVerificationEmailWithHttpMessagesAsync(string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// /// /// /// The headers that will be added to request. @@ -14007,12 +14449,10 @@ public partial interface ISecurity /// /// Thrown when a required parameter is null /// - Task> LockUserWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Unlock user - /// - /// - /// >User id + Task> ConfirmEmailWithHttpMessagesAsync(string userId, ConfirmEmailRequest body = default(ConfirmEmailRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// /// /// /// The headers that will be added to request. @@ -14029,8 +14469,8 @@ public partial interface ISecurity /// /// Thrown when a required parameter is null /// - Task> UnlockUserWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// + Task> GenerateChangeEmailTokenWithHttpMessagesAsync(string userId, string newEmail = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// /// /// The headers that will be added to request. @@ -14047,8 +14487,8 @@ public partial interface ISecurity /// /// Thrown when a required parameter is null /// - Task>> GetUserApiKeysWithHttpMessagesAsync(string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// + Task> GenerateEmailConfirmationTokenWithHttpMessagesAsync(string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// /// /// The headers that will be added to request. @@ -14062,8 +14502,15 @@ public partial interface ISecurity /// /// Thrown when unable to deserialize the response /// - Task>> SaveUserApiKeyWithHttpMessagesAsync(UserApiKey body = default(UserApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// + /// + /// Thrown when a required parameter is null + /// + Task> GeneratePasswordResetTokenWithHttpMessagesAsync(string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// + /// /// /// /// The headers that will be added to request. @@ -14077,8 +14524,13 @@ public partial interface ISecurity /// /// Thrown when unable to deserialize the response /// - Task>> UpdateUserApiKeyWithHttpMessagesAsync(UserApiKey body = default(UserApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// + /// + /// Thrown when a required parameter is null + /// + Task> GenerateUserTokenWithHttpMessagesAsync(string userId, string tokenProvider = default(string), string purpose = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// /// /// /// The headers that will be added to request. @@ -14092,7 +14544,10 @@ public partial interface ISecurity /// /// Thrown when unable to deserialize the response /// - Task>> DeleteUserApiKeysWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Thrown when a required parameter is null + /// + Task> VerifyUserTokenWithHttpMessagesAsync(string userId, VerifyTokenRequest body = default(VerifyTokenRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } // @@ -14101,900 +14556,1177 @@ public partial interface ISecurity // regenerated. // -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Security. + /// + public static partial class SecurityExtensions + { + /// + /// Sign in with user name and password + /// + /// + /// Verifies provided credentials and if succeeded returns full user details, + /// otherwise returns 401 Unauthorized. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Login request. + /// + public static SignInResult Login(this ISecurity operations, LoginRequest body = default(LoginRequest)) + { + return operations.LoginAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Sign in with user name and password + /// + /// + /// Verifies provided credentials and if succeeded returns full user details, + /// otherwise returns 401 Unauthorized. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Login request. + /// + /// + /// The cancellation token. + /// + public static async Task LoginAsync(this ISecurity operations, LoginRequest body = default(LoginRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.LoginWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Sign out + /// + /// + /// The operations group for this extension method. + /// + public static void Logout(this ISecurity operations) + { + operations.LogoutAsync().GetAwaiter().GetResult(); + } + + /// + /// Sign out + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task LogoutAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.LogoutWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get current user details + /// + /// + /// The operations group for this extension method. + /// + public static UserDetail GetCurrentUser(this ISecurity operations) + { + return operations.GetCurrentUserAsync().GetAwaiter().GetResult(); + } + + /// + /// Get current user details + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetCurrentUserAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetCurrentUserWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + public static IList Userinfo(this ISecurity operations) + { + return operations.UserinfoAsync().GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> UserinfoAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UserinfoWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } - /// - /// Extension methods for Security. - /// - public static partial class SecurityExtensions - { /// - /// Sign in with user name and password + /// Get all registered permissions + /// + /// + /// The operations group for this extension method. + /// + public static IList GetAllRegisteredPermissions(this ISecurity operations) + { + return operations.GetAllRegisteredPermissionsAsync().GetAwaiter().GetResult(); + } + + /// + /// Get all registered permissions + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> GetAllRegisteredPermissionsAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetAllRegisteredPermissionsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// SearchAsync roles by keyword /// - /// - /// Verifies provided credentials and if succeeded returns full user details, - /// otherwise returns 401 Unauthorized. - /// /// /// The operations group for this extension method. /// /// - /// Login request. + /// SearchAsync parameters. /// - public static SignInResult Login(this ISecurity operations, LoginRequest body = default(LoginRequest)) + public static RoleSearchResult SearchRoles(this ISecurity operations, RoleSearchCriteria body = default(RoleSearchCriteria)) { - return operations.LoginAsync(body).GetAwaiter().GetResult(); + return operations.SearchRolesAsync(body).GetAwaiter().GetResult(); } /// - /// Sign in with user name and password + /// SearchAsync roles by keyword /// - /// - /// Verifies provided credentials and if succeeded returns full user details, - /// otherwise returns 401 Unauthorized. - /// /// /// The operations group for this extension method. /// /// - /// Login request. + /// SearchAsync parameters. /// /// /// The cancellation token. /// - public static async Task LoginAsync(this ISecurity operations, LoginRequest body = default(LoginRequest), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task SearchRolesAsync(this ISecurity operations, RoleSearchCriteria body = default(RoleSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.LoginWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.SearchRolesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Sign out + /// Get role by ID /// /// /// The operations group for this extension method. /// - public static void Logout(this ISecurity operations) + /// + /// + public static Role GetRole(this ISecurity operations, string roleName) { - operations.LogoutAsync().GetAwaiter().GetResult(); + return operations.GetRoleAsync(roleName).GetAwaiter().GetResult(); + } + + /// + /// Get role by ID + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetRoleAsync(this ISecurity operations, string roleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetRoleWithHttpMessagesAsync(roleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete roles by ID + /// + /// + /// The operations group for this extension method. + /// + /// + /// An array of role IDs. + /// + public static void DeleteRoles(this ISecurity operations, IList ids = default(IList)) + { + operations.DeleteRolesAsync(ids).GetAwaiter().GetResult(); + } + + /// + /// Delete roles by ID + /// + /// + /// The operations group for this extension method. + /// + /// + /// An array of role IDs. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteRolesAsync(this ISecurity operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteRolesWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Update an existing role or create new + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static SecurityResult UpdateRole(this ISecurity operations, Role body = default(Role)) + { + return operations.UpdateRoleAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Update an existing role or create new + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task UpdateRoleAsync(this ISecurity operations, Role body = default(Role), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateRoleWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// SearchAsync users by keyword + /// + /// + /// The operations group for this extension method. + /// + /// + /// Search criteria. + /// + public static UserSearchResult SearchUsers(this ISecurity operations, UserSearchCriteria body = default(UserSearchCriteria)) + { + return operations.SearchUsersAsync(body).GetAwaiter().GetResult(); + } + + /// + /// SearchAsync users by keyword + /// + /// + /// The operations group for this extension method. + /// + /// + /// Search criteria. + /// + /// + /// The cancellation token. + /// + public static async Task SearchUsersAsync(this ISecurity operations, UserSearchCriteria body = default(UserSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.SearchUsersWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get user details by user name + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static ApplicationUser GetUserByName(this ISecurity operations, string userName) + { + return operations.GetUserByNameAsync(userName).GetAwaiter().GetResult(); + } + + /// + /// Get user details by user name + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetUserByNameAsync(this ISecurity operations, string userName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetUserByNameWithHttpMessagesAsync(userName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get user details by user ID + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static ApplicationUser GetUserById(this ISecurity operations, string id) + { + return operations.GetUserByIdAsync(id).GetAwaiter().GetResult(); } /// - /// Sign out + /// Get user details by user ID /// /// /// The operations group for this extension method. /// + /// + /// /// /// The cancellation token. /// - public static async Task LogoutAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetUserByIdAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.LogoutWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.GetUserByIdWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Get current user details + /// Get user details by user email /// /// /// The operations group for this extension method. /// - public static UserDetail GetCurrentUser(this ISecurity operations) + /// + /// + public static ApplicationUser GetUserByEmail(this ISecurity operations, string email) { - return operations.GetCurrentUserAsync().GetAwaiter().GetResult(); + return operations.GetUserByEmailAsync(email).GetAwaiter().GetResult(); } /// - /// Get current user details + /// Get user details by user email /// /// /// The operations group for this extension method. /// + /// + /// /// /// The cancellation token. /// - public static async Task GetCurrentUserAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetUserByEmailAsync(this ISecurity operations, string email, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetCurrentUserWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetUserByEmailWithHttpMessagesAsync(email, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } + /// + /// Get user details by external login provider + /// /// /// The operations group for this extension method. /// - public static IList Userinfo(this ISecurity operations) + /// + /// + /// + /// + public static ApplicationUser GetUserByLogin(this ISecurity operations, string loginProvider, string providerKey) { - return operations.UserinfoAsync().GetAwaiter().GetResult(); + return operations.GetUserByLoginAsync(loginProvider, providerKey).GetAwaiter().GetResult(); } + /// + /// Get user details by external login provider + /// /// /// The operations group for this extension method. /// + /// + /// + /// + /// /// /// The cancellation token. /// - public static async Task> UserinfoAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetUserByLoginAsync(this ISecurity operations, string loginProvider, string providerKey, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UserinfoWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetUserByLoginWithHttpMessagesAsync(loginProvider, providerKey, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get all registered permissions + /// Create new user /// /// /// The operations group for this extension method. /// - public static IList GetAllRegisteredPermissions(this ISecurity operations) + /// + /// + public static SecurityResult Create(this ISecurity operations, ApplicationUser body = default(ApplicationUser)) { - return operations.GetAllRegisteredPermissionsAsync().GetAwaiter().GetResult(); + return operations.CreateAsync(body).GetAwaiter().GetResult(); } /// - /// Get all registered permissions + /// Create new user /// /// /// The operations group for this extension method. /// + /// + /// /// /// The cancellation token. /// - public static async Task> GetAllRegisteredPermissionsAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateAsync(this ISecurity operations, ApplicationUser body = default(ApplicationUser), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetAllRegisteredPermissionsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// SearchAsync roles by keyword + /// Change password for current user. /// /// /// The operations group for this extension method. /// /// - /// SearchAsync parameters. + /// Old and new passwords. /// - public static RoleSearchResult SearchRoles(this ISecurity operations, RoleSearchCriteria body = default(RoleSearchCriteria)) + public static SecurityResult ChangeCurrentUserPassword(this ISecurity operations, ChangePasswordRequest body = default(ChangePasswordRequest)) { - return operations.SearchRolesAsync(body).GetAwaiter().GetResult(); + return operations.ChangeCurrentUserPasswordAsync(body).GetAwaiter().GetResult(); } /// - /// SearchAsync roles by keyword + /// Change password for current user. /// /// /// The operations group for this extension method. /// /// - /// SearchAsync parameters. + /// Old and new passwords. /// /// /// The cancellation token. /// - public static async Task SearchRolesAsync(this ISecurity operations, RoleSearchCriteria body = default(RoleSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ChangeCurrentUserPasswordAsync(this ISecurity operations, ChangePasswordRequest body = default(ChangePasswordRequest), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.SearchRolesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ChangeCurrentUserPasswordWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get role by ID + /// Change password /// /// /// The operations group for this extension method. /// - /// + /// + /// user name /// - public static Role GetRole(this ISecurity operations, string roleName) + /// + /// Old and new passwords. + /// + public static SecurityResult ChangePassword(this ISecurity operations, string userName, ChangePasswordRequest body = default(ChangePasswordRequest)) { - return operations.GetRoleAsync(roleName).GetAwaiter().GetResult(); + return operations.ChangePasswordAsync(userName, body).GetAwaiter().GetResult(); } /// - /// Get role by ID + /// Change password /// /// /// The operations group for this extension method. /// - /// + /// + /// user name + /// + /// + /// Old and new passwords. /// /// /// The cancellation token. /// - public static async Task GetRoleAsync(this ISecurity operations, string roleName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ChangePasswordAsync(this ISecurity operations, string userName, ChangePasswordRequest body = default(ChangePasswordRequest), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetRoleWithHttpMessagesAsync(roleName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ChangePasswordWithHttpMessagesAsync(userName, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Delete roles by ID + /// Reset password confirmation /// /// /// The operations group for this extension method. /// - /// - /// An array of role IDs. + /// /// - public static void DeleteRoles(this ISecurity operations, IList ids = default(IList)) + /// + /// Password reset information containing new password. + /// + public static SecurityResult ResetPassword(this ISecurity operations, string userName, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest)) { - operations.DeleteRolesAsync(ids).GetAwaiter().GetResult(); + return operations.ResetPasswordAsync(userName, body).GetAwaiter().GetResult(); } /// - /// Delete roles by ID + /// Reset password confirmation /// /// /// The operations group for this extension method. /// - /// - /// An array of role IDs. + /// + /// + /// + /// Password reset information containing new password. /// /// /// The cancellation token. /// - public static async Task DeleteRolesAsync(this ISecurity operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ResetPasswordAsync(this ISecurity operations, string userName, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteRolesWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ResetPasswordWithHttpMessagesAsync(userName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Update an existing role or create new + /// Reset password confirmation /// /// /// The operations group for this extension method. /// + /// + /// /// + /// New password. /// - public static SecurityResult UpdateRole(this ISecurity operations, Role body = default(Role)) + public static SecurityResult ResetPasswordByToken(this ISecurity operations, string userId, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest)) { - return operations.UpdateRoleAsync(body).GetAwaiter().GetResult(); + return operations.ResetPasswordByTokenAsync(userId, body).GetAwaiter().GetResult(); } /// - /// Update an existing role or create new + /// Reset password confirmation /// /// /// The operations group for this extension method. /// + /// + /// /// + /// New password. /// /// /// The cancellation token. /// - public static async Task UpdateRoleAsync(this ISecurity operations, Role body = default(Role), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ResetPasswordByTokenAsync(this ISecurity operations, string userId, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateRoleWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ResetPasswordByTokenWithHttpMessagesAsync(userId, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// SearchAsync users by keyword + /// Validate password reset token /// /// /// The operations group for this extension method. /// + /// + /// /// - /// Search criteria. /// - public static UserSearchResult SearchUsers(this ISecurity operations, UserSearchCriteria body = default(UserSearchCriteria)) + public static bool? ValidatePasswordResetToken(this ISecurity operations, string userId, ValidatePasswordResetTokenRequest body = default(ValidatePasswordResetTokenRequest)) { - return operations.SearchUsersAsync(body).GetAwaiter().GetResult(); + return operations.ValidatePasswordResetTokenAsync(userId, body).GetAwaiter().GetResult(); } /// - /// SearchAsync users by keyword + /// Validate password reset token /// /// /// The operations group for this extension method. /// + /// + /// /// - /// Search criteria. /// /// /// The cancellation token. /// - public static async Task SearchUsersAsync(this ISecurity operations, UserSearchCriteria body = default(UserSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ValidatePasswordResetTokenAsync(this ISecurity operations, string userId, ValidatePasswordResetTokenRequest body = default(ValidatePasswordResetTokenRequest), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.SearchUsersWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ValidatePasswordResetTokenWithHttpMessagesAsync(userId, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Update user details by user ID + /// Send email with instructions on how to reset user password. /// + /// + /// Verifies provided userName and (if succeeded) sends email. + /// /// /// The operations group for this extension method. /// - /// - /// User details. + /// /// - public static SecurityResult Update(this ISecurity operations, ApplicationUser body = default(ApplicationUser)) + public static void RequestPasswordReset(this ISecurity operations, string loginOrEmail) { - return operations.UpdateAsync(body).GetAwaiter().GetResult(); + operations.RequestPasswordResetAsync(loginOrEmail).GetAwaiter().GetResult(); } /// - /// Update user details by user ID + /// Send email with instructions on how to reset user password. /// + /// + /// Verifies provided userName and (if succeeded) sends email. + /// /// /// The operations group for this extension method. /// - /// - /// User details. + /// /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this ISecurity operations, ApplicationUser body = default(ApplicationUser), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task RequestPasswordResetAsync(this ISecurity operations, string loginOrEmail, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.RequestPasswordResetWithHttpMessagesAsync(loginOrEmail, null, cancellationToken).ConfigureAwait(false)).Dispose(); } - /// - /// Delete users by name - /// /// /// The operations group for this extension method. /// - /// - /// An array of user names. + /// /// - public static void Delete(this ISecurity operations, IList names = default(IList)) + public static IdentityResult ValidatePassword(this ISecurity operations, string body = default(string)) { - operations.DeleteAsync(names).GetAwaiter().GetResult(); + return operations.ValidatePasswordAsync(body).GetAwaiter().GetResult(); } - /// - /// Delete users by name - /// /// /// The operations group for this extension method. /// - /// - /// An array of user names. + /// /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this ISecurity operations, IList names = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ValidatePasswordAsync(this ISecurity operations, string body = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(names, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ValidatePasswordWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } - /// - /// Get user details by user name - /// /// /// The operations group for this extension method. /// - /// + /// /// - public static ApplicationUser GetUserByName(this ISecurity operations, string userName) + public static IdentityResult ValidateUserPassword(this ISecurity operations, ChangePasswordRequest body = default(ChangePasswordRequest)) { - return operations.GetUserByNameAsync(userName).GetAwaiter().GetResult(); + return operations.ValidateUserPasswordAsync(body).GetAwaiter().GetResult(); } - /// - /// Get user details by user name - /// /// /// The operations group for this extension method. /// - /// + /// /// /// /// The cancellation token. /// - public static async Task GetUserByNameAsync(this ISecurity operations, string userName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ValidateUserPasswordAsync(this ISecurity operations, ChangePasswordRequest body = default(ChangePasswordRequest), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetUserByNameWithHttpMessagesAsync(userName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ValidateUserPasswordWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get user details by user ID + /// Update user details by user ID /// /// /// The operations group for this extension method. /// - /// + /// + /// User details. /// - public static ApplicationUser GetUserById(this ISecurity operations, string id) + public static SecurityResult Update(this ISecurity operations, ApplicationUser body = default(ApplicationUser)) { - return operations.GetUserByIdAsync(id).GetAwaiter().GetResult(); + return operations.UpdateAsync(body).GetAwaiter().GetResult(); } /// - /// Get user details by user ID + /// Update user details by user ID /// /// /// The operations group for this extension method. /// - /// + /// + /// User details. /// /// /// The cancellation token. /// - public static async Task GetUserByIdAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this ISecurity operations, ApplicationUser body = default(ApplicationUser), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetUserByIdWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get user details by user email + /// Delete users by name /// /// /// The operations group for this extension method. /// - /// + /// + /// An array of user names. /// - public static ApplicationUser GetUserByEmail(this ISecurity operations, string email) + public static void Delete(this ISecurity operations, IList names = default(IList)) { - return operations.GetUserByEmailAsync(email).GetAwaiter().GetResult(); + operations.DeleteAsync(names).GetAwaiter().GetResult(); } /// - /// Get user details by user email + /// Delete users by name /// /// /// The operations group for this extension method. /// - /// + /// + /// An array of user names. /// /// /// The cancellation token. /// - public static async Task GetUserByEmailAsync(this ISecurity operations, string email, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this ISecurity operations, IList names = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetUserByEmailWithHttpMessagesAsync(email, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DeleteWithHttpMessagesAsync(names, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Get user details by external login provider + /// Checks if user locked /// /// /// The operations group for this extension method. /// - /// - /// - /// + /// + /// User id /// - public static ApplicationUser GetUserByLogin(this ISecurity operations, string loginProvider, string providerKey) + public static UserLockedResult IsUserLocked(this ISecurity operations, string id) { - return operations.GetUserByLoginAsync(loginProvider, providerKey).GetAwaiter().GetResult(); + return operations.IsUserLockedAsync(id).GetAwaiter().GetResult(); } /// - /// Get user details by external login provider + /// Checks if user locked /// /// /// The operations group for this extension method. /// - /// - /// - /// + /// + /// User id /// /// /// The cancellation token. /// - public static async Task GetUserByLoginAsync(this ISecurity operations, string loginProvider, string providerKey, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task IsUserLockedAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetUserByLoginWithHttpMessagesAsync(loginProvider, providerKey, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.IsUserLockedWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Create new user + /// Checks if manual password change is enabled /// /// /// The operations group for this extension method. /// - /// - /// - public static SecurityResult Create(this ISecurity operations, ApplicationUser body = default(ApplicationUser)) + public static UserLockedResult PasswordChangeEnabled(this ISecurity operations) { - return operations.CreateAsync(body).GetAwaiter().GetResult(); + return operations.PasswordChangeEnabledAsync().GetAwaiter().GetResult(); } /// - /// Create new user + /// Checks if manual password change is enabled /// /// /// The operations group for this extension method. /// - /// - /// /// /// The cancellation token. /// - public static async Task CreateAsync(this ISecurity operations, ApplicationUser body = default(ApplicationUser), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task PasswordChangeEnabledAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.PasswordChangeEnabledWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Change password + /// Lock user /// /// /// The operations group for this extension method. /// - /// - /// - /// - /// Old and new passwords. + /// + /// >User id /// - public static void ChangePassword(this ISecurity operations, string userName, ChangePasswordRequest body = default(ChangePasswordRequest)) + public static SecurityResult LockUser(this ISecurity operations, string id) { - operations.ChangePasswordAsync(userName, body).GetAwaiter().GetResult(); + return operations.LockUserAsync(id).GetAwaiter().GetResult(); } /// - /// Change password + /// Lock user /// /// /// The operations group for this extension method. /// - /// - /// - /// - /// Old and new passwords. + /// + /// >User id /// /// /// The cancellation token. /// - public static async Task ChangePasswordAsync(this ISecurity operations, string userName, ChangePasswordRequest body = default(ChangePasswordRequest), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task LockUserAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.ChangePasswordWithHttpMessagesAsync(userName, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.LockUserWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Resets password for current user. + /// Unlock user /// /// /// The operations group for this extension method. /// - /// - /// Password reset information containing new password. + /// + /// >User id /// - public static SecurityResult ResetCurrentUserPassword(this ISecurity operations, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest)) + public static SecurityResult UnlockUser(this ISecurity operations, string id) { - return operations.ResetCurrentUserPasswordAsync(body).GetAwaiter().GetResult(); + return operations.UnlockUserAsync(id).GetAwaiter().GetResult(); } /// - /// Resets password for current user. + /// Unlock user /// /// /// The operations group for this extension method. /// - /// - /// Password reset information containing new password. + /// + /// >User id /// /// /// The cancellation token. /// - public static async Task ResetCurrentUserPasswordAsync(this ISecurity operations, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UnlockUserAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ResetCurrentUserPasswordWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UnlockUserWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } - /// - /// Reset password confirmation - /// /// /// The operations group for this extension method. /// - /// - /// - /// - /// New password. + /// /// - public static SecurityResult ResetPassword(this ISecurity operations, string userName, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest)) + public static IList GetUserApiKeys(this ISecurity operations, string id) { - return operations.ResetPasswordAsync(userName, body).GetAwaiter().GetResult(); + return operations.GetUserApiKeysAsync(id).GetAwaiter().GetResult(); } - /// - /// Reset password confirmation - /// /// /// The operations group for this extension method. /// - /// - /// - /// - /// New password. + /// /// /// /// The cancellation token. /// - public static async Task ResetPasswordAsync(this ISecurity operations, string userName, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> GetUserApiKeysAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ResetPasswordWithHttpMessagesAsync(userName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetUserApiKeysWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } - /// - /// Reset password confirmation - /// /// /// The operations group for this extension method. /// - /// - /// /// - /// New password. /// - public static SecurityResult ResetPasswordByToken(this ISecurity operations, string userId, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest)) + public static IList SaveUserApiKey(this ISecurity operations, UserApiKey body = default(UserApiKey)) { - return operations.ResetPasswordByTokenAsync(userId, body).GetAwaiter().GetResult(); + return operations.SaveUserApiKeyAsync(body).GetAwaiter().GetResult(); } - /// - /// Reset password confirmation - /// /// /// The operations group for this extension method. /// - /// - /// /// - /// New password. /// /// /// The cancellation token. /// - public static async Task ResetPasswordByTokenAsync(this ISecurity operations, string userId, ResetPasswordConfirmRequest body = default(ResetPasswordConfirmRequest), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> SaveUserApiKeyAsync(this ISecurity operations, UserApiKey body = default(UserApiKey), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ResetPasswordByTokenWithHttpMessagesAsync(userId, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.SaveUserApiKeyWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } - /// - /// Validate password reset token - /// /// /// The operations group for this extension method. /// - /// - /// /// /// - public static bool? ValidatePasswordResetToken(this ISecurity operations, string userId, ValidatePasswordResetTokenRequest body = default(ValidatePasswordResetTokenRequest)) + public static IList UpdateUserApiKey(this ISecurity operations, UserApiKey body = default(UserApiKey)) { - return operations.ValidatePasswordResetTokenAsync(userId, body).GetAwaiter().GetResult(); + return operations.UpdateUserApiKeyAsync(body).GetAwaiter().GetResult(); } - /// - /// Validate password reset token - /// /// /// The operations group for this extension method. /// - /// - /// /// /// /// /// The cancellation token. /// - public static async Task ValidatePasswordResetTokenAsync(this ISecurity operations, string userId, ValidatePasswordResetTokenRequest body = default(ValidatePasswordResetTokenRequest), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> UpdateUserApiKeyAsync(this ISecurity operations, UserApiKey body = default(UserApiKey), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ValidatePasswordResetTokenWithHttpMessagesAsync(userId, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateUserApiKeyWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } - /// - /// Send email with instructions on how to reset user password. - /// - /// - /// Verifies provided userName and (if succeeded) sends email. - /// /// /// The operations group for this extension method. /// - /// + /// /// - public static void RequestPasswordReset(this ISecurity operations, string loginOrEmail) + public static IList DeleteUserApiKeys(this ISecurity operations, IList ids = default(IList)) { - operations.RequestPasswordResetAsync(loginOrEmail).GetAwaiter().GetResult(); + return operations.DeleteUserApiKeysAsync(ids).GetAwaiter().GetResult(); } - /// - /// Send email with instructions on how to reset user password. - /// - /// - /// Verifies provided userName and (if succeeded) sends email. - /// /// /// The operations group for this extension method. /// - /// + /// /// /// /// The cancellation token. /// - public static async Task RequestPasswordResetAsync(this ISecurity operations, string loginOrEmail, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> DeleteUserApiKeysAsync(this ISecurity operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.RequestPasswordResetWithHttpMessagesAsync(loginOrEmail, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.DeleteUserApiKeysWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } + /// + /// Get allowed login types + /// /// /// The operations group for this extension method. /// - /// - /// - public static PasswordValidationResult ValidatePassword(this ISecurity operations, string body = default(string)) + public static void GetLoginTypes(this ISecurity operations) { - return operations.ValidatePasswordAsync(body).GetAwaiter().GetResult(); + operations.GetLoginTypesAsync().GetAwaiter().GetResult(); } + /// + /// Get allowed login types + /// /// /// The operations group for this extension method. /// - /// - /// /// /// The cancellation token. /// - public static async Task ValidatePasswordAsync(this ISecurity operations, string body = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetLoginTypesAsync(this ISecurity operations, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ValidatePasswordWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.GetLoginTypesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Checks if user locked + /// Verify user email /// /// /// The operations group for this extension method. /// - /// - /// User id + /// /// - public static UserLockedResult IsUserLocked(this ISecurity operations, string id) + public static void SendVerificationEmail(this ISecurity operations, string userId) { - return operations.IsUserLockedAsync(id).GetAwaiter().GetResult(); + operations.SendVerificationEmailAsync(userId).GetAwaiter().GetResult(); } /// - /// Checks if user locked + /// Verify user email /// /// /// The operations group for this extension method. /// - /// - /// User id + /// /// /// /// The cancellation token. /// - public static async Task IsUserLockedAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task SendVerificationEmailAsync(this ISecurity operations, string userId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.IsUserLockedWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.SendVerificationEmailWithHttpMessagesAsync(userId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } - /// - /// Lock user - /// /// /// The operations group for this extension method. /// - /// - /// >User id + /// /// - public static SecurityResult LockUser(this ISecurity operations, string id) + /// + /// + public static SecurityResult ConfirmEmail(this ISecurity operations, string userId, ConfirmEmailRequest body = default(ConfirmEmailRequest)) { - return operations.LockUserAsync(id).GetAwaiter().GetResult(); + return operations.ConfirmEmailAsync(userId, body).GetAwaiter().GetResult(); } - /// - /// Lock user - /// /// /// The operations group for this extension method. /// - /// - /// >User id + /// + /// + /// /// /// /// The cancellation token. /// - public static async Task LockUserAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ConfirmEmailAsync(this ISecurity operations, string userId, ConfirmEmailRequest body = default(ConfirmEmailRequest), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.LockUserWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ConfirmEmailWithHttpMessagesAsync(userId, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } - /// - /// Unlock user - /// /// /// The operations group for this extension method. /// - /// - /// >User id + /// /// - public static SecurityResult UnlockUser(this ISecurity operations, string id) + /// + /// + public static string GenerateChangeEmailToken(this ISecurity operations, string userId, string newEmail = default(string)) { - return operations.UnlockUserAsync(id).GetAwaiter().GetResult(); + return operations.GenerateChangeEmailTokenAsync(userId, newEmail).GetAwaiter().GetResult(); } - /// - /// Unlock user - /// /// /// The operations group for this extension method. /// - /// - /// >User id + /// + /// + /// /// /// /// The cancellation token. /// - public static async Task UnlockUserAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GenerateChangeEmailTokenAsync(this ISecurity operations, string userId, string newEmail = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UnlockUserWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GenerateChangeEmailTokenWithHttpMessagesAsync(userId, newEmail, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -15003,24 +15735,24 @@ public static SecurityResult UnlockUser(this ISecurity operations, string id) /// /// The operations group for this extension method. /// - /// + /// /// - public static IList GetUserApiKeys(this ISecurity operations, string id) + public static string GenerateEmailConfirmationToken(this ISecurity operations, string userId) { - return operations.GetUserApiKeysAsync(id).GetAwaiter().GetResult(); + return operations.GenerateEmailConfirmationTokenAsync(userId).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// - /// + /// /// /// /// The cancellation token. /// - public static async Task> GetUserApiKeysAsync(this ISecurity operations, string id, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GenerateEmailConfirmationTokenAsync(this ISecurity operations, string userId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetUserApiKeysWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GenerateEmailConfirmationTokenWithHttpMessagesAsync(userId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -15029,24 +15761,24 @@ public static IList GetUserApiKeys(this ISecurity operations, string /// /// The operations group for this extension method. /// - /// + /// /// - public static IList SaveUserApiKey(this ISecurity operations, UserApiKey body = default(UserApiKey)) + public static string GeneratePasswordResetToken(this ISecurity operations, string userId) { - return operations.SaveUserApiKeyAsync(body).GetAwaiter().GetResult(); + return operations.GeneratePasswordResetTokenAsync(userId).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// - /// + /// /// /// /// The cancellation token. /// - public static async Task> SaveUserApiKeyAsync(this ISecurity operations, UserApiKey body = default(UserApiKey), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GeneratePasswordResetTokenAsync(this ISecurity operations, string userId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.SaveUserApiKeyWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GeneratePasswordResetTokenWithHttpMessagesAsync(userId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -15055,24 +15787,32 @@ public static IList GetUserApiKeys(this ISecurity operations, string /// /// The operations group for this extension method. /// - /// + /// /// - public static IList UpdateUserApiKey(this ISecurity operations, UserApiKey body = default(UserApiKey)) + /// + /// + /// + /// + public static string GenerateUserToken(this ISecurity operations, string userId, string tokenProvider = default(string), string purpose = default(string)) { - return operations.UpdateUserApiKeyAsync(body).GetAwaiter().GetResult(); + return operations.GenerateUserTokenAsync(userId, tokenProvider, purpose).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// - /// + /// + /// + /// + /// + /// /// /// /// The cancellation token. /// - public static async Task> UpdateUserApiKeyAsync(this ISecurity operations, UserApiKey body = default(UserApiKey), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GenerateUserTokenAsync(this ISecurity operations, string userId, string tokenProvider = default(string), string purpose = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateUserApiKeyWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GenerateUserTokenWithHttpMessagesAsync(userId, tokenProvider, purpose, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -15081,24 +15821,28 @@ public static IList GetUserApiKeys(this ISecurity operations, string /// /// The operations group for this extension method. /// - /// + /// + /// + /// /// - public static IList DeleteUserApiKeys(this ISecurity operations, IList ids = default(IList)) + public static bool? VerifyUserToken(this ISecurity operations, string userId, VerifyTokenRequest body = default(VerifyTokenRequest)) { - return operations.DeleteUserApiKeysAsync(ids).GetAwaiter().GetResult(); + return operations.VerifyUserTokenAsync(userId, body).GetAwaiter().GetResult(); } /// /// The operations group for this extension method. /// - /// + /// + /// + /// /// /// /// The cancellation token. /// - public static async Task> DeleteUserApiKeysAsync(this ISecurity operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task VerifyUserTokenAsync(this ISecurity operations, string userId, VerifyTokenRequest body = default(VerifyTokenRequest), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.DeleteUserApiKeysWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.VerifyUserTokenWithHttpMessagesAsync(userId, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -16120,33 +16864,29 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models using System.Threading; using System.Threading.Tasks; - public partial class BlobInfo + public partial class Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema { /// - /// Initializes a new instance of the BlobInfo class. + /// Initializes a new instance of the + /// Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema + /// class. /// - public BlobInfo() + public Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema() { CustomInit(); } /// - /// Initializes a new instance of the BlobInfo class. + /// Initializes a new instance of the + /// Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema + /// class. /// - public BlobInfo(string key = default(string), long? size = default(long?), string contentType = default(string), string type = default(string), string name = default(string), string url = default(string), string relativeUrl = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + public Paths1gq0sd1connectTokenpostrequestbodycontentapplicationJsonPatchJsonschema(string grantType, string scope = default(string), string username = default(string), string password = default(string)) { - Key = key; - Size = size; - ContentType = contentType; - Type = type; - Name = name; - Url = url; - RelativeUrl = relativeUrl; - CreatedDate = createdDate; - ModifiedDate = modifiedDate; - CreatedBy = createdBy; - ModifiedBy = modifiedBy; - Id = id; + GrantType = grantType; + Scope = scope; + Username = username; + Password = password; CustomInit(); } @@ -16157,64 +16897,37 @@ public BlobInfo() /// /// - [JsonProperty(PropertyName = "key")] - public string Key { get; set; } - - /// - /// - [JsonProperty(PropertyName = "size")] - public long? Size { get; set; } - - /// - /// - [JsonProperty(PropertyName = "contentType")] - public string ContentType { get; set; } - - /// - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// - [JsonProperty(PropertyName = "url")] - public string Url { get; set; } - - /// - /// - [JsonProperty(PropertyName = "relativeUrl")] - public string RelativeUrl { get; set; } - - /// - /// - [JsonProperty(PropertyName = "createdDate")] - public System.DateTime? CreatedDate { get; set; } + [JsonProperty(PropertyName = "grant_type")] + public string GrantType { get; set; } /// /// - [JsonProperty(PropertyName = "modifiedDate")] - public System.DateTime? ModifiedDate { get; set; } + [JsonProperty(PropertyName = "scope")] + public string Scope { get; set; } /// /// - [JsonProperty(PropertyName = "createdBy")] - public string CreatedBy { get; set; } + [JsonProperty(PropertyName = "username")] + public string Username { get; set; } /// /// - [JsonProperty(PropertyName = "modifiedBy")] - public string ModifiedBy { get; set; } + [JsonProperty(PropertyName = "password")] + public string Password { get; set; } /// + /// Validate the object. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (GrantType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "GrantType"); + } + } } } // @@ -16236,31 +16949,26 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models using System.Threading; using System.Threading.Tasks; - public partial class OperationLog + public partial class AppDescriptor { /// - /// Initializes a new instance of the OperationLog class. + /// Initializes a new instance of the AppDescriptor class. /// - public OperationLog() + public AppDescriptor() { CustomInit(); } /// - /// Initializes a new instance of the OperationLog class. + /// Initializes a new instance of the AppDescriptor class. /// - /// Possible values include: 'Detached', - /// 'Unchanged', 'Added', 'Deleted', 'Modified' - public OperationLog(string objectType = default(string), string objectId = default(string), string operationType = default(string), string detail = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + public AppDescriptor(string title = default(string), string description = default(string), string iconUrl = default(string), string relativeUrl = default(string), string permission = default(string), string id = default(string)) { - ObjectType = objectType; - ObjectId = objectId; - OperationType = operationType; - Detail = detail; - CreatedDate = createdDate; - ModifiedDate = modifiedDate; - CreatedBy = createdBy; - ModifiedBy = modifiedBy; + Title = title; + Description = description; + IconUrl = iconUrl; + RelativeUrl = relativeUrl; + Permission = permission; Id = id; CustomInit(); } @@ -16272,45 +16980,28 @@ public OperationLog() /// /// - [JsonProperty(PropertyName = "objectType")] - public string ObjectType { get; set; } - - /// - /// - [JsonProperty(PropertyName = "objectId")] - public string ObjectId { get; set; } - - /// - /// Gets or sets possible values include: 'Detached', 'Unchanged', - /// 'Added', 'Deleted', 'Modified' - /// - [JsonProperty(PropertyName = "operationType")] - public string OperationType { get; set; } - - /// - /// - [JsonProperty(PropertyName = "detail")] - public string Detail { get; set; } + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } /// /// - [JsonProperty(PropertyName = "createdDate")] - public System.DateTime? CreatedDate { get; set; } + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } /// /// - [JsonProperty(PropertyName = "modifiedDate")] - public System.DateTime? ModifiedDate { get; set; } + [JsonProperty(PropertyName = "iconUrl")] + public string IconUrl { get; set; } /// /// - [JsonProperty(PropertyName = "createdBy")] - public string CreatedBy { get; set; } + [JsonProperty(PropertyName = "relativeUrl")] + public string RelativeUrl { get; set; } /// /// - [JsonProperty(PropertyName = "modifiedBy")] - public string ModifiedBy { get; set; } + [JsonProperty(PropertyName = "permission")] + public string Permission { get; set; } /// /// @@ -16338,84 +17029,27 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models using System.Threading; using System.Threading.Tasks; - public partial class DynamicPropertyDictionaryItemName - { - /// - /// Initializes a new instance of the DynamicPropertyDictionaryItemName - /// class. - /// - public DynamicPropertyDictionaryItemName() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DynamicPropertyDictionaryItemName - /// class. - /// - public DynamicPropertyDictionaryItemName(string locale = default(string), string name = default(string)) - { - Locale = locale; - Name = name; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "locale")] - public string Locale { get; set; } - - /// - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - public partial class DynamicPropertyDictionaryItem + public partial class OperationLog { /// - /// Initializes a new instance of the DynamicPropertyDictionaryItem - /// class. + /// Initializes a new instance of the OperationLog class. /// - public DynamicPropertyDictionaryItem() + public OperationLog() { CustomInit(); } /// - /// Initializes a new instance of the DynamicPropertyDictionaryItem - /// class. + /// Initializes a new instance of the OperationLog class. /// - public DynamicPropertyDictionaryItem(string propertyId = default(string), string name = default(string), IList displayNames = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + /// Possible values include: 'Detached', + /// 'Unchanged', 'Added', 'Deleted', 'Modified' + public OperationLog(string objectType = default(string), string objectId = default(string), string operationType = default(string), string detail = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { - PropertyId = propertyId; - Name = name; - DisplayNames = displayNames; + ObjectType = objectType; + ObjectId = objectId; + OperationType = operationType; + Detail = detail; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; @@ -16431,18 +17065,25 @@ public DynamicPropertyDictionaryItem() /// /// - [JsonProperty(PropertyName = "propertyId")] - public string PropertyId { get; set; } + [JsonProperty(PropertyName = "objectType")] + public string ObjectType { get; set; } /// /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [JsonProperty(PropertyName = "objectId")] + public string ObjectId { get; set; } /// + /// Gets or sets possible values include: 'Detached', 'Unchanged', + /// 'Added', 'Deleted', 'Modified' /// - [JsonProperty(PropertyName = "displayNames")] - public IList DisplayNames { get; set; } + [JsonProperty(PropertyName = "operationType")] + public string OperationType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "detail")] + public string Detail { get; set; } /// /// @@ -16503,6 +17144,9 @@ public SemanticVersion() /// /// Initializes a new instance of the SemanticVersion class. /// + /// Major version X (X.y.z) + /// Minor version Y (x.Y.z) + /// Patch version Z (x.y.Z) public SemanticVersion(int? major = default(int?), int? minor = default(int?), int? patch = default(int?), string prerelease = default(string)) { Major = major; @@ -16518,16 +17162,19 @@ public SemanticVersion() partial void CustomInit(); /// + /// Gets major version X (X.y.z) /// [JsonProperty(PropertyName = "major")] public int? Major { get; private set; } /// + /// Gets minor version Y (x.Y.z) /// [JsonProperty(PropertyName = "minor")] public int? Minor { get; private set; } /// + /// Gets patch version Z (x.y.Z) /// [JsonProperty(PropertyName = "patch")] public int? Patch { get; private set; } @@ -16734,28 +17381,88 @@ public ModuleDescriptor() /// /// - [JsonProperty(PropertyName = "validationErrors")] - public IList ValidationErrors { get; set; } + [JsonProperty(PropertyName = "validationErrors")] + public IList ValidationErrors { get; set; } + + /// + /// + [JsonProperty(PropertyName = "isRemovable")] + public bool? IsRemovable { get; set; } + + /// + /// + [JsonProperty(PropertyName = "isInstalled")] + public bool? IsInstalled { get; set; } + + /// + /// + [JsonProperty(PropertyName = "installedVersion")] + public ModuleIdentity InstalledVersion { get; set; } + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + public partial class DynamicPropertyDictionaryItemName + { + /// + /// Initializes a new instance of the DynamicPropertyDictionaryItemName + /// class. + /// + public DynamicPropertyDictionaryItemName() + { + CustomInit(); + } /// + /// Initializes a new instance of the DynamicPropertyDictionaryItemName + /// class. /// - [JsonProperty(PropertyName = "isRemovable")] - public bool? IsRemovable { get; set; } + /// Language ID, e.g. en-US. + public DynamicPropertyDictionaryItemName(string locale = default(string), string name = default(string)) + { + Locale = locale; + Name = name; + CustomInit(); + } /// + /// An initialization method that performs custom operations like setting defaults /// - [JsonProperty(PropertyName = "isInstalled")] - public bool? IsInstalled { get; set; } + partial void CustomInit(); /// + /// Gets or sets language ID, e.g. en-US. /// - [JsonProperty(PropertyName = "installedVersion")] - public ModuleIdentity InstalledVersion { get; set; } + [JsonProperty(PropertyName = "locale")] + public string Locale { get; set; } /// /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } } } @@ -16778,25 +17485,33 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models using System.Threading; using System.Threading.Tasks; - public partial class SortInfo + public partial class DynamicPropertyDictionaryItem { /// - /// Initializes a new instance of the SortInfo class. + /// Initializes a new instance of the DynamicPropertyDictionaryItem + /// class. /// - public SortInfo() + public DynamicPropertyDictionaryItem() { CustomInit(); } /// - /// Initializes a new instance of the SortInfo class. + /// Initializes a new instance of the DynamicPropertyDictionaryItem + /// class. /// - /// Possible values include: 'Ascending', - /// 'Descending' - public SortInfo(string sortColumn = default(string), string sortDirection = default(string)) + /// Item names for different + /// languages. + public DynamicPropertyDictionaryItem(string propertyId = default(string), string name = default(string), IList displayNames = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { - SortColumn = sortColumn; - SortDirection = sortDirection; + PropertyId = propertyId; + Name = name; + DisplayNames = displayNames; + CreatedDate = createdDate; + ModifiedDate = modifiedDate; + CreatedBy = createdBy; + ModifiedBy = modifiedBy; + Id = id; CustomInit(); } @@ -16807,14 +17522,44 @@ public SortInfo() /// /// - [JsonProperty(PropertyName = "sortColumn")] - public string SortColumn { get; set; } + [JsonProperty(PropertyName = "propertyId")] + public string PropertyId { get; set; } /// - /// Gets or sets possible values include: 'Ascending', 'Descending' /// - [JsonProperty(PropertyName = "sortDirection")] - public string SortDirection { get; set; } + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets item names for different languages. + /// + [JsonProperty(PropertyName = "displayNames")] + public IList DisplayNames { get; set; } + + /// + /// + [JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "modifiedDate")] + public System.DateTime? ModifiedDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// + [JsonProperty(PropertyName = "modifiedBy")] + public string ModifiedBy { get; set; } + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } } } @@ -17034,6 +17779,10 @@ public PermissionScope() /// /// Initializes a new instance of the PermissionScope class. /// + /// Scope type name + /// Display label for particular scope value used + /// only for representation + /// Represent string scope value public PermissionScope(string type = default(string), string label = default(string), string scope = default(string)) { Type = type; @@ -17048,16 +17797,20 @@ public PermissionScope() partial void CustomInit(); /// + /// Gets or sets scope type name /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// + /// Gets or sets display label for particular scope value used only for + /// representation /// [JsonProperty(PropertyName = "label")] public string Label { get; set; } /// + /// Gets or sets represent string scope value /// [JsonProperty(PropertyName = "scope")] public string Scope { get; set; } @@ -17096,6 +17849,11 @@ public Permission() /// /// Initializes a new instance of the Permission class. /// + /// Id of the module which has registered this + /// permission. + /// Display name of the group to which this + /// permission belongs. The '|' character is used to separate Child and + /// parent groups. public Permission(string id = default(string), string name = default(string), string moduleId = default(string), string groupName = default(string), IList assignedScopes = default(IList), IList availableScopes = default(IList)) { Id = id; @@ -17123,11 +17881,15 @@ public Permission() public string Name { get; set; } /// + /// Gets or sets id of the module which has registered this permission. /// [JsonProperty(PropertyName = "moduleId")] public string ModuleId { get; set; } /// + /// Gets or sets display name of the group to which this permission + /// belongs. The '|' character is used to separate Child and parent + /// groups. /// [JsonProperty(PropertyName = "groupName")] public string GroupName { get; set; } @@ -17274,19 +18036,38 @@ public ObjectSettingEntry() /// /// Initializes a new instance of the ObjectSettingEntry class. /// + /// Setting may belong to any object in + /// system + /// Flag indicates the this setting is read + /// only and can't be changed + /// The flag indicates that you need to + /// restart the application to apply this setting changes. + /// The module id which setting belong + /// to + /// Setting group name + /// Setting name + /// Display setting name + /// Flag indicates that this setting doesn't + /// need to be displayed on the UI /// Possible values include: 'ShortText', /// 'LongText', 'Integer', 'Decimal', 'DateTime', 'Boolean', - /// 'SecureString', 'Json' - public ObjectSettingEntry(bool? itHasValues = default(bool?), string objectId = default(string), string objectType = default(string), object value = default(object), bool? restartRequired = default(bool?), string moduleId = default(string), string groupName = default(string), string name = default(string), bool? isHidden = default(bool?), string valueType = default(string), IList allowedValues = default(IList), object defaultValue = default(object), bool? isDictionary = default(bool?)) + /// 'SecureString', 'Json', 'PositiveInteger' + /// The flag indicates what current setting + /// is just editable dictionary and hasn't any concrete value + public ObjectSettingEntry(bool? itHasValues = default(bool?), string objectId = default(string), string objectType = default(string), bool? isReadOnly = default(bool?), object value = default(object), string id = default(string), bool? restartRequired = default(bool?), string moduleId = default(string), string groupName = default(string), string name = default(string), string displayName = default(string), bool? isRequired = default(bool?), bool? isHidden = default(bool?), string valueType = default(string), IList allowedValues = default(IList), object defaultValue = default(object), bool? isDictionary = default(bool?)) { ItHasValues = itHasValues; ObjectId = objectId; ObjectType = objectType; + IsReadOnly = isReadOnly; Value = value; + Id = id; RestartRequired = restartRequired; ModuleId = moduleId; GroupName = groupName; Name = name; + DisplayName = displayName; + IsRequired = isRequired; IsHidden = isHidden; ValueType = valueType; AllowedValues = allowedValues; @@ -17298,264 +18079,108 @@ public ObjectSettingEntry() /// /// An initialization method that performs custom operations like setting defaults /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "itHasValues")] - public bool? ItHasValues { get; private set; } - - /// - /// - [JsonProperty(PropertyName = "objectId")] - public string ObjectId { get; set; } - - /// - /// - [JsonProperty(PropertyName = "objectType")] - public string ObjectType { get; set; } - - /// - /// - [JsonProperty(PropertyName = "value")] - public object Value { get; set; } - - /// - /// - [JsonProperty(PropertyName = "restartRequired")] - public bool? RestartRequired { get; set; } - - /// - /// - [JsonProperty(PropertyName = "moduleId")] - public string ModuleId { get; set; } - - /// - /// - [JsonProperty(PropertyName = "groupName")] - public string GroupName { get; set; } - - /// - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// - [JsonProperty(PropertyName = "isHidden")] - public bool? IsHidden { get; set; } - - /// - /// Gets or sets possible values include: 'ShortText', 'LongText', - /// 'Integer', 'Decimal', 'DateTime', 'Boolean', 'SecureString', 'Json' - /// - [JsonProperty(PropertyName = "valueType")] - public string ValueType { get; set; } - - /// - /// - [JsonProperty(PropertyName = "allowedValues")] - public IList AllowedValues { get; set; } - - /// - /// - [JsonProperty(PropertyName = "defaultValue")] - public object DefaultValue { get; set; } - - /// - /// - [JsonProperty(PropertyName = "isDictionary")] - public bool? IsDictionary { get; set; } - - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - public partial class TenantIdentity - { - /// - /// Initializes a new instance of the TenantIdentity class. - /// - public TenantIdentity() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TenantIdentity class. - /// - public TenantIdentity(string id = default(string), string type = default(string), bool? isEmpty = default(bool?), bool? isValid = default(bool?)) - { - Id = id; - Type = type; - IsEmpty = isEmpty; - IsValid = isValid; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// - [JsonProperty(PropertyName = "isEmpty")] - public bool? IsEmpty { get; private set; } - - /// - /// - [JsonProperty(PropertyName = "isValid")] - public bool? IsValid { get; private set; } - - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; + partial void CustomInit(); - public partial class AssetEntrySearchCriteria - { /// - /// Initializes a new instance of the AssetEntrySearchCriteria class. /// - public AssetEntrySearchCriteria() - { - CustomInit(); - } + [JsonProperty(PropertyName = "itHasValues")] + public bool? ItHasValues { get; private set; } /// - /// Initializes a new instance of the AssetEntrySearchCriteria class. + /// Gets or sets setting may belong to any object in system /// - public AssetEntrySearchCriteria(IList tenants = default(IList), string group = default(string), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) - { - Tenants = tenants; - Group = group; - ResponseGroup = responseGroup; - ObjectType = objectType; - ObjectTypes = objectTypes; - ObjectIds = objectIds; - Keyword = keyword; - SearchPhrase = searchPhrase; - LanguageCode = languageCode; - Sort = sort; - SortInfos = sortInfos; - Skip = skip; - Take = take; - CustomInit(); - } + [JsonProperty(PropertyName = "objectId")] + public string ObjectId { get; set; } /// - /// An initialization method that performs custom operations like setting defaults /// - partial void CustomInit(); + [JsonProperty(PropertyName = "objectType")] + public string ObjectType { get; set; } /// + /// Gets or sets flag indicates the this setting is read only and can't + /// be changed /// - [JsonProperty(PropertyName = "tenants")] - public IList Tenants { get; set; } + [JsonProperty(PropertyName = "isReadOnly")] + public bool? IsReadOnly { get; set; } /// /// - [JsonProperty(PropertyName = "group")] - public string Group { get; set; } + [JsonProperty(PropertyName = "value")] + public object Value { get; set; } /// /// - [JsonProperty(PropertyName = "responseGroup")] - public string ResponseGroup { get; set; } + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } /// + /// Gets or sets the flag indicates that you need to restart the + /// application to apply this setting changes. /// - [JsonProperty(PropertyName = "objectType")] - public string ObjectType { get; set; } + [JsonProperty(PropertyName = "restartRequired")] + public bool? RestartRequired { get; set; } /// + /// Gets or sets the module id which setting belong to /// - [JsonProperty(PropertyName = "objectTypes")] - public IList ObjectTypes { get; set; } + [JsonProperty(PropertyName = "moduleId")] + public string ModuleId { get; set; } /// + /// Gets or sets setting group name /// - [JsonProperty(PropertyName = "objectIds")] - public IList ObjectIds { get; set; } + [JsonProperty(PropertyName = "groupName")] + public string GroupName { get; set; } /// + /// Gets or sets setting name /// - [JsonProperty(PropertyName = "keyword")] - public string Keyword { get; set; } + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } /// + /// Gets or sets display setting name /// - [JsonProperty(PropertyName = "searchPhrase")] - public string SearchPhrase { get; set; } + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } /// /// - [JsonProperty(PropertyName = "languageCode")] - public string LanguageCode { get; set; } + [JsonProperty(PropertyName = "isRequired")] + public bool? IsRequired { get; set; } /// + /// Gets or sets flag indicates that this setting doesn't need to be + /// displayed on the UI /// - [JsonProperty(PropertyName = "sort")] - public string Sort { get; set; } + [JsonProperty(PropertyName = "isHidden")] + public bool? IsHidden { get; set; } /// + /// Gets or sets possible values include: 'ShortText', 'LongText', + /// 'Integer', 'Decimal', 'DateTime', 'Boolean', 'SecureString', + /// 'Json', 'PositiveInteger' /// - [JsonProperty(PropertyName = "sortInfos")] - public IList SortInfos { get; private set; } + [JsonProperty(PropertyName = "valueType")] + public string ValueType { get; set; } /// /// - [JsonProperty(PropertyName = "skip")] - public int? Skip { get; set; } + [JsonProperty(PropertyName = "allowedValues")] + public IList AllowedValues { get; set; } /// /// - [JsonProperty(PropertyName = "take")] - public int? Take { get; set; } + [JsonProperty(PropertyName = "defaultValue")] + public object DefaultValue { get; set; } + + /// + /// Gets or sets the flag indicates what current setting is just + /// editable dictionary and hasn't any concrete value + /// + [JsonProperty(PropertyName = "isDictionary")] + public bool? IsDictionary { get; set; } } } @@ -17578,30 +18203,35 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models using System.Threading; using System.Threading.Tasks; - public partial class AssetEntry + public partial class OpenIddictResponse { /// - /// Initializes a new instance of the AssetEntry class. + /// Initializes a new instance of the OpenIddictResponse class. /// - public AssetEntry() + public OpenIddictResponse() { CustomInit(); } /// - /// Initializes a new instance of the AssetEntry class. + /// Initializes a new instance of the OpenIddictResponse class. /// - public AssetEntry(string languageCode = default(string), TenantIdentity tenant = default(TenantIdentity), BlobInfo blobInfo = default(BlobInfo), string group = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + public OpenIddictResponse(string accessToken = default(string), string code = default(string), string deviceCode = default(string), string error = default(string), string errorDescription = default(string), string errorUri = default(string), long? expiresIn = default(long?), string idToken = default(string), string refreshToken = default(string), string scope = default(string), string state = default(string), string tokenType = default(string), string userCode = default(string), int? count = default(int?)) { - LanguageCode = languageCode; - Tenant = tenant; - BlobInfo = blobInfo; - Group = group; - CreatedDate = createdDate; - ModifiedDate = modifiedDate; - CreatedBy = createdBy; - ModifiedBy = modifiedBy; - Id = id; + AccessToken = accessToken; + Code = code; + DeviceCode = deviceCode; + Error = error; + ErrorDescription = errorDescription; + ErrorUri = errorUri; + ExpiresIn = expiresIn; + IdToken = idToken; + RefreshToken = refreshToken; + Scope = scope; + State = state; + TokenType = tokenType; + UserCode = userCode; + Count = count; CustomInit(); } @@ -17612,48 +18242,73 @@ public AssetEntry() /// /// - [JsonProperty(PropertyName = "languageCode")] - public string LanguageCode { get; set; } + [JsonProperty(PropertyName = "accessToken")] + public string AccessToken { get; set; } /// /// - [JsonProperty(PropertyName = "tenant")] - public TenantIdentity Tenant { get; set; } + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } /// /// - [JsonProperty(PropertyName = "blobInfo")] - public BlobInfo BlobInfo { get; set; } + [JsonProperty(PropertyName = "deviceCode")] + public string DeviceCode { get; set; } /// /// - [JsonProperty(PropertyName = "group")] - public string Group { get; set; } + [JsonProperty(PropertyName = "error")] + public string Error { get; set; } /// /// - [JsonProperty(PropertyName = "createdDate")] - public System.DateTime? CreatedDate { get; set; } + [JsonProperty(PropertyName = "errorDescription")] + public string ErrorDescription { get; set; } /// /// - [JsonProperty(PropertyName = "modifiedDate")] - public System.DateTime? ModifiedDate { get; set; } + [JsonProperty(PropertyName = "errorUri")] + public string ErrorUri { get; set; } /// /// - [JsonProperty(PropertyName = "createdBy")] - public string CreatedBy { get; set; } + [JsonProperty(PropertyName = "expiresIn")] + public long? ExpiresIn { get; set; } /// /// - [JsonProperty(PropertyName = "modifiedBy")] - public string ModifiedBy { get; set; } + [JsonProperty(PropertyName = "idToken")] + public string IdToken { get; set; } /// /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [JsonProperty(PropertyName = "refreshToken")] + public string RefreshToken { get; set; } + + /// + /// + [JsonProperty(PropertyName = "scope")] + public string Scope { get; set; } + + /// + /// + [JsonProperty(PropertyName = "state")] + public string State { get; set; } + + /// + /// + [JsonProperty(PropertyName = "tokenType")] + public string TokenType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "userCode")] + public string UserCode { get; set; } + + /// + /// + [JsonProperty(PropertyName = "count")] + public int? Count { get; private set; } } } @@ -17676,23 +18331,23 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models using System.Threading; using System.Threading.Tasks; - public partial class AssetEntrySearchResult + public partial class LastModifiedResponse { /// - /// Initializes a new instance of the AssetEntrySearchResult class. + /// Initializes a new instance of the LastModifiedResponse class. /// - public AssetEntrySearchResult() + public LastModifiedResponse() { CustomInit(); } /// - /// Initializes a new instance of the AssetEntrySearchResult class. + /// Initializes a new instance of the LastModifiedResponse class. /// - public AssetEntrySearchResult(int? totalCount = default(int?), IList results = default(IList)) + public LastModifiedResponse(string scope = default(string), System.DateTime? lastModifiedDate = default(System.DateTime?)) { - TotalCount = totalCount; - Results = results; + Scope = scope; + LastModifiedDate = lastModifiedDate; CustomInit(); } @@ -17703,13 +18358,13 @@ public AssetEntrySearchResult() /// /// - [JsonProperty(PropertyName = "totalCount")] - public int? TotalCount { get; set; } + [JsonProperty(PropertyName = "scope")] + public string Scope { get; set; } /// /// - [JsonProperty(PropertyName = "results")] - public IList Results { get; set; } + [JsonProperty(PropertyName = "lastModifiedDate")] + public System.DateTime? LastModifiedDate { get; set; } } } @@ -17732,30 +18387,23 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models using System.Threading; using System.Threading.Tasks; - public partial class BlobEntry + public partial class ChangedEntitiesRequest { /// - /// Initializes a new instance of the BlobEntry class. + /// Initializes a new instance of the ChangedEntitiesRequest class. /// - public BlobEntry() + public ChangedEntitiesRequest() { CustomInit(); } /// - /// Initializes a new instance of the BlobEntry class. + /// Initializes a new instance of the ChangedEntitiesRequest class. /// - public BlobEntry(string type = default(string), string name = default(string), string url = default(string), string relativeUrl = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + public ChangedEntitiesRequest(IList entityNames = default(IList), System.DateTime? modifiedSince = default(System.DateTime?)) { - Type = type; - Name = name; - Url = url; - RelativeUrl = relativeUrl; - CreatedDate = createdDate; - ModifiedDate = modifiedDate; - CreatedBy = createdBy; - ModifiedBy = modifiedBy; - Id = id; + EntityNames = entityNames; + ModifiedSince = modifiedSince; CustomInit(); } @@ -17766,48 +18414,13 @@ public BlobEntry() /// /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// - [JsonProperty(PropertyName = "url")] - public string Url { get; set; } - - /// - /// - [JsonProperty(PropertyName = "relativeUrl")] - public string RelativeUrl { get; set; } - - /// - /// - [JsonProperty(PropertyName = "createdDate")] - public System.DateTime? CreatedDate { get; set; } - - /// - /// - [JsonProperty(PropertyName = "modifiedDate")] - public System.DateTime? ModifiedDate { get; set; } - - /// - /// - [JsonProperty(PropertyName = "createdBy")] - public string CreatedBy { get; set; } - - /// - /// - [JsonProperty(PropertyName = "modifiedBy")] - public string ModifiedBy { get; set; } + [JsonProperty(PropertyName = "entityNames")] + public IList EntityNames { get; set; } /// /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [JsonProperty(PropertyName = "modifiedSince")] + public System.DateTime? ModifiedSince { get; set; } } } @@ -17830,23 +18443,23 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models using System.Threading; using System.Threading.Tasks; - public partial class BlobEntrySearchResult + public partial class ChangedEntity { /// - /// Initializes a new instance of the BlobEntrySearchResult class. + /// Initializes a new instance of the ChangedEntity class. /// - public BlobEntrySearchResult() + public ChangedEntity() { CustomInit(); } /// - /// Initializes a new instance of the BlobEntrySearchResult class. + /// Initializes a new instance of the ChangedEntity class. /// - public BlobEntrySearchResult(int? totalCount = default(int?), IList results = default(IList)) + public ChangedEntity(string name = default(string), System.DateTime? modifiedDate = default(System.DateTime?)) { - TotalCount = totalCount; - Results = results; + Name = name; + ModifiedDate = modifiedDate; CustomInit(); } @@ -17857,13 +18470,13 @@ public BlobEntrySearchResult() /// /// - [JsonProperty(PropertyName = "totalCount")] - public int? TotalCount { get; set; } + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } /// /// - [JsonProperty(PropertyName = "results")] - public IList Results { get; set; } + [JsonProperty(PropertyName = "modifiedDate")] + public System.DateTime? ModifiedDate { get; set; } } } @@ -17886,31 +18499,22 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models using System.Threading; using System.Threading.Tasks; - public partial class BlobFolder + public partial class ChangedEntitiesResponse { /// - /// Initializes a new instance of the BlobFolder class. + /// Initializes a new instance of the ChangedEntitiesResponse class. /// - public BlobFolder() + public ChangedEntitiesResponse() { CustomInit(); } /// - /// Initializes a new instance of the BlobFolder class. + /// Initializes a new instance of the ChangedEntitiesResponse class. /// - public BlobFolder(string parentUrl = default(string), string type = default(string), string name = default(string), string url = default(string), string relativeUrl = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + public ChangedEntitiesResponse(IList entities = default(IList)) { - ParentUrl = parentUrl; - Type = type; - Name = name; - Url = url; - RelativeUrl = relativeUrl; - CreatedDate = createdDate; - ModifiedDate = modifiedDate; - CreatedBy = createdBy; - ModifiedBy = modifiedBy; - Id = id; + Entities = entities; CustomInit(); } @@ -17921,53 +18525,8 @@ public BlobFolder() /// /// - [JsonProperty(PropertyName = "parentUrl")] - public string ParentUrl { get; set; } - - /// - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// - [JsonProperty(PropertyName = "url")] - public string Url { get; set; } - - /// - /// - [JsonProperty(PropertyName = "relativeUrl")] - public string RelativeUrl { get; set; } - - /// - /// - [JsonProperty(PropertyName = "createdDate")] - public System.DateTime? CreatedDate { get; set; } - - /// - /// - [JsonProperty(PropertyName = "modifiedDate")] - public System.DateTime? ModifiedDate { get; set; } - - /// - /// - [JsonProperty(PropertyName = "createdBy")] - public string CreatedBy { get; set; } - - /// - /// - [JsonProperty(PropertyName = "modifiedBy")] - public string ModifiedBy { get; set; } - - /// - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [JsonProperty(PropertyName = "entities")] + public IList Entities { get; set; } } } @@ -17990,23 +18549,25 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models using System.Threading; using System.Threading.Tasks; - public partial class LastModifiedResponse + public partial class SortInfo { /// - /// Initializes a new instance of the LastModifiedResponse class. + /// Initializes a new instance of the SortInfo class. /// - public LastModifiedResponse() + public SortInfo() { CustomInit(); } /// - /// Initializes a new instance of the LastModifiedResponse class. + /// Initializes a new instance of the SortInfo class. /// - public LastModifiedResponse(string scope = default(string), System.DateTime? lastModifiedDate = default(System.DateTime?)) - { - Scope = scope; - LastModifiedDate = lastModifiedDate; + /// Possible values include: 'Ascending', + /// 'Descending' + public SortInfo(string sortColumn = default(string), string sortDirection = default(string)) + { + SortColumn = sortColumn; + SortDirection = sortDirection; CustomInit(); } @@ -18017,13 +18578,14 @@ public LastModifiedResponse() /// /// - [JsonProperty(PropertyName = "scope")] - public string Scope { get; set; } + [JsonProperty(PropertyName = "sortColumn")] + public string SortColumn { get; set; } /// + /// Gets or sets possible values include: 'Ascending', 'Descending' /// - [JsonProperty(PropertyName = "lastModifiedDate")] - public System.DateTime? LastModifiedDate { get; set; } + [JsonProperty(PropertyName = "sortDirection")] + public string SortDirection { get; set; } } } @@ -18059,6 +18621,11 @@ public ChangeLogSearchCriteria() /// /// Initializes a new instance of the ChangeLogSearchCriteria class. /// + /// Search object type + /// Search phrase + /// Property is left for backward + /// compatibility + /// Search phrase language public ChangeLogSearchCriteria(IList operationTypes = default(IList), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { OperationTypes = operationTypes; @@ -18104,6 +18671,7 @@ public ChangeLogSearchCriteria() public string ResponseGroup { get; set; } /// + /// Gets or sets search object type /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } @@ -18119,16 +18687,19 @@ public ChangeLogSearchCriteria() public IList ObjectIds { get; set; } /// + /// Gets or sets search phrase /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// + /// Gets or sets property is left for backward compatibility /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// + /// Gets or sets search phrase language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } @@ -18317,7 +18888,7 @@ public SystemInfo() /// /// Initializes a new instance of the SystemInfo class. /// - public SystemInfo(string platformVersion = default(string), License license = default(License), IList installedModules = default(IList), string version = default(string), bool? is64BitOperatingSystem = default(bool?), bool? is64BitProcess = default(bool?)) + public SystemInfo(string platformVersion = default(string), License license = default(License), IList installedModules = default(IList), string version = default(string), bool? is64BitOperatingSystem = default(bool?), bool? is64BitProcess = default(bool?), string databaseProvider = default(string)) { PlatformVersion = platformVersion; License = license; @@ -18325,6 +18896,7 @@ public SystemInfo() Version = version; Is64BitOperatingSystem = is64BitOperatingSystem; Is64BitProcess = is64BitProcess; + DatabaseProvider = databaseProvider; CustomInit(); } @@ -18363,6 +18935,11 @@ public SystemInfo() [JsonProperty(PropertyName = "is64BitProcess")] public bool? Is64BitProcess { get; set; } + /// + /// + [JsonProperty(PropertyName = "databaseProvider")] + public string DatabaseProvider { get; set; } + } } // @@ -18399,6 +18976,11 @@ public DynamicPropertySearchCriteria() /// Initializes a new instance of the DynamicPropertySearchCriteria /// class. /// + /// Search object type + /// Search phrase + /// Property is left for backward + /// compatibility + /// Search phrase language public DynamicPropertySearchCriteria(string typeName = default(string), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { TypeName = typeName; @@ -18432,6 +19014,7 @@ public DynamicPropertySearchCriteria() public string ResponseGroup { get; set; } /// + /// Gets or sets search object type /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } @@ -18447,16 +19030,19 @@ public DynamicPropertySearchCriteria() public IList ObjectIds { get; set; } /// + /// Gets or sets search phrase /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// + /// Gets or sets property is left for backward compatibility /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// + /// Gets or sets search phrase language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } @@ -18515,6 +19101,7 @@ public DynamicPropertyName() /// /// Initializes a new instance of the DynamicPropertyName class. /// + /// Language ID, e.g. en-US. public DynamicPropertyName(string locale = default(string), string name = default(string)) { Locale = locale; @@ -18528,6 +19115,7 @@ public DynamicPropertyName() partial void CustomInit(); /// + /// Gets or sets language ID, e.g. en-US. /// [JsonProperty(PropertyName = "locale")] public string Locale { get; set; } @@ -18571,9 +19159,19 @@ public DynamicProperty() /// /// Initializes a new instance of the DynamicProperty class. /// + /// dynamic property description + /// Defines whether a property supports multiple + /// values. + /// Dictionary has a predefined set of + /// values. User can select one or more of them and cannot enter + /// arbitrary values. + /// For multilingual properties user can + /// enter different values for each of registered languages. /// Possible values include: 'Undefined', /// 'ShortText', 'LongText', 'Integer', 'Decimal', 'DateTime', /// 'Boolean', 'Html', 'Image' + /// Property names for different + /// languages. public DynamicProperty(string name = default(string), string description = default(string), string objectType = default(string), bool? isArray = default(bool?), bool? isDictionary = default(bool?), bool? isMultilingual = default(bool?), bool? isRequired = default(bool?), int? displayOrder = default(int?), string valueType = default(string), IList displayNames = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { Name = name; @@ -18605,6 +19203,7 @@ public DynamicProperty() public string Name { get; set; } /// + /// Gets or sets dynamic property description /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } @@ -18615,16 +19214,21 @@ public DynamicProperty() public string ObjectType { get; set; } /// + /// Gets or sets defines whether a property supports multiple values. /// [JsonProperty(PropertyName = "isArray")] public bool? IsArray { get; set; } /// + /// Gets or sets dictionary has a predefined set of values. User can + /// select one or more of them and cannot enter arbitrary values. /// [JsonProperty(PropertyName = "isDictionary")] public bool? IsDictionary { get; set; } /// + /// Gets or sets for multilingual properties user can enter different + /// values for each of registered languages. /// [JsonProperty(PropertyName = "isMultilingual")] public bool? IsMultilingual { get; set; } @@ -18648,6 +19252,7 @@ public DynamicProperty() public string ValueType { get; set; } /// + /// Gets or sets property names for different languages. /// [JsonProperty(PropertyName = "displayNames")] public IList DisplayNames { get; set; } @@ -18867,9 +19472,19 @@ public DynamicObjectProperty() /// /// Initializes a new instance of the DynamicObjectProperty class. /// + /// dynamic property description + /// Defines whether a property supports multiple + /// values. + /// Dictionary has a predefined set of + /// values. User can select one or more of them and cannot enter + /// arbitrary values. + /// For multilingual properties user can + /// enter different values for each of registered languages. /// Possible values include: 'Undefined', /// 'ShortText', 'LongText', 'Integer', 'Decimal', 'DateTime', /// 'Boolean', 'Html', 'Image' + /// Property names for different + /// languages. public DynamicObjectProperty(string objectId = default(string), IList values = default(IList), string name = default(string), string description = default(string), string objectType = default(string), bool? isArray = default(bool?), bool? isDictionary = default(bool?), bool? isMultilingual = default(bool?), bool? isRequired = default(bool?), int? displayOrder = default(int?), string valueType = default(string), IList displayNames = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { ObjectId = objectId; @@ -18913,6 +19528,7 @@ public DynamicObjectProperty() public string Name { get; set; } /// + /// Gets or sets dynamic property description /// [JsonProperty(PropertyName = "description")] public string Description { get; set; } @@ -18923,16 +19539,21 @@ public DynamicObjectProperty() public string ObjectType { get; set; } /// + /// Gets or sets defines whether a property supports multiple values. /// [JsonProperty(PropertyName = "isArray")] public bool? IsArray { get; set; } /// + /// Gets or sets dictionary has a predefined set of values. User can + /// select one or more of them and cannot enter arbitrary values. /// [JsonProperty(PropertyName = "isDictionary")] public bool? IsDictionary { get; set; } /// + /// Gets or sets for multilingual properties user can enter different + /// values for each of registered languages. /// [JsonProperty(PropertyName = "isMultilingual")] public bool? IsMultilingual { get; set; } @@ -18956,6 +19577,7 @@ public DynamicObjectProperty() public string ValueType { get; set; } /// + /// Gets or sets property names for different languages. /// [JsonProperty(PropertyName = "displayNames")] public IList DisplayNames { get; set; } @@ -19021,6 +19643,11 @@ public DynamicPropertyDictionaryItemSearchCriteria() /// Initializes a new instance of the /// DynamicPropertyDictionaryItemSearchCriteria class. /// + /// Search object type + /// Search phrase + /// Property is left for backward + /// compatibility + /// Search phrase language public DynamicPropertyDictionaryItemSearchCriteria(string propertyId = default(string), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { PropertyId = propertyId; @@ -19054,6 +19681,7 @@ public DynamicPropertyDictionaryItemSearchCriteria() public string ResponseGroup { get; set; } /// + /// Gets or sets search object type /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } @@ -19069,16 +19697,19 @@ public DynamicPropertyDictionaryItemSearchCriteria() public IList ObjectIds { get; set; } /// + /// Gets or sets search phrase /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// + /// Gets or sets property is left for backward compatibility /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// + /// Gets or sets search phrase language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } @@ -19317,11 +19948,14 @@ public ModulePushNotification() /// /// Initializes a new instance of the ModulePushNotification class. /// - public ModulePushNotification(System.DateTime? started = default(System.DateTime?), System.DateTime? finished = default(System.DateTime?), IList progressLog = default(IList), string serverId = default(string), string creator = default(string), System.DateTime? created = default(System.DateTime?), bool? isNew = default(bool?), string notifyType = default(string), string description = default(string), string title = default(string), int? repeatCount = default(int?), string id = default(string)) + /// Gets the count of errors during + /// processing. + public ModulePushNotification(System.DateTime? started = default(System.DateTime?), System.DateTime? finished = default(System.DateTime?), IList progressLog = default(IList), int? errorCount = default(int?), string serverId = default(string), string creator = default(string), System.DateTime? created = default(System.DateTime?), bool? isNew = default(bool?), string notifyType = default(string), string description = default(string), string title = default(string), int? repeatCount = default(int?), string id = default(string)) { Started = started; Finished = finished; ProgressLog = progressLog; + ErrorCount = errorCount; ServerId = serverId; Creator = creator; Created = created; @@ -19354,6 +19988,12 @@ public ModulePushNotification() [JsonProperty(PropertyName = "progressLog")] public IList ProgressLog { get; set; } + /// + /// Gets the count of errors during processing. + /// + [JsonProperty(PropertyName = "errorCount")] + public int? ErrorCount { get; private set; } + /// /// [JsonProperty(PropertyName = "serverId")] @@ -19435,11 +20075,14 @@ public ModuleAutoInstallPushNotification() /// Initializes a new instance of the ModuleAutoInstallPushNotification /// class. /// - public ModuleAutoInstallPushNotification(System.DateTime? started = default(System.DateTime?), System.DateTime? finished = default(System.DateTime?), IList progressLog = default(IList), string serverId = default(string), string creator = default(string), System.DateTime? created = default(System.DateTime?), bool? isNew = default(bool?), string notifyType = default(string), string description = default(string), string title = default(string), int? repeatCount = default(int?), string id = default(string)) + /// Gets the count of errors during + /// processing. + public ModuleAutoInstallPushNotification(System.DateTime? started = default(System.DateTime?), System.DateTime? finished = default(System.DateTime?), IList progressLog = default(IList), int? errorCount = default(int?), string serverId = default(string), string creator = default(string), System.DateTime? created = default(System.DateTime?), bool? isNew = default(bool?), string notifyType = default(string), string description = default(string), string title = default(string), int? repeatCount = default(int?), string id = default(string)) { Started = started; Finished = finished; ProgressLog = progressLog; + ErrorCount = errorCount; ServerId = serverId; Creator = creator; Created = created; @@ -19472,6 +20115,12 @@ public ModuleAutoInstallPushNotification() [JsonProperty(PropertyName = "progressLog")] public IList ProgressLog { get; set; } + /// + /// Gets the count of errors during processing. + /// + [JsonProperty(PropertyName = "errorCount")] + public int? ErrorCount { get; private set; } + /// /// [JsonProperty(PropertyName = "serverId")] @@ -19525,6 +20174,61 @@ public ModuleAutoInstallPushNotification() // regenerated. // +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + public partial class JsonElement + { + /// + /// Initializes a new instance of the JsonElement class. + /// + public JsonElement() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the JsonElement class. + /// + /// Possible values include: 'Undefined', + /// 'Object', 'Array', 'String', 'Number', 'True', 'False', + /// 'Null' + public JsonElement(string valueKind = default(string)) + { + ValueKind = valueKind; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'Undefined', 'Object', + /// 'Array', 'String', 'Number', 'True', 'False', 'Null' + /// + [JsonProperty(PropertyName = "valueKind")] + public string ValueKind { get; set; } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; @@ -19553,15 +20257,18 @@ public OpenIddictApplicationDescriptor() /// Initializes a new instance of the OpenIddictApplicationDescriptor /// class. /// - public OpenIddictApplicationDescriptor(string clientId = default(string), string clientSecret = default(string), string consentType = default(string), string displayName = default(string), IList permissions = default(IList), IList postLogoutRedirectUris = default(IList), IList redirectUris = default(IList), string type = default(string)) + public OpenIddictApplicationDescriptor(string clientId = default(string), string clientSecret = default(string), string consentType = default(string), string displayName = default(string), IDictionary displayNames = default(IDictionary), IList permissions = default(IList), IList postLogoutRedirectUris = default(IList), IDictionary properties = default(IDictionary), IList redirectUris = default(IList), IList requirements = default(IList), string type = default(string)) { ClientId = clientId; ClientSecret = clientSecret; ConsentType = consentType; DisplayName = displayName; + DisplayNames = displayNames; Permissions = permissions; PostLogoutRedirectUris = postLogoutRedirectUris; + Properties = properties; RedirectUris = redirectUris; + Requirements = requirements; Type = type; CustomInit(); } @@ -19591,6 +20298,11 @@ public OpenIddictApplicationDescriptor() [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; set; } + /// + /// + [JsonProperty(PropertyName = "displayNames")] + public IDictionary DisplayNames { get; private set; } + /// /// [JsonProperty(PropertyName = "permissions")] @@ -19601,11 +20313,21 @@ public OpenIddictApplicationDescriptor() [JsonProperty(PropertyName = "postLogoutRedirectUris")] public IList PostLogoutRedirectUris { get; private set; } + /// + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; private set; } + /// /// [JsonProperty(PropertyName = "redirectUris")] public IList RedirectUris { get; private set; } + /// + /// + [JsonProperty(PropertyName = "requirements")] + public IList Requirements { get; private set; } + /// /// [JsonProperty(PropertyName = "type")] @@ -19645,6 +20367,11 @@ public OAuthAppSearchCriteria() /// /// Initializes a new instance of the OAuthAppSearchCriteria class. /// + /// Search object type + /// Search phrase + /// Property is left for backward + /// compatibility + /// Search phrase language public OAuthAppSearchCriteria(string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { ResponseGroup = responseGroup; @@ -19672,6 +20399,208 @@ public OAuthAppSearchCriteria() public string ResponseGroup { get; set; } /// + /// Gets or sets search object type + /// + [JsonProperty(PropertyName = "objectType")] + public string ObjectType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "objectTypes")] + public IList ObjectTypes { get; set; } + + /// + /// + [JsonProperty(PropertyName = "objectIds")] + public IList ObjectIds { get; set; } + + /// + /// Gets or sets search phrase + /// + [JsonProperty(PropertyName = "keyword")] + public string Keyword { get; set; } + + /// + /// Gets or sets property is left for backward compatibility + /// + [JsonProperty(PropertyName = "searchPhrase")] + public string SearchPhrase { get; set; } + + /// + /// Gets or sets search phrase language + /// + [JsonProperty(PropertyName = "languageCode")] + public string LanguageCode { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sort")] + public string Sort { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sortInfos")] + public IList SortInfos { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "skip")] + public int? Skip { get; set; } + + /// + /// + [JsonProperty(PropertyName = "take")] + public int? Take { get; set; } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + public partial class OAuthAppSearchResult + { + /// + /// Initializes a new instance of the OAuthAppSearchResult class. + /// + public OAuthAppSearchResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OAuthAppSearchResult class. + /// + public OAuthAppSearchResult(int? totalCount = default(int?), IList results = default(IList)) + { + TotalCount = totalCount; + Results = results; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "totalCount")] + public int? TotalCount { get; set; } + + /// + /// + [JsonProperty(PropertyName = "results")] + public IList Results { get; set; } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + public partial class PushNotificationSearchCriteria + { + /// + /// Initializes a new instance of the PushNotificationSearchCriteria + /// class. + /// + public PushNotificationSearchCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PushNotificationSearchCriteria + /// class. + /// + /// Search object type + /// Search phrase + /// Property is left for backward + /// compatibility + /// Search phrase language + public PushNotificationSearchCriteria(IList ids = default(IList), bool? onlyNew = default(bool?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) + { + Ids = ids; + OnlyNew = onlyNew; + StartDate = startDate; + EndDate = endDate; + ResponseGroup = responseGroup; + ObjectType = objectType; + ObjectTypes = objectTypes; + ObjectIds = objectIds; + Keyword = keyword; + SearchPhrase = searchPhrase; + LanguageCode = languageCode; + Sort = sort; + SortInfos = sortInfos; + Skip = skip; + Take = take; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "ids")] + public IList Ids { get; set; } + + /// + /// + [JsonProperty(PropertyName = "onlyNew")] + public bool? OnlyNew { get; set; } + + /// + /// + [JsonProperty(PropertyName = "startDate")] + public System.DateTime? StartDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "endDate")] + public System.DateTime? EndDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "responseGroup")] + public string ResponseGroup { get; set; } + + /// + /// Gets or sets search object type /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } @@ -19687,16 +20616,19 @@ public OAuthAppSearchCriteria() public IList ObjectIds { get; set; } /// + /// Gets or sets search phrase /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// + /// Gets or sets property is left for backward compatibility /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// + /// Gets or sets search phrase language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } @@ -19729,62 +20661,6 @@ public OAuthAppSearchCriteria() // regenerated. // -namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - public partial class OAuthAppSearchResult - { - /// - /// Initializes a new instance of the OAuthAppSearchResult class. - /// - public OAuthAppSearchResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OAuthAppSearchResult class. - /// - public OAuthAppSearchResult(int? totalCount = default(int?), IList results = default(IList)) - { - TotalCount = totalCount; - Results = results; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "totalCount")] - public int? TotalCount { get; set; } - - /// - /// - [JsonProperty(PropertyName = "results")] - public IList Results { get; set; } - - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; @@ -20103,12 +20979,13 @@ public UserDetail() /// /// Initializes a new instance of the UserDetail class. /// - public UserDetail(IList permissions = default(IList), string userName = default(string), bool? isAdministrator = default(bool?), bool? passwordExpired = default(bool?), string id = default(string)) + public UserDetail(IList permissions = default(IList), string userName = default(string), bool? isAdministrator = default(bool?), bool? passwordExpired = default(bool?), int? daysTillPasswordExpiry = default(int?), string id = default(string)) { Permissions = permissions; UserName = userName; IsAdministrator = isAdministrator; PasswordExpired = passwordExpired; + DaysTillPasswordExpiry = daysTillPasswordExpiry; Id = id; CustomInit(); } @@ -20138,6 +21015,11 @@ public UserDetail() [JsonProperty(PropertyName = "passwordExpired")] public bool? PasswordExpired { get; set; } + /// + /// + [JsonProperty(PropertyName = "daysTillPasswordExpiry")] + public int? DaysTillPasswordExpiry { get; set; } + /// /// [JsonProperty(PropertyName = "id")] @@ -20177,6 +21059,11 @@ public RoleSearchCriteria() /// /// Initializes a new instance of the RoleSearchCriteria class. /// + /// Search object type + /// Search phrase + /// Property is left for backward + /// compatibility + /// Search phrase language public RoleSearchCriteria(string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { ResponseGroup = responseGroup; @@ -20204,6 +21091,7 @@ public RoleSearchCriteria() public string ResponseGroup { get; set; } /// + /// Gets or sets search object type /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } @@ -20219,16 +21107,19 @@ public RoleSearchCriteria() public IList ObjectIds { get; set; } /// + /// Gets or sets search phrase /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// + /// Gets or sets property is left for backward compatibility /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// + /// Gets or sets search phrase language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } @@ -20261,6 +21152,62 @@ public RoleSearchCriteria() // regenerated. // +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + public partial class StringIdentityUserRole + { + /// + /// Initializes a new instance of the StringIdentityUserRole class. + /// + public StringIdentityUserRole() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StringIdentityUserRole class. + /// + public StringIdentityUserRole(string userId = default(string), string roleId = default(string)) + { + UserId = userId; + RoleId = roleId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "userId")] + public string UserId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "roleId")] + public string RoleId { get; set; } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models { using Microsoft.Rest; @@ -20485,11 +21432,17 @@ public UserSearchCriteria() /// /// Initializes a new instance of the UserSearchCriteria class. /// - public UserSearchCriteria(string memberId = default(string), IList memberIds = default(IList), System.DateTime? modifiedSinceDate = default(System.DateTime?), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) + /// Search object type + /// Search phrase + /// Property is left for backward + /// compatibility + /// Search phrase language + public UserSearchCriteria(string memberId = default(string), IList memberIds = default(IList), System.DateTime? modifiedSinceDate = default(System.DateTime?), IList roles = default(IList), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string keyword = default(string), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { MemberId = memberId; MemberIds = memberIds; ModifiedSinceDate = modifiedSinceDate; + Roles = roles; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; @@ -20524,12 +21477,18 @@ public UserSearchCriteria() [JsonProperty(PropertyName = "modifiedSinceDate")] public System.DateTime? ModifiedSinceDate { get; set; } + /// + /// + [JsonProperty(PropertyName = "roles")] + public IList Roles { get; set; } + /// /// [JsonProperty(PropertyName = "responseGroup")] public string ResponseGroup { get; set; } /// + /// Gets or sets search object type /// [JsonProperty(PropertyName = "objectType")] public string ObjectType { get; set; } @@ -20545,16 +21504,19 @@ public UserSearchCriteria() public IList ObjectIds { get; set; } /// + /// Gets or sets search phrase /// [JsonProperty(PropertyName = "keyword")] public string Keyword { get; set; } /// + /// Gets or sets property is left for backward compatibility /// [JsonProperty(PropertyName = "searchPhrase")] public string SearchPhrase { get; set; } /// + /// Gets or sets search phrase language /// [JsonProperty(PropertyName = "languageCode")] public string LanguageCode { get; set; } @@ -20669,15 +21631,29 @@ public ApplicationUser() /// /// Initializes a new instance of the ApplicationUser class. /// + /// Tenant id + /// Obsolete. Use LockoutEnd. DateTime + /// in UTC when lockout ends, any time in the past is considered not + /// locked out. /// Possible values include: 'PendingApproval', /// 'Approved', 'Rejected' - public ApplicationUser(string storeId = default(string), string memberId = default(string), bool? isAdministrator = default(bool?), string photoUrl = default(string), string userType = default(string), string password = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), IList roles = default(IList), System.DateTime? lockoutEndDateUtc = default(System.DateTime?), string userState = default(string), IList permissions = default(IList), IList logins = default(IList), bool? passwordExpired = default(bool?), string id = default(string), string userName = default(string), string normalizedUserName = default(string), string email = default(string), string normalizedEmail = default(string), bool? emailConfirmed = default(bool?), string passwordHash = default(string), string securityStamp = default(string), string concurrencyStamp = default(string), string phoneNumber = default(string), bool? phoneNumberConfirmed = default(bool?), bool? twoFactorEnabled = default(bool?), System.DateTime? lockoutEnd = default(System.DateTime?), bool? lockoutEnabled = default(bool?), int? accessFailedCount = default(int?)) + /// Obsolete. All permissions from assigned + /// roles. + /// External provider logins. + /// Indicates that the password for this + /// user is expired and must be changed. + /// The last date when the + /// password was changed + /// The last date when the + /// requested password change. + public ApplicationUser(string storeId = default(string), string memberId = default(string), bool? isAdministrator = default(bool?), string photoUrl = default(string), string userType = default(string), string status = default(string), string password = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), IList roles = default(IList), System.DateTime? lockoutEndDateUtc = default(System.DateTime?), string userState = default(string), IList permissions = default(IList), IList logins = default(IList), bool? passwordExpired = default(bool?), System.DateTime? lastPasswordChangedDate = default(System.DateTime?), System.DateTime? lastPasswordChangeRequestDate = default(System.DateTime?), string id = default(string), string userName = default(string), string normalizedUserName = default(string), string email = default(string), string normalizedEmail = default(string), bool? emailConfirmed = default(bool?), string passwordHash = default(string), string securityStamp = default(string), string concurrencyStamp = default(string), string phoneNumber = default(string), bool? phoneNumberConfirmed = default(bool?), bool? twoFactorEnabled = default(bool?), System.DateTime? lockoutEnd = default(System.DateTime?), bool? lockoutEnabled = default(bool?), int? accessFailedCount = default(int?)) { StoreId = storeId; MemberId = memberId; IsAdministrator = isAdministrator; PhotoUrl = photoUrl; UserType = userType; + Status = status; Password = password; CreatedDate = createdDate; ModifiedDate = modifiedDate; @@ -20689,6 +21665,8 @@ public ApplicationUser() Permissions = permissions; Logins = logins; PasswordExpired = passwordExpired; + LastPasswordChangedDate = lastPasswordChangedDate; + LastPasswordChangeRequestDate = lastPasswordChangeRequestDate; Id = id; UserName = userName; NormalizedUserName = normalizedUserName; @@ -20713,6 +21691,7 @@ public ApplicationUser() partial void CustomInit(); /// + /// Gets or sets tenant id /// [JsonProperty(PropertyName = "storeId")] public string StoreId { get; set; } @@ -20737,6 +21716,11 @@ public ApplicationUser() [JsonProperty(PropertyName = "userType")] public string UserType { get; set; } + /// + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + /// /// [JsonProperty(PropertyName = "password")] @@ -20768,6 +21752,8 @@ public ApplicationUser() public IList Roles { get; set; } /// + /// Gets or sets obsolete. Use LockoutEnd. DateTime in UTC when lockout + /// ends, any time in the past is considered not locked out. /// [JsonProperty(PropertyName = "lockoutEndDateUtc")] public System.DateTime? LockoutEndDateUtc { get; set; } @@ -20780,20 +21766,36 @@ public ApplicationUser() public string UserState { get; set; } /// + /// Gets or sets obsolete. All permissions from assigned roles. /// [JsonProperty(PropertyName = "permissions")] public IList Permissions { get; set; } /// + /// Gets or sets external provider logins. /// [JsonProperty(PropertyName = "logins")] public IList Logins { get; set; } /// + /// Gets or sets indicates that the password for this user is expired + /// and must be changed. /// [JsonProperty(PropertyName = "passwordExpired")] public bool? PasswordExpired { get; set; } + /// + /// Gets or sets the last date when the password was changed + /// + [JsonProperty(PropertyName = "lastPasswordChangedDate")] + public System.DateTime? LastPasswordChangedDate { get; set; } + + /// + /// Gets or sets the last date when the requested password change. + /// + [JsonProperty(PropertyName = "lastPasswordChangeRequestDate")] + public System.DateTime? LastPasswordChangeRequestDate { get; set; } + /// /// [JsonProperty(PropertyName = "id")] @@ -21130,28 +22132,23 @@ namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models using System.Threading; using System.Threading.Tasks; - public partial class PasswordValidationResult + public partial class IdentityError { /// - /// Initializes a new instance of the PasswordValidationResult class. + /// Initializes a new instance of the IdentityError class. /// - public PasswordValidationResult() + public IdentityError() { CustomInit(); } /// - /// Initializes a new instance of the PasswordValidationResult class. + /// Initializes a new instance of the IdentityError class. /// - public PasswordValidationResult(bool? passwordIsValid = default(bool?), int? minPasswordLength = default(int?), bool? passwordViolatesMinLength = default(bool?), bool? passwordMustHaveLowerCaseLetters = default(bool?), bool? passwordMustHaveUpperCaseLetters = default(bool?), bool? passwordMustHaveDigits = default(bool?), bool? passwordMustHaveSpecialCharacters = default(bool?)) + public IdentityError(string code = default(string), string description = default(string)) { - PasswordIsValid = passwordIsValid; - MinPasswordLength = minPasswordLength; - PasswordViolatesMinLength = passwordViolatesMinLength; - PasswordMustHaveLowerCaseLetters = passwordMustHaveLowerCaseLetters; - PasswordMustHaveUpperCaseLetters = passwordMustHaveUpperCaseLetters; - PasswordMustHaveDigits = passwordMustHaveDigits; - PasswordMustHaveSpecialCharacters = passwordMustHaveSpecialCharacters; + Code = code; + Description = description; CustomInit(); } @@ -21162,38 +22159,69 @@ public PasswordValidationResult() /// /// - [JsonProperty(PropertyName = "passwordIsValid")] - public bool? PasswordIsValid { get; set; } + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } /// /// - [JsonProperty(PropertyName = "minPasswordLength")] - public int? MinPasswordLength { get; set; } + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + public partial class IdentityResult + { /// + /// Initializes a new instance of the IdentityResult class. /// - [JsonProperty(PropertyName = "passwordViolatesMinLength")] - public bool? PasswordViolatesMinLength { get; set; } + public IdentityResult() + { + CustomInit(); + } /// + /// Initializes a new instance of the IdentityResult class. /// - [JsonProperty(PropertyName = "passwordMustHaveLowerCaseLetters")] - public bool? PasswordMustHaveLowerCaseLetters { get; set; } + public IdentityResult(bool? succeeded = default(bool?), IList errors = default(IList)) + { + Succeeded = succeeded; + Errors = errors; + CustomInit(); + } /// + /// An initialization method that performs custom operations like setting defaults /// - [JsonProperty(PropertyName = "passwordMustHaveUpperCaseLetters")] - public bool? PasswordMustHaveUpperCaseLetters { get; set; } + partial void CustomInit(); /// /// - [JsonProperty(PropertyName = "passwordMustHaveDigits")] - public bool? PasswordMustHaveDigits { get; set; } + [JsonProperty(PropertyName = "succeeded")] + public bool? Succeeded { get; private set; } /// /// - [JsonProperty(PropertyName = "passwordMustHaveSpecialCharacters")] - public bool? PasswordMustHaveSpecialCharacters { get; set; } + [JsonProperty(PropertyName = "errors")] + public IList Errors { get; private set; } } } @@ -21247,3 +22275,115 @@ public UserLockedResult() } } +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + public partial class ConfirmEmailRequest + { + /// + /// Initializes a new instance of the ConfirmEmailRequest class. + /// + public ConfirmEmailRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConfirmEmailRequest class. + /// + public ConfirmEmailRequest(string token = default(string)) + { + Token = token; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "token")] + public string Token { get; set; } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + public partial class VerifyTokenRequest + { + /// + /// Initializes a new instance of the VerifyTokenRequest class. + /// + public VerifyTokenRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VerifyTokenRequest class. + /// + public VerifyTokenRequest(string tokenProvider = default(string), string purpose = default(string), string token = default(string)) + { + TokenProvider = tokenProvider; + Purpose = purpose; + Token = token; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "tokenProvider")] + public string TokenProvider { get; set; } + + /// + /// + [JsonProperty(PropertyName = "purpose")] + public string Purpose { get; set; } + + /// + /// + [JsonProperty(PropertyName = "token")] + public string Token { get; set; } + + } +} diff --git a/VirtoCommerce.Storefront/Domain/Security/CustomUserManager.cs b/VirtoCommerce.Storefront/Domain/Security/CustomUserManager.cs index 0959ed6b3..04674c3fd 100644 --- a/VirtoCommerce.Storefront/Domain/Security/CustomUserManager.cs +++ b/VirtoCommerce.Storefront/Domain/Security/CustomUserManager.cs @@ -5,17 +5,23 @@ using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi; +using VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models; using VirtoCommerce.Storefront.Model.Security; namespace VirtoCommerce.Storefront.Domain.Security { public class CustomUserManager : AspNetUserManager { + private readonly ISecurity _platformSecurityApi; + public CustomUserManager(IUserStore userStore, IOptions optionsAccessor, IPasswordHasher passwordHasher, IEnumerable> userValidators, IEnumerable> passwordValidators, - ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger> logger) + ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger> logger, + ISecurity platformSecurityApi) : base(userStore, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger) { + _platformSecurityApi = platformSecurityApi; } public async override Task GetUserAsync(ClaimsPrincipal principal) @@ -41,5 +47,46 @@ public async override Task GetUserAsync(ClaimsPrincipal principal) } return user; } + + public override async Task ResetPasswordAsync(User user, string token, string newPassword) + { + var result = await _platformSecurityApi.ResetPasswordByTokenAsync(user.Id, + new ResetPasswordConfirmRequest() { NewPassword = newPassword, Token = token }); + + return result.ToIdentityResult(); + } + + public override async Task ConfirmEmailAsync(User user, string token) + { + var result = await _platformSecurityApi.ConfirmEmailAsync(user.Id, new ConfirmEmailRequest() { Token = token }); + + return result.ToIdentityResult(); + } + + public override async Task GenerateChangeEmailTokenAsync(User user, string newEmail) + { + return await _platformSecurityApi.GenerateChangeEmailTokenAsync(user.Id, newEmail); + } + + public override async Task GenerateEmailConfirmationTokenAsync(User user) + { + return await _platformSecurityApi.GenerateEmailConfirmationTokenAsync(user.Id); + } + + public override async Task GeneratePasswordResetTokenAsync(User user) + { + return await _platformSecurityApi.GeneratePasswordResetTokenAsync(user.Id); + } + + public override async Task GenerateUserTokenAsync(User user, string tokenProvider, string purpose) + { + return await _platformSecurityApi.GenerateUserTokenAsync(user.Id, tokenProvider, purpose); + } + + public override async Task VerifyUserTokenAsync(User user, string tokenProvider, string purpose, string token) + { + return await _platformSecurityApi.VerifyUserTokenAsync(user.Id, + new VerifyTokenRequest() { TokenProvider = tokenProvider, Purpose = purpose, Token = tokenProvider }) ?? false; + } } }