import { ApiResponse , RequestOptions } from '../core' ; import { BatchRetrieveOrdersRequest , batchRetrieveOrdersRequestSchema , } from '../models/batchRetrieveOrdersRequest' ; import { BatchRetrieveOrdersResponse , batchRetrieveOrdersResponseSchema , } from '../models/batchRetrieveOrdersResponse' ; import { CalculateOrderRequest , calculateOrderRequestSchema , } from '../models/calculateOrderRequest' ; import { CalculateOrderResponse , calculateOrderResponseSchema , } from '../models/calculateOrderResponse' ; import { CloneOrderRequest , cloneOrderRequestSchema , } from '../models/cloneOrderRequest' ; import { CloneOrderResponse , cloneOrderResponseSchema , } from '../models/cloneOrderResponse' ; import { CreateOrderRequest , createOrderRequestSchema , } from '../models/createOrderRequest' ; import { CreateOrderResponse , createOrderResponseSchema , } from '../models/createOrderResponse' ; import { PayOrderRequest , payOrderRequestSchema , } from '../models/payOrderRequest' ; import { PayOrderResponse , payOrderResponseSchema , } from '../models/payOrderResponse' ; import { RetrieveOrderResponse , retrieveOrderResponseSchema , } from '../models/retrieveOrderResponse' ; import { SearchOrdersRequest , searchOrdersRequestSchema , } from '../models/searchOrdersRequest' ; import { SearchOrdersResponse , searchOrdersResponseSchema , } from '../models/searchOrdersResponse' ; import { UpdateOrderRequest , updateOrderRequestSchema , } from '../models/updateOrderRequest' ; import { UpdateOrderResponse , updateOrderResponseSchema , } from '../models/updateOrderResponse' ; import { string } from '../schema' ; import { BaseApi } from './baseApi' ; export class OrdersApi extends BaseApi { param body return async createOrder ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/orders' ) ; const mapped = req . prepareArgs ( { body : [ body , createOrderRequestSchema ] } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( createOrderResponseSchema , requestOptions ) ; } param body return async batchRetrieveOrders ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/orders/batch-retrieve' ) ; const mapped = req . prepareArgs ( { body : [ body , batchRetrieveOrdersRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( batchRetrieveOrdersResponseSchema , requestOptions ) ; } param body return async calculateOrder ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/orders/calculate' ) ; const mapped = req . prepareArgs ( { body : [ body , calculateOrderRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( calculateOrderResponseSchema , requestOptions ) ; } param body return async cloneOrder ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/orders/clone' ) ; const mapped = req . prepareArgs ( { body : [ body , cloneOrderRequestSchema ] } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( cloneOrderResponseSchema , requestOptions ) ; } param body return async searchOrders ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/orders/search' ) ; const mapped = req . prepareArgs ( { body : [ body , searchOrdersRequestSchema ] } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( searchOrdersResponseSchema , requestOptions ) ; } param orderId return async retrieveOrder ( orderId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { orderId : [ orderId , string ( ) ] } ) ; req . appendTemplatePath `/v2/orders/${ mapped . orderId }` ; return req . callAsJson ( retrieveOrderResponseSchema , requestOptions ) ; } param orderId param body return async updateOrder ( orderId , body , requestOptions ? ) { const req = this . createRequest ( 'PUT' ) ; const mapped = req . prepareArgs ( { orderId : [ orderId , string ( ) ] , body : [ body , updateOrderRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; req . appendTemplatePath `/v2/orders/${ mapped . orderId }` ; return req . callAsJson ( updateOrderResponseSchema , requestOptions ) ; } param orderId param body return async payOrder ( orderId , body , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { orderId : [ orderId , string ( ) ] , body : [ body , payOrderRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; req . appendTemplatePath `/v2/orders/${ mapped . orderId }/pay` ; return req . callAsJson ( payOrderResponseSchema , requestOptions ) ; } }