# NomadEnvoyCli.OrderApi

All URIs are relative to *https://nomad.samarkand-global.cn/envoy*

Method | HTTP request | Description
------------- | ------------- | -------------
[**addOrder**](OrderApi.md#addOrder) | **POST** /order/{store} | addOrder
[**cancelOrder**](OrderApi.md#cancelOrder) | **DELETE** /order/{store} | cancelOrder
[**getOrderByField**](OrderApi.md#getOrderByField) | **GET** /order/{store} | getOrderByField
[**updateOrder**](OrderApi.md#updateOrder) | **PUT** /order/{store} | updateOrder



## addOrder

> OrderApiResponse addOrder(store, order)

addOrder

Creates a new order for products for this store.

### Example

```javascript
var NomadEnvoyCli = require('nomad_envoy_cli');
var defaultClient = NomadEnvoyCli.ApiClient.instance;
// Configure API key authorization: ca_key
var ca_key = defaultClient.authentications['ca_key'];
ca_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ca_key.apiKeyPrefix = 'Token';
// Configure API key authorization: ca_stage
var ca_stage = defaultClient.authentications['ca_stage'];
ca_stage.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ca_stage.apiKeyPrefix = 'Token';

var apiInstance = new NomadEnvoyCli.OrderApi();
var store = "store_example"; // String | ID of the store.
var order = new NomadEnvoyCli.Order(); // Order | Order details
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.addOrder(store, order, callback);
```

### Parameters



Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **store** | **String**| ID of the store. | 
 **order** | [**Order**](Order.md)| Order details | 

### Return type

[**OrderApiResponse**](OrderApiResponse.md)

### Authorization

[ca_key](../README.md#ca_key), [ca_stage](../README.md#ca_stage)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json


## cancelOrder

> OrderApiResponse cancelOrder(store, orderId)

cancelOrder

Attempts to cancel a created order, success will depend on platform support.

### Example

```javascript
var NomadEnvoyCli = require('nomad_envoy_cli');
var defaultClient = NomadEnvoyCli.ApiClient.instance;
// Configure API key authorization: ca_key
var ca_key = defaultClient.authentications['ca_key'];
ca_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ca_key.apiKeyPrefix = 'Token';
// Configure API key authorization: ca_stage
var ca_stage = defaultClient.authentications['ca_stage'];
ca_stage.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ca_stage.apiKeyPrefix = 'Token';

var apiInstance = new NomadEnvoyCli.OrderApi();
var store = "store_example"; // String | ID of the store.
var orderId = 56; // Number | ID of order to cancel.
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.cancelOrder(store, orderId, callback);
```

### Parameters



Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **store** | **String**| ID of the store. | 
 **orderId** | **Number**| ID of order to cancel. | 

### Return type

[**OrderApiResponse**](OrderApiResponse.md)

### Authorization

[ca_key](../README.md#ca_key), [ca_stage](../README.md#ca_stage)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json


## getOrderByField

> OrderApiResponse getOrderByField(store, opts)

getOrderByField

Requests a list of orders based on the supplied parameters.

### Example

```javascript
var NomadEnvoyCli = require('nomad_envoy_cli');
var defaultClient = NomadEnvoyCli.ApiClient.instance;
// Configure API key authorization: ca_key
var ca_key = defaultClient.authentications['ca_key'];
ca_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ca_key.apiKeyPrefix = 'Token';
// Configure API key authorization: ca_stage
var ca_stage = defaultClient.authentications['ca_stage'];
ca_stage.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ca_stage.apiKeyPrefix = 'Token';

var apiInstance = new NomadEnvoyCli.OrderApi();
var store = samarkand.youzan.test; // String | ID of the store.
var opts = {
  'orderId': SO428899, // String | Order ref of ERP system.
  'clientOrderRef': E20220915080033003100025, // String | Client order ref of E-commerce platform.
  'status': WAIT_BUYER_PAY, // String | Order status, available options are: WAIT_BUYER_PAY, WAIT_SELLER_SEND_GOODS, WAIT_BUYER_CONFIRM_GOODS, TRADE_SUCCESS, TRADE_CLOSED, TRADE_REFUND, TRADE_PARTIAL_REFUND, TRADE_FAILED.
  'type': NORMAL, // String | Order type, 2 available options: NORMAL, DISTRIBUTION
  'createdRange': 2022-07-19T05:10:23Z/2022-07-19T07:10:23Z, // String | The time range of order creation, use ISO_8601 format here.
  'updatedRange': 2022-07-19T05:10:23Z/2022-07-19T07:10:23Z, // String | The time range of order update, use ISO_8601 format here.
  'pageNo': 1, // Number | Page number, between 1 and 1000.
  'pageSize': 10 // Number | Page size, options: 1, 10, 50, 100.
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getOrderByField(store, opts, callback);
```

### Parameters



Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **store** | **String**| ID of the store. | 
 **orderId** | **String**| Order ref of ERP system. | [optional] 
 **clientOrderRef** | **String**| Client order ref of E-commerce platform. | [optional] 
 **status** | **String**| Order status, available options are: WAIT_BUYER_PAY, WAIT_SELLER_SEND_GOODS, WAIT_BUYER_CONFIRM_GOODS, TRADE_SUCCESS, TRADE_CLOSED, TRADE_REFUND, TRADE_PARTIAL_REFUND, TRADE_FAILED. | [optional] 
 **type** | **String**| Order type, 2 available options: NORMAL, DISTRIBUTION | [optional] 
 **createdRange** | **String**| The time range of order creation, use ISO_8601 format here. | [optional] 
 **updatedRange** | **String**| The time range of order update, use ISO_8601 format here. | [optional] 
 **pageNo** | **Number**| Page number, between 1 and 1000. | [optional] 
 **pageSize** | **Number**| Page size, options: 1, 10, 50, 100. | [optional] 

### Return type

[**OrderApiResponse**](OrderApiResponse.md)

### Authorization

[ca_key](../README.md#ca_key), [ca_stage](../README.md#ca_stage)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json


## updateOrder

> OrderApiResponse updateOrder(store, order)

updateOrder

Update the shipping status of an order for this store.

### Example

```javascript
var NomadEnvoyCli = require('nomad_envoy_cli');
var defaultClient = NomadEnvoyCli.ApiClient.instance;
// Configure API key authorization: ca_key
var ca_key = defaultClient.authentications['ca_key'];
ca_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ca_key.apiKeyPrefix = 'Token';
// Configure API key authorization: ca_stage
var ca_stage = defaultClient.authentications['ca_stage'];
ca_stage.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ca_stage.apiKeyPrefix = 'Token';

var apiInstance = new NomadEnvoyCli.OrderApi();
var store = "store_example"; // String | ID of the store.
var order = new NomadEnvoyCli.Order(); // Order | Order details
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.updateOrder(store, order, callback);
```

### Parameters



Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **store** | **String**| ID of the store. | 
 **order** | [**Order**](Order.md)| Order details | 

### Return type

[**OrderApiResponse**](OrderApiResponse.md)

### Authorization

[ca_key](../README.md#ca_key), [ca_stage](../README.md#ca_stage)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

