# Translator

# Introduction

**AmplifierApiClient** .NET package provides ways to authenticate and communicate with Amplifier API. This includes access to B2B WS.

[Nuget](https://www.nuget.org/packages/AmperApiClient.NET/)

You can add this package to your .NET project by using:

* **Package Manager Console in Visual Studio**

    ```Install-Package AmperApiClient.NET```

* **.NET CLI**

    ```dotnet add package AmperApiClient.NET```

* **add reference directly to your .csproj file**

  ``` xml 
      <ItemGroup>
            <PackageReference Include="AmperApiClient.NET" Version="1.x.x" />
        </ItemGroup> 
  ```

[Example project](https://bitbucket.org/amplifierspzoo/amper-translator-example)

Import
```
  using Amplifier;
```

# AmplifierJWTAuth

### Constructors

 Name | Description
 ---- | -----------
| **Constructor(username,  password, authUrl)** | Creates an **AmplifierJWTAuth** with specified credentials


### Methods

Return Type | Name | Description
----------- | ---- | -----------
| *Task\<string>* | **<a href="#gettoken">GetToken</a>** | Fetches your JSON Web Token required for communication with backend of Amplifier



### Constructor(username,  password, authUrl)

```cs 
  using Amplifier;
```

```csharp
  string AUTH_URL = "your_ws_endpoint";
  string USERNAME = "your_user_name";
  string PASSWORD = "your_password";

  AmplifierJWTAuth amplifierJWTAuth = new AmplifierJWTAuth(USERNAME, PASSWORD, AUTH_URL);
```

  > replace `"your_ws_endpoint"`, `"your_user_name"` and `"your_password"` with your credentials

Name | Type | Description |
---- | ---- | ----------- |
| **your_ws_endpoint** | *String* | Your dedicated AMPER WS endpoint |
| **username** | *String* |  |
| **password** | *String* |  |

### GetToken()

```cs 
  using Amplifier;
```

```csharp
  AmplifierJWTAuth amplifierJWTAuth = new AmplifierJWTAuth(USERNAME, PASSWORD, AUTH_URL);

  string token = await amplifierJWTAuth.getToken();
```

**Returns**

Personal JSON Web Token

# B2BWSConfig

### Properties

Name | Type | Description
---- | ---- | -----------
| **B2BWSUrl** | *string* | target AMPER Web Service URL
| **ERPConnectionString** | *string* | 
| **JWTToken** | *string* | JSON Web Token fetched by AmplifierJWTAuth

# B2BWSBackend

### Constructors

 Name | Description
 ---- | -----------
| **Constructor(b2BWSConfig)** | Creates an B2BWSBackend using config containing JWT and WS URL

### Methods

Return Type | Name | Description
----------- | ---- | -----------
| *Task\<string>* | **<a href="#changeorderstatus-status-token">ChangeOrderStatus(status,  token)</a>** | Asynchronously changes the status of an order
| *Task\<string>* | **<a href="#getlistofcomplaints">GetListOfComplaints</a>** | Asynchronously fetches the list of complaints
| *Task\<string>* | **<a href="#getlistoforders-status">GetListOfOrders(status)</a>** | Asynchronously fetches list of orders with a specified status
| *Task\<string>* | **<a href="#getorder-token">GetOrder(token)</a>** | Asynchronously fetches an order by it's token
| *Task* | **<a href="#sendaccountsasync-accounts">SendAccountsAsync(accounts)</a>** | Asynchronously sends the list of accounts
| *Task* | **<a href="#sendaddresses-addresses">SendAddresses(addresses)</a>** | Asynchronously Sends the list of addresses
| *Task* | **<a href="#sendcategorydiscountasync-category_discounts">SendCategoryDiscountAsync(category_discounts)</a>** | Asynchronously sends the list of category discounts
| *Task* | **<a href="#sendcustomerproductlogisticminimumasync-relations">SendCustomerProductLogisticMinimumAsync(relations)</a>** | Asynchronously sends the list of logistic minimums for customers and products
| *Task* | **<a href="#sendcustomerproductsrelationasyncsasync-relations">SendCustomerProductsRelationAsyncsAsync(relations)</a>** | Asynchronously sends the list of customer product relations
| Task* | **<a href="#senddocumentsasync-documents">SendDocumentsAsync(documents)</a>** | Asynchronously sends the list of documents
| *Task* | **<a href="#sendfile-path-filename-product_external_id-order">SendFile(path,  fileName,  product_external_id,  order)</a>** | Asynchronously sends a file
| *Task* | **<a href="#sendpricelevelsasync-pricelevels">SendPriceLevelsAsync(priceLevels)</a>** | Asynchronously sends the list of price levels
| *Task* | **<a href="#sendpricesasync-pricelevels">SendPricesAsync(priceLevels)</a>** | Asynchronously sends the list of prices
| *Task* | **<a href="#sendproductcategoriesasync-categories">SendProductCategoriesAsync(categories)</a>** | Asynchronously sends the list of product categories
| *Task* | **<a href="#sendproductcategoriesrelationasyncsasync-relations">SendProductCategoriesRelationAsyncsAsync(relations)</a>** | Asynchronously sends the list of product category relations
| *Task* | **<a href="#sendproductsasync-products">SendProductsAsync(products)</a>** | Asynchronously sends the list of products
| *Task* | **<a href="#sendrelatedproductsasync-related_products">SendRelatedProductsAsync(related_products)</a>** | Asynchronously sends the list of related products
| *Task* | **<a href="#sendsettlementsasync-settlements">SendSettlementsAsync(settlements)</a>** | Asynchronously sends the list of settlements
| *Task* | **<a href="#sendstocklocationsasync-stocklocations">SendStockLocationsAsync(stockLocations)</a>** | Asynchronously sends the list of location of the product stock
| *Task* | **<a href="#sendstocksasync-stocks">SendStocksAsync(stocks)</a>** | Asynchronously sends the list of product stock



### Constructor(b2BWSConfig)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **b2BWSConfig** | *<a href="#b2bwsconfig">B2BWSConfig</a>* |  |

### ChangeOrderStatus(status,  token)

Name | Type | Description |
---- | ---- | ----------- |
| **status** | *String* | New status |
| **token** | *String* | Order's token |

**Returns**

Task object containing result of the operation

### GetListOfComplaints()


**Returns**

Task object containing list of complaints in JSON format as a string

### GetListOfOrders(status)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **status** | *String* | Status of orders |

**Returns**

Task object containing list of orders in JSON format as a string

### GetOrder(token)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **token** | *String* | Order's token |

**Returns**

Task object containing order in JSON format as a string

### SendAccountsAsync(accounts)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **accounts** | *List\<<a href="#account">Account</a>>* | List of accounts |

**Returns**

Task object representing the result of the operation

### SendAddresses(addresses)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **addresses** | *List\<<a href="#address">Address</a>>* | List of addresses |

**Returns**

Task object representing the result of the operation

### SendCategoryDiscountAsync(category_discounts)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **category_discounts** | *List\<<a href="#categorydiscount">CategoryDiscount</a>>* | List of category discounts |

**Returns**

Task object representing the result of the operation

### SendCustomerProductLogisticMinimumAsync(relations)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **relations** | *List\<<a href="#customerproductlogisticminimum">CustomerProductLogisticMinimum</a>>* | List of logistic minimums for customers and products |

**Returns**

Task object representing the result of the operation

### SendCustomerProductsRelationAsyncsAsync(relations)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **relations** | *List\<<a href="#customerproductrelation">CustomerProductRelation</a>>* | List of customer product relations |

**Returns**

Task object representing the result of the operation

### SendDocumentsAsync(documents)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **documents** | *List\<<a href="#document">Document</a>>* | List of documents |

**Returns**

Task object representing the result of the operation

### SendFile(path,  fileName,  product_external_id,  order)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **path** | *String* | Path to a file |
| **fileName** | *String* | Name of a file after it's sent |
| **product_external_id** | *String* | Product's Id in client's database |
| **order** | *String* |  |

**Returns**

Task object representing the result of the operation

### SendPriceLevelsAsync(priceLevels)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **priceLevels** | *List\<<a href="#pricelevel">PriceLevel</a>>* | List of price levels |

**Returns**

Task object representing the result of the operation

### SendPricesAsync(priceLevels)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **priceLevels** | *List\<<a href="#price">Price</a>>* | List of prices |

**Returns**

Task object representing the result of the operation

### SendProductCategoriesAsync(categories)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **categories** | *List\<<a href="#productcategory">ProductCategory</a>>* | List of product categories |

**Returns**
Task object representing the result of the operation

### SendProductCategoriesRelationAsyncsAsync(relations)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **relations** | *List\<<a href="#productcategoryrelation">ProductCategoryRelation</a>>* | List of product category relations |

**Returns**

Task object representing the result of the operation

### SendProductsAsync(products)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **products** | *List\<<a href="#product">Product</a>>* | List of products |

**Returns**

Task object representing the result of asynchrous operation

### SendRelatedProductsAsync(related_products)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **related_products** | *List\<<a href="#relatedproducts">RelatedProducts</a>>* | List of related products |

**Returns**

Task object representing the result of the operation

### SendSettlementsAsync(settlements)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **settlements** | *List\<<a href="#settlement">Settlement</a>>* | List of settlements |

**Returns**

Task object representing the result of the operation

### SendStockLocationsAsync(stockLocations)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **stockLocations** | *List\<<a href="#stocklocation">StockLocation</a>>* | List of location of the product stock |

**Returns**

Task object representing the result of the operation

### SendStocksAsync(stocks)
**Parameters**

Name | Type | Description |
---- | ---- | ----------- |
| **stocks** | *List\<<a href="#stock">Stock</a>>* | List of product stock |

**Returns**

Task object representing the result of the operation

# Models

## Account

### Properties

Name | Type | Description
---- | ---- | -----------
| **customers** | *List<<a href="#customer">Customer</a>>* | 
| **external_id** | *string* | Account's Id in client's database
| **name** | *string* | 
| **short_name** | *string* | 

## Address

### Properties

Name | Type | Description
---- | ---- | -----------
| **city** | *string* | 
| **customer_external_id** | *string* | Customer's Id in client's database
| **email** | *string* | 
| **external_id** | *string* | Addres's Id in client's database
| **name** | *string* | 
| **phone** | *string* | 
| **postal_code** | *string* | 
| **street** | *string* | 
| **street_continuation** | *string* | 
| **voivodeship** | *string* | 

## CategoryDiscount

### Properties

Name | Type | Description
---- | ---- | -----------
| **category_external_id** | *string* | Category's Id in client's database
| **discount** | *decimal* | 
| **end_date** | *string* | 
| **external_id** | *string* | Category discount's Id in client's database
| **order** | *int* | 
| **price_level_external_id** | *string* | Price level's Id in client's database
| **start_date** | *string* | 




## Complaint

### Properties

Name | Type | Description
---- | ---- | -----------
| **attachments** | *List\<object>* | 
| **created_at** | *DateTime* | 
| **created_by** | *DateTime* | 
| **customer_external_id** | *string* | Customer's Id in client's database
| **id** | *int* | 
| **lines** | *List<<a href="#complaintline">ComplaintLine</a>>* | 
| **note** | *string* | 
| **notes** | *List\<object>* | 
| **nr** | *string* | 
| **status** | *string* | 
| **updated_at** | *int?* | 
| **updated_by** | *int?* | 




## ComplaintLine

### Properties

Name | Type | Description
---- | ---- | -----------
| **complaint** | *id* | 
| **description** | *string* | 
| **id** | *id* | 
| **name** | *string* | 
| **order** | *string* | 
| **product_external_id** | *string* | Product's Id in client's database
| **product_id** | *int* | 
| **purchase_date** | *string* | 




## Customer

### Properties

Name | Type | Description
---- | ---- | -----------
| **city** | *string* | 
| **comments** | *string* | 
| **discount** | *decimal* | 
| **doc_export** | *bool* | 
| **external_id** | *string* | Customer's Id in client's database
| **ftp_export** | *bool* | 
| **login** | *string* | 
| **mail_export** | *bool* | 
| **name** | *string* | 
| **offer_export** | *bool* | 
| **overdue_limit** | *decimal* | 
| **password** | *string* | 
| **phone** | *string* | 
| **postal_code** | *string* | 
| **price_level_external_id** | *string* | Price level's Id in client's database
| **primary_email** | *string* | 
| **short_name** | *string* | 
| **street** | *string* | 
| **tax_id** | *string* | 
| **template** | *string* | 
| **trade_credit_limit** | *decimal* | 




## CustomerProductLogisticMinimum

### Properties

Name | Type | Description
---- | ---- | -----------
| **customer_external_id** | *string* | Customer's Id in client's database
| **external_id** | *string* | Id of logistic minimum for customer and product in client's database
| **logistic_minimum** | *decimal* | 
| **product_external_id** | *string* | Product's Id in client's database




## CustomerProductRelation

### Properties

Name | Type | Description
---- | ---- | -----------
| **customer_external_id** | *string* | Customer's Id in client's database
| **external_id** | *string* | Customer product relation's Id in client's database
| **product_external_id** | *string* | Product's Id in client's database




## Document

### Properties

Name | Type | Description
---- | ---- | -----------
| **customer** | *string* | 
| **date** | *string* | 
| **description** | *string* | 
| **document_lines** | *List<<a href="#documentline">DocumentLine</a>>* | 
| **due_date** | *string* | 
| **external_id** | *string* | Document's Id in client's database
| **number** | *string* | 
| **value_gross** | *decimal* | 
| **value_net** | *decimal* | 




## DocumentLine

### Properties

Name | Type | Description
---- | ---- | -----------
| **document** | *string* | 
| **group** | *string* | 
| **make** | *string* | 
| **manufacturer** | *string* | 
| **price_gross** | *decimal* | 
| **price_net** | *decimal* | 
| **product** | *decimal* | 
| **product_ean** | *decimal* | 
| **product_name** | *string* | 
| **product_symbol** | *string* | 
| **quantity** | *decimal* | 
| **quantity_aggregate** | *decimal* | 
| **unit** | *string* | 
| **unit_aggregate** | *string* | 
| **value_gross** | *decimal* | 
| **value_net** | *decimal* | 
| **vat** | *int* | 




## Order

### Properties

Name | Type | Description
---- | ---- | -----------
| **billing_address** | *string* | 
| **created** | *DateTime* | 
| **customer_external_id** | *string* | Customer's Id in client's database
| **customer_note** | *string* | 
| **discount_amount** | *object* | 
| **lines** | *List<<a href="#orderline">OrderLine</a>>* | 
| **paid** | *object* | 
| **products_total_gross** | *string* | 
| **products_total_net** | *string* | 
| **shipment** | *int* | 
| **shipment_type** | *int* | 
| **shipping_address** | *int* | 
| **shipping_price_gross** | *string* | 
| **shipping_price_net** | *string* | 
| **status** | *string* | 
| **token** | *string* | 
| **total_gross** | *decimal* | 
| **total_net** | *decimal* | 
| **updated** | *DateTime* | 
| **user_email** | *string* | 




## OrderLine

### Properties

Name | Type | Description
---- | ---- | -----------
| **attributes** | *List\<object>* | 
| **id** | *int* | 
| **product** | *int* | 
| **product_external_id** | *string* | Product's Id in client's database
| **product_name** | *string* | 
| **product_sku** | *string* | 
| **quantity** | *int* | 
| **tax_rate** | *string* | 
| **unit_price_gross** | *string* | 
| **unit_price_net** | *string* | 




## Price

### Properties

Name | Type | Description
---- | ---- | -----------
| **discount** | *decimal* | 
| **end_date** | *string* | 
| **external_id** | *string* | Price's Id in client's database
| **order** | *int* | 
| **price** | *decimal* | 
| **price_level_external_id** | *string* | Price level's Id in client's database
| **product_external_id** | *string* | Product's Id in client's database
| **start_date** | *string* | 




## PriceLevel

### Properties

Name | Type | Description
---- | ---- | -----------
| **external_id** | *string* | Price level's Id in client's database
| **name** | *string* | 
| **order** | *int* | 




## Product

### Properties

Name | Type | Description
---- | ---- | -----------
| **attributes** | *List<<a href="#productattributes">ProductAttributes</a>>* | 
| **available_on** | *string* | 
| **can_be_split** | *bool* | 
| **cumulative_converter** | *decimal* | 
| **cumulative_unit_of_measure** | *string* | 
| **cumulative_unit_ratio_splitter** | *decimal* | 
| **default_price** | *decimal* | 
| **default_unit_of_measure** | *string* | 
| **description** | *string* | 
| **external_id** | *string* | Product's Id in client's database
| **friendly_name** | *string* | 
| **is_featured** | *bool* | 
| **is_published** | *bool* | 
| **name** | *string* | 
| **short_code** | *string* | 
| **short_description** | *string* | 
| **sku** | *string* | 
| **unit_roundup** | *bool* | 
| **vat** | *int* | 
| **weight** | *decimal* | 




## ProductAttributes

### Properties

Name | Type | Description
---- | ---- | -----------
| **atr_name** | *string* | 
| **atr_val** | *string* | 
| **key** | *string* | 


### Constructors

 Name | Description
 ---- | -----------
| **Constructor(String, String, String)** | 



### Constructor(String, String, String)



## ProductCategory

### Properties

Name | Type | Description
---- | ---- | -----------
| **description** | *string* | 
| **external_id** | *string* | Product category's Id in client's database
| **name** | *string* | 
| **order** | *int* | 
| **parent_external_id** | *string* | Category's parent category Id in client's database
| **seo_tags** | *string* | 




## ProductCategoryRelation

### Properties

Name | Type | Description
---- | ---- | -----------
| **category_external_id** | *string* | Category's Id in client's database
| **external_id** | *string* | Product and category relation's Id in client's database
| **product_external_id** | *string* | Product's Id in client's database




## ProductImage

Name | Type | Description
---- | ---- | -----------
| **alt** | *string* | 
| **product_id** | *int* | 
| **image** | *string* | 
| **order** | *int* | 
| **thumbnail_width** | *int* | 

## RelatedProduct

### Properties

Name | Type | Description
---- | ---- | -----------
| **external_id** | *string* | Related product's Id in client's database




## RelatedProducts

### Properties

Name | Type | Description
---- | ---- | -----------
| **external_id** | *string* | Product's Id in client's database
| **related_products** | *List<<a href="#relatedproducts">RelatedProduct</a>>* | List of related products




## Settlement

### Properties

Name | Type | Description
---- | ---- | -----------
| **customer** | *string* | 
| **date** | *string* | 
| **due_date** | *string* | 
| **external_id** | *string* | Settlement's Id in client's database
| **number** | *string* | 
| **value** | *decimal* | 
| **value_to_pay** | *decimal* | 




## Stock

### Properties

Name | Type | Description
---- | ---- | -----------
| **external_id** | *string* | 
| **product_external_id** | *string* | Product's Id in client's database
| **quantity** | *decimal* | 
| **quantity_allocated** | *decimal* | 
| **stock_level_external_id** | *string* | Stock location's Id in client's database




## StockLocation

### Properties

Name | Type | Description
---- | ---- | -----------
| **external_id** | *string* | 
| **name** | *string* |