public async Task <Queu> GetDefinition(CancellationToken cancellationToken = default)
 {
     using (Microsoft.Rest.HttpOperationResponse <object> response = await this.passiveMqApi.GetQueuByNameWithHttpMessagesAsync(this.queuName, null, cancellationToken).ConfigureAwait(false))
     {
         Models.QueuDto dto = response.AsResult <Models.QueuDto>();
         return(Queu.FromDto(dto));
     }
 }
        public async Task DeleteMessage(Guid messageId, CancellationToken cancellationToken = default)
        {
            Guid id = await this.EndshureQueuId(cancellationToken).ConfigureAwait(false);

            using (Microsoft.Rest.HttpOperationResponse <Models.ErrorResponseDto> response = await this.passiveMqApi.DeleteMessageWithHttpMessagesAsync(id, messageId, null, cancellationToken).ConfigureAwait(false))
            {
                response.AsResult();
            }
        }
        public async Task <MqMessage> PeekMessage(CancellationToken cancellationToken = default)
        {
            Guid id = await this.EndshureQueuId(cancellationToken).ConfigureAwait(false);

            using (Microsoft.Rest.HttpOperationResponse <object> response = await this.passiveMqApi.PeekMessageWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false))
            {
                Models.MessageDto dto = response.AsResult <Models.MessageDto>();
                return(MqMessage.FromDto(dto));
            }
        }
        public async Task <int> GetCount(CancellationToken cancellationToken = default)
        {
            Guid id = await this.EndshureQueuId(cancellationToken).ConfigureAwait(false);

            using (Microsoft.Rest.HttpOperationResponse <object> response = await this.passiveMqApi.GetCountWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false))
            {
                Models.CountMessageDto dto = response.AsResult <Models.CountMessageDto>();
                return(dto.Count.Value);
            }
        }
Exemplo n.º 5
0
        /// <param name='operations'>
        /// Reference to the BillingWebJob.IUserBilling.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <IList <UsageInfoModel> > GetCurrentMonthDataAsync(this IUserBilling operations,
                                                                                    CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <System.Collections.Generic.IList <BillingWebJob.Models.UsageInfoModel> >
            result =
                await
                operations.GetCurrentMonthDataWithOperationResponseAsync(cancellationToken)
                .ConfigureAwait(false);

            return(result.Body);
        }
Exemplo n.º 6
0
        /// <param name='operations'>
        /// Reference to the BillingWebJob.IUserBilling.
        /// </param>
        /// <param name='startDateValue'>
        /// Required.
        /// </param>
        /// <param name='endDateValue'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <IList <UsageInfoModel> > GetDataForMonthRangeAsync(this IUserBilling operations,
                                                                                     string startDateValue, string endDateValue,
                                                                                     CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <System.Collections.Generic.IList <BillingWebJob.Models.UsageInfoModel> >
            result =
                await
                operations.GetDataForMonthRangeWithOperationResponseAsync(startDateValue, endDateValue,
                                                                          cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
        private async Task <Guid> EndshureQueuId(CancellationToken cancellationToken = default)
        {
            if (!this.queuId.HasValue)
            {
                using (Microsoft.Rest.HttpOperationResponse <object> response = await this.passiveMqApi.GetQueuByNameWithHttpMessagesAsync(this.queuName, null, cancellationToken).ConfigureAwait(false))
                {
                    Models.QueuDto dto = response.AsResult <Models.QueuDto>();
                    this.queuId = dto.Id;
                }
            }

            return(this.queuId.Value);
        }
        private async Task <Guid?> GetQueuId(CancellationToken cancellationToken = default)
        {
            using (Microsoft.Rest.HttpOperationResponse <object> response = await this.passiveMqApi.GetQueuByNameWithHttpMessagesAsync(this.queuName, null, cancellationToken).ConfigureAwait(false))
            {
                if (response.Response.StatusCode == System.Net.HttpStatusCode.NotFound)
                {
                    return(null);
                }

                Models.QueuDto dto = response.AsResult <Models.QueuDto>();
                return(dto.Id);
            }
        }
        public async Task CrateIfNotExists(string topicPattern = null, string notificationAdress = null, CancellationToken cancellationToken = default)
        {
            Models.QueuCreateReqDto dto = new Models.QueuCreateReqDto()
            {
                Name               = this.queuName,
                TopicPattern       = topicPattern,
                NotificationAdress = notificationAdress
            };

            using (Microsoft.Rest.HttpOperationResponse <object> response = await this.passiveMqApi.CreateQueuWithHttpMessagesAsync(false, dto, null, cancellationToken).ConfigureAwait(false))
            {
                response.AsResult();
            }
        }
Exemplo n.º 10
0
        public async Task DeleteMessage(MqMessage message, CancellationToken cancellationToken = default)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            Guid id = await this.EndshureQueuId(cancellationToken).ConfigureAwait(false);

            using (Microsoft.Rest.HttpOperationResponse <Models.ErrorResponseDto> response = await this.passiveMqApi.DeleteMessageWithHttpMessagesAsync(id, message.Id, null, cancellationToken).ConfigureAwait(false))
            {
                response.AsResult();
            }
        }
Exemplo n.º 11
0
        public async Task <MqMessage> GetMessage(System.TimeSpan?nextVisibilityTimeSpan = null, CancellationToken cancellationToken = default)
        {
            Guid id = await this.EndshureQueuId(cancellationToken).ConfigureAwait(false);

            Models.ExchangeModel model = new Models.ExchangeModel()
            {
                NextVisibleInMs = nextVisibilityTimeSpan.HasValue ? (int?)(nextVisibilityTimeSpan.Value.TotalMilliseconds) : null
            };

            using (Microsoft.Rest.HttpOperationResponse <object> response = await this.passiveMqApi.ExchangeWithHttpMessagesAsync(id, model, null, cancellationToken).ConfigureAwait(false))
            {
                Models.MessageDto dto = response.AsResult <Models.MessageDto>();
                return(MqMessage.FromDto(dto));
            }
        }
Exemplo n.º 12
0
        public async Task <MqMessage> AddMessage(MqCreateMessage message, CancellationToken cancellationToken = default)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            Guid id = await this.EndshureQueuId(cancellationToken).ConfigureAwait(false);

            using (Microsoft.Rest.HttpOperationResponse <object> response = await this.passiveMqApi.CreateMessageWithHttpMessagesAsync(id, message.ToDto(), null, cancellationToken).ConfigureAwait(false))
            {
                Models.MessageDto dto = response.AsResult <Models.MessageDto>();
                return(MqMessage.FromDto(dto));
            }
        }
Exemplo n.º 13
0
        public async Task Publish(string topic, MqCreateMessage message, CancellationToken cancellationToken = default)
        {
            if (topic == null) throw new ArgumentNullException(nameof(topic));
            if (message == null) throw new ArgumentNullException(nameof(message));

            Models.MessagePublishDto dto = new Models.MessagePublishDto()
            {
                Message = message.ToDto(),
                Topic = topic.Trim()
            };

            using (Microsoft.Rest.HttpOperationResponse<object> respone = await this.passiveMqApi.PublishWithHttpMessagesAsync(dto, null, cancellationToken).ConfigureAwait(false))
            {
                respone.AsResult();
            }
        }
Exemplo n.º 14
0
        public async Task SetNotificationAdress(string notificationAdress, CancellationToken cancellationToken = default)
        {
            Guid?id = await this.GetQueuId().ConfigureAwait(false);

            if (id.HasValue)
            {
                Models.NotificationAdressUpdateDto notificationAdressUpdateDto = new Models.NotificationAdressUpdateDto()
                {
                    NotificationAdress = notificationAdress,
                    QueuId             = id.Value
                };
                using (Microsoft.Rest.HttpOperationResponse <object> response = await this.passiveMqApi.PutNotificationAdressWithHttpMessagesAsync(id.Value, notificationAdressUpdateDto, null, cancellationToken).ConfigureAwait(false))
                {
                    response.AsResult();
                }
            }
            else
            {
                throw new PassiveMqException($"Queu with name {this.queuName} not found.");
            }
        }
        /// <param name='operations'>
        /// Reference to the ProductServiceClient.IProductOperations.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <IList <Product> > GetAsync(this IProductOperations operations, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <System.Collections.Generic.IList <global::ProductServiceClient.Models.Product> > result = await operations.GetWithOperationResponseAsync(cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Exemplo n.º 16
0
        /// <param name='operations'>
        /// Reference to the MyDashDataAPI.ITodoList.
        /// </param>
        /// <param name='owner'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <IList <Todo> > GetAsync(this ITodoList operations, string owner, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <System.Collections.Generic.IList <MyDashDataAPI.Models.Todo> > result = await operations.GetWithOperationResponseAsync(owner, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Exemplo n.º 17
0
        /// <param name='operations'>
        /// Reference to the ZtherApiIntegration.API.IColors.
        /// </param>
        /// <param name='type'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <ColorList> GetAllByGroupTypeAsyncAsync(this IColors operations, string type, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ZtherApiIntegration.API.Models.ColorList> result = await operations.GetAllByGroupTypeAsyncWithOperationResponseAsync(type, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
        /// <param name='operations'>
        /// Reference to the ZtherApiIntegration.API.ISeoOperations.
        /// </param>
        /// <param name='brand'>
        /// Required.
        /// </param>
        /// <param name='pagename'>
        /// Required.
        /// </param>
        /// <param name='productCode'>
        /// Optional.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <Seo> GetByBrandAndPageNameAsync(this ISeoOperations operations, string brand, string pagename, string productCode = null, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ZtherApiIntegration.API.Models.Seo> result = await operations.GetByBrandAndPageNameWithOperationResponseAsync(brand, pagename, productCode, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
        /// <param name='operations'>
        /// Reference to the ZtherApiIntegration.API.ISwatches.
        /// </param>
        /// <param name='brand'>
        /// Required.
        /// </param>
        /// <param name='sortby'>
        /// Optional.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <SwatchList> GetAllSolidByBrandAsync(this ISwatches operations, string brand, string sortby = null, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ZtherApiIntegration.API.Models.SwatchList> result = await operations.GetAllSolidByBrandWithOperationResponseAsync(brand, sortby, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
        /// <param name='operations'>
        /// Reference to the ZtherApiIntegration.API.ISwatches.
        /// </param>
        /// <param name='brand'>
        /// Required.
        /// </param>
        /// <param name='color'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <ProductLineArtList> GetSolidsByBrandAndColorAsync(this ISwatches operations, string brand, string color, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ZtherApiIntegration.API.Models.ProductLineArtList> result = await operations.GetSolidsByBrandAndColorWithOperationResponseAsync(brand, color, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Exemplo n.º 21
0
        /// <param name='operations'>
        /// Reference to the XamMvvmAndWebServices.ICustomers.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <IList <Customer> > GetCustomersAsync(this ICustomers operations, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <System.Collections.Generic.IList <XamMvvmAndWebServices.Models.Customer> > result = await operations.GetCustomersWithOperationResponseAsync(cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
        /// <param name='operations'>
        /// Reference to the ZtherApiIntegration.API.IProducts.
        /// </param>
        /// <param name='brand'>
        /// Optional.
        /// </param>
        /// <param name='page'>
        /// Optional.
        /// </param>
        /// <param name='pagesize'>
        /// Optional.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <ProductList> GetAllAsync(this IProducts operations, string brand = null, int?page = null, int?pagesize = null, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ZtherApiIntegration.API.Models.ProductList> result = await operations.GetAllWithOperationResponseAsync(brand, page, pagesize, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
        /// <param name='operations'>
        /// Reference to the ZtherApiIntegration.API.IProducts.
        /// </param>
        /// <param name='code'>
        /// Required.
        /// </param>
        /// <param name='color'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <SizeList> GetAllSizeByProductAndColorAsync(this IProducts operations, string code, string color, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ZtherApiIntegration.API.Models.SizeList> result = await operations.GetAllSizeByProductAndColorWithOperationResponseAsync(code, color, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Exemplo n.º 24
0
        /// <param name='operations'>
        /// Reference to the ZtherApiIntegration.API.ISignUps.
        /// </param>
        /// <param name='brand'>
        /// Required.
        /// </param>
        /// <param name='id'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <SignUp> GetSignUpsByIdAsync(this ISignUps operations, string brand, int id, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ZtherApiIntegration.API.Models.SignUp> result = await operations.GetSignUpsByIdWithOperationResponseAsync(brand, id, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Exemplo n.º 25
0
        /// <param name='operations'>
        /// Reference to the ContactsConsoleApplication.IValues.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <IList <string> > GetAsync(this IValues operations, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <System.Collections.Generic.IList <string> > result = await operations.GetWithOperationResponseAsync(cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Exemplo n.º 26
0
        /// <param name='operations'>
        /// Reference to the ZtherApiIntegration.API.IStates.
        /// </param>
        /// <param name='code'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <State> GetByStateAbrrevAsync(this IStates operations, string code, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ZtherApiIntegration.API.Models.State> result = await operations.GetByStateAbrrevWithOperationResponseAsync(code, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
        /// <param name='operations'>
        /// Reference to the ZtherApiIntegration.API.IProducts.
        /// </param>
        /// <param name='code'>
        /// Required.
        /// </param>
        /// <param name='model'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <CoordinateList> UpdateAsync(this IProducts operations, string code, ProductUpdate model, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ZtherApiIntegration.API.Models.CoordinateList> result = await operations.UpdateWithOperationResponseAsync(code, model, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Exemplo n.º 28
0
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.HttpOperationException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async System.Threading.Tasks.Task <Microsoft.Rest.HttpOperationResponse <System.Collections.Generic.IList <ValueViewModel> > > ApiValuesGetWithHttpMessagesAsync(System.Collections.Generic.Dictionary <string, System.Collections.Generic.List <string> > customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            // Tracing
            bool   _shouldTrace  = Microsoft.Rest.ServiceClientTracing.IsEnabled;
            string _invocationId = null;

            if (_shouldTrace)
            {
                _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
                System.Collections.Generic.Dictionary <string, object> tracingParameters = new System.Collections.Generic.Dictionary <string, object>();
                tracingParameters.Add("cancellationToken", cancellationToken);
                Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ApiValuesGet", tracingParameters);
            }
            // Construct URL
            var _baseUrl = this.BaseUri.AbsoluteUri;
            var _url     = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/Values").ToString();

            // Create HTTP transport objects
            System.Net.Http.HttpRequestMessage  _httpRequest  = new System.Net.Http.HttpRequestMessage();
            System.Net.Http.HttpResponseMessage _httpResponse = null;
            _httpRequest.Method     = new System.Net.Http.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;

            // Send Request
            if (_shouldTrace)
            {
                Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
            }
            cancellationToken.ThrowIfCancellationRequested();
            _httpResponse = await this.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);

            if (_shouldTrace)
            {
                Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
            }
            System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
            cancellationToken.ThrowIfCancellationRequested();
            string _responseContent = null;

            if ((int)_statusCode != 200)
            {
                var ex = new Microsoft.Rest.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 Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_shouldTrace)
                {
                    Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new Microsoft.Rest.HttpOperationResponse <System.Collections.Generic.IList <ValueViewModel> >();

            _result.Request  = _httpRequest;
            _result.Response = _httpResponse;
            // Deserialize Response
            if ((int)_statusCode == 200)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

                try
                {
                    _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject <System.Collections.Generic.IList <ValueViewModel> >(_responseContent, this.DeserializationSettings);
                }
                catch (Newtonsoft.Json.JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
            }
            return(_result);
        }
        /// <param name='operations'>
        /// Reference to the ZtherApiIntegration.API.IProducts.
        /// </param>
        /// <param name='code'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <BaseModelProduct> GetAllByProductCodesAsync(this IProducts operations, IList <string> code, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ZtherApiIntegration.API.Models.BaseModelProduct> result = await operations.GetAllByProductCodesWithOperationResponseAsync(code, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Exemplo n.º 30
0
        /// <param name='operations'>
        /// Reference to the XamMvvmAndWebServices.ICustomers.
        /// </param>
        /// <param name='id'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <Customer> DeleteCustomerAsync(this ICustomers operations, int id, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <XamMvvmAndWebServices.Models.Customer> result = await operations.DeleteCustomerWithOperationResponseAsync(id, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }