Add unit tests for authentication and webhook parsing

- Implement tests for basic and bearer authentication headers in `test_auth.py`.
- Create tests for the `EasybillWebhookParser` in `test_webhooks.py`, covering JSON and form-encoded payloads, as well as a generic parse and acknowledgement method.
This commit is contained in:
claudi 2026-04-17 10:20:12 +02:00
commit caacb339dd
550 changed files with 127217 additions and 0 deletions

View file

@ -0,0 +1,888 @@
# easybill_generated_async.DiscountApi
All URIs are relative to *https://api.easybill.de/rest/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**discounts_position_get**](DiscountApi.md#discounts_position_get) | **GET** /discounts/position | Fetch list of position discounts
[**discounts_position_group_get**](DiscountApi.md#discounts_position_group_get) | **GET** /discounts/position-group | Fetch list of position-group discounts
[**discounts_position_group_id_delete**](DiscountApi.md#discounts_position_group_id_delete) | **DELETE** /discounts/position-group/{id} | Delete the specified position-group discount
[**discounts_position_group_id_get**](DiscountApi.md#discounts_position_group_id_get) | **GET** /discounts/position-group/{id} | Fetch specified position-group discount by id
[**discounts_position_group_id_put**](DiscountApi.md#discounts_position_group_id_put) | **PUT** /discounts/position-group/{id} | Update a position-group discount
[**discounts_position_group_post**](DiscountApi.md#discounts_position_group_post) | **POST** /discounts/position-group | Create a new position-group discount
[**discounts_position_id_delete**](DiscountApi.md#discounts_position_id_delete) | **DELETE** /discounts/position/{id} | Delete the specified position discount
[**discounts_position_id_get**](DiscountApi.md#discounts_position_id_get) | **GET** /discounts/position/{id} | Fetch specified position discount by id
[**discounts_position_id_put**](DiscountApi.md#discounts_position_id_put) | **PUT** /discounts/position/{id} | Update a position discount
[**discounts_position_post**](DiscountApi.md#discounts_position_post) | **POST** /discounts/position | Create a new position discount
# **discounts_position_get**
> DiscountPositions discounts_position_get(limit=limit, page=page, customer_id=customer_id)
Fetch list of position discounts
### Example
* Basic Authentication (basicAuth):
* Api Key Authentication (Bearer):
```python
import easybill_generated_async
from easybill_generated_async.models.discount_positions import DiscountPositions
from easybill_generated_async.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.easybill.de/rest/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = easybill_generated_async.Configuration(
host = "https://api.easybill.de/rest/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: basicAuth
configuration = easybill_generated_async.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Configure API key authorization: Bearer
configuration.api_key['Bearer'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer'] = 'Bearer'
# Enter a context with an instance of the API client
async with easybill_generated_async.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = easybill_generated_async.DiscountApi(api_client)
limit = 56 # int | Limited the result. Default is 100. Maximum can be 1000. (optional)
page = 56 # int | Set current Page. Default is 1. (optional)
customer_id = 'customer_id_example' # str | Filter discounts by customer_id. You can add multiple customer_ids separate by comma like id,id,id. (optional)
try:
# Fetch list of position discounts
api_response = await api_instance.discounts_position_get(limit=limit, page=page, customer_id=customer_id)
print("The response of DiscountApi->discounts_position_get:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DiscountApi->discounts_position_get: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**limit** | **int**| Limited the result. Default is 100. Maximum can be 1000. | [optional]
**page** | **int**| Set current Page. Default is 1. | [optional]
**customer_id** | **str**| Filter discounts by customer_id. You can add multiple customer_ids separate by comma like id,id,id. | [optional]
### Return type
[**DiscountPositions**](DiscountPositions.md)
### Authorization
[basicAuth](../README.md#basicAuth), [Bearer](../README.md#Bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
**429** | Too Many Requests | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **discounts_position_group_get**
> DiscountPositionGroups discounts_position_group_get(limit=limit, page=page, customer_id=customer_id)
Fetch list of position-group discounts
### Example
* Basic Authentication (basicAuth):
* Api Key Authentication (Bearer):
```python
import easybill_generated_async
from easybill_generated_async.models.discount_position_groups import DiscountPositionGroups
from easybill_generated_async.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.easybill.de/rest/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = easybill_generated_async.Configuration(
host = "https://api.easybill.de/rest/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: basicAuth
configuration = easybill_generated_async.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Configure API key authorization: Bearer
configuration.api_key['Bearer'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer'] = 'Bearer'
# Enter a context with an instance of the API client
async with easybill_generated_async.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = easybill_generated_async.DiscountApi(api_client)
limit = 56 # int | Limited the result. Default is 100. Maximum can be 1000. (optional)
page = 56 # int | Set current Page. Default is 1. (optional)
customer_id = 'customer_id_example' # str | Filter discounts by customer_id. You can add multiple customer_ids separate by comma like id,id,id. (optional)
try:
# Fetch list of position-group discounts
api_response = await api_instance.discounts_position_group_get(limit=limit, page=page, customer_id=customer_id)
print("The response of DiscountApi->discounts_position_group_get:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DiscountApi->discounts_position_group_get: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**limit** | **int**| Limited the result. Default is 100. Maximum can be 1000. | [optional]
**page** | **int**| Set current Page. Default is 1. | [optional]
**customer_id** | **str**| Filter discounts by customer_id. You can add multiple customer_ids separate by comma like id,id,id. | [optional]
### Return type
[**DiscountPositionGroups**](DiscountPositionGroups.md)
### Authorization
[basicAuth](../README.md#basicAuth), [Bearer](../README.md#Bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
**429** | Too Many Requests | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **discounts_position_group_id_delete**
> discounts_position_group_id_delete(id)
Delete the specified position-group discount
### Example
* Basic Authentication (basicAuth):
* Api Key Authentication (Bearer):
```python
import easybill_generated_async
from easybill_generated_async.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.easybill.de/rest/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = easybill_generated_async.Configuration(
host = "https://api.easybill.de/rest/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: basicAuth
configuration = easybill_generated_async.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Configure API key authorization: Bearer
configuration.api_key['Bearer'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer'] = 'Bearer'
# Enter a context with an instance of the API client
async with easybill_generated_async.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = easybill_generated_async.DiscountApi(api_client)
id = 56 # int | ID of the to be soon deleted discount
try:
# Delete the specified position-group discount
await api_instance.discounts_position_group_id_delete(id)
except Exception as e:
print("Exception when calling DiscountApi->discounts_position_group_id_delete: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **int**| ID of the to be soon deleted discount |
### Return type
void (empty response body)
### Authorization
[basicAuth](../README.md#basicAuth), [Bearer](../README.md#Bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**204** | Successful operation | - |
**404** | Not found | - |
**429** | Too Many Requests | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **discounts_position_group_id_get**
> DiscountPositionGroup discounts_position_group_id_get(id, limit=limit, page=page)
Fetch specified position-group discount by id
### Example
* Basic Authentication (basicAuth):
* Api Key Authentication (Bearer):
```python
import easybill_generated_async
from easybill_generated_async.models.discount_position_group import DiscountPositionGroup
from easybill_generated_async.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.easybill.de/rest/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = easybill_generated_async.Configuration(
host = "https://api.easybill.de/rest/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: basicAuth
configuration = easybill_generated_async.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Configure API key authorization: Bearer
configuration.api_key['Bearer'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer'] = 'Bearer'
# Enter a context with an instance of the API client
async with easybill_generated_async.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = easybill_generated_async.DiscountApi(api_client)
id = 56 # int | ID of the discount
limit = 56 # int | Limited the result. Default is 100. Maximum can be 1000. (optional)
page = 56 # int | Set current Page. Default is 1. (optional)
try:
# Fetch specified position-group discount by id
api_response = await api_instance.discounts_position_group_id_get(id, limit=limit, page=page)
print("The response of DiscountApi->discounts_position_group_id_get:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DiscountApi->discounts_position_group_id_get: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **int**| ID of the discount |
**limit** | **int**| Limited the result. Default is 100. Maximum can be 1000. | [optional]
**page** | **int**| Set current Page. Default is 1. | [optional]
### Return type
[**DiscountPositionGroup**](DiscountPositionGroup.md)
### Authorization
[basicAuth](../README.md#basicAuth), [Bearer](../README.md#Bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
**404** | Not found | - |
**429** | Too Many Requests | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **discounts_position_group_id_put**
> DiscountPositionGroup discounts_position_group_id_put(id, body=body)
Update a position-group discount
### Example
* Basic Authentication (basicAuth):
* Api Key Authentication (Bearer):
```python
import easybill_generated_async
from easybill_generated_async.models.discount_position_group import DiscountPositionGroup
from easybill_generated_async.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.easybill.de/rest/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = easybill_generated_async.Configuration(
host = "https://api.easybill.de/rest/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: basicAuth
configuration = easybill_generated_async.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Configure API key authorization: Bearer
configuration.api_key['Bearer'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer'] = 'Bearer'
# Enter a context with an instance of the API client
async with easybill_generated_async.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = easybill_generated_async.DiscountApi(api_client)
id = 56 # int | ID of the to be soon updated discount
body = easybill_generated_async.DiscountPositionGroup() # DiscountPositionGroup | (optional)
try:
# Update a position-group discount
api_response = await api_instance.discounts_position_group_id_put(id, body=body)
print("The response of DiscountApi->discounts_position_group_id_put:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DiscountApi->discounts_position_group_id_put: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **int**| ID of the to be soon updated discount |
**body** | [**DiscountPositionGroup**](DiscountPositionGroup.md)| | [optional]
### Return type
[**DiscountPositionGroup**](DiscountPositionGroup.md)
### Authorization
[basicAuth](../README.md#basicAuth), [Bearer](../README.md#Bearer)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
**404** | Not found | - |
**429** | Too Many Requests | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **discounts_position_group_post**
> DiscountPositionGroup discounts_position_group_post(body)
Create a new position-group discount
### Example
* Basic Authentication (basicAuth):
* Api Key Authentication (Bearer):
```python
import easybill_generated_async
from easybill_generated_async.models.discount_position_group import DiscountPositionGroup
from easybill_generated_async.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.easybill.de/rest/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = easybill_generated_async.Configuration(
host = "https://api.easybill.de/rest/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: basicAuth
configuration = easybill_generated_async.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Configure API key authorization: Bearer
configuration.api_key['Bearer'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer'] = 'Bearer'
# Enter a context with an instance of the API client
async with easybill_generated_async.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = easybill_generated_async.DiscountApi(api_client)
body = easybill_generated_async.DiscountPositionGroup() # DiscountPositionGroup |
try:
# Create a new position-group discount
api_response = await api_instance.discounts_position_group_post(body)
print("The response of DiscountApi->discounts_position_group_post:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DiscountApi->discounts_position_group_post: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**DiscountPositionGroup**](DiscountPositionGroup.md)| |
### Return type
[**DiscountPositionGroup**](DiscountPositionGroup.md)
### Authorization
[basicAuth](../README.md#basicAuth), [Bearer](../README.md#Bearer)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**201** | Successful operation | - |
**429** | Too Many Requests | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **discounts_position_id_delete**
> discounts_position_id_delete(id)
Delete the specified position discount
### Example
* Basic Authentication (basicAuth):
* Api Key Authentication (Bearer):
```python
import easybill_generated_async
from easybill_generated_async.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.easybill.de/rest/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = easybill_generated_async.Configuration(
host = "https://api.easybill.de/rest/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: basicAuth
configuration = easybill_generated_async.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Configure API key authorization: Bearer
configuration.api_key['Bearer'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer'] = 'Bearer'
# Enter a context with an instance of the API client
async with easybill_generated_async.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = easybill_generated_async.DiscountApi(api_client)
id = 56 # int | ID of the to be soon deleted discount
try:
# Delete the specified position discount
await api_instance.discounts_position_id_delete(id)
except Exception as e:
print("Exception when calling DiscountApi->discounts_position_id_delete: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **int**| ID of the to be soon deleted discount |
### Return type
void (empty response body)
### Authorization
[basicAuth](../README.md#basicAuth), [Bearer](../README.md#Bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**204** | Successful operation | - |
**404** | Not found | - |
**429** | Too Many Requests | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **discounts_position_id_get**
> DiscountPosition discounts_position_id_get(id, limit=limit, page=page)
Fetch specified position discount by id
### Example
* Basic Authentication (basicAuth):
* Api Key Authentication (Bearer):
```python
import easybill_generated_async
from easybill_generated_async.models.discount_position import DiscountPosition
from easybill_generated_async.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.easybill.de/rest/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = easybill_generated_async.Configuration(
host = "https://api.easybill.de/rest/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: basicAuth
configuration = easybill_generated_async.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Configure API key authorization: Bearer
configuration.api_key['Bearer'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer'] = 'Bearer'
# Enter a context with an instance of the API client
async with easybill_generated_async.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = easybill_generated_async.DiscountApi(api_client)
id = 56 # int | ID of the discount
limit = 56 # int | Limited the result. Default is 100. Maximum can be 1000. (optional)
page = 56 # int | Set current Page. Default is 1. (optional)
try:
# Fetch specified position discount by id
api_response = await api_instance.discounts_position_id_get(id, limit=limit, page=page)
print("The response of DiscountApi->discounts_position_id_get:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DiscountApi->discounts_position_id_get: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **int**| ID of the discount |
**limit** | **int**| Limited the result. Default is 100. Maximum can be 1000. | [optional]
**page** | **int**| Set current Page. Default is 1. | [optional]
### Return type
[**DiscountPosition**](DiscountPosition.md)
### Authorization
[basicAuth](../README.md#basicAuth), [Bearer](../README.md#Bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
**404** | Not found | - |
**429** | Too Many Requests | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **discounts_position_id_put**
> DiscountPosition discounts_position_id_put(id, body=body)
Update a position discount
### Example
* Basic Authentication (basicAuth):
* Api Key Authentication (Bearer):
```python
import easybill_generated_async
from easybill_generated_async.models.discount_position import DiscountPosition
from easybill_generated_async.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.easybill.de/rest/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = easybill_generated_async.Configuration(
host = "https://api.easybill.de/rest/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: basicAuth
configuration = easybill_generated_async.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Configure API key authorization: Bearer
configuration.api_key['Bearer'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer'] = 'Bearer'
# Enter a context with an instance of the API client
async with easybill_generated_async.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = easybill_generated_async.DiscountApi(api_client)
id = 56 # int | ID of the to be soon updated discount
body = easybill_generated_async.DiscountPosition() # DiscountPosition | (optional)
try:
# Update a position discount
api_response = await api_instance.discounts_position_id_put(id, body=body)
print("The response of DiscountApi->discounts_position_id_put:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DiscountApi->discounts_position_id_put: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **int**| ID of the to be soon updated discount |
**body** | [**DiscountPosition**](DiscountPosition.md)| | [optional]
### Return type
[**DiscountPosition**](DiscountPosition.md)
### Authorization
[basicAuth](../README.md#basicAuth), [Bearer](../README.md#Bearer)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
**404** | Not found | - |
**429** | Too Many Requests | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **discounts_position_post**
> DiscountPosition discounts_position_post(body)
Create a new position discount
### Example
* Basic Authentication (basicAuth):
* Api Key Authentication (Bearer):
```python
import easybill_generated_async
from easybill_generated_async.models.discount_position import DiscountPosition
from easybill_generated_async.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.easybill.de/rest/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = easybill_generated_async.Configuration(
host = "https://api.easybill.de/rest/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: basicAuth
configuration = easybill_generated_async.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Configure API key authorization: Bearer
configuration.api_key['Bearer'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer'] = 'Bearer'
# Enter a context with an instance of the API client
async with easybill_generated_async.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = easybill_generated_async.DiscountApi(api_client)
body = easybill_generated_async.DiscountPosition() # DiscountPosition |
try:
# Create a new position discount
api_response = await api_instance.discounts_position_post(body)
print("The response of DiscountApi->discounts_position_post:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DiscountApi->discounts_position_post: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**DiscountPosition**](DiscountPosition.md)| |
### Return type
[**DiscountPosition**](DiscountPosition.md)
### Authorization
[basicAuth](../README.md#basicAuth), [Bearer](../README.md#Bearer)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**201** | Successful operation | - |
**429** | Too Many Requests | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)