//
// MiscellaneousAPI.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//

import Alamofire



public class MiscellaneousAPI: APIBase {
    /**
     Get statistics on the sales of Minecraft.
     
     - parameter orderStatisticsRequest: (body) 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/ 
     - parameter completion: completion handler to receive the data and the error objects
     */
    public class func getOrdersStatistics(orderStatisticsRequest orderStatisticsRequest: OrderStatisticsRequest, completion: ((data: OrderStatisticsResponse?, error: ErrorType?) -> Void)) {
        getOrdersStatisticsWithRequestBuilder(orderStatisticsRequest: orderStatisticsRequest).execute { (response, error) -> Void in
            completion(data: response?.body, error: error);
        }
    }


    /**
     Get statistics on the sales of Minecraft.
     - POST /orders/statistics     - BASIC:
       - type: http
       - name: MojangStatisticsToken
     - examples: [{contentType=application/json, example={
  "last24h" : 6,
  "total" : 0,
  "saleVelocityPerSeconds" : 1.46581298050294517310021547018550336360931396484375
}, statusCode=200}]
     - parameter orderStatisticsRequest: (body) 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/ 

     - returns: RequestBuilder<OrderStatisticsResponse> 
     */
    public class func getOrdersStatisticsWithRequestBuilder(orderStatisticsRequest orderStatisticsRequest: OrderStatisticsRequest) -> RequestBuilder<OrderStatisticsResponse> {
        let path = "/orders/statistics"
        let URLString = OpenAPIClientAPI.basePath + path
        let parameters = orderStatisticsRequest.encodeToJSON() as? [String:AnyObject]
 
        let convertedParameters = APIHelper.convertBoolToString(parameters)
 
        let requestBuilder: RequestBuilder<OrderStatisticsResponse>.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "POST", URLString: URLString, parameters: convertedParameters, isBody: true)
    }

}
