# eis_discount
The EMIL DiscountService API description

This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 1.0
- Package version: 1.5.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
For more information, please visit [https://www.emil.de](https://www.emil.de)

## Requirements.

Python >=3.6

## Installation & Usage
### pip install

If the python package is hosted on a repository, you can install directly using:

```sh
pip install eis.discount
```
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)

Then import the package:
```python
import eis.discount
```

### Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)

Then import the package:
```python
import eis.discount
```

## Getting Started

The environment variables must be set in order to properly use this SDK.

```shell 
export EMIL_USERNAME=XXXXXXX
export EMIL_PASSWORD=XXXXXXX
```

Please follow the [installation procedure](#installation--usage) and then run the following:

```python
import time
import eis.discount
from pprint import pprint
from eis.discount.api import campaigns_api
from eis.discount.model.create_campaign_request_dto import CreateCampaignRequestDto
from eis.discount.model.create_campaign_response_class import CreateCampaignResponseClass
from eis.discount.model.create_eligible_account_request_dto import CreateEligibleAccountRequestDto
from eis.discount.model.create_eligible_account_response_class import CreateEligibleAccountResponseClass
from eis.discount.model.get_campaign_response_class import GetCampaignResponseClass
from eis.discount.model.list_campaigns_response_class import ListCampaignsResponseClass
from eis.discount.model.list_eligible_accounts_response_class import ListEligibleAccountsResponseClass
from eis.discount.model.update_campaign_request_dto import UpdateCampaignRequestDto
from eis.discount.model.update_campaign_response_class import UpdateCampaignResponseClass
from eis.discount.model.update_campaign_status_request_dto import UpdateCampaignStatusRequestDto
# Defining the host is optional and defaults to https://apiv2.emil.de
# See configuration.py for a list of all supported configuration parameters.
configuration = eis.discount.Configuration(
    host = "https://apiv2.emil.de"
)

# 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.

# Bearer is automatically handled with exported environment variables. However, you
# can manuallay configure Bearer authorization (JWT): bearer
configuration = eis.discount.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)

# After manual token becomes invalid, the SDK will default to re-login automatically
# with environment variable credentials.


# Enter a context with an instance of the API client
with eis.discount.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = campaigns_api.CampaignsApi(api_client)
    create_campaign_request_dto = CreateCampaignRequestDto(
        name="Summer Sale 2024",
        slug="summer-sale-2024",
        start_date=dateutil_parser('1970-01-01T00:00:00.00Z'),
        end_date=dateutil_parser('1970-01-01T00:00:00.00Z'),
    ) # CreateCampaignRequestDto | 
    authorization = "Authorization_example" # str | Bearer Token: provided by the login endpoint under the name accessToken. (optional)

    try:
        # Create the Campaign
        api_response = api_instance.create_campaign(create_campaign_request_dto, authorization=authorization)
        pprint(api_response)
    except eis.discount.ApiException as e:
        print("Exception when calling CampaignsApi->create_campaign: %s\n" % e)
```

## Documentation for API Endpoints

All URIs are relative to *https://apiv2.emil.de*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*CampaignsApi* | [**create_campaign**](docs/CampaignsApi.md#create_campaign) | **POST** /discountservice/v1/campaigns | Create the Campaign
*CampaignsApi* | [**create_eligible_account**](docs/CampaignsApi.md#create_eligible_account) | **POST** /discountservice/v1/campaigns/{code}/eligible-accounts | Create the Eligible Account
*CampaignsApi* | [**delete_campaign**](docs/CampaignsApi.md#delete_campaign) | **DELETE** /discountservice/v1/campaigns/{code} | Delete the Campaign
*CampaignsApi* | [**delete_eligible_account**](docs/CampaignsApi.md#delete_eligible_account) | **DELETE** /discountservice/v1/campaigns/{code}/eligible-accounts/{accountCode} | Delete the Eligible Account
*CampaignsApi* | [**delete_eligible_accounts**](docs/CampaignsApi.md#delete_eligible_accounts) | **DELETE** /discountservice/v1/campaigns/{code}/eligible-accounts | Delete the Eligible Accounts
*CampaignsApi* | [**get_campaign**](docs/CampaignsApi.md#get_campaign) | **GET** /discountservice/v1/campaigns/{code} | Retrieve the Campaign
*CampaignsApi* | [**list_campaigns**](docs/CampaignsApi.md#list_campaigns) | **GET** /discountservice/v1/campaigns | List Campaigns
*CampaignsApi* | [**list_eligible_accounts**](docs/CampaignsApi.md#list_eligible_accounts) | **GET** /discountservice/v1/campaigns/eligible-accounts | List Eligible Accounts
*CampaignsApi* | [**update_campaign**](docs/CampaignsApi.md#update_campaign) | **PUT** /discountservice/v1/campaigns/{code} | Update the Campaign
*CampaignsApi* | [**update_campaign_status**](docs/CampaignsApi.md#update_campaign_status) | **PATCH** /discountservice/v1/campaigns/{code}/status | Updates the status of a campaign.
*CampaignsApi* | [**upload_eligible_accounts**](docs/CampaignsApi.md#upload_eligible_accounts) | **POST** /discountservice/v1/campaigns/{code}/eligible-accounts/batch | Uploads the eligible accounts.
*PolicyVouchersApi* | [**charge_policy_voucher**](docs/PolicyVouchersApi.md#charge_policy_voucher) | **POST** /discountservice/v1/policy-vouchers/charge | Charges the policy voucher.
*PolicyVouchersApi* | [**check_account_eligibility**](docs/PolicyVouchersApi.md#check_account_eligibility) | **POST** /discountservice/v1/policy-vouchers/eligibility | Checks the account eligibility.
*PolicyVouchersApi* | [**create_policy_voucher**](docs/PolicyVouchersApi.md#create_policy_voucher) | **POST** /discountservice/v1/policy-vouchers | Create the policy voucher
*PolicyVouchersApi* | [**delete_policy_voucher**](docs/PolicyVouchersApi.md#delete_policy_voucher) | **DELETE** /discountservice/v1/policy-vouchers/{code} | Delete the policy voucher
*PolicyVouchersApi* | [**get_policy_voucher**](docs/PolicyVouchersApi.md#get_policy_voucher) | **GET** /discountservice/v1/policy-vouchers/{code} | Retrieve the policy voucher
*PolicyVouchersApi* | [**list_policy_vouchers**](docs/PolicyVouchersApi.md#list_policy_vouchers) | **GET** /discountservice/v1/policy-vouchers | List policy vouchers
*PolicyVouchersApi* | [**redeem_policy_voucher**](docs/PolicyVouchersApi.md#redeem_policy_voucher) | **POST** /discountservice/v1/policy-vouchers/redeem | Redeems the policy voucher.
*PolicyVouchersApi* | [**withdraw_policy_voucher**](docs/PolicyVouchersApi.md#withdraw_policy_voucher) | **POST** /discountservice/v1/policy-vouchers/withdraw | Withdraws the policy voucher.
*VouchersApi* | [**create_voucher**](docs/VouchersApi.md#create_voucher) | **POST** /discountservice/v1/vouchers | Create the Voucher
*VouchersApi* | [**delete_voucher**](docs/VouchersApi.md#delete_voucher) | **DELETE** /discountservice/v1/vouchers/{code} | Delete the Voucher
*VouchersApi* | [**get_voucher**](docs/VouchersApi.md#get_voucher) | **GET** /discountservice/v1/vouchers/{code} | Retrieve the Voucher
*VouchersApi* | [**list_vouchers**](docs/VouchersApi.md#list_vouchers) | **GET** /discountservice/v1/vouchers | List Vouchers
*VouchersApi* | [**update_voucher**](docs/VouchersApi.md#update_voucher) | **PUT** /discountservice/v1/vouchers/{code} | Update the Voucher
*DefaultApi* | [**check**](docs/DefaultApi.md#check) | **GET** /discountservice/health | Health Check


## Documentation For Models

 - [CampaignClass](docs/CampaignClass.md)
 - [ChargePolicyVoucherRequestDto](docs/ChargePolicyVoucherRequestDto.md)
 - [ChargePolicyVoucherResponseClass](docs/ChargePolicyVoucherResponseClass.md)
 - [CheckAccountEligibilityRequestDto](docs/CheckAccountEligibilityRequestDto.md)
 - [CheckAccountEligibilityResponseClass](docs/CheckAccountEligibilityResponseClass.md)
 - [CreateCampaignRequestDto](docs/CreateCampaignRequestDto.md)
 - [CreateCampaignResponseClass](docs/CreateCampaignResponseClass.md)
 - [CreateEligibleAccountRequestDto](docs/CreateEligibleAccountRequestDto.md)
 - [CreateEligibleAccountResponseClass](docs/CreateEligibleAccountResponseClass.md)
 - [CreatePolicyVoucherRequestDto](docs/CreatePolicyVoucherRequestDto.md)
 - [CreatePolicyVoucherResponseClass](docs/CreatePolicyVoucherResponseClass.md)
 - [CreateProductDiscountDto](docs/CreateProductDiscountDto.md)
 - [CreateVoucherRequestDto](docs/CreateVoucherRequestDto.md)
 - [CreateVoucherResponseClass](docs/CreateVoucherResponseClass.md)
 - [EligibleAccountClass](docs/EligibleAccountClass.md)
 - [GetCampaignResponseClass](docs/GetCampaignResponseClass.md)
 - [GetPolicyVoucherResponseClass](docs/GetPolicyVoucherResponseClass.md)
 - [GetVoucherResponseClass](docs/GetVoucherResponseClass.md)
 - [InlineResponse200](docs/InlineResponse200.md)
 - [InlineResponse503](docs/InlineResponse503.md)
 - [ListCampaignsResponseClass](docs/ListCampaignsResponseClass.md)
 - [ListEligibleAccountsResponseClass](docs/ListEligibleAccountsResponseClass.md)
 - [ListPolicyVouchersResponseClass](docs/ListPolicyVouchersResponseClass.md)
 - [ListVouchersResponseClass](docs/ListVouchersResponseClass.md)
 - [PolicyVoucherClass](docs/PolicyVoucherClass.md)
 - [PolicyVoucherTransactionClass](docs/PolicyVoucherTransactionClass.md)
 - [ProductDiscountClass](docs/ProductDiscountClass.md)
 - [RedeemPolicyVoucherRequestDto](docs/RedeemPolicyVoucherRequestDto.md)
 - [RedeemPolicyVoucherResponseClass](docs/RedeemPolicyVoucherResponseClass.md)
 - [UpdateCampaignRequestDto](docs/UpdateCampaignRequestDto.md)
 - [UpdateCampaignResponseClass](docs/UpdateCampaignResponseClass.md)
 - [UpdateCampaignStatusRequestDto](docs/UpdateCampaignStatusRequestDto.md)
 - [UpdateVoucherRequestDto](docs/UpdateVoucherRequestDto.md)
 - [UpdateVoucherResponseClass](docs/UpdateVoucherResponseClass.md)
 - [VoucherClass](docs/VoucherClass.md)
 - [WithdrawPolicyVoucherRequestDto](docs/WithdrawPolicyVoucherRequestDto.md)
 - [WithdrawPolicyVoucherResponseClass](docs/WithdrawPolicyVoucherResponseClass.md)


## Documentation For Authorization


## bearer

- **Type**: Bearer authentication (JWT)


## Author

kontakt@emil.de


## Notes for Large OpenAPI documents
If the OpenAPI document is large, imports in eis.discount.apis and eis.discount.models may fail with a
RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1:
Use specific imports for apis and models like:
- `from eis.discount.api.default_api import DefaultApi`
- `from eis.discount.model.pet import Pet`

Solution 2:
Before importing the package, adjust the maximum recursion limit as shown below:
```
import sys
sys.setrecursionlimit(1500)
import eis.discount
from eis.discount.apis import *
from eis.discount.models import *
```

