# NodeSwaggerApi.PromotionApi

All URIs are relative to *https://api.supremepay.lk:3011/api/admin*

Method | HTTP request | Description
------------- | ------------- | -------------
[**createPromotion**](PromotionApi.md#createPromotion) | **POST** /promotion/create | 
[**createPromotionImage**](PromotionApi.md#createPromotionImage) | **PUT** /promotion/images | 
[**deletePromotion**](PromotionApi.md#deletePromotion) | **DELETE** /promotion/{promo_code} | 
[**deletePromotionImage**](PromotionApi.md#deletePromotionImage) | **POST** /promotion/images/remove | 
[**getPromotionByPromoCode**](PromotionApi.md#getPromotionByPromoCode) | **GET** /promotion/bypromocode/{promo_code} | 
[**getPromotions**](PromotionApi.md#getPromotions) | **GET** /promotion/allpromotion | 
[**updatePromotion**](PromotionApi.md#updatePromotion) | **PUT** /promotion | 


<a name="createPromotion"></a>
# **createPromotion**
> Promotion createPromotion(promotionDetails)



Create Promotion

### Example
```javascript
var NodeSwaggerApi = require('node_swagger_api');
var defaultClient = NodeSwaggerApi.ApiClient.instance;

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

var apiInstance = new NodeSwaggerApi.PromotionApi();

var promotionDetails = new NodeSwaggerApi.Promotion(); // Promotion | promotion details


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.createPromotion(promotionDetails, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **promotionDetails** | [**Promotion**](Promotion.md)| promotion details | 

### Return type

[**Promotion**](Promotion.md)

### Authorization

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

### HTTP request headers

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

<a name="createPromotionImage"></a>
# **createPromotionImage**
> AvatarSuccess createPromotionImage(image, id)



promotion image upload

### Example
```javascript
var NodeSwaggerApi = require('node_swagger_api');
var defaultClient = NodeSwaggerApi.ApiClient.instance;

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

var apiInstance = new NodeSwaggerApi.PromotionApi();

var image = "/path/to/file.txt"; // File | upload image

var id = "/path/to/file.txt"; // File | promotion _id


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.createPromotionImage(image, id, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **image** | **File**| upload image | 
 **id** | **File**| promotion _id | 

### Return type

[**AvatarSuccess**](AvatarSuccess.md)

### Authorization

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

### HTTP request headers

 - **Content-Type**: multipart/form-data
 - **Accept**: application/json, application/xml

<a name="deletePromotion"></a>
# **deletePromotion**
> CommonSuccess deletePromotion(promoCode)



Delete promotion by promo code

### Example
```javascript
var NodeSwaggerApi = require('node_swagger_api');
var defaultClient = NodeSwaggerApi.ApiClient.instance;

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

var apiInstance = new NodeSwaggerApi.PromotionApi();

var promoCode = "promoCode_example"; // String | promotion code


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.deletePromotion(promoCode, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **promoCode** | **String**| promotion code | 

### Return type

[**CommonSuccess**](CommonSuccess.md)

### Authorization

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

### HTTP request headers

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

<a name="deletePromotionImage"></a>
# **deletePromotionImage**
> CommonSuccess deletePromotionImage(details)



delete Promotion image

### Example
```javascript
var NodeSwaggerApi = require('node_swagger_api');
var defaultClient = NodeSwaggerApi.ApiClient.instance;

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

var apiInstance = new NodeSwaggerApi.PromotionApi();

var details = new NodeSwaggerApi.PromoImageDelete(); // PromoImageDelete | promotion remove image details details


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.deletePromotionImage(details, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **details** | [**PromoImageDelete**](PromoImageDelete.md)| promotion remove image details details | 

### Return type

[**CommonSuccess**](CommonSuccess.md)

### Authorization

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

### HTTP request headers

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

<a name="getPromotionByPromoCode"></a>
# **getPromotionByPromoCode**
> Promotion getPromotionByPromoCode(promoCode)



Get promotion by promo code

### Example
```javascript
var NodeSwaggerApi = require('node_swagger_api');
var defaultClient = NodeSwaggerApi.ApiClient.instance;

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

var apiInstance = new NodeSwaggerApi.PromotionApi();

var promoCode = "promoCode_example"; // String | if you want specific promotion you want to give promo code


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getPromotionByPromoCode(promoCode, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **promoCode** | **String**| if you want specific promotion you want to give promo code | 

### Return type

[**Promotion**](Promotion.md)

### Authorization

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

### HTTP request headers

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

<a name="getPromotions"></a>
# **getPromotions**
> [Promotion] getPromotions()



Get all promotion details

### Example
```javascript
var NodeSwaggerApi = require('node_swagger_api');
var defaultClient = NodeSwaggerApi.ApiClient.instance;

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

var apiInstance = new NodeSwaggerApi.PromotionApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getPromotions(callback);
```

### Parameters
This endpoint does not need any parameter.

### Return type

[**[Promotion]**](Promotion.md)

### Authorization

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

### HTTP request headers

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

<a name="updatePromotion"></a>
# **updatePromotion**
> Promotion updatePromotion(details)



update promotion

### Example
```javascript
var NodeSwaggerApi = require('node_swagger_api');
var defaultClient = NodeSwaggerApi.ApiClient.instance;

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

var apiInstance = new NodeSwaggerApi.PromotionApi();

var details = new NodeSwaggerApi.Promotion(); // Promotion | update promotion data


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.updatePromotion(details, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **details** | [**Promotion**](Promotion.md)| update promotion data | 

### Return type

[**Promotion**](Promotion.md)

### Authorization

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

### HTTP request headers

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

