# KykyapiClient.PurchaseOrderApi

All URIs are relative to *https://localhost/v1*

Method | HTTP request | Description
------------- | ------------- | -------------
[**createPurchaseOrder**](PurchaseOrderApi.md#createPurchaseOrder) | **POST** /purchaseOrders | Create purchase order
[**deletePurchaseOrder**](PurchaseOrderApi.md#deletePurchaseOrder) | **DELETE** /purchaseOrders/{purchaseOrderId} | Delete purchase order
[**findPurchaseOrder**](PurchaseOrderApi.md#findPurchaseOrder) | **GET** /purchaseOrders/{purchaseOrderId} | Find purchase order
[**getPurchaseOrderPdf**](PurchaseOrderApi.md#getPurchaseOrderPdf) | **GET** /purchaseOrders/{purchaseOrderId}/pdf | Get purchase order PDF
[**listPurchaseOrders**](PurchaseOrderApi.md#listPurchaseOrders) | **GET** /purchaseOrders | List purchase orders
[**updatePurchaseOrder**](PurchaseOrderApi.md#updatePurchaseOrder) | **PUT** /purchaseOrders/{purchaseOrderId} | Update purchase order


<a name="createPurchaseOrder"></a>
# **createPurchaseOrder**
> PurchaseOrder createPurchaseOrder(body)

Create purchase order

Create purchase order

### Example
```javascript
var KykyapiClient = require('kykyapi-client');
var defaultClient = KykyapiClient.ApiClient.instance;

// Configure API key authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.apiKeyPrefix = 'Token';

var apiInstance = new KykyapiClient.PurchaseOrderApi();

var body = new KykyapiClient.PurchaseOrder(); // PurchaseOrder | Payload

apiInstance.createPurchaseOrder(body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **body** | [**PurchaseOrder**](PurchaseOrder.md)| Payload | 

### Return type

[**PurchaseOrder**](PurchaseOrder.md)

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

 - **Content-Type**: application/json;charset=utf-8
 - **Accept**: application/json;charset=utf-8

<a name="deletePurchaseOrder"></a>
# **deletePurchaseOrder**
> deletePurchaseOrder(purchaseOrderId)

Delete purchase order

Deletes single purchase order

### Example
```javascript
var KykyapiClient = require('kykyapi-client');
var defaultClient = KykyapiClient.ApiClient.instance;

// Configure API key authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.apiKeyPrefix = 'Token';

var apiInstance = new KykyapiClient.PurchaseOrderApi();

var purchaseOrderId = 789; // Number | sale order id

apiInstance.deletePurchaseOrder(purchaseOrderId).then(function() {
  console.log('API called successfully.');
}, function(error) {
  console.error(error);
});

```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **purchaseOrderId** | **Number**| sale order id | 

### Return type

null (empty response body)

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

 - **Content-Type**: application/json;charset=utf-8
 - **Accept**: application/json;charset=utf-8

<a name="findPurchaseOrder"></a>
# **findPurchaseOrder**
> PurchaseOrder findPurchaseOrder(purchaseOrderId)

Find purchase order

Returns single purchase order

### Example
```javascript
var KykyapiClient = require('kykyapi-client');
var defaultClient = KykyapiClient.ApiClient.instance;

// Configure API key authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.apiKeyPrefix = 'Token';

var apiInstance = new KykyapiClient.PurchaseOrderApi();

var purchaseOrderId = 789; // Number | sale order id

apiInstance.findPurchaseOrder(purchaseOrderId).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **purchaseOrderId** | **Number**| sale order id | 

### Return type

[**PurchaseOrder**](PurchaseOrder.md)

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

 - **Content-Type**: application/json;charset=utf-8
 - **Accept**: application/json;charset=utf-8

<a name="getPurchaseOrderPdf"></a>
# **getPurchaseOrderPdf**
> &#39;Blob&#39; getPurchaseOrderPdf(purchaseOrderId, type)

Get purchase order PDF

Returns purchase order PDF

### Example
```javascript
var KykyapiClient = require('kykyapi-client');
var defaultClient = KykyapiClient.ApiClient.instance;

// Configure API key authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.apiKeyPrefix = 'Token';

var apiInstance = new KykyapiClient.PurchaseOrderApi();

var purchaseOrderId = 789; // Number | purchase order id

var type = "type_example"; // String | Specifies returned PDF type. One of PURCHASE_ORDER

apiInstance.getPurchaseOrderPdf(purchaseOrderId, type).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **purchaseOrderId** | **Number**| purchase order id | 
 **type** | **String**| Specifies returned PDF type. One of PURCHASE_ORDER | 

### Return type

**&#39;Blob&#39;**

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

 - **Content-Type**: application/json;charset=utf-8
 - **Accept**: application/json;charset=utf-8

<a name="listPurchaseOrders"></a>
# **listPurchaseOrders**
> [PurchaseOrder] listPurchaseOrders(opts)

List purchase orders

List purchase orders

### Example
```javascript
var KykyapiClient = require('kykyapi-client');
var defaultClient = KykyapiClient.ApiClient.instance;

// Configure API key authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.apiKeyPrefix = 'Token';

var apiInstance = new KykyapiClient.PurchaseOrderApi();

var opts = { 
  'saleId': 789, // Number | filter by sale id
  'estimatedArrivalTimeBefore': "estimatedArrivalTimeBefore_example", // String | return only purchase orders that have estimated arrival time after the date
  'estimatedArrivalTimeAfter': "estimatedArrivalTimeAfter_example", // String | return only purchase orders that have estimated arrival time after the date
  'state': "state_example" // String | return only purchase orders that have specified state
};
apiInstance.listPurchaseOrders(opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **saleId** | **Number**| filter by sale id | [optional] 
 **estimatedArrivalTimeBefore** | **String**| return only purchase orders that have estimated arrival time after the date | [optional] 
 **estimatedArrivalTimeAfter** | **String**| return only purchase orders that have estimated arrival time after the date | [optional] 
 **state** | **String**| return only purchase orders that have specified state | [optional] 

### Return type

[**[PurchaseOrder]**](PurchaseOrder.md)

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

 - **Content-Type**: application/json;charset=utf-8
 - **Accept**: application/json;charset=utf-8

<a name="updatePurchaseOrder"></a>
# **updatePurchaseOrder**
> PurchaseOrder updatePurchaseOrder(purchaseOrderId, body)

Update purchase order

Updates a purchase order

### Example
```javascript
var KykyapiClient = require('kykyapi-client');
var defaultClient = KykyapiClient.ApiClient.instance;

// Configure API key authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.apiKeyPrefix = 'Token';

var apiInstance = new KykyapiClient.PurchaseOrderApi();

var purchaseOrderId = 789; // Number | sale order id

var body = new KykyapiClient.PurchaseOrder(); // PurchaseOrder | Payload

apiInstance.updatePurchaseOrder(purchaseOrderId, body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **purchaseOrderId** | **Number**| sale order id | 
 **body** | [**PurchaseOrder**](PurchaseOrder.md)| Payload | 

### Return type

[**PurchaseOrder**](PurchaseOrder.md)

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

 - **Content-Type**: application/json;charset=utf-8
 - **Accept**: application/json;charset=utf-8

