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:
commit
caacb339dd
550 changed files with 127217 additions and 0 deletions
467
generated/async/docs/CustomerApi.md
Normal file
467
generated/async/docs/CustomerApi.md
Normal file
|
|
@ -0,0 +1,467 @@
|
|||
# easybill_generated_async.CustomerApi
|
||||
|
||||
All URIs are relative to *https://api.easybill.de/rest/v1*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**customers_get**](CustomerApi.md#customers_get) | **GET** /customers | Fetch customers list
|
||||
[**customers_id_delete**](CustomerApi.md#customers_id_delete) | **DELETE** /customers/{id} | Delete customer
|
||||
[**customers_id_get**](CustomerApi.md#customers_id_get) | **GET** /customers/{id} | Fetch customer
|
||||
[**customers_id_put**](CustomerApi.md#customers_id_put) | **PUT** /customers/{id} | Update Customer
|
||||
[**customers_post**](CustomerApi.md#customers_post) | **POST** /customers | Create customer
|
||||
|
||||
|
||||
# **customers_get**
|
||||
> Customers customers_get(limit=limit, page=page, group_id=group_id, additional_group_id=additional_group_id, number=number, country=country, zip_code=zip_code, emails=emails, first_name=first_name, last_name=last_name, company_name=company_name, created_at=created_at)
|
||||
|
||||
Fetch customers list
|
||||
|
||||
### Example
|
||||
|
||||
* Basic Authentication (basicAuth):
|
||||
* Api Key Authentication (Bearer):
|
||||
|
||||
```python
|
||||
import easybill_generated_async
|
||||
from easybill_generated_async.models.customers import Customers
|
||||
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.CustomerApi(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)
|
||||
group_id = 'group_id_example' # str | Filter customers by group_id. You can add multiple group ids separate by comma like id,id,id. (optional)
|
||||
additional_group_id = 'additional_group_id_example' # str | Filter customers by additional_group_id. You can add multiple group ids separate by comma like id,id,id. (optional)
|
||||
number = 'number_example' # str | Filter customers by number. You can add multiple numbers separate by comma like no,no,no. (optional)
|
||||
country = 'country_example' # str | Filter customers by country. You can add multiple countries separate by comma like DE,PL,FR. (optional)
|
||||
zip_code = 'zip_code_example' # str | Filter customers by zip_code. You can add multiple zip codes separate by comma like zip,zip,zip. (optional)
|
||||
emails = 'emails_example' # str | Filter customers by emails. You can add multiple emails separate by comma like mail,mail,mail. (optional)
|
||||
first_name = 'first_name_example' # str | Filter customers by first_name. You can add multiple names separate by comma like name,name,name. (optional)
|
||||
last_name = 'last_name_example' # str | Filter customers by first_name. You can add multiple names separate by comma like name,name,name. (optional)
|
||||
company_name = 'company_name_example' # str | Filter customers by first_name. You can add multiple names separate by comma like name,name,name. (optional)
|
||||
created_at = 'created_at_example' # str | Filter customers by created_at. You can filter one date with created_at=2014-12-10 or between like 2015-01-01,2015-12-31. (optional)
|
||||
|
||||
try:
|
||||
# Fetch customers list
|
||||
api_response = await api_instance.customers_get(limit=limit, page=page, group_id=group_id, additional_group_id=additional_group_id, number=number, country=country, zip_code=zip_code, emails=emails, first_name=first_name, last_name=last_name, company_name=company_name, created_at=created_at)
|
||||
print("The response of CustomerApi->customers_get:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling CustomerApi->customers_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]
|
||||
**group_id** | **str**| Filter customers by group_id. You can add multiple group ids separate by comma like id,id,id. | [optional]
|
||||
**additional_group_id** | **str**| Filter customers by additional_group_id. You can add multiple group ids separate by comma like id,id,id. | [optional]
|
||||
**number** | **str**| Filter customers by number. You can add multiple numbers separate by comma like no,no,no. | [optional]
|
||||
**country** | **str**| Filter customers by country. You can add multiple countries separate by comma like DE,PL,FR. | [optional]
|
||||
**zip_code** | **str**| Filter customers by zip_code. You can add multiple zip codes separate by comma like zip,zip,zip. | [optional]
|
||||
**emails** | **str**| Filter customers by emails. You can add multiple emails separate by comma like mail,mail,mail. | [optional]
|
||||
**first_name** | **str**| Filter customers by first_name. You can add multiple names separate by comma like name,name,name. | [optional]
|
||||
**last_name** | **str**| Filter customers by first_name. You can add multiple names separate by comma like name,name,name. | [optional]
|
||||
**company_name** | **str**| Filter customers by first_name. You can add multiple names separate by comma like name,name,name. | [optional]
|
||||
**created_at** | **str**| Filter customers by created_at. You can filter one date with created_at=2014-12-10 or between like 2015-01-01,2015-12-31. | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**Customers**](Customers.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)
|
||||
|
||||
# **customers_id_delete**
|
||||
> customers_id_delete(id)
|
||||
|
||||
Delete customer
|
||||
|
||||
### 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.CustomerApi(api_client)
|
||||
id = 56 # int | ID of customer that needs to be deleted
|
||||
|
||||
try:
|
||||
# Delete customer
|
||||
await api_instance.customers_id_delete(id)
|
||||
except Exception as e:
|
||||
print("Exception when calling CustomerApi->customers_id_delete: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**id** | **int**| ID of customer that needs to be deleted |
|
||||
|
||||
### 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)
|
||||
|
||||
# **customers_id_get**
|
||||
> Customer customers_id_get(id)
|
||||
|
||||
Fetch customer
|
||||
|
||||
### Example
|
||||
|
||||
* Basic Authentication (basicAuth):
|
||||
* Api Key Authentication (Bearer):
|
||||
|
||||
```python
|
||||
import easybill_generated_async
|
||||
from easybill_generated_async.models.customer import Customer
|
||||
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.CustomerApi(api_client)
|
||||
id = 56 # int | ID of customer that needs to be fetched
|
||||
|
||||
try:
|
||||
# Fetch customer
|
||||
api_response = await api_instance.customers_id_get(id)
|
||||
print("The response of CustomerApi->customers_id_get:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling CustomerApi->customers_id_get: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**id** | **int**| ID of customer that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Customer**](Customer.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)
|
||||
|
||||
# **customers_id_put**
|
||||
> Customer customers_id_put(id, body, type=type)
|
||||
|
||||
Update Customer
|
||||
|
||||
### Example
|
||||
|
||||
* Basic Authentication (basicAuth):
|
||||
* Api Key Authentication (Bearer):
|
||||
|
||||
```python
|
||||
import easybill_generated_async
|
||||
from easybill_generated_async.models.customer import Customer
|
||||
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.CustomerApi(api_client)
|
||||
id = 56 # int | ID of customer that needs to be updated
|
||||
body = easybill_generated_async.Customer() # Customer |
|
||||
type = CUSTOMER # str | Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\". (optional) (default to CUSTOMER)
|
||||
|
||||
try:
|
||||
# Update Customer
|
||||
api_response = await api_instance.customers_id_put(id, body, type=type)
|
||||
print("The response of CustomerApi->customers_id_put:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling CustomerApi->customers_id_put: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**id** | **int**| ID of customer that needs to be updated |
|
||||
**body** | [**Customer**](Customer.md)| |
|
||||
**type** | **str**| Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\". | [optional] [default to CUSTOMER]
|
||||
|
||||
### Return type
|
||||
|
||||
[**Customer**](Customer.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 | - |
|
||||
**400** | Invalid Customer | - |
|
||||
**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)
|
||||
|
||||
# **customers_post**
|
||||
> Customer customers_post(body, type=type)
|
||||
|
||||
Create customer
|
||||
|
||||
### Example
|
||||
|
||||
* Basic Authentication (basicAuth):
|
||||
* Api Key Authentication (Bearer):
|
||||
|
||||
```python
|
||||
import easybill_generated_async
|
||||
from easybill_generated_async.models.customer import Customer
|
||||
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.CustomerApi(api_client)
|
||||
body = easybill_generated_async.Customer() # Customer |
|
||||
type = CUSTOMER # str | Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\". (optional) (default to CUSTOMER)
|
||||
|
||||
try:
|
||||
# Create customer
|
||||
api_response = await api_instance.customers_post(body, type=type)
|
||||
print("The response of CustomerApi->customers_post:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling CustomerApi->customers_post: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Customer**](Customer.md)| |
|
||||
**type** | **str**| Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\". | [optional] [default to CUSTOMER]
|
||||
|
||||
### Return type
|
||||
|
||||
[**Customer**](Customer.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 | - |
|
||||
**400** | Invalid Customer | - |
|
||||
**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)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue