public virtual IActionResult GetOrdersStatistics([FromBody] OrderStatisticsRequest orderStatisticsRequest) { //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... // return StatusCode(200, default(OrderStatisticsResponse)); string exampleJson = null; exampleJson = "{\r\n \"last24h\" : 6,\r\n \"total\" : 0,\r\n \"saleVelocityPerSeconds\" : 1.46581298050294517310021547018550336360931396484375\r\n}"; var example = exampleJson != null ? JsonConvert.DeserializeObject <OrderStatisticsResponse>(exampleJson) : default(OrderStatisticsResponse); //TODO: Change the data returned return(new ObjectResult(example)); }
/// <summary> /// Get statistics on the sales of Minecraft. /// </summary> /// <param name="orderStatisticsRequest">The payload is a json list of options under the metricKeys key. You will receive a single object corresponding to the sum of sales of the requested type(s). You must request at least one type of sale. Below is the default list used by https://minecraft.net/en/stats/</param> /// <returns>OrderStatisticsResponse</returns> public OrderStatisticsResponse GetOrdersStatistics(OrderStatisticsRequest orderStatisticsRequest) { // verify the required parameter 'orderStatisticsRequest' is set if (orderStatisticsRequest == null) { throw new ApiException(400, "Missing required parameter 'orderStatisticsRequest' when calling GetOrdersStatistics"); } var path = "/orders/statistics"; path = path.Replace("{format}", "json"); var queryParams = new Dictionary <String, String>(); var headerParams = new Dictionary <String, String>(); var formParams = new Dictionary <String, String>(); var fileParams = new Dictionary <String, FileParameter>(); String postBody = null; postBody = ApiClient.Serialize(orderStatisticsRequest); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { "MojangStatisticsToken" }; // make the HTTP request IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); if (((int)response.StatusCode) >= 400) { throw new ApiException((int)response.StatusCode, "Error calling GetOrdersStatistics: " + response.Content, response.Content); } else if (((int)response.StatusCode) == 0) { throw new ApiException((int)response.StatusCode, "Error calling GetOrdersStatistics: " + response.ErrorMessage, response.ErrorMessage); } return((OrderStatisticsResponse)ApiClient.Deserialize(response.Content, typeof(OrderStatisticsResponse), response.Headers)); }
/// <summary> /// Get statistics on the sales of Minecraft. /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="orderStatisticsRequest">The payload is a json list of options under the metricKeys key. You will receive a single object corresponding to the sum of sales of the requested type(s). You must request at least one type of sale. Below is the default list used by https://minecraft.net/en/stats/</param> /// <returns>Task of ApiResponse (OrderStatisticsResponse)</returns> public async System.Threading.Tasks.Task <Org.OpenAPITools.Client.ApiResponse <OrderStatisticsResponse> > GetOrdersStatisticsAsyncWithHttpInfo(OrderStatisticsRequest orderStatisticsRequest) { // verify the required parameter 'orderStatisticsRequest' is set if (orderStatisticsRequest == null) { throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderStatisticsRequest' when calling MiscellaneousApi->GetOrdersStatistics"); } Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); String[] @contentTypes = new String[] { "application/json" }; // to determine the Accept header String[] @accepts = new String[] { "application/json" }; foreach (var contentType in @contentTypes) { requestOptions.HeaderParameters.Add("Content-Type", contentType); } foreach (var accept in @accepts) { requestOptions.HeaderParameters.Add("Accept", accept); } requestOptions.Data = orderStatisticsRequest; // authentication (MojangStatisticsToken) required // http basic authentication required if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password)) { requestOptions.HeaderParameters.Add("Authorization", "Basic " + Org.OpenAPITools.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); } // make the HTTP request var response = await this.AsynchronousClient.PostAsync <OrderStatisticsResponse>("/orders/statistics", requestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception exception = this.ExceptionFactory("GetOrdersStatistics", response); if (exception != null) { throw exception; } } return(response); }
/// <summary> /// Get statistics on the sales of Minecraft. /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="orderStatisticsRequest">The payload is a json list of options under the metricKeys key. You will receive a single object corresponding to the sum of sales of the requested type(s). You must request at least one type of sale. Below is the default list used by https://minecraft.net/en/stats/</param> /// <returns>Task of OrderStatisticsResponse</returns> public async System.Threading.Tasks.Task <OrderStatisticsResponse> GetOrdersStatisticsAsync(OrderStatisticsRequest orderStatisticsRequest) { Org.OpenAPITools.Client.ApiResponse <OrderStatisticsResponse> localVarResponse = await GetOrdersStatisticsAsyncWithHttpInfo(orderStatisticsRequest); return(localVarResponse.Data); }
/// <summary> /// Get statistics on the sales of Minecraft. /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="orderStatisticsRequest">The payload is a json list of options under the metricKeys key. You will receive a single object corresponding to the sum of sales of the requested type(s). You must request at least one type of sale. Below is the default list used by https://minecraft.net/en/stats/</param> /// <returns>OrderStatisticsResponse</returns> public OrderStatisticsResponse GetOrdersStatistics(OrderStatisticsRequest orderStatisticsRequest) { Org.OpenAPITools.Client.ApiResponse <OrderStatisticsResponse> localVarResponse = GetOrdersStatisticsWithHttpInfo(orderStatisticsRequest); return(localVarResponse.Data); }
/// <summary> /// Get statistics on the sales of Minecraft. /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="orderStatisticsRequest">The payload is a json list of options under the metricKeys key. You will receive a single object corresponding to the sum of sales of the requested type(s). You must request at least one type of sale. Below is the default list used by https://minecraft.net/en/stats/</param> /// <returns>Task of ApiResponse (OrderStatisticsResponse)</returns> public async System.Threading.Tasks.Task <ApiResponse <OrderStatisticsResponse> > GetOrdersStatisticsAsyncWithHttpInfo(OrderStatisticsRequest orderStatisticsRequest) { // verify the required parameter 'orderStatisticsRequest' is set if (orderStatisticsRequest == null) { throw new ApiException(400, "Missing required parameter 'orderStatisticsRequest' when calling MiscellaneousApi->GetOrdersStatistics"); } var localVarPath = "/orders/statistics"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (orderStatisticsRequest != null && orderStatisticsRequest.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(orderStatisticsRequest); // http body (model) parameter } else { localVarPostBody = orderStatisticsRequest; // byte array } // authentication (MojangStatisticsToken) required // http basic authentication required if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password)) { localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password); } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("GetOrdersStatistics", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <OrderStatisticsResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (OrderStatisticsResponse)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(OrderStatisticsResponse)))); }
/// <summary> /// Get statistics on the sales of Minecraft. /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="orderStatisticsRequest">The payload is a json list of options under the metricKeys key. You will receive a single object corresponding to the sum of sales of the requested type(s). You must request at least one type of sale. Below is the default list used by https://minecraft.net/en/stats/</param> /// <returns>OrderStatisticsResponse</returns> public OrderStatisticsResponse GetOrdersStatistics(OrderStatisticsRequest orderStatisticsRequest) { ApiResponse <OrderStatisticsResponse> localVarResponse = GetOrdersStatisticsWithHttpInfo(orderStatisticsRequest); return(localVarResponse.Data); }
protected abstract OrderStatisticsResponse GetOrdersStatistics(OrderStatisticsRequest orderStatisticsRequest);
public virtual OrderStatisticsResponse GetOrdersStatistics(NancyContext context, OrderStatisticsRequest orderStatisticsRequest) { return(GetOrdersStatistics(orderStatisticsRequest)); }