diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml deleted file mode 100644 index dff71f3..0000000 --- a/.github/workflows/pypi.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI - -on: push - -jobs: - build: - name: Build distribution 📦 - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.x" - - name: Install pypa/build - run: >- - python3 -m - pip install - build - --user - - name: Build a binary wheel and a source tarball - run: python3 -m build - - name: Store the distribution packages - uses: actions/upload-artifact@v4 - with: - name: python-package-distributions - path: dist/ - - publish-to-pypi: - name: >- - Publish Python 🐍 distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes - needs: - - build - runs-on: ubuntu-latest - environment: - name: pypi - url: https://pypi.org/p/messente-api # Replace with your PyPI project name - permissions: - id-token: write # IMPORTANT: mandatory for trusted publishing - - steps: - - name: Download all the dists - uses: actions/download-artifact@v4 - with: - name: python-package-distributions - path: dist/ - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - - github-release: - name: >- - Sign the Python 🐍 distribution 📦 with Sigstore - and upload them to GitHub Release - needs: - - publish-to-pypi - runs-on: ubuntu-latest - - permissions: - contents: write # IMPORTANT: mandatory for making GitHub Releases - id-token: write # IMPORTANT: mandatory for sigstore - - steps: - - name: Download all the dists - uses: actions/download-artifact@v4 - with: - name: python-package-distributions - path: dist/ - - name: Sign the dists with Sigstore - uses: sigstore/gh-action-sigstore-python@v3.0.0 - with: - inputs: >- - ./dist/*.tar.gz - ./dist/*.whl - - name: Create GitHub Release - env: - GITHUB_TOKEN: ${{ github.token }} - run: >- - gh release create - "$GITHUB_REF_NAME" - --repo "$GITHUB_REPOSITORY" - --notes "" - - name: Upload artifact signatures to GitHub Release - env: - GITHUB_TOKEN: ${{ github.token }} - # Upload to GitHub Release using the `gh` CLI. - # `dist/` contains the built packages, and the - # sigstore-produced signatures and certificates. - run: >- - gh release upload - "$GITHUB_REF_NAME" dist/** - --repo "$GITHUB_REPOSITORY" \ No newline at end of file diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 0000000..5bb9f51 --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,31 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: messente_api Python package + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r test-requirements.txt + - name: Test with pytest + run: | + pytest --cov={{packageName}} diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index d62c762..7bd524e 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -4,6 +4,7 @@ .openapi-generator-ignore .travis.yml README.md +docs/AccountBalanceApi.md docs/BlacklistApi.md docs/BulkMessagingApi.md docs/BulkOmniMessageCreateSuccessResponse.md @@ -44,12 +45,16 @@ docs/MessageResult.md docs/MobileNetwork.md docs/NumberLookupApi.md docs/NumberToBlacklist.md +docs/NumberVerificationApi.md docs/NumbersToInvestigate.md docs/OmniMessageCreateSuccessResponse.md docs/Omnimessage.md docs/OmnimessageApi.md docs/OmnimessageMessagesInner.md +docs/Price.md docs/PriceInfo.md +docs/PriceNetworksInner.md +docs/PricingApi.md docs/Priority.md docs/SMS.md docs/StatisticsApi.md @@ -64,25 +69,52 @@ docs/TextStore.md docs/Viber.md docs/ViberVideo.md docs/WhatsApp.md +docs/WhatsAppAudio.md docs/WhatsAppComponent.md docs/WhatsAppCurrency.md docs/WhatsAppDatetime.md +docs/WhatsAppDocument.md +docs/WhatsAppImage.md docs/WhatsAppLanguage.md docs/WhatsAppMedia.md docs/WhatsAppParameter.md +docs/WhatsAppSticker.md docs/WhatsAppTemplate.md +docs/WhatsAppTemplatesApi.md docs/WhatsAppText.md +docs/WhatsAppVideo.md +docs/WhatsappButtonType.md +docs/WhatsappComponentType.md +docs/WhatsappCreateTemplateRequest.md +docs/WhatsappCreateTemplateResponse.md +docs/WhatsappHeaderFormat.md +docs/WhatsappListTemplatesResponse.md +docs/WhatsappOtpButtonType.md +docs/WhatsappPagination.md +docs/WhatsappPagingCursors.md +docs/WhatsappSupportedApp.md +docs/WhatsappTemplateButton.md +docs/WhatsappTemplateCategory.md +docs/WhatsappTemplateComponent.md +docs/WhatsappTemplateExample.md +docs/WhatsappTemplateResponse.md +docs/WhatsappTemplateStatus.md +docs/WhatsappUpdateTemplateRequest.md git_push.sh messente_api/__init__.py messente_api/api/__init__.py +messente_api/api/account_balance_api.py messente_api/api/blacklist_api.py messente_api/api/bulk_messaging_api.py messente_api/api/contacts_api.py messente_api/api/delivery_report_api.py messente_api/api/groups_api.py messente_api/api/number_lookup_api.py +messente_api/api/number_verification_api.py messente_api/api/omnimessage_api.py +messente_api/api/pricing_api.py messente_api/api/statistics_api.py +messente_api/api/whats_app_templates_api.py messente_api/api_client.py messente_api/api_response.py messente_api/configuration.py @@ -126,7 +158,9 @@ messente_api/models/numbers_to_investigate.py messente_api/models/omni_message_create_success_response.py messente_api/models/omnimessage.py messente_api/models/omnimessage_messages_inner.py +messente_api/models/price.py messente_api/models/price_info.py +messente_api/models/price_networks_inner.py messente_api/models/priority.py messente_api/models/sms.py messente_api/models/statistics_report.py @@ -140,14 +174,36 @@ messente_api/models/text_store.py messente_api/models/viber.py messente_api/models/viber_video.py messente_api/models/whats_app.py +messente_api/models/whats_app_audio.py messente_api/models/whats_app_component.py messente_api/models/whats_app_currency.py messente_api/models/whats_app_datetime.py +messente_api/models/whats_app_document.py +messente_api/models/whats_app_image.py messente_api/models/whats_app_language.py messente_api/models/whats_app_media.py messente_api/models/whats_app_parameter.py +messente_api/models/whats_app_sticker.py messente_api/models/whats_app_template.py messente_api/models/whats_app_text.py +messente_api/models/whats_app_video.py +messente_api/models/whatsapp_button_type.py +messente_api/models/whatsapp_component_type.py +messente_api/models/whatsapp_create_template_request.py +messente_api/models/whatsapp_create_template_response.py +messente_api/models/whatsapp_header_format.py +messente_api/models/whatsapp_list_templates_response.py +messente_api/models/whatsapp_otp_button_type.py +messente_api/models/whatsapp_pagination.py +messente_api/models/whatsapp_paging_cursors.py +messente_api/models/whatsapp_supported_app.py +messente_api/models/whatsapp_template_button.py +messente_api/models/whatsapp_template_category.py +messente_api/models/whatsapp_template_component.py +messente_api/models/whatsapp_template_example.py +messente_api/models/whatsapp_template_response.py +messente_api/models/whatsapp_template_status.py +messente_api/models/whatsapp_update_template_request.py messente_api/py.typed messente_api/rest.py pyproject.toml diff --git a/README.md b/README.md index ae150c3..6dd2c66 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Messente API Library - Messente API version: 2.0.0 -- Python package version: 2.4.0 +- Python package version: 2.5.0 [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. @@ -18,6 +18,11 @@ Messente API has the following features: Messente API Library provides the operations described below to access the features. +### AccountBalanceApi + +1. Get account balance [`get_account_balance`](docs/AccountBalanceApi.md#get_account_balance) +1. Get account balance [`get_account_balance_using_post`](docs/AccountBalanceApi.md#get_account_balance_using_post) + ### BlacklistApi 1. Adds a phone number to the blacklist [`add_to_blacklist`](docs/BlacklistApi.md#add_to_blacklist) @@ -56,15 +61,33 @@ Messente API Library provides the operations described below to access the featu 1. Requests info about phone numbers [`fetch_info`](docs/NumberLookupApi.md#fetch_info) +### NumberVerificationApi + +1. verify number [`verify_number`](docs/NumberVerificationApi.md#verify_number) +1. verified the PIN code entered by the user. [`verify_pin`](docs/NumberVerificationApi.md#verify_pin) + ### OmnimessageApi 1. Cancels a scheduled Omnimessage [`cancel_scheduled_message`](docs/OmnimessageApi.md#cancel_scheduled_message) 1. Sends an Omnimessage [`send_omnimessage`](docs/OmnimessageApi.md#send_omnimessage) +### PricingApi + +1. Get pricelist for account [`get_pricelist`](docs/PricingApi.md#get_pricelist) +1. Get pricing for a specific country [`get_prices`](docs/PricingApi.md#get_prices) + ### StatisticsApi 1. Requests statistics reports for each country [`create_statistics_report`](docs/StatisticsApi.md#create_statistics_report) +### WhatsAppTemplatesApi + +1. Creates a WhatsApp template [`create_whatsapp_template`](docs/WhatsAppTemplatesApi.md#create_whatsapp_template) +1. Deletes a WhatsApp template [`delete_whatsapp_template`](docs/WhatsAppTemplatesApi.md#delete_whatsapp_template) +1. Requests a WhatsApp template with the given ID [`get_whatsapp_template_by_id`](docs/WhatsAppTemplatesApi.md#get_whatsapp_template_by_id) +1. Requests a list of WhatsApp templates [`list_whatsapp_templates`](docs/WhatsAppTemplatesApi.md#list_whatsapp_templates) +1. Updates a WhatsApp template [`update_whatsapp_template`](docs/WhatsAppTemplatesApi.md#update_whatsapp_template) + ## Auth **Type**: HTTP basic authentication diff --git a/docs/AccountBalanceApi.md b/docs/AccountBalanceApi.md new file mode 100644 index 0000000..acf0ff6 --- /dev/null +++ b/docs/AccountBalanceApi.md @@ -0,0 +1,180 @@ +# messente_api.AccountBalanceApi + +All URIs are relative to *https://api.messente.com/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_account_balance**](AccountBalanceApi.md#get_account_balance) | **GET** /get_balance | Get account balance +[**get_account_balance_using_post**](AccountBalanceApi.md#get_account_balance_using_post) | **POST** /get_balance | Get account balance + + +# **get_account_balance** +> str get_account_balance(username, password) + +Get account balance + +### Example + +* Api Key Authentication (apiPassword): +* Api Key Authentication (apiUsername): + +```python +import messente_api +from messente_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.messente.com/v1 +# See configuration.py for a list of all supported configuration parameters. +configuration = messente_api.Configuration( + host = "https://api.messente.com/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 API key authorization: apiPassword +configuration.api_key['apiPassword'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['apiPassword'] = 'Bearer' + +# Configure API key authorization: apiUsername +configuration.api_key['apiUsername'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['apiUsername'] = 'Bearer' + +# Enter a context with an instance of the API client +with messente_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = messente_api.AccountBalanceApi(api_client) + username = 'username_example' # str | The API username + password = 'password_example' # str | The API password + + try: + # Get account balance + api_response = api_instance.get_account_balance(username, password) + print("The response of AccountBalanceApi->get_account_balance:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountBalanceApi->get_account_balance: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The API username | + **password** | **str**| The API password | + +### Return type + +**str** + +### Authorization + +[apiPassword](../README.md#apiPassword), [apiUsername](../README.md#apiUsername) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Both errors and success responses are returned as plain text with HTTP status 200. | - | + +[[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) + +# **get_account_balance_using_post** +> str get_account_balance_using_post(username, password) + +Get account balance + +### Example + +* Api Key Authentication (apiPassword): +* Api Key Authentication (apiUsername): + +```python +import messente_api +from messente_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.messente.com/v1 +# See configuration.py for a list of all supported configuration parameters. +configuration = messente_api.Configuration( + host = "https://api.messente.com/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 API key authorization: apiPassword +configuration.api_key['apiPassword'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['apiPassword'] = 'Bearer' + +# Configure API key authorization: apiUsername +configuration.api_key['apiUsername'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['apiUsername'] = 'Bearer' + +# Enter a context with an instance of the API client +with messente_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = messente_api.AccountBalanceApi(api_client) + username = 'username_example' # str | The API username + password = 'password_example' # str | The API password + + try: + # Get account balance + api_response = api_instance.get_account_balance_using_post(username, password) + print("The response of AccountBalanceApi->get_account_balance_using_post:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountBalanceApi->get_account_balance_using_post: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The API username | + **password** | **str**| The API password | + +### Return type + +**str** + +### Authorization + +[apiPassword](../README.md#apiPassword), [apiUsername](../README.md#apiUsername) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Both errors and success responses are returned as plain text with HTTP status 200. | - | + +[[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) + diff --git a/docs/NumberVerificationApi.md b/docs/NumberVerificationApi.md new file mode 100644 index 0000000..18b7cb2 --- /dev/null +++ b/docs/NumberVerificationApi.md @@ -0,0 +1,210 @@ +# messente_api.NumberVerificationApi + +All URIs are relative to *https://api.messente.com/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**verify_number**](NumberVerificationApi.md#verify_number) | **POST** /verify/start | verify number +[**verify_pin**](NumberVerificationApi.md#verify_pin) | **POST** /verify/pin | verified the PIN code entered by the user. + + +# **verify_number** +> str verify_number(username, password, to, template=template, pin_length=pin_length, var_from=var_from, max_tries=max_tries, retry_delay=retry_delay, validity=validity, ip=ip, browser=browser, cookie=cookie) + +verify number + +### Example + +* Api Key Authentication (apiPassword): +* Api Key Authentication (apiUsername): + +```python +import messente_api +from messente_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.messente.com/v1 +# See configuration.py for a list of all supported configuration parameters. +configuration = messente_api.Configuration( + host = "https://api.messente.com/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 API key authorization: apiPassword +configuration.api_key['apiPassword'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['apiPassword'] = 'Bearer' + +# Configure API key authorization: apiUsername +configuration.api_key['apiUsername'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['apiUsername'] = 'Bearer' + +# Enter a context with an instance of the API client +with messente_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = messente_api.NumberVerificationApi(api_client) + username = 'username_example' # str | The API username + password = 'password_example' # str | The API password + to = 'to_example' # str | Receiver's phone number with the country code + template = 'template_example' # str | Template of the message, including PIN code. Placeholder for PIN code is . When not set, default template is used: \"Your Verification PIN code is \". (optional) + pin_length = 'pin_length_example' # str | Length of the PIN code. Minumum 4 digits, maximum 16. Defaults to 4. (optional) + var_from = 'var_from_example' # str | Sender name. When not set, the default Sender name \"Verigator\" is used. This sender ID also needs to be added to your account beforehand. (optional) + max_tries = 'max_tries_example' # str | Maximum number of times the PIN code is sent in total. Defaults to \"2\" - initial PIN code and one retry. It is discouraged to set this value to \"1\" as only the initial PIN code is sent and retry is disabled. (optional) + retry_delay = 'retry_delay_example' # str | For how long (in seconds) to wait for next retry, if the correct PIN code has not been entered yet? Defaults to 30 seconds. (optional) + validity = 'validity_example' # str | For how long (in seconds) is the PIN code valid. Defaults to 5 minutes (300 seconds). Maximum 30 minutes (1800 seconds). (optional) + ip = 'ip_example' # str | IP address of the client making verification request. (optional) + browser = 'browser_example' # str | User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\". (optional) + cookie = 'cookie_example' # str | Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed. (optional) + + try: + # verify number + api_response = api_instance.verify_number(username, password, to, template=template, pin_length=pin_length, var_from=var_from, max_tries=max_tries, retry_delay=retry_delay, validity=validity, ip=ip, browser=browser, cookie=cookie) + print("The response of NumberVerificationApi->verify_number:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling NumberVerificationApi->verify_number: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The API username | + **password** | **str**| The API password | + **to** | **str**| Receiver's phone number with the country code | + **template** | **str**| Template of the message, including PIN code. Placeholder for PIN code is <PIN>. When not set, default template is used: \"Your Verification PIN code is <PIN>\". | [optional] + **pin_length** | **str**| Length of the PIN code. Minumum 4 digits, maximum 16. Defaults to 4. | [optional] + **var_from** | **str**| Sender name. When not set, the default Sender name \"Verigator\" is used. This sender ID also needs to be added to your account beforehand. | [optional] + **max_tries** | **str**| Maximum number of times the PIN code is sent in total. Defaults to \"2\" - initial PIN code and one retry. It is discouraged to set this value to \"1\" as only the initial PIN code is sent and retry is disabled. | [optional] + **retry_delay** | **str**| For how long (in seconds) to wait for next retry, if the correct PIN code has not been entered yet? Defaults to 30 seconds. | [optional] + **validity** | **str**| For how long (in seconds) is the PIN code valid. Defaults to 5 minutes (300 seconds). Maximum 30 minutes (1800 seconds). | [optional] + **ip** | **str**| IP address of the client making verification request. | [optional] + **browser** | **str**| User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\". | [optional] + **cookie** | **str**| Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed. | [optional] + +### Return type + +**str** + +### Authorization + +[apiPassword](../README.md#apiPassword), [apiUsername](../README.md#apiUsername) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Both errors and success responses are returned as plain text with HTTP status 200. | - | + +[[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) + +# **verify_pin** +> str verify_pin(username, password, verification_id, pin, ip=ip, browser=browser, cookie=cookie) + +verified the PIN code entered by the user. + +### Example + +* Api Key Authentication (apiPassword): +* Api Key Authentication (apiUsername): + +```python +import messente_api +from messente_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.messente.com/v1 +# See configuration.py for a list of all supported configuration parameters. +configuration = messente_api.Configuration( + host = "https://api.messente.com/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 API key authorization: apiPassword +configuration.api_key['apiPassword'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['apiPassword'] = 'Bearer' + +# Configure API key authorization: apiUsername +configuration.api_key['apiUsername'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['apiUsername'] = 'Bearer' + +# Enter a context with an instance of the API client +with messente_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = messente_api.NumberVerificationApi(api_client) + username = 'username_example' # str | The API username + password = 'password_example' # str | The API password + verification_id = 'verification_id_example' # str | Verification ID returned by the successful verification request. + pin = 'pin_example' # str | PIN code entered by the user. + ip = 'ip_example' # str | IP address of the client making verification request. If the IP address is from another country, PIN is required even if the cookies match. (optional) + browser = 'browser_example' # str | User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\". (optional) + cookie = 'cookie_example' # str | Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed. (optional) + + try: + # verified the PIN code entered by the user. + api_response = api_instance.verify_pin(username, password, verification_id, pin, ip=ip, browser=browser, cookie=cookie) + print("The response of NumberVerificationApi->verify_pin:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling NumberVerificationApi->verify_pin: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The API username | + **password** | **str**| The API password | + **verification_id** | **str**| Verification ID returned by the successful verification request. | + **pin** | **str**| PIN code entered by the user. | + **ip** | **str**| IP address of the client making verification request. If the IP address is from another country, PIN is required even if the cookies match. | [optional] + **browser** | **str**| User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\". | [optional] + **cookie** | **str**| Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed. | [optional] + +### Return type + +**str** + +### Authorization + +[apiPassword](../README.md#apiPassword), [apiUsername](../README.md#apiUsername) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Both errors and success responses are returned as plain text with HTTP status 200. | - | + +[[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) + diff --git a/docs/OmnimessageMessagesInner.md b/docs/OmnimessageMessagesInner.md index 4746b71..58fb415 100644 --- a/docs/OmnimessageMessagesInner.md +++ b/docs/OmnimessageMessagesInner.md @@ -13,10 +13,14 @@ Name | Type | Description | Notes **button_url** | **str** | URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) | [optional] **button_text** | **str** | Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) | [optional] **channel** | **str** | The channel used to deliver the message | [optional] [default to 'telegram'] -**video** | [**ViberVideo**](ViberVideo.md) | | [optional] +**video** | [**WhatsAppVideo**](WhatsAppVideo.md) | | [optional] **autoconvert** | **str** | Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way | [optional] **udh** | **str** | hex-encoded string containing SMS UDH | [optional] **template** | [**WhatsAppTemplate**](WhatsAppTemplate.md) | | [optional] +**image** | [**WhatsAppImage**](WhatsAppImage.md) | | [optional] +**audio** | [**WhatsAppAudio**](WhatsAppAudio.md) | | [optional] +**document** | [**WhatsAppDocument**](WhatsAppDocument.md) | | [optional] +**sticker** | [**WhatsAppSticker**](WhatsAppSticker.md) | | [optional] **document_url** | **str** | URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" | [optional] **audio_url** | **str** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" | [optional] diff --git a/docs/Price.md b/docs/Price.md new file mode 100644 index 0000000..0972adc --- /dev/null +++ b/docs/Price.md @@ -0,0 +1,33 @@ +# Price + +An object containing the pricing information for a given country + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**country** | **str** | The alpha-2 code for the country | +**name** | **str** | The name of the country | +**prefix** | **str** | The country code prefix | +**networks** | [**List[PriceNetworksInner]**](PriceNetworksInner.md) | A list of networks available in the country | + +## Example + +```python +from messente_api.models.price import Price + +# TODO update the JSON string below +json = "{}" +# create an instance of Price from a JSON string +price_instance = Price.from_json(json) +# print the JSON string representation of the object +print(Price.to_json()) + +# convert the object into a dict +price_dict = price_instance.to_dict() +# create an instance of Price from a dict +price_from_dict = Price.from_dict(price_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PriceNetworksInner.md b/docs/PriceNetworksInner.md new file mode 100644 index 0000000..692da00 --- /dev/null +++ b/docs/PriceNetworksInner.md @@ -0,0 +1,32 @@ +# PriceNetworksInner + +An object containing the network information + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | The name of the network | +**price** | **str** | The price for sending a message to this network | +**mccmnc** | **float** | The MCCMNC code for the network | + +## Example + +```python +from messente_api.models.price_networks_inner import PriceNetworksInner + +# TODO update the JSON string below +json = "{}" +# create an instance of PriceNetworksInner from a JSON string +price_networks_inner_instance = PriceNetworksInner.from_json(json) +# print the JSON string representation of the object +print(PriceNetworksInner.to_json()) + +# convert the object into a dict +price_networks_inner_dict = price_networks_inner_instance.to_dict() +# create an instance of PriceNetworksInner from a dict +price_networks_inner_from_dict = PriceNetworksInner.from_dict(price_networks_inner_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PricingApi.md b/docs/PricingApi.md new file mode 100644 index 0000000..bcc9b71 --- /dev/null +++ b/docs/PricingApi.md @@ -0,0 +1,185 @@ +# messente_api.PricingApi + +All URIs are relative to *https://api.messente.com/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_pricelist**](PricingApi.md#get_pricelist) | **GET** /pricelist | Get pricelist for account +[**get_prices**](PricingApi.md#get_prices) | **GET** /prices | Get pricing for a specific country + + +# **get_pricelist** +> str get_pricelist(username, password) + +Get pricelist for account + +### Example + +* Api Key Authentication (apiPassword): +* Api Key Authentication (apiUsername): + +```python +import messente_api +from messente_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.messente.com/v1 +# See configuration.py for a list of all supported configuration parameters. +configuration = messente_api.Configuration( + host = "https://api.messente.com/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 API key authorization: apiPassword +configuration.api_key['apiPassword'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['apiPassword'] = 'Bearer' + +# Configure API key authorization: apiUsername +configuration.api_key['apiUsername'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['apiUsername'] = 'Bearer' + +# Enter a context with an instance of the API client +with messente_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = messente_api.PricingApi(api_client) + username = 'username_example' # str | The API username + password = 'password_example' # str | The API password + + try: + # Get pricelist for account + api_response = api_instance.get_pricelist(username, password) + print("The response of PricingApi->get_pricelist:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PricingApi->get_pricelist: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The API username | + **password** | **str**| The API password | + +### Return type + +**str** + +### Authorization + +[apiPassword](../README.md#apiPassword), [apiUsername](../README.md#apiUsername) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Both errors and success responses are returned as plain text with HTTP status 200. Unsuccessful responses contain the error code, while successful ones contain the pricelist in CSV format. | - | + +[[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) + +# **get_prices** +> Price get_prices(username, password, country, format=format) + +Get pricing for a specific country + +### Example + +* Api Key Authentication (apiPassword): +* Api Key Authentication (apiUsername): + +```python +import messente_api +from messente_api.models.price import Price +from messente_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.messente.com/v1 +# See configuration.py for a list of all supported configuration parameters. +configuration = messente_api.Configuration( + host = "https://api.messente.com/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 API key authorization: apiPassword +configuration.api_key['apiPassword'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['apiPassword'] = 'Bearer' + +# Configure API key authorization: apiUsername +configuration.api_key['apiUsername'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['apiUsername'] = 'Bearer' + +# Enter a context with an instance of the API client +with messente_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = messente_api.PricingApi(api_client) + username = 'username_example' # str | The API username + password = 'password_example' # str | The API password + country = 'EE' # str | The country code, for which to get the prices + format = 'format_example' # str | The format of the response. Can be either 'json' or 'xml'. If not specified, defaults to 'json'. (optional) + + try: + # Get pricing for a specific country + api_response = api_instance.get_prices(username, password, country, format=format) + print("The response of PricingApi->get_prices:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PricingApi->get_prices: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The API username | + **password** | **str**| The API password | + **country** | **str**| The country code, for which to get the prices | + **format** | **str**| The format of the response. Can be either 'json' or 'xml'. If not specified, defaults to 'json'. | [optional] + +### Return type + +[**Price**](Price.md) + +### Authorization + +[apiPassword](../README.md#apiPassword), [apiUsername](../README.md#apiUsername) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml, text/plain; charset=utf-8 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Unsuccessful responses are returned as plain text with an error code, while successful ones contain either JSON or XML depending on the user's choice. | - | + +[[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) + diff --git a/docs/WhatsApp.md b/docs/WhatsApp.md index f402db3..e926685 100644 --- a/docs/WhatsApp.md +++ b/docs/WhatsApp.md @@ -10,8 +10,13 @@ Name | Type | Description | Notes **validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted | [optional] **ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] **template** | [**WhatsAppTemplate**](WhatsAppTemplate.md) | | [optional] -**text** | [**WhatsAppText**](WhatsAppText.md) | | [optional] **channel** | **str** | The channel used to deliver the message | [optional] [default to 'whatsapp'] +**text** | [**WhatsAppText**](WhatsAppText.md) | | [optional] +**image** | [**WhatsAppImage**](WhatsAppImage.md) | | [optional] +**video** | [**WhatsAppVideo**](WhatsAppVideo.md) | | [optional] +**audio** | [**WhatsAppAudio**](WhatsAppAudio.md) | | [optional] +**document** | [**WhatsAppDocument**](WhatsAppDocument.md) | | [optional] +**sticker** | [**WhatsAppSticker**](WhatsAppSticker.md) | | [optional] ## Example diff --git a/docs/WhatsAppAudio.md b/docs/WhatsAppAudio.md new file mode 100644 index 0000000..e0f9698 --- /dev/null +++ b/docs/WhatsAppAudio.md @@ -0,0 +1,32 @@ +# WhatsAppAudio + +WhatsApp audio content. Either \"id\" or \"link\" must be provided, but not both. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier for the audio file. | [optional] +**mime_type** | **str** | MIME type of the audio file. | [optional] +**link** | **str** | URL link to the audio file. | [optional] + +## Example + +```python +from messente_api.models.whats_app_audio import WhatsAppAudio + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsAppAudio from a JSON string +whats_app_audio_instance = WhatsAppAudio.from_json(json) +# print the JSON string representation of the object +print(WhatsAppAudio.to_json()) + +# convert the object into a dict +whats_app_audio_dict = whats_app_audio_instance.to_dict() +# create an instance of WhatsAppAudio from a dict +whats_app_audio_from_dict = WhatsAppAudio.from_dict(whats_app_audio_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsAppDocument.md b/docs/WhatsAppDocument.md new file mode 100644 index 0000000..988a237 --- /dev/null +++ b/docs/WhatsAppDocument.md @@ -0,0 +1,34 @@ +# WhatsAppDocument + +WhatsApp document content. Either \"id\" or \"link\" must be provided, but not both. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier for the document file. | [optional] +**caption** | **str** | Caption for the document. | [optional] +**mime_type** | **str** | MIME type of the document file. | [optional] +**file_name** | **str** | Name of the document file. | [optional] +**link** | **str** | URL link to the document file. | [optional] + +## Example + +```python +from messente_api.models.whats_app_document import WhatsAppDocument + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsAppDocument from a JSON string +whats_app_document_instance = WhatsAppDocument.from_json(json) +# print the JSON string representation of the object +print(WhatsAppDocument.to_json()) + +# convert the object into a dict +whats_app_document_dict = whats_app_document_instance.to_dict() +# create an instance of WhatsAppDocument from a dict +whats_app_document_from_dict = WhatsAppDocument.from_dict(whats_app_document_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsAppImage.md b/docs/WhatsAppImage.md new file mode 100644 index 0000000..e839d7d --- /dev/null +++ b/docs/WhatsAppImage.md @@ -0,0 +1,33 @@ +# WhatsAppImage + +WhatsApp image content. Either \"id\" or \"link\" must be provided, but not both. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier for the image file. | [optional] +**caption** | **str** | Caption for the image. | [optional] +**mime_type** | **str** | MIME type of the image file. | [optional] +**link** | **str** | URL link to the image file. | [optional] + +## Example + +```python +from messente_api.models.whats_app_image import WhatsAppImage + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsAppImage from a JSON string +whats_app_image_instance = WhatsAppImage.from_json(json) +# print the JSON string representation of the object +print(WhatsAppImage.to_json()) + +# convert the object into a dict +whats_app_image_dict = whats_app_image_instance.to_dict() +# create an instance of WhatsAppImage from a dict +whats_app_image_from_dict = WhatsAppImage.from_dict(whats_app_image_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsAppSticker.md b/docs/WhatsAppSticker.md new file mode 100644 index 0000000..d2721eb --- /dev/null +++ b/docs/WhatsAppSticker.md @@ -0,0 +1,33 @@ +# WhatsAppSticker + +WhatsApp sticker content. Either \"id\" or \"link\" must be provided, but not both. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier for the sticker file. | [optional] +**mime_type** | **str** | MIME type of the sticker file. | [optional] +**animated** | **bool** | Indicates whether the sticker is animated. | [optional] +**link** | **str** | URL link to the sticker file. | [optional] + +## Example + +```python +from messente_api.models.whats_app_sticker import WhatsAppSticker + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsAppSticker from a JSON string +whats_app_sticker_instance = WhatsAppSticker.from_json(json) +# print the JSON string representation of the object +print(WhatsAppSticker.to_json()) + +# convert the object into a dict +whats_app_sticker_dict = whats_app_sticker_instance.to_dict() +# create an instance of WhatsAppSticker from a dict +whats_app_sticker_from_dict = WhatsAppSticker.from_dict(whats_app_sticker_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsAppTemplate.md b/docs/WhatsAppTemplate.md index 4b8397d..6955f1d 100644 --- a/docs/WhatsAppTemplate.md +++ b/docs/WhatsAppTemplate.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **str** | Name of the template | **language** | [**WhatsAppLanguage**](WhatsAppLanguage.md) | | -**components** | [**List[WhatsAppComponent]**](WhatsAppComponent.md) | List of template components | [optional] +**components** | [**List[WhatsAppComponent]**](WhatsAppComponent.md) | List of template components | ## Example diff --git a/docs/WhatsAppTemplatesApi.md b/docs/WhatsAppTemplatesApi.md new file mode 100644 index 0000000..9984a9e --- /dev/null +++ b/docs/WhatsAppTemplatesApi.md @@ -0,0 +1,448 @@ +# messente_api.WhatsAppTemplatesApi + +All URIs are relative to *https://api.messente.com/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_whatsapp_template**](WhatsAppTemplatesApi.md#create_whatsapp_template) | **POST** /whatsapp/wabas/{wabaId}/templates | Creates a WhatsApp template +[**delete_whatsapp_template**](WhatsAppTemplatesApi.md#delete_whatsapp_template) | **DELETE** /whatsapp/wabas/{wabaId}/templates | Deletes a WhatsApp template +[**get_whatsapp_template_by_id**](WhatsAppTemplatesApi.md#get_whatsapp_template_by_id) | **GET** /whatsapp/wabas/{wabaId}/templates/{templateId} | Requests a WhatsApp template with the given ID +[**list_whatsapp_templates**](WhatsAppTemplatesApi.md#list_whatsapp_templates) | **GET** /whatsapp/wabas/{wabaId}/templates | Requests a list of WhatsApp templates +[**update_whatsapp_template**](WhatsAppTemplatesApi.md#update_whatsapp_template) | **PUT** /whatsapp/wabas/{wabaId}/templates/{templateId} | Updates a WhatsApp template + + +# **create_whatsapp_template** +> WhatsappCreateTemplateResponse create_whatsapp_template(waba_id, whatsapp_create_template_request) + +Creates a WhatsApp template + +### Example + +* Basic Authentication (basicAuth): + +```python +import messente_api +from messente_api.models.whatsapp_create_template_request import WhatsappCreateTemplateRequest +from messente_api.models.whatsapp_create_template_response import WhatsappCreateTemplateResponse +from messente_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.messente.com/v1 +# See configuration.py for a list of all supported configuration parameters. +configuration = messente_api.Configuration( + host = "https://api.messente.com/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 = messente_api.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + +# Enter a context with an instance of the API client +with messente_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = messente_api.WhatsAppTemplatesApi(api_client) + waba_id = 'waba_id_example' # str | The ID of the WABA + whatsapp_create_template_request = messente_api.WhatsappCreateTemplateRequest() # WhatsappCreateTemplateRequest | The WhatsApp template to create + + try: + # Creates a WhatsApp template + api_response = api_instance.create_whatsapp_template(waba_id, whatsapp_create_template_request) + print("The response of WhatsAppTemplatesApi->create_whatsapp_template:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling WhatsAppTemplatesApi->create_whatsapp_template: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **waba_id** | **str**| The ID of the WABA | + **whatsapp_create_template_request** | [**WhatsappCreateTemplateRequest**](WhatsappCreateTemplateRequest.md)| The WhatsApp template to create | + +### Return type + +[**WhatsappCreateTemplateResponse**](WhatsappCreateTemplateResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | template creation successful | - | +**400** | Invalid input | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**500** | Internal Server Error | - | + +[[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) + +# **delete_whatsapp_template** +> object delete_whatsapp_template(waba_id, name, hsm_id=hsm_id) + +Deletes a WhatsApp template + +### Example + +* Basic Authentication (basicAuth): + +```python +import messente_api +from messente_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.messente.com/v1 +# See configuration.py for a list of all supported configuration parameters. +configuration = messente_api.Configuration( + host = "https://api.messente.com/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 = messente_api.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + +# Enter a context with an instance of the API client +with messente_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = messente_api.WhatsAppTemplatesApi(api_client) + waba_id = 'waba_id_example' # str | The ID of the WABA + name = 'template_name' # str | The name of the template to delete + hsm_id = '1' # str | The ID of the template to delete (optional) + + try: + # Deletes a WhatsApp template + api_response = api_instance.delete_whatsapp_template(waba_id, name, hsm_id=hsm_id) + print("The response of WhatsAppTemplatesApi->delete_whatsapp_template:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling WhatsAppTemplatesApi->delete_whatsapp_template: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **waba_id** | **str**| The ID of the WABA | + **name** | **str**| The name of the template to delete | + **hsm_id** | **str**| The ID of the template to delete | [optional] + +### Return type + +**object** + +### Authorization + +[basicAuth](../README.md#basicAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | template deletion successful | - | +**400** | Invalid input | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**500** | Internal Server Error | - | + +[[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) + +# **get_whatsapp_template_by_id** +> WhatsappTemplateResponse get_whatsapp_template_by_id(waba_id, template_id) + +Requests a WhatsApp template with the given ID + +### Example + +* Basic Authentication (basicAuth): + +```python +import messente_api +from messente_api.models.whatsapp_template_response import WhatsappTemplateResponse +from messente_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.messente.com/v1 +# See configuration.py for a list of all supported configuration parameters. +configuration = messente_api.Configuration( + host = "https://api.messente.com/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 = messente_api.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + +# Enter a context with an instance of the API client +with messente_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = messente_api.WhatsAppTemplatesApi(api_client) + waba_id = 'waba_id_example' # str | The ID of the WABA + template_id = 'template_id_example' # str | The ID of the template to retrieve + + try: + # Requests a WhatsApp template with the given ID + api_response = api_instance.get_whatsapp_template_by_id(waba_id, template_id) + print("The response of WhatsAppTemplatesApi->get_whatsapp_template_by_id:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling WhatsAppTemplatesApi->get_whatsapp_template_by_id: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **waba_id** | **str**| The ID of the WABA | + **template_id** | **str**| The ID of the template to retrieve | + +### Return type + +[**WhatsappTemplateResponse**](WhatsappTemplateResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | template fetched successfully | - | +**400** | Invalid input | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**500** | Internal Server Error | - | + +[[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) + +# **list_whatsapp_templates** +> WhatsappListTemplatesResponse list_whatsapp_templates(waba_id, limit=limit, before=before, after=after, category=category, content=content, language=language, name=name, status=status) + +Requests a list of WhatsApp templates + +### Example + +* Basic Authentication (basicAuth): + +```python +import messente_api +from messente_api.models.whatsapp_list_templates_response import WhatsappListTemplatesResponse +from messente_api.models.whatsapp_template_category import WhatsappTemplateCategory +from messente_api.models.whatsapp_template_status import WhatsappTemplateStatus +from messente_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.messente.com/v1 +# See configuration.py for a list of all supported configuration parameters. +configuration = messente_api.Configuration( + host = "https://api.messente.com/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 = messente_api.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + +# Enter a context with an instance of the API client +with messente_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = messente_api.WhatsAppTemplatesApi(api_client) + waba_id = 'waba_id_example' # str | The ID of the WABA + limit = 25 # int | The number of templates to return in the list. Although the max size is 500, for large datasets it is recommended to use a lower limit and instead use pagination to avoid potential timeouts. Defaults to 25. (optional) (default to 25) + before = 'MAZDZD' # str | A cursor point used for a paginated request to indicate the template to paginate backwards from. (optional) + after = 'MjQZD' # str | A cursor point used for a paginated request to indicate the template to paginate forwards from. (optional) + category = messente_api.WhatsappTemplateCategory() # WhatsappTemplateCategory | A filter for returning only templates matching a specific category. (optional) + content = 'special offer' # str | A search filter representing the content of a template. Only matching templates will be returned in the list. (optional) + language = 'en' # str | A filter for returning only templates matching a specific language code. A list of supported languages is available in the [WhatsApp documentation](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates/) (optional) + name = 'Sample Template' # str | A search filter representing the name, either full or partial, of a template. Only matching templates will be returned in the list. (optional) + status = messente_api.WhatsappTemplateStatus() # WhatsappTemplateStatus | A filter for returning only templates matching a specific status. (optional) + + try: + # Requests a list of WhatsApp templates + api_response = api_instance.list_whatsapp_templates(waba_id, limit=limit, before=before, after=after, category=category, content=content, language=language, name=name, status=status) + print("The response of WhatsAppTemplatesApi->list_whatsapp_templates:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling WhatsAppTemplatesApi->list_whatsapp_templates: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **waba_id** | **str**| The ID of the WABA | + **limit** | **int**| The number of templates to return in the list. Although the max size is 500, for large datasets it is recommended to use a lower limit and instead use pagination to avoid potential timeouts. Defaults to 25. | [optional] [default to 25] + **before** | **str**| A cursor point used for a paginated request to indicate the template to paginate backwards from. | [optional] + **after** | **str**| A cursor point used for a paginated request to indicate the template to paginate forwards from. | [optional] + **category** | [**WhatsappTemplateCategory**](.md)| A filter for returning only templates matching a specific category. | [optional] + **content** | **str**| A search filter representing the content of a template. Only matching templates will be returned in the list. | [optional] + **language** | **str**| A filter for returning only templates matching a specific language code. A list of supported languages is available in the [WhatsApp documentation](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates/) | [optional] + **name** | **str**| A search filter representing the name, either full or partial, of a template. Only matching templates will be returned in the list. | [optional] + **status** | [**WhatsappTemplateStatus**](.md)| A filter for returning only templates matching a specific status. | [optional] + +### Return type + +[**WhatsappListTemplatesResponse**](WhatsappListTemplatesResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | template list fetched successfully | - | +**400** | Invalid input | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**500** | Internal Server Error | - | + +[[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) + +# **update_whatsapp_template** +> object update_whatsapp_template(waba_id, template_id, whatsapp_update_template_request) + +Updates a WhatsApp template + +### Example + +* Basic Authentication (basicAuth): + +```python +import messente_api +from messente_api.models.whatsapp_update_template_request import WhatsappUpdateTemplateRequest +from messente_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.messente.com/v1 +# See configuration.py for a list of all supported configuration parameters. +configuration = messente_api.Configuration( + host = "https://api.messente.com/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 = messente_api.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + +# Enter a context with an instance of the API client +with messente_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = messente_api.WhatsAppTemplatesApi(api_client) + waba_id = 'waba_id_example' # str | The ID of the WABA + template_id = 'template_id_example' # str | The ID of the template to update + whatsapp_update_template_request = messente_api.WhatsappUpdateTemplateRequest() # WhatsappUpdateTemplateRequest | The template data to be updated + + try: + # Updates a WhatsApp template + api_response = api_instance.update_whatsapp_template(waba_id, template_id, whatsapp_update_template_request) + print("The response of WhatsAppTemplatesApi->update_whatsapp_template:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling WhatsAppTemplatesApi->update_whatsapp_template: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **waba_id** | **str**| The ID of the WABA | + **template_id** | **str**| The ID of the template to update | + **whatsapp_update_template_request** | [**WhatsappUpdateTemplateRequest**](WhatsappUpdateTemplateRequest.md)| The template data to be updated | + +### Return type + +**object** + +### Authorization + +[basicAuth](../README.md#basicAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | template update successful | - | +**400** | Invalid input | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**500** | Internal Server Error | - | + +[[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) + diff --git a/docs/WhatsAppVideo.md b/docs/WhatsAppVideo.md new file mode 100644 index 0000000..de03c5c --- /dev/null +++ b/docs/WhatsAppVideo.md @@ -0,0 +1,33 @@ +# WhatsAppVideo + +WhatsApp video content. Either \"id\" or \"link\" must be provided, but not both. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier for the video file. | [optional] +**caption** | **str** | Caption for the video. | [optional] +**mime_type** | **str** | MIME type of the video file. | [optional] +**link** | **str** | URL link to the video file. | [optional] + +## Example + +```python +from messente_api.models.whats_app_video import WhatsAppVideo + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsAppVideo from a JSON string +whats_app_video_instance = WhatsAppVideo.from_json(json) +# print the JSON string representation of the object +print(WhatsAppVideo.to_json()) + +# convert the object into a dict +whats_app_video_dict = whats_app_video_instance.to_dict() +# create an instance of WhatsAppVideo from a dict +whats_app_video_from_dict = WhatsAppVideo.from_dict(whats_app_video_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappButtonType.md b/docs/WhatsappButtonType.md new file mode 100644 index 0000000..d3eb77d --- /dev/null +++ b/docs/WhatsappButtonType.md @@ -0,0 +1,23 @@ +# WhatsappButtonType + +Type of the button + +## Enum + +* `QUICK_REPLY` (value: `'quick_reply'`) + +* `PHONE_NUMBER` (value: `'phone_number'`) + +* `OTP` (value: `'otp'`) + +* `URL` (value: `'url'`) + +* `CATALOG` (value: `'catalog'`) + +* `FLOW` (value: `'flow'`) + +* `COPY_CODE` (value: `'copy_code'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappComponentType.md b/docs/WhatsappComponentType.md new file mode 100644 index 0000000..b0bf099 --- /dev/null +++ b/docs/WhatsappComponentType.md @@ -0,0 +1,17 @@ +# WhatsappComponentType + +Type of the component + +## Enum + +* `BODY` (value: `'body'`) + +* `HEADER` (value: `'header'`) + +* `FOOTER` (value: `'footer'`) + +* `BUTTONS` (value: `'buttons'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappCreateTemplateRequest.md b/docs/WhatsappCreateTemplateRequest.md new file mode 100644 index 0000000..992d2a8 --- /dev/null +++ b/docs/WhatsappCreateTemplateRequest.md @@ -0,0 +1,33 @@ +# WhatsappCreateTemplateRequest + +Request to create a WhatsApp template + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Name of the template | +**category** | [**WhatsappTemplateCategory**](WhatsappTemplateCategory.md) | | +**language** | **str** | Language of the template | +**components** | [**List[WhatsappTemplateComponent]**](WhatsappTemplateComponent.md) | List of template components | + +## Example + +```python +from messente_api.models.whatsapp_create_template_request import WhatsappCreateTemplateRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsappCreateTemplateRequest from a JSON string +whatsapp_create_template_request_instance = WhatsappCreateTemplateRequest.from_json(json) +# print the JSON string representation of the object +print(WhatsappCreateTemplateRequest.to_json()) + +# convert the object into a dict +whatsapp_create_template_request_dict = whatsapp_create_template_request_instance.to_dict() +# create an instance of WhatsappCreateTemplateRequest from a dict +whatsapp_create_template_request_from_dict = WhatsappCreateTemplateRequest.from_dict(whatsapp_create_template_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappCreateTemplateResponse.md b/docs/WhatsappCreateTemplateResponse.md new file mode 100644 index 0000000..17c2913 --- /dev/null +++ b/docs/WhatsappCreateTemplateResponse.md @@ -0,0 +1,32 @@ +# WhatsappCreateTemplateResponse + +Response for creating a WhatsApp template + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Template ID | +**status** | [**WhatsappTemplateStatus**](WhatsappTemplateStatus.md) | | +**category** | [**WhatsappTemplateCategory**](WhatsappTemplateCategory.md) | | + +## Example + +```python +from messente_api.models.whatsapp_create_template_response import WhatsappCreateTemplateResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsappCreateTemplateResponse from a JSON string +whatsapp_create_template_response_instance = WhatsappCreateTemplateResponse.from_json(json) +# print the JSON string representation of the object +print(WhatsappCreateTemplateResponse.to_json()) + +# convert the object into a dict +whatsapp_create_template_response_dict = whatsapp_create_template_response_instance.to_dict() +# create an instance of WhatsappCreateTemplateResponse from a dict +whatsapp_create_template_response_from_dict = WhatsappCreateTemplateResponse.from_dict(whatsapp_create_template_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappHeaderFormat.md b/docs/WhatsappHeaderFormat.md new file mode 100644 index 0000000..24b3d58 --- /dev/null +++ b/docs/WhatsappHeaderFormat.md @@ -0,0 +1,11 @@ +# WhatsappHeaderFormat + +Format of the header component + +## Enum + +* `TEXT` (value: `'text'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappListTemplatesResponse.md b/docs/WhatsappListTemplatesResponse.md new file mode 100644 index 0000000..613e3c7 --- /dev/null +++ b/docs/WhatsappListTemplatesResponse.md @@ -0,0 +1,31 @@ +# WhatsappListTemplatesResponse + +Whatsapp Cloud API list of templates response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**templates** | [**List[WhatsappTemplateResponse]**](WhatsappTemplateResponse.md) | List of templates | +**paging** | [**WhatsappPagination**](WhatsappPagination.md) | | + +## Example + +```python +from messente_api.models.whatsapp_list_templates_response import WhatsappListTemplatesResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsappListTemplatesResponse from a JSON string +whatsapp_list_templates_response_instance = WhatsappListTemplatesResponse.from_json(json) +# print the JSON string representation of the object +print(WhatsappListTemplatesResponse.to_json()) + +# convert the object into a dict +whatsapp_list_templates_response_dict = whatsapp_list_templates_response_instance.to_dict() +# create an instance of WhatsappListTemplatesResponse from a dict +whatsapp_list_templates_response_from_dict = WhatsappListTemplatesResponse.from_dict(whatsapp_list_templates_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappOtpButtonType.md b/docs/WhatsappOtpButtonType.md new file mode 100644 index 0000000..89cbe91 --- /dev/null +++ b/docs/WhatsappOtpButtonType.md @@ -0,0 +1,15 @@ +# WhatsappOtpButtonType + +Type of the OTP button + +## Enum + +* `COPY_CODE` (value: `'copy_code'`) + +* `ONE_TAP` (value: `'one_tap'`) + +* `ZERO_TAP` (value: `'zero_tap'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappPagination.md b/docs/WhatsappPagination.md new file mode 100644 index 0000000..e3520cc --- /dev/null +++ b/docs/WhatsappPagination.md @@ -0,0 +1,32 @@ +# WhatsappPagination + +Whatsapp media object. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**previous** | **str** | A URL to ge the previous paginated page. | [optional] +**next** | **str** | A URL to ge the next paginated page. | [optional] +**cursors** | [**WhatsappPagingCursors**](WhatsappPagingCursors.md) | | + +## Example + +```python +from messente_api.models.whatsapp_pagination import WhatsappPagination + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsappPagination from a JSON string +whatsapp_pagination_instance = WhatsappPagination.from_json(json) +# print the JSON string representation of the object +print(WhatsappPagination.to_json()) + +# convert the object into a dict +whatsapp_pagination_dict = whatsapp_pagination_instance.to_dict() +# create an instance of WhatsappPagination from a dict +whatsapp_pagination_from_dict = WhatsappPagination.from_dict(whatsapp_pagination_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappPagingCursors.md b/docs/WhatsappPagingCursors.md new file mode 100644 index 0000000..ff353f2 --- /dev/null +++ b/docs/WhatsappPagingCursors.md @@ -0,0 +1,31 @@ +# WhatsappPagingCursors + +WhatsApp paging cursors object. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**before** | **str** | The template before the first template in the current list | [optional] +**after** | **str** | The template after the last template in the current list | [optional] + +## Example + +```python +from messente_api.models.whatsapp_paging_cursors import WhatsappPagingCursors + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsappPagingCursors from a JSON string +whatsapp_paging_cursors_instance = WhatsappPagingCursors.from_json(json) +# print the JSON string representation of the object +print(WhatsappPagingCursors.to_json()) + +# convert the object into a dict +whatsapp_paging_cursors_dict = whatsapp_paging_cursors_instance.to_dict() +# create an instance of WhatsappPagingCursors from a dict +whatsapp_paging_cursors_from_dict = WhatsappPagingCursors.from_dict(whatsapp_paging_cursors_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappSupportedApp.md b/docs/WhatsappSupportedApp.md new file mode 100644 index 0000000..85ede2b --- /dev/null +++ b/docs/WhatsappSupportedApp.md @@ -0,0 +1,31 @@ +# WhatsappSupportedApp + +Supported app for the button + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**package_name** | **str** | Package name | +**signature_hash** | **str** | Signature hash | + +## Example + +```python +from messente_api.models.whatsapp_supported_app import WhatsappSupportedApp + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsappSupportedApp from a JSON string +whatsapp_supported_app_instance = WhatsappSupportedApp.from_json(json) +# print the JSON string representation of the object +print(WhatsappSupportedApp.to_json()) + +# convert the object into a dict +whatsapp_supported_app_dict = whatsapp_supported_app_instance.to_dict() +# create an instance of WhatsappSupportedApp from a dict +whatsapp_supported_app_from_dict = WhatsappSupportedApp.from_dict(whatsapp_supported_app_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappTemplateButton.md b/docs/WhatsappTemplateButton.md new file mode 100644 index 0000000..2c1d7fa --- /dev/null +++ b/docs/WhatsappTemplateButton.md @@ -0,0 +1,36 @@ +# WhatsappTemplateButton + +Whatsapp button object. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**WhatsappButtonType**](WhatsappButtonType.md) | | [optional] +**otp_type** | [**WhatsappOtpButtonType**](WhatsappOtpButtonType.md) | | [optional] +**autofill_text** | **str** | Text to be autofilled in the OTP field | [optional] +**supported_apps** | [**List[WhatsappSupportedApp]**](WhatsappSupportedApp.md) | List of supported apps for the button | [optional] +**text** | **str** | Text content of the button | [optional] +**phone_number** | **str** | Phone number for the button | [optional] +**url** | **str** | URL for the button | [optional] + +## Example + +```python +from messente_api.models.whatsapp_template_button import WhatsappTemplateButton + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsappTemplateButton from a JSON string +whatsapp_template_button_instance = WhatsappTemplateButton.from_json(json) +# print the JSON string representation of the object +print(WhatsappTemplateButton.to_json()) + +# convert the object into a dict +whatsapp_template_button_dict = whatsapp_template_button_instance.to_dict() +# create an instance of WhatsappTemplateButton from a dict +whatsapp_template_button_from_dict = WhatsappTemplateButton.from_dict(whatsapp_template_button_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappTemplateCategory.md b/docs/WhatsappTemplateCategory.md new file mode 100644 index 0000000..68b63f5 --- /dev/null +++ b/docs/WhatsappTemplateCategory.md @@ -0,0 +1,15 @@ +# WhatsappTemplateCategory + +Template category + +## Enum + +* `AUTHENTICATION` (value: `'authentication'`) + +* `MARKETING` (value: `'marketing'`) + +* `UTILITY` (value: `'utility'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappTemplateComponent.md b/docs/WhatsappTemplateComponent.md new file mode 100644 index 0000000..a40ad05 --- /dev/null +++ b/docs/WhatsappTemplateComponent.md @@ -0,0 +1,34 @@ +# WhatsappTemplateComponent + +Template component object + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**WhatsappComponentType**](WhatsappComponentType.md) | | [optional] +**format** | [**WhatsappHeaderFormat**](WhatsappHeaderFormat.md) | | [optional] +**text** | **str** | Text content of the component | [optional] +**example** | [**WhatsappTemplateExample**](WhatsappTemplateExample.md) | | [optional] +**buttons** | [**List[WhatsappTemplateButton]**](WhatsappTemplateButton.md) | List of buttons for the component | [optional] + +## Example + +```python +from messente_api.models.whatsapp_template_component import WhatsappTemplateComponent + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsappTemplateComponent from a JSON string +whatsapp_template_component_instance = WhatsappTemplateComponent.from_json(json) +# print the JSON string representation of the object +print(WhatsappTemplateComponent.to_json()) + +# convert the object into a dict +whatsapp_template_component_dict = whatsapp_template_component_instance.to_dict() +# create an instance of WhatsappTemplateComponent from a dict +whatsapp_template_component_from_dict = WhatsappTemplateComponent.from_dict(whatsapp_template_component_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappTemplateExample.md b/docs/WhatsappTemplateExample.md new file mode 100644 index 0000000..615f5d0 --- /dev/null +++ b/docs/WhatsappTemplateExample.md @@ -0,0 +1,31 @@ +# WhatsappTemplateExample + +Example of the templated content + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**header_text** | **List[str]** | Example of the templated text for the header | [optional] +**body_text** | **List[List[str]]** | Example of the templated text for the body | [optional] + +## Example + +```python +from messente_api.models.whatsapp_template_example import WhatsappTemplateExample + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsappTemplateExample from a JSON string +whatsapp_template_example_instance = WhatsappTemplateExample.from_json(json) +# print the JSON string representation of the object +print(WhatsappTemplateExample.to_json()) + +# convert the object into a dict +whatsapp_template_example_dict = whatsapp_template_example_instance.to_dict() +# create an instance of WhatsappTemplateExample from a dict +whatsapp_template_example_from_dict = WhatsappTemplateExample.from_dict(whatsapp_template_example_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappTemplateResponse.md b/docs/WhatsappTemplateResponse.md new file mode 100644 index 0000000..cea1086 --- /dev/null +++ b/docs/WhatsappTemplateResponse.md @@ -0,0 +1,35 @@ +# WhatsappTemplateResponse + +Whatsapp Cloud API template + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Template ID | +**components** | [**List[WhatsappTemplateComponent]**](WhatsappTemplateComponent.md) | List of template components | +**language** | **str** | Language of the template | +**name** | **str** | Name of the template | +**category** | [**WhatsappTemplateCategory**](WhatsappTemplateCategory.md) | | +**status** | [**WhatsappTemplateStatus**](WhatsappTemplateStatus.md) | | + +## Example + +```python +from messente_api.models.whatsapp_template_response import WhatsappTemplateResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsappTemplateResponse from a JSON string +whatsapp_template_response_instance = WhatsappTemplateResponse.from_json(json) +# print the JSON string representation of the object +print(WhatsappTemplateResponse.to_json()) + +# convert the object into a dict +whatsapp_template_response_dict = whatsapp_template_response_instance.to_dict() +# create an instance of WhatsappTemplateResponse from a dict +whatsapp_template_response_from_dict = WhatsappTemplateResponse.from_dict(whatsapp_template_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappTemplateStatus.md b/docs/WhatsappTemplateStatus.md new file mode 100644 index 0000000..293e3ab --- /dev/null +++ b/docs/WhatsappTemplateStatus.md @@ -0,0 +1,27 @@ +# WhatsappTemplateStatus + +Template status + +## Enum + +* `APPROVED` (value: `'approved'`) + +* `IN_APPEAL` (value: `'in_appeal'`) + +* `REJECTED` (value: `'rejected'`) + +* `PENDING` (value: `'pending'`) + +* `PENDING_DELETION` (value: `'pending_deletion'`) + +* `DELETED` (value: `'deleted'`) + +* `DISABLED` (value: `'disabled'`) + +* `PAUSED` (value: `'paused'`) + +* `LIMIT_EXCEEDED` (value: `'limit_exceeded'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WhatsappUpdateTemplateRequest.md b/docs/WhatsappUpdateTemplateRequest.md new file mode 100644 index 0000000..2a7a6cb --- /dev/null +++ b/docs/WhatsappUpdateTemplateRequest.md @@ -0,0 +1,31 @@ +# WhatsappUpdateTemplateRequest + +Request to create a WhatsApp template + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | [**WhatsappTemplateCategory**](WhatsappTemplateCategory.md) | | [optional] +**components** | [**List[WhatsappTemplateComponent]**](WhatsappTemplateComponent.md) | List of template components | [optional] + +## Example + +```python +from messente_api.models.whatsapp_update_template_request import WhatsappUpdateTemplateRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of WhatsappUpdateTemplateRequest from a JSON string +whatsapp_update_template_request_instance = WhatsappUpdateTemplateRequest.from_json(json) +# print the JSON string representation of the object +print(WhatsappUpdateTemplateRequest.to_json()) + +# convert the object into a dict +whatsapp_update_template_request_dict = whatsapp_update_template_request_instance.to_dict() +# create an instance of WhatsappUpdateTemplateRequest from a dict +whatsapp_update_template_request_from_dict = WhatsappUpdateTemplateRequest.from_dict(whatsapp_update_template_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/messente_api/__init__.py b/messente_api/__init__.py index d7ad337..8d8b55a 100644 --- a/messente_api/__init__.py +++ b/messente_api/__init__.py @@ -15,17 +15,21 @@ """ # noqa: E501 -__version__ = "2.4.0" +__version__ = "2.5.0" # import apis into sdk package +from messente_api.api.account_balance_api import AccountBalanceApi from messente_api.api.blacklist_api import BlacklistApi from messente_api.api.bulk_messaging_api import BulkMessagingApi from messente_api.api.contacts_api import ContactsApi from messente_api.api.delivery_report_api import DeliveryReportApi from messente_api.api.groups_api import GroupsApi from messente_api.api.number_lookup_api import NumberLookupApi +from messente_api.api.number_verification_api import NumberVerificationApi from messente_api.api.omnimessage_api import OmnimessageApi +from messente_api.api.pricing_api import PricingApi from messente_api.api.statistics_api import StatisticsApi +from messente_api.api.whats_app_templates_api import WhatsAppTemplatesApi # import ApiClient from messente_api.api_response import ApiResponse @@ -77,7 +81,9 @@ from messente_api.models.omni_message_create_success_response import OmniMessageCreateSuccessResponse from messente_api.models.omnimessage import Omnimessage from messente_api.models.omnimessage_messages_inner import OmnimessageMessagesInner +from messente_api.models.price import Price from messente_api.models.price_info import PriceInfo +from messente_api.models.price_networks_inner import PriceNetworksInner from messente_api.models.priority import Priority from messente_api.models.sms import SMS from messente_api.models.statistics_report import StatisticsReport @@ -91,11 +97,33 @@ from messente_api.models.viber import Viber from messente_api.models.viber_video import ViberVideo from messente_api.models.whats_app import WhatsApp +from messente_api.models.whats_app_audio import WhatsAppAudio from messente_api.models.whats_app_component import WhatsAppComponent from messente_api.models.whats_app_currency import WhatsAppCurrency from messente_api.models.whats_app_datetime import WhatsAppDatetime +from messente_api.models.whats_app_document import WhatsAppDocument +from messente_api.models.whats_app_image import WhatsAppImage from messente_api.models.whats_app_language import WhatsAppLanguage from messente_api.models.whats_app_media import WhatsAppMedia from messente_api.models.whats_app_parameter import WhatsAppParameter +from messente_api.models.whats_app_sticker import WhatsAppSticker from messente_api.models.whats_app_template import WhatsAppTemplate from messente_api.models.whats_app_text import WhatsAppText +from messente_api.models.whats_app_video import WhatsAppVideo +from messente_api.models.whatsapp_button_type import WhatsappButtonType +from messente_api.models.whatsapp_component_type import WhatsappComponentType +from messente_api.models.whatsapp_create_template_request import WhatsappCreateTemplateRequest +from messente_api.models.whatsapp_create_template_response import WhatsappCreateTemplateResponse +from messente_api.models.whatsapp_header_format import WhatsappHeaderFormat +from messente_api.models.whatsapp_list_templates_response import WhatsappListTemplatesResponse +from messente_api.models.whatsapp_otp_button_type import WhatsappOtpButtonType +from messente_api.models.whatsapp_pagination import WhatsappPagination +from messente_api.models.whatsapp_paging_cursors import WhatsappPagingCursors +from messente_api.models.whatsapp_supported_app import WhatsappSupportedApp +from messente_api.models.whatsapp_template_button import WhatsappTemplateButton +from messente_api.models.whatsapp_template_category import WhatsappTemplateCategory +from messente_api.models.whatsapp_template_component import WhatsappTemplateComponent +from messente_api.models.whatsapp_template_example import WhatsappTemplateExample +from messente_api.models.whatsapp_template_response import WhatsappTemplateResponse +from messente_api.models.whatsapp_template_status import WhatsappTemplateStatus +from messente_api.models.whatsapp_update_template_request import WhatsappUpdateTemplateRequest diff --git a/messente_api/api/__init__.py b/messente_api/api/__init__.py index f8f4079..846f66e 100644 --- a/messente_api/api/__init__.py +++ b/messente_api/api/__init__.py @@ -1,12 +1,16 @@ # flake8: noqa # import apis into api package +from messente_api.api.account_balance_api import AccountBalanceApi from messente_api.api.blacklist_api import BlacklistApi from messente_api.api.bulk_messaging_api import BulkMessagingApi from messente_api.api.contacts_api import ContactsApi from messente_api.api.delivery_report_api import DeliveryReportApi from messente_api.api.groups_api import GroupsApi from messente_api.api.number_lookup_api import NumberLookupApi +from messente_api.api.number_verification_api import NumberVerificationApi from messente_api.api.omnimessage_api import OmnimessageApi +from messente_api.api.pricing_api import PricingApi from messente_api.api.statistics_api import StatisticsApi +from messente_api.api.whats_app_templates_api import WhatsAppTemplatesApi diff --git a/messente_api/api/account_balance_api.py b/messente_api/api/account_balance_api.py new file mode 100644 index 0000000..4cd7fbf --- /dev/null +++ b/messente_api/api/account_balance_api.py @@ -0,0 +1,600 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated + +from messente_api.api_client import ApiClient, RequestSerialized +from messente_api.api_response import ApiResponse +from messente_api.rest import RESTResponseType + + +class AccountBalanceApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_account_balance( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> str: + """Get account balance + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_account_balance_serialize( + username=username, + password=password, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_account_balance_with_http_info( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> ApiResponse[str]: + """Get account balance + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_account_balance_serialize( + username=username, + password=password, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_account_balance_without_preload_content( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> RESTResponseType: + """Get account balance + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_account_balance_serialize( + username=username, + password=password, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_account_balance_serialize( + self, + username, + password, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api2.messente.com' + ] + _host = _hosts[_host_index] + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if username is not None: + + _query_params.append(('username', username)) + + if password is not None: + + _query_params.append(('password', password)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'text/plain' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'apiPassword', + 'apiUsername' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/get_balance', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_account_balance_using_post( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> str: + """Get account balance + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_account_balance_using_post_serialize( + username=username, + password=password, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_account_balance_using_post_with_http_info( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> ApiResponse[str]: + """Get account balance + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_account_balance_using_post_serialize( + username=username, + password=password, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_account_balance_using_post_without_preload_content( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> RESTResponseType: + """Get account balance + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_account_balance_using_post_serialize( + username=username, + password=password, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_account_balance_using_post_serialize( + self, + username, + password, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api2.messente.com' + ] + _host = _hosts[_host_index] + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if username is not None: + + _query_params.append(('username', username)) + + if password is not None: + + _query_params.append(('password', password)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'text/plain' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'apiPassword', + 'apiUsername' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/get_balance', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/messente_api/api/number_verification_api.py b/messente_api/api/number_verification_api.py new file mode 100644 index 0000000..0bdc6e6 --- /dev/null +++ b/messente_api/api/number_verification_api.py @@ -0,0 +1,856 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated + +from messente_api.api_client import ApiClient, RequestSerialized +from messente_api.api_response import ApiResponse +from messente_api.rest import RESTResponseType + + +class NumberVerificationApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def verify_number( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + to: Annotated[StrictStr, Field(description="Receiver's phone number with the country code")], + template: Annotated[Optional[StrictStr], Field(description="Template of the message, including PIN code. Placeholder for PIN code is . When not set, default template is used: \"Your Verification PIN code is \". ")] = None, + pin_length: Annotated[Optional[StrictStr], Field(description="Length of the PIN code. Minumum 4 digits, maximum 16. Defaults to 4.")] = None, + var_from: Annotated[Optional[StrictStr], Field(description="Sender name. When not set, the default Sender name \"Verigator\" is used. This sender ID also needs to be added to your account beforehand.")] = None, + max_tries: Annotated[Optional[StrictStr], Field(description="Maximum number of times the PIN code is sent in total. Defaults to \"2\" - initial PIN code and one retry. It is discouraged to set this value to \"1\" as only the initial PIN code is sent and retry is disabled. ")] = None, + retry_delay: Annotated[Optional[StrictStr], Field(description="For how long (in seconds) to wait for next retry, if the correct PIN code has not been entered yet? Defaults to 30 seconds.")] = None, + validity: Annotated[Optional[StrictStr], Field(description="For how long (in seconds) is the PIN code valid. Defaults to 5 minutes (300 seconds). Maximum 30 minutes (1800 seconds).")] = None, + ip: Annotated[Optional[StrictStr], Field(description="IP address of the client making verification request.")] = None, + browser: Annotated[Optional[StrictStr], Field(description="User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\".")] = None, + cookie: Annotated[Optional[StrictStr], Field(description="Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> str: + """verify number + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param to: Receiver's phone number with the country code (required) + :type to: str + :param template: Template of the message, including PIN code. Placeholder for PIN code is . When not set, default template is used: \"Your Verification PIN code is \". + :type template: str + :param pin_length: Length of the PIN code. Minumum 4 digits, maximum 16. Defaults to 4. + :type pin_length: str + :param var_from: Sender name. When not set, the default Sender name \"Verigator\" is used. This sender ID also needs to be added to your account beforehand. + :type var_from: str + :param max_tries: Maximum number of times the PIN code is sent in total. Defaults to \"2\" - initial PIN code and one retry. It is discouraged to set this value to \"1\" as only the initial PIN code is sent and retry is disabled. + :type max_tries: str + :param retry_delay: For how long (in seconds) to wait for next retry, if the correct PIN code has not been entered yet? Defaults to 30 seconds. + :type retry_delay: str + :param validity: For how long (in seconds) is the PIN code valid. Defaults to 5 minutes (300 seconds). Maximum 30 minutes (1800 seconds). + :type validity: str + :param ip: IP address of the client making verification request. + :type ip: str + :param browser: User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\". + :type browser: str + :param cookie: Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed. + :type cookie: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._verify_number_serialize( + username=username, + password=password, + to=to, + template=template, + pin_length=pin_length, + var_from=var_from, + max_tries=max_tries, + retry_delay=retry_delay, + validity=validity, + ip=ip, + browser=browser, + cookie=cookie, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def verify_number_with_http_info( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + to: Annotated[StrictStr, Field(description="Receiver's phone number with the country code")], + template: Annotated[Optional[StrictStr], Field(description="Template of the message, including PIN code. Placeholder for PIN code is . When not set, default template is used: \"Your Verification PIN code is \". ")] = None, + pin_length: Annotated[Optional[StrictStr], Field(description="Length of the PIN code. Minumum 4 digits, maximum 16. Defaults to 4.")] = None, + var_from: Annotated[Optional[StrictStr], Field(description="Sender name. When not set, the default Sender name \"Verigator\" is used. This sender ID also needs to be added to your account beforehand.")] = None, + max_tries: Annotated[Optional[StrictStr], Field(description="Maximum number of times the PIN code is sent in total. Defaults to \"2\" - initial PIN code and one retry. It is discouraged to set this value to \"1\" as only the initial PIN code is sent and retry is disabled. ")] = None, + retry_delay: Annotated[Optional[StrictStr], Field(description="For how long (in seconds) to wait for next retry, if the correct PIN code has not been entered yet? Defaults to 30 seconds.")] = None, + validity: Annotated[Optional[StrictStr], Field(description="For how long (in seconds) is the PIN code valid. Defaults to 5 minutes (300 seconds). Maximum 30 minutes (1800 seconds).")] = None, + ip: Annotated[Optional[StrictStr], Field(description="IP address of the client making verification request.")] = None, + browser: Annotated[Optional[StrictStr], Field(description="User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\".")] = None, + cookie: Annotated[Optional[StrictStr], Field(description="Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> ApiResponse[str]: + """verify number + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param to: Receiver's phone number with the country code (required) + :type to: str + :param template: Template of the message, including PIN code. Placeholder for PIN code is . When not set, default template is used: \"Your Verification PIN code is \". + :type template: str + :param pin_length: Length of the PIN code. Minumum 4 digits, maximum 16. Defaults to 4. + :type pin_length: str + :param var_from: Sender name. When not set, the default Sender name \"Verigator\" is used. This sender ID also needs to be added to your account beforehand. + :type var_from: str + :param max_tries: Maximum number of times the PIN code is sent in total. Defaults to \"2\" - initial PIN code and one retry. It is discouraged to set this value to \"1\" as only the initial PIN code is sent and retry is disabled. + :type max_tries: str + :param retry_delay: For how long (in seconds) to wait for next retry, if the correct PIN code has not been entered yet? Defaults to 30 seconds. + :type retry_delay: str + :param validity: For how long (in seconds) is the PIN code valid. Defaults to 5 minutes (300 seconds). Maximum 30 minutes (1800 seconds). + :type validity: str + :param ip: IP address of the client making verification request. + :type ip: str + :param browser: User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\". + :type browser: str + :param cookie: Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed. + :type cookie: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._verify_number_serialize( + username=username, + password=password, + to=to, + template=template, + pin_length=pin_length, + var_from=var_from, + max_tries=max_tries, + retry_delay=retry_delay, + validity=validity, + ip=ip, + browser=browser, + cookie=cookie, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def verify_number_without_preload_content( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + to: Annotated[StrictStr, Field(description="Receiver's phone number with the country code")], + template: Annotated[Optional[StrictStr], Field(description="Template of the message, including PIN code. Placeholder for PIN code is . When not set, default template is used: \"Your Verification PIN code is \". ")] = None, + pin_length: Annotated[Optional[StrictStr], Field(description="Length of the PIN code. Minumum 4 digits, maximum 16. Defaults to 4.")] = None, + var_from: Annotated[Optional[StrictStr], Field(description="Sender name. When not set, the default Sender name \"Verigator\" is used. This sender ID also needs to be added to your account beforehand.")] = None, + max_tries: Annotated[Optional[StrictStr], Field(description="Maximum number of times the PIN code is sent in total. Defaults to \"2\" - initial PIN code and one retry. It is discouraged to set this value to \"1\" as only the initial PIN code is sent and retry is disabled. ")] = None, + retry_delay: Annotated[Optional[StrictStr], Field(description="For how long (in seconds) to wait for next retry, if the correct PIN code has not been entered yet? Defaults to 30 seconds.")] = None, + validity: Annotated[Optional[StrictStr], Field(description="For how long (in seconds) is the PIN code valid. Defaults to 5 minutes (300 seconds). Maximum 30 minutes (1800 seconds).")] = None, + ip: Annotated[Optional[StrictStr], Field(description="IP address of the client making verification request.")] = None, + browser: Annotated[Optional[StrictStr], Field(description="User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\".")] = None, + cookie: Annotated[Optional[StrictStr], Field(description="Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> RESTResponseType: + """verify number + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param to: Receiver's phone number with the country code (required) + :type to: str + :param template: Template of the message, including PIN code. Placeholder for PIN code is . When not set, default template is used: \"Your Verification PIN code is \". + :type template: str + :param pin_length: Length of the PIN code. Minumum 4 digits, maximum 16. Defaults to 4. + :type pin_length: str + :param var_from: Sender name. When not set, the default Sender name \"Verigator\" is used. This sender ID also needs to be added to your account beforehand. + :type var_from: str + :param max_tries: Maximum number of times the PIN code is sent in total. Defaults to \"2\" - initial PIN code and one retry. It is discouraged to set this value to \"1\" as only the initial PIN code is sent and retry is disabled. + :type max_tries: str + :param retry_delay: For how long (in seconds) to wait for next retry, if the correct PIN code has not been entered yet? Defaults to 30 seconds. + :type retry_delay: str + :param validity: For how long (in seconds) is the PIN code valid. Defaults to 5 minutes (300 seconds). Maximum 30 minutes (1800 seconds). + :type validity: str + :param ip: IP address of the client making verification request. + :type ip: str + :param browser: User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\". + :type browser: str + :param cookie: Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed. + :type cookie: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._verify_number_serialize( + username=username, + password=password, + to=to, + template=template, + pin_length=pin_length, + var_from=var_from, + max_tries=max_tries, + retry_delay=retry_delay, + validity=validity, + ip=ip, + browser=browser, + cookie=cookie, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _verify_number_serialize( + self, + username, + password, + to, + template, + pin_length, + var_from, + max_tries, + retry_delay, + validity, + ip, + browser, + cookie, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api2.messente.com' + ] + _host = _hosts[_host_index] + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if username is not None: + + _query_params.append(('username', username)) + + if password is not None: + + _query_params.append(('password', password)) + + if to is not None: + + _query_params.append(('to', to)) + + if template is not None: + + _query_params.append(('template', template)) + + if pin_length is not None: + + _query_params.append(('pin_length', pin_length)) + + if var_from is not None: + + _query_params.append(('from', var_from)) + + if max_tries is not None: + + _query_params.append(('max_tries', max_tries)) + + if retry_delay is not None: + + _query_params.append(('retry_delay', retry_delay)) + + if validity is not None: + + _query_params.append(('validity', validity)) + + if ip is not None: + + _query_params.append(('ip', ip)) + + if browser is not None: + + _query_params.append(('browser', browser)) + + if cookie is not None: + + _query_params.append(('cookie', cookie)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'text/plain' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'apiPassword', + 'apiUsername' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/verify/start', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def verify_pin( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + verification_id: Annotated[StrictStr, Field(description="Verification ID returned by the successful verification request.")], + pin: Annotated[StrictStr, Field(description="PIN code entered by the user.")], + ip: Annotated[Optional[StrictStr], Field(description="IP address of the client making verification request. If the IP address is from another country, PIN is required even if the cookies match.")] = None, + browser: Annotated[Optional[StrictStr], Field(description="User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\".")] = None, + cookie: Annotated[Optional[StrictStr], Field(description="Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> str: + """verified the PIN code entered by the user. + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param verification_id: Verification ID returned by the successful verification request. (required) + :type verification_id: str + :param pin: PIN code entered by the user. (required) + :type pin: str + :param ip: IP address of the client making verification request. If the IP address is from another country, PIN is required even if the cookies match. + :type ip: str + :param browser: User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\". + :type browser: str + :param cookie: Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed. + :type cookie: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._verify_pin_serialize( + username=username, + password=password, + verification_id=verification_id, + pin=pin, + ip=ip, + browser=browser, + cookie=cookie, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def verify_pin_with_http_info( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + verification_id: Annotated[StrictStr, Field(description="Verification ID returned by the successful verification request.")], + pin: Annotated[StrictStr, Field(description="PIN code entered by the user.")], + ip: Annotated[Optional[StrictStr], Field(description="IP address of the client making verification request. If the IP address is from another country, PIN is required even if the cookies match.")] = None, + browser: Annotated[Optional[StrictStr], Field(description="User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\".")] = None, + cookie: Annotated[Optional[StrictStr], Field(description="Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> ApiResponse[str]: + """verified the PIN code entered by the user. + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param verification_id: Verification ID returned by the successful verification request. (required) + :type verification_id: str + :param pin: PIN code entered by the user. (required) + :type pin: str + :param ip: IP address of the client making verification request. If the IP address is from another country, PIN is required even if the cookies match. + :type ip: str + :param browser: User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\". + :type browser: str + :param cookie: Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed. + :type cookie: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._verify_pin_serialize( + username=username, + password=password, + verification_id=verification_id, + pin=pin, + ip=ip, + browser=browser, + cookie=cookie, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def verify_pin_without_preload_content( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + verification_id: Annotated[StrictStr, Field(description="Verification ID returned by the successful verification request.")], + pin: Annotated[StrictStr, Field(description="PIN code entered by the user.")], + ip: Annotated[Optional[StrictStr], Field(description="IP address of the client making verification request. If the IP address is from another country, PIN is required even if the cookies match.")] = None, + browser: Annotated[Optional[StrictStr], Field(description="User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\".")] = None, + cookie: Annotated[Optional[StrictStr], Field(description="Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> RESTResponseType: + """verified the PIN code entered by the user. + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param verification_id: Verification ID returned by the successful verification request. (required) + :type verification_id: str + :param pin: PIN code entered by the user. (required) + :type pin: str + :param ip: IP address of the client making verification request. If the IP address is from another country, PIN is required even if the cookies match. + :type ip: str + :param browser: User Agent of the browser. For example \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36\". + :type browser: str + :param cookie: Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed. + :type cookie: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._verify_pin_serialize( + username=username, + password=password, + verification_id=verification_id, + pin=pin, + ip=ip, + browser=browser, + cookie=cookie, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _verify_pin_serialize( + self, + username, + password, + verification_id, + pin, + ip, + browser, + cookie, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api2.messente.com' + ] + _host = _hosts[_host_index] + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if username is not None: + + _query_params.append(('username', username)) + + if password is not None: + + _query_params.append(('password', password)) + + if verification_id is not None: + + _query_params.append(('verification_id', verification_id)) + + if pin is not None: + + _query_params.append(('pin', pin)) + + if ip is not None: + + _query_params.append(('ip', ip)) + + if browser is not None: + + _query_params.append(('browser', browser)) + + if cookie is not None: + + _query_params.append(('cookie', cookie)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'text/plain' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'apiPassword', + 'apiUsername' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/verify/pin', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/messente_api/api/pricing_api.py b/messente_api/api/pricing_api.py new file mode 100644 index 0000000..11582f2 --- /dev/null +++ b/messente_api/api/pricing_api.py @@ -0,0 +1,638 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated +from messente_api.models.price import Price + +from messente_api.api_client import ApiClient, RequestSerialized +from messente_api.api_response import ApiResponse +from messente_api.rest import RESTResponseType + + +class PricingApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_pricelist( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> str: + """Get pricelist for account + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pricelist_serialize( + username=username, + password=password, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_pricelist_with_http_info( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> ApiResponse[str]: + """Get pricelist for account + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pricelist_serialize( + username=username, + password=password, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_pricelist_without_preload_content( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> RESTResponseType: + """Get pricelist for account + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pricelist_serialize( + username=username, + password=password, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_pricelist_serialize( + self, + username, + password, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api2.messente.com' + ] + _host = _hosts[_host_index] + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if username is not None: + + _query_params.append(('username', username)) + + if password is not None: + + _query_params.append(('password', password)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'text/plain' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'apiPassword', + 'apiUsername' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pricelist', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_prices( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + country: Annotated[StrictStr, Field(description="The country code, for which to get the prices")], + format: Annotated[Optional[StrictStr], Field(description="The format of the response. Can be either 'json' or 'xml'. If not specified, defaults to 'json'.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> Price: + """Get pricing for a specific country + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param country: The country code, for which to get the prices (required) + :type country: str + :param format: The format of the response. Can be either 'json' or 'xml'. If not specified, defaults to 'json'. + :type format: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_prices_serialize( + username=username, + password=password, + country=country, + format=format, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Price", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_prices_with_http_info( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + country: Annotated[StrictStr, Field(description="The country code, for which to get the prices")], + format: Annotated[Optional[StrictStr], Field(description="The format of the response. Can be either 'json' or 'xml'. If not specified, defaults to 'json'.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> ApiResponse[Price]: + """Get pricing for a specific country + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param country: The country code, for which to get the prices (required) + :type country: str + :param format: The format of the response. Can be either 'json' or 'xml'. If not specified, defaults to 'json'. + :type format: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_prices_serialize( + username=username, + password=password, + country=country, + format=format, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Price", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_prices_without_preload_content( + self, + username: Annotated[StrictStr, Field(description="The API username")], + password: Annotated[StrictStr, Field(description="The API password")], + country: Annotated[StrictStr, Field(description="The country code, for which to get the prices")], + format: Annotated[Optional[StrictStr], Field(description="The format of the response. Can be either 'json' or 'xml'. If not specified, defaults to 'json'.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> RESTResponseType: + """Get pricing for a specific country + + + :param username: The API username (required) + :type username: str + :param password: The API password (required) + :type password: str + :param country: The country code, for which to get the prices (required) + :type country: str + :param format: The format of the response. Can be either 'json' or 'xml'. If not specified, defaults to 'json'. + :type format: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_prices_serialize( + username=username, + password=password, + country=country, + format=format, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Price", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_prices_serialize( + self, + username, + password, + country, + format, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api2.messente.com' + ] + _host = _hosts[_host_index] + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if username is not None: + + _query_params.append(('username', username)) + + if password is not None: + + _query_params.append(('password', password)) + + if country is not None: + + _query_params.append(('country', country)) + + if format is not None: + + _query_params.append(('format', format)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json', + 'application/xml', + 'text/plain; charset=utf-8' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'apiPassword', + 'apiUsername' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/prices', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/messente_api/api/whats_app_templates_api.py b/messente_api/api/whats_app_templates_api.py new file mode 100644 index 0000000..c34381f --- /dev/null +++ b/messente_api/api/whats_app_templates_api.py @@ -0,0 +1,1652 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing import Any, Dict, Optional +from typing_extensions import Annotated +from messente_api.models.whatsapp_create_template_request import WhatsappCreateTemplateRequest +from messente_api.models.whatsapp_create_template_response import WhatsappCreateTemplateResponse +from messente_api.models.whatsapp_list_templates_response import WhatsappListTemplatesResponse +from messente_api.models.whatsapp_template_category import WhatsappTemplateCategory +from messente_api.models.whatsapp_template_response import WhatsappTemplateResponse +from messente_api.models.whatsapp_template_status import WhatsappTemplateStatus +from messente_api.models.whatsapp_update_template_request import WhatsappUpdateTemplateRequest + +from messente_api.api_client import ApiClient, RequestSerialized +from messente_api.api_response import ApiResponse +from messente_api.rest import RESTResponseType + + +class WhatsAppTemplatesApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_whatsapp_template( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + whatsapp_create_template_request: Annotated[WhatsappCreateTemplateRequest, Field(description="The WhatsApp template to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> WhatsappCreateTemplateResponse: + """Creates a WhatsApp template + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param whatsapp_create_template_request: The WhatsApp template to create (required) + :type whatsapp_create_template_request: WhatsappCreateTemplateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_whatsapp_template_serialize( + waba_id=waba_id, + whatsapp_create_template_request=whatsapp_create_template_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WhatsappCreateTemplateResponse", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_whatsapp_template_with_http_info( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + whatsapp_create_template_request: Annotated[WhatsappCreateTemplateRequest, Field(description="The WhatsApp template to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[WhatsappCreateTemplateResponse]: + """Creates a WhatsApp template + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param whatsapp_create_template_request: The WhatsApp template to create (required) + :type whatsapp_create_template_request: WhatsappCreateTemplateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_whatsapp_template_serialize( + waba_id=waba_id, + whatsapp_create_template_request=whatsapp_create_template_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WhatsappCreateTemplateResponse", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_whatsapp_template_without_preload_content( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + whatsapp_create_template_request: Annotated[WhatsappCreateTemplateRequest, Field(description="The WhatsApp template to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Creates a WhatsApp template + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param whatsapp_create_template_request: The WhatsApp template to create (required) + :type whatsapp_create_template_request: WhatsappCreateTemplateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_whatsapp_template_serialize( + waba_id=waba_id, + whatsapp_create_template_request=whatsapp_create_template_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WhatsappCreateTemplateResponse", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_whatsapp_template_serialize( + self, + waba_id, + whatsapp_create_template_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if waba_id is not None: + _path_params['wabaId'] = waba_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if whatsapp_create_template_request is not None: + _body_params = whatsapp_create_template_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'basicAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/whatsapp/wabas/{wabaId}/templates', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_whatsapp_template( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + name: Annotated[StrictStr, Field(description="The name of the template to delete")], + hsm_id: Annotated[Optional[StrictStr], Field(description="The ID of the template to delete")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> object: + """Deletes a WhatsApp template + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param name: The name of the template to delete (required) + :type name: str + :param hsm_id: The ID of the template to delete + :type hsm_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_whatsapp_template_serialize( + waba_id=waba_id, + name=name, + hsm_id=hsm_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_whatsapp_template_with_http_info( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + name: Annotated[StrictStr, Field(description="The name of the template to delete")], + hsm_id: Annotated[Optional[StrictStr], Field(description="The ID of the template to delete")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[object]: + """Deletes a WhatsApp template + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param name: The name of the template to delete (required) + :type name: str + :param hsm_id: The ID of the template to delete + :type hsm_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_whatsapp_template_serialize( + waba_id=waba_id, + name=name, + hsm_id=hsm_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_whatsapp_template_without_preload_content( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + name: Annotated[StrictStr, Field(description="The name of the template to delete")], + hsm_id: Annotated[Optional[StrictStr], Field(description="The ID of the template to delete")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Deletes a WhatsApp template + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param name: The name of the template to delete (required) + :type name: str + :param hsm_id: The ID of the template to delete + :type hsm_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_whatsapp_template_serialize( + waba_id=waba_id, + name=name, + hsm_id=hsm_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_whatsapp_template_serialize( + self, + waba_id, + name, + hsm_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if waba_id is not None: + _path_params['wabaId'] = waba_id + # process the query parameters + if name is not None: + + _query_params.append(('name', name)) + + if hsm_id is not None: + + _query_params.append(('hsmId', hsm_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'basicAuth' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/whatsapp/wabas/{wabaId}/templates', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_whatsapp_template_by_id( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + template_id: Annotated[StrictStr, Field(description="The ID of the template to retrieve")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> WhatsappTemplateResponse: + """Requests a WhatsApp template with the given ID + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param template_id: The ID of the template to retrieve (required) + :type template_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_whatsapp_template_by_id_serialize( + waba_id=waba_id, + template_id=template_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WhatsappTemplateResponse", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_whatsapp_template_by_id_with_http_info( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + template_id: Annotated[StrictStr, Field(description="The ID of the template to retrieve")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[WhatsappTemplateResponse]: + """Requests a WhatsApp template with the given ID + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param template_id: The ID of the template to retrieve (required) + :type template_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_whatsapp_template_by_id_serialize( + waba_id=waba_id, + template_id=template_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WhatsappTemplateResponse", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_whatsapp_template_by_id_without_preload_content( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + template_id: Annotated[StrictStr, Field(description="The ID of the template to retrieve")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Requests a WhatsApp template with the given ID + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param template_id: The ID of the template to retrieve (required) + :type template_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_whatsapp_template_by_id_serialize( + waba_id=waba_id, + template_id=template_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WhatsappTemplateResponse", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_whatsapp_template_by_id_serialize( + self, + waba_id, + template_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if waba_id is not None: + _path_params['wabaId'] = waba_id + if template_id is not None: + _path_params['templateId'] = template_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'basicAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/whatsapp/wabas/{wabaId}/templates/{templateId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_whatsapp_templates( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + limit: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="The number of templates to return in the list. Although the max size is 500, for large datasets it is recommended to use a lower limit and instead use pagination to avoid potential timeouts. Defaults to 25.")] = None, + before: Annotated[Optional[StrictStr], Field(description="A cursor point used for a paginated request to indicate the template to paginate backwards from.")] = None, + after: Annotated[Optional[StrictStr], Field(description="A cursor point used for a paginated request to indicate the template to paginate forwards from.")] = None, + category: Annotated[Optional[WhatsappTemplateCategory], Field(description="A filter for returning only templates matching a specific category.")] = None, + content: Annotated[Optional[StrictStr], Field(description="A search filter representing the content of a template. Only matching templates will be returned in the list.")] = None, + language: Annotated[Optional[StrictStr], Field(description="A filter for returning only templates matching a specific language code. A list of supported languages is available in the [WhatsApp documentation](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates/) ")] = None, + name: Annotated[Optional[StrictStr], Field(description="A search filter representing the name, either full or partial, of a template. Only matching templates will be returned in the list.")] = None, + status: Annotated[Optional[WhatsappTemplateStatus], Field(description="A filter for returning only templates matching a specific status.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> WhatsappListTemplatesResponse: + """Requests a list of WhatsApp templates + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param limit: The number of templates to return in the list. Although the max size is 500, for large datasets it is recommended to use a lower limit and instead use pagination to avoid potential timeouts. Defaults to 25. + :type limit: int + :param before: A cursor point used for a paginated request to indicate the template to paginate backwards from. + :type before: str + :param after: A cursor point used for a paginated request to indicate the template to paginate forwards from. + :type after: str + :param category: A filter for returning only templates matching a specific category. + :type category: WhatsappTemplateCategory + :param content: A search filter representing the content of a template. Only matching templates will be returned in the list. + :type content: str + :param language: A filter for returning only templates matching a specific language code. A list of supported languages is available in the [WhatsApp documentation](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates/) + :type language: str + :param name: A search filter representing the name, either full or partial, of a template. Only matching templates will be returned in the list. + :type name: str + :param status: A filter for returning only templates matching a specific status. + :type status: WhatsappTemplateStatus + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_whatsapp_templates_serialize( + waba_id=waba_id, + limit=limit, + before=before, + after=after, + category=category, + content=content, + language=language, + name=name, + status=status, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WhatsappListTemplatesResponse", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_whatsapp_templates_with_http_info( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + limit: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="The number of templates to return in the list. Although the max size is 500, for large datasets it is recommended to use a lower limit and instead use pagination to avoid potential timeouts. Defaults to 25.")] = None, + before: Annotated[Optional[StrictStr], Field(description="A cursor point used for a paginated request to indicate the template to paginate backwards from.")] = None, + after: Annotated[Optional[StrictStr], Field(description="A cursor point used for a paginated request to indicate the template to paginate forwards from.")] = None, + category: Annotated[Optional[WhatsappTemplateCategory], Field(description="A filter for returning only templates matching a specific category.")] = None, + content: Annotated[Optional[StrictStr], Field(description="A search filter representing the content of a template. Only matching templates will be returned in the list.")] = None, + language: Annotated[Optional[StrictStr], Field(description="A filter for returning only templates matching a specific language code. A list of supported languages is available in the [WhatsApp documentation](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates/) ")] = None, + name: Annotated[Optional[StrictStr], Field(description="A search filter representing the name, either full or partial, of a template. Only matching templates will be returned in the list.")] = None, + status: Annotated[Optional[WhatsappTemplateStatus], Field(description="A filter for returning only templates matching a specific status.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[WhatsappListTemplatesResponse]: + """Requests a list of WhatsApp templates + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param limit: The number of templates to return in the list. Although the max size is 500, for large datasets it is recommended to use a lower limit and instead use pagination to avoid potential timeouts. Defaults to 25. + :type limit: int + :param before: A cursor point used for a paginated request to indicate the template to paginate backwards from. + :type before: str + :param after: A cursor point used for a paginated request to indicate the template to paginate forwards from. + :type after: str + :param category: A filter for returning only templates matching a specific category. + :type category: WhatsappTemplateCategory + :param content: A search filter representing the content of a template. Only matching templates will be returned in the list. + :type content: str + :param language: A filter for returning only templates matching a specific language code. A list of supported languages is available in the [WhatsApp documentation](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates/) + :type language: str + :param name: A search filter representing the name, either full or partial, of a template. Only matching templates will be returned in the list. + :type name: str + :param status: A filter for returning only templates matching a specific status. + :type status: WhatsappTemplateStatus + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_whatsapp_templates_serialize( + waba_id=waba_id, + limit=limit, + before=before, + after=after, + category=category, + content=content, + language=language, + name=name, + status=status, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WhatsappListTemplatesResponse", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_whatsapp_templates_without_preload_content( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + limit: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="The number of templates to return in the list. Although the max size is 500, for large datasets it is recommended to use a lower limit and instead use pagination to avoid potential timeouts. Defaults to 25.")] = None, + before: Annotated[Optional[StrictStr], Field(description="A cursor point used for a paginated request to indicate the template to paginate backwards from.")] = None, + after: Annotated[Optional[StrictStr], Field(description="A cursor point used for a paginated request to indicate the template to paginate forwards from.")] = None, + category: Annotated[Optional[WhatsappTemplateCategory], Field(description="A filter for returning only templates matching a specific category.")] = None, + content: Annotated[Optional[StrictStr], Field(description="A search filter representing the content of a template. Only matching templates will be returned in the list.")] = None, + language: Annotated[Optional[StrictStr], Field(description="A filter for returning only templates matching a specific language code. A list of supported languages is available in the [WhatsApp documentation](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates/) ")] = None, + name: Annotated[Optional[StrictStr], Field(description="A search filter representing the name, either full or partial, of a template. Only matching templates will be returned in the list.")] = None, + status: Annotated[Optional[WhatsappTemplateStatus], Field(description="A filter for returning only templates matching a specific status.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Requests a list of WhatsApp templates + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param limit: The number of templates to return in the list. Although the max size is 500, for large datasets it is recommended to use a lower limit and instead use pagination to avoid potential timeouts. Defaults to 25. + :type limit: int + :param before: A cursor point used for a paginated request to indicate the template to paginate backwards from. + :type before: str + :param after: A cursor point used for a paginated request to indicate the template to paginate forwards from. + :type after: str + :param category: A filter for returning only templates matching a specific category. + :type category: WhatsappTemplateCategory + :param content: A search filter representing the content of a template. Only matching templates will be returned in the list. + :type content: str + :param language: A filter for returning only templates matching a specific language code. A list of supported languages is available in the [WhatsApp documentation](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates/) + :type language: str + :param name: A search filter representing the name, either full or partial, of a template. Only matching templates will be returned in the list. + :type name: str + :param status: A filter for returning only templates matching a specific status. + :type status: WhatsappTemplateStatus + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_whatsapp_templates_serialize( + waba_id=waba_id, + limit=limit, + before=before, + after=after, + category=category, + content=content, + language=language, + name=name, + status=status, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WhatsappListTemplatesResponse", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_whatsapp_templates_serialize( + self, + waba_id, + limit, + before, + after, + category, + content, + language, + name, + status, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if waba_id is not None: + _path_params['wabaId'] = waba_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if before is not None: + + _query_params.append(('before', before)) + + if after is not None: + + _query_params.append(('after', after)) + + if category is not None: + + _query_params.append(('category', category.value)) + + if content is not None: + + _query_params.append(('content', content)) + + if language is not None: + + _query_params.append(('language', language)) + + if name is not None: + + _query_params.append(('name', name)) + + if status is not None: + + _query_params.append(('status', status.value)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'basicAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/whatsapp/wabas/{wabaId}/templates', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_whatsapp_template( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + template_id: Annotated[StrictStr, Field(description="The ID of the template to update")], + whatsapp_update_template_request: Annotated[Optional[WhatsappUpdateTemplateRequest], Field(description="The template data to be updated")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> object: + """Updates a WhatsApp template + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param template_id: The ID of the template to update (required) + :type template_id: str + :param whatsapp_update_template_request: The template data to be updated (required) + :type whatsapp_update_template_request: WhatsappUpdateTemplateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_whatsapp_template_serialize( + waba_id=waba_id, + template_id=template_id, + whatsapp_update_template_request=whatsapp_update_template_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_whatsapp_template_with_http_info( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + template_id: Annotated[StrictStr, Field(description="The ID of the template to update")], + whatsapp_update_template_request: Annotated[Optional[WhatsappUpdateTemplateRequest], Field(description="The template data to be updated")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[object]: + """Updates a WhatsApp template + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param template_id: The ID of the template to update (required) + :type template_id: str + :param whatsapp_update_template_request: The template data to be updated (required) + :type whatsapp_update_template_request: WhatsappUpdateTemplateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_whatsapp_template_serialize( + waba_id=waba_id, + template_id=template_id, + whatsapp_update_template_request=whatsapp_update_template_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_whatsapp_template_without_preload_content( + self, + waba_id: Annotated[StrictStr, Field(description="The ID of the WABA")], + template_id: Annotated[StrictStr, Field(description="The ID of the template to update")], + whatsapp_update_template_request: Annotated[Optional[WhatsappUpdateTemplateRequest], Field(description="The template data to be updated")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Updates a WhatsApp template + + + :param waba_id: The ID of the WABA (required) + :type waba_id: str + :param template_id: The ID of the template to update (required) + :type template_id: str + :param whatsapp_update_template_request: The template data to be updated (required) + :type whatsapp_update_template_request: WhatsappUpdateTemplateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_whatsapp_template_serialize( + waba_id=waba_id, + template_id=template_id, + whatsapp_update_template_request=whatsapp_update_template_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '400': "ErrorOmnichannel", + '401': "ErrorOmnichannel", + '403': "ErrorOmnichannel", + '500': "ErrorOmnichannel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_whatsapp_template_serialize( + self, + waba_id, + template_id, + whatsapp_update_template_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if waba_id is not None: + _path_params['wabaId'] = waba_id + if template_id is not None: + _path_params['templateId'] = template_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if whatsapp_update_template_request is not None: + _body_params = whatsapp_update_template_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'basicAuth' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/whatsapp/wabas/{wabaId}/templates/{templateId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/messente_api/api_client.py b/messente_api/api_client.py index 81ff8b1..947b8c5 100644 --- a/messente_api/api_client.py +++ b/messente_api/api_client.py @@ -91,7 +91,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/2.4.0/python' + self.user_agent = 'OpenAPI-Generator/2.5.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/messente_api/configuration.py b/messente_api/configuration.py index 1ff6537..78720d6 100644 --- a/messente_api/configuration.py +++ b/messente_api/configuration.py @@ -115,6 +115,8 @@ "AuthSettings", { "basicAuth": BasicAuthSetting, + "apiUsername": APIKeyAuthSetting, + "apiPassword": APIKeyAuthSetting, }, total=False, ) @@ -165,6 +167,25 @@ class Configuration: :Example: + API Key Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + cookieAuth: # name for the security scheme + type: apiKey + in: cookie + name: JSESSIONID # cookie name + + You can programmatically set the cookie: + +conf = messente_api.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + + The following cookie will be added to the HTTP request: + Cookie: JSESSIONID abc123 + HTTP Basic Authentication Example. Given the following security scheme in the OpenAPI specification: components: @@ -509,6 +530,24 @@ def auth_settings(self)-> AuthSettings: 'key': 'Authorization', 'value': self.get_basic_auth_token() } + if 'apiUsername' in self.api_key: + auth['apiUsername'] = { + 'type': 'api_key', + 'in': 'query', + 'key': 'username', + 'value': self.get_api_key_with_prefix( + 'apiUsername', + ), + } + if 'apiPassword' in self.api_key: + auth['apiPassword'] = { + 'type': 'api_key', + 'in': 'query', + 'key': 'password', + 'value': self.get_api_key_with_prefix( + 'apiPassword', + ), + } return auth def to_debug_report(self) -> str: @@ -520,7 +559,7 @@ def to_debug_report(self) -> str: "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 2.0.0\n"\ - "SDK Package Version: 2.4.0".\ + "SDK Package Version: 2.5.0".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self) -> List[HostSetting]: diff --git a/messente_api/models/__init__.py b/messente_api/models/__init__.py index 57fc05d..f6da3b3 100644 --- a/messente_api/models/__init__.py +++ b/messente_api/models/__init__.py @@ -53,7 +53,9 @@ from messente_api.models.omni_message_create_success_response import OmniMessageCreateSuccessResponse from messente_api.models.omnimessage import Omnimessage from messente_api.models.omnimessage_messages_inner import OmnimessageMessagesInner +from messente_api.models.price import Price from messente_api.models.price_info import PriceInfo +from messente_api.models.price_networks_inner import PriceNetworksInner from messente_api.models.priority import Priority from messente_api.models.sms import SMS from messente_api.models.statistics_report import StatisticsReport @@ -67,11 +69,33 @@ from messente_api.models.viber import Viber from messente_api.models.viber_video import ViberVideo from messente_api.models.whats_app import WhatsApp +from messente_api.models.whats_app_audio import WhatsAppAudio from messente_api.models.whats_app_component import WhatsAppComponent from messente_api.models.whats_app_currency import WhatsAppCurrency from messente_api.models.whats_app_datetime import WhatsAppDatetime +from messente_api.models.whats_app_document import WhatsAppDocument +from messente_api.models.whats_app_image import WhatsAppImage from messente_api.models.whats_app_language import WhatsAppLanguage from messente_api.models.whats_app_media import WhatsAppMedia from messente_api.models.whats_app_parameter import WhatsAppParameter +from messente_api.models.whats_app_sticker import WhatsAppSticker from messente_api.models.whats_app_template import WhatsAppTemplate from messente_api.models.whats_app_text import WhatsAppText +from messente_api.models.whats_app_video import WhatsAppVideo +from messente_api.models.whatsapp_button_type import WhatsappButtonType +from messente_api.models.whatsapp_component_type import WhatsappComponentType +from messente_api.models.whatsapp_create_template_request import WhatsappCreateTemplateRequest +from messente_api.models.whatsapp_create_template_response import WhatsappCreateTemplateResponse +from messente_api.models.whatsapp_header_format import WhatsappHeaderFormat +from messente_api.models.whatsapp_list_templates_response import WhatsappListTemplatesResponse +from messente_api.models.whatsapp_otp_button_type import WhatsappOtpButtonType +from messente_api.models.whatsapp_pagination import WhatsappPagination +from messente_api.models.whatsapp_paging_cursors import WhatsappPagingCursors +from messente_api.models.whatsapp_supported_app import WhatsappSupportedApp +from messente_api.models.whatsapp_template_button import WhatsappTemplateButton +from messente_api.models.whatsapp_template_category import WhatsappTemplateCategory +from messente_api.models.whatsapp_template_component import WhatsappTemplateComponent +from messente_api.models.whatsapp_template_example import WhatsappTemplateExample +from messente_api.models.whatsapp_template_response import WhatsappTemplateResponse +from messente_api.models.whatsapp_template_status import WhatsappTemplateStatus +from messente_api.models.whatsapp_update_template_request import WhatsappUpdateTemplateRequest diff --git a/messente_api/models/price.py b/messente_api/models/price.py new file mode 100644 index 0000000..8ca0777 --- /dev/null +++ b/messente_api/models/price.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from messente_api.models.price_networks_inner import PriceNetworksInner +from typing import Optional, Set +from typing_extensions import Self + +class Price(BaseModel): + """ + An object containing the pricing information for a given country + """ # noqa: E501 + country: StrictStr = Field(description="The alpha-2 code for the country") + name: StrictStr = Field(description="The name of the country") + prefix: StrictStr = Field(description="The country code prefix") + networks: List[PriceNetworksInner] = Field(description="A list of networks available in the country") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["country", "name", "prefix", "networks"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Price from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in networks (list) + _items = [] + if self.networks: + for _item_networks in self.networks: + if _item_networks: + _items.append(_item_networks.to_dict()) + _dict['networks'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Price from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "country": obj.get("country"), + "name": obj.get("name"), + "prefix": obj.get("prefix"), + "networks": [PriceNetworksInner.from_dict(_item) for _item in obj["networks"]] if obj.get("networks") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/price_networks_inner.py b/messente_api/models/price_networks_inner.py new file mode 100644 index 0000000..3837891 --- /dev/null +++ b/messente_api/models/price_networks_inner.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class PriceNetworksInner(BaseModel): + """ + An object containing the network information + """ # noqa: E501 + name: StrictStr = Field(description="The name of the network") + price: StrictStr = Field(description="The price for sending a message to this network") + mccmnc: Union[StrictFloat, StrictInt] = Field(description="The MCCMNC code for the network") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "price", "mccmnc"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PriceNetworksInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PriceNetworksInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "price": obj.get("price"), + "mccmnc": obj.get("mccmnc") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whats_app.py b/messente_api/models/whats_app.py index 9f8cca7..3786e34 100644 --- a/messente_api/models/whats_app.py +++ b/messente_api/models/whats_app.py @@ -20,8 +20,13 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional +from messente_api.models.whats_app_audio import WhatsAppAudio +from messente_api.models.whats_app_document import WhatsAppDocument +from messente_api.models.whats_app_image import WhatsAppImage +from messente_api.models.whats_app_sticker import WhatsAppSticker from messente_api.models.whats_app_template import WhatsAppTemplate from messente_api.models.whats_app_text import WhatsAppText +from messente_api.models.whats_app_video import WhatsAppVideo from typing import Optional, Set from typing_extensions import Self @@ -33,10 +38,15 @@ class WhatsApp(BaseModel): validity: Optional[StrictInt] = Field(default=None, description="After how many minutes this channel is considered as failed and the next channel is attempted") ttl: Optional[StrictInt] = Field(default=None, description="After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used.") template: Optional[WhatsAppTemplate] = None - text: Optional[WhatsAppText] = None channel: Optional[StrictStr] = Field(default='whatsapp', description="The channel used to deliver the message") + text: Optional[WhatsAppText] = None + image: Optional[WhatsAppImage] = None + video: Optional[WhatsAppVideo] = None + audio: Optional[WhatsAppAudio] = None + document: Optional[WhatsAppDocument] = None + sticker: Optional[WhatsAppSticker] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["sender", "validity", "ttl", "template", "text", "channel"] + __properties: ClassVar[List[str]] = ["sender", "validity", "ttl", "template", "channel", "text", "image", "video", "audio", "document", "sticker"] @field_validator('channel') def channel_validate_enum(cls, value): @@ -95,6 +105,21 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of text if self.text: _dict['text'] = self.text.to_dict() + # override the default output from pydantic by calling `to_dict()` of image + if self.image: + _dict['image'] = self.image.to_dict() + # override the default output from pydantic by calling `to_dict()` of video + if self.video: + _dict['video'] = self.video.to_dict() + # override the default output from pydantic by calling `to_dict()` of audio + if self.audio: + _dict['audio'] = self.audio.to_dict() + # override the default output from pydantic by calling `to_dict()` of document + if self.document: + _dict['document'] = self.document.to_dict() + # override the default output from pydantic by calling `to_dict()` of sticker + if self.sticker: + _dict['sticker'] = self.sticker.to_dict() # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -116,8 +141,13 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "validity": obj.get("validity"), "ttl": obj.get("ttl"), "template": WhatsAppTemplate.from_dict(obj["template"]) if obj.get("template") is not None else None, + "channel": obj.get("channel") if obj.get("channel") is not None else 'whatsapp', "text": WhatsAppText.from_dict(obj["text"]) if obj.get("text") is not None else None, - "channel": obj.get("channel") if obj.get("channel") is not None else 'whatsapp' + "image": WhatsAppImage.from_dict(obj["image"]) if obj.get("image") is not None else None, + "video": WhatsAppVideo.from_dict(obj["video"]) if obj.get("video") is not None else None, + "audio": WhatsAppAudio.from_dict(obj["audio"]) if obj.get("audio") is not None else None, + "document": WhatsAppDocument.from_dict(obj["document"]) if obj.get("document") is not None else None, + "sticker": WhatsAppSticker.from_dict(obj["sticker"]) if obj.get("sticker") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/messente_api/models/whats_app_audio.py b/messente_api/models/whats_app_audio.py new file mode 100644 index 0000000..f19d902 --- /dev/null +++ b/messente_api/models/whats_app_audio.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class WhatsAppAudio(BaseModel): + """ + WhatsApp audio content. Either \"id\" or \"link\" must be provided, but not both. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier for the audio file.") + mime_type: Optional[StrictStr] = Field(default=None, description="MIME type of the audio file.") + link: Optional[StrictStr] = Field(default=None, description="URL link to the audio file.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "mime_type", "link"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsAppAudio from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if mime_type (nullable) is None + # and model_fields_set contains the field + if self.mime_type is None and "mime_type" in self.model_fields_set: + _dict['mime_type'] = None + + # set to None if link (nullable) is None + # and model_fields_set contains the field + if self.link is None and "link" in self.model_fields_set: + _dict['link'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsAppAudio from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "mime_type": obj.get("mime_type"), + "link": obj.get("link") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whats_app_component.py b/messente_api/models/whats_app_component.py index 97d362c..ebaa0b7 100644 --- a/messente_api/models/whats_app_component.py +++ b/messente_api/models/whats_app_component.py @@ -88,6 +88,11 @@ def to_dict(self) -> Dict[str, Any]: for _key, _value in self.additional_properties.items(): _dict[_key] = _value + # set to None if index (nullable) is None + # and model_fields_set contains the field + if self.index is None and "index" in self.model_fields_set: + _dict['index'] = None + return _dict @classmethod diff --git a/messente_api/models/whats_app_document.py b/messente_api/models/whats_app_document.py new file mode 100644 index 0000000..4aacfd2 --- /dev/null +++ b/messente_api/models/whats_app_document.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class WhatsAppDocument(BaseModel): + """ + WhatsApp document content. Either \"id\" or \"link\" must be provided, but not both. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier for the document file.") + caption: Optional[StrictStr] = Field(default=None, description="Caption for the document.") + mime_type: Optional[StrictStr] = Field(default=None, description="MIME type of the document file.") + file_name: Optional[StrictStr] = Field(default=None, description="Name of the document file.") + link: Optional[StrictStr] = Field(default=None, description="URL link to the document file.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "caption", "mime_type", "file_name", "link"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsAppDocument from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if caption (nullable) is None + # and model_fields_set contains the field + if self.caption is None and "caption" in self.model_fields_set: + _dict['caption'] = None + + # set to None if mime_type (nullable) is None + # and model_fields_set contains the field + if self.mime_type is None and "mime_type" in self.model_fields_set: + _dict['mime_type'] = None + + # set to None if file_name (nullable) is None + # and model_fields_set contains the field + if self.file_name is None and "file_name" in self.model_fields_set: + _dict['file_name'] = None + + # set to None if link (nullable) is None + # and model_fields_set contains the field + if self.link is None and "link" in self.model_fields_set: + _dict['link'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsAppDocument from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "caption": obj.get("caption"), + "mime_type": obj.get("mime_type"), + "file_name": obj.get("file_name"), + "link": obj.get("link") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whats_app_image.py b/messente_api/models/whats_app_image.py new file mode 100644 index 0000000..2b5fe9a --- /dev/null +++ b/messente_api/models/whats_app_image.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class WhatsAppImage(BaseModel): + """ + WhatsApp image content. Either \"id\" or \"link\" must be provided, but not both. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier for the image file.") + caption: Optional[StrictStr] = Field(default=None, description="Caption for the image.") + mime_type: Optional[StrictStr] = Field(default=None, description="MIME type of the image file.") + link: Optional[StrictStr] = Field(default=None, description="URL link to the image file.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "caption", "mime_type", "link"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsAppImage from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if caption (nullable) is None + # and model_fields_set contains the field + if self.caption is None and "caption" in self.model_fields_set: + _dict['caption'] = None + + # set to None if mime_type (nullable) is None + # and model_fields_set contains the field + if self.mime_type is None and "mime_type" in self.model_fields_set: + _dict['mime_type'] = None + + # set to None if link (nullable) is None + # and model_fields_set contains the field + if self.link is None and "link" in self.model_fields_set: + _dict['link'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsAppImage from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "caption": obj.get("caption"), + "mime_type": obj.get("mime_type"), + "link": obj.get("link") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whats_app_sticker.py b/messente_api/models/whats_app_sticker.py new file mode 100644 index 0000000..addc51b --- /dev/null +++ b/messente_api/models/whats_app_sticker.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class WhatsAppSticker(BaseModel): + """ + WhatsApp sticker content. Either \"id\" or \"link\" must be provided, but not both. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier for the sticker file.") + mime_type: Optional[StrictStr] = Field(default=None, description="MIME type of the sticker file.") + animated: Optional[StrictBool] = Field(default=None, description="Indicates whether the sticker is animated.") + link: Optional[StrictStr] = Field(default=None, description="URL link to the sticker file.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "mime_type", "animated", "link"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsAppSticker from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if mime_type (nullable) is None + # and model_fields_set contains the field + if self.mime_type is None and "mime_type" in self.model_fields_set: + _dict['mime_type'] = None + + # set to None if animated (nullable) is None + # and model_fields_set contains the field + if self.animated is None and "animated" in self.model_fields_set: + _dict['animated'] = None + + # set to None if link (nullable) is None + # and model_fields_set contains the field + if self.link is None and "link" in self.model_fields_set: + _dict['link'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsAppSticker from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "mime_type": obj.get("mime_type"), + "animated": obj.get("animated"), + "link": obj.get("link") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whats_app_template.py b/messente_api/models/whats_app_template.py index 3e79767..091e1c8 100644 --- a/messente_api/models/whats_app_template.py +++ b/messente_api/models/whats_app_template.py @@ -19,7 +19,7 @@ import json from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from typing import Any, ClassVar, Dict, List from messente_api.models.whats_app_component import WhatsAppComponent from messente_api.models.whats_app_language import WhatsAppLanguage from typing import Optional, Set @@ -31,7 +31,7 @@ class WhatsAppTemplate(BaseModel): """ # noqa: E501 name: StrictStr = Field(description="Name of the template") language: WhatsAppLanguage - components: Optional[List[WhatsAppComponent]] = Field(default=None, description="List of template components") + components: List[WhatsAppComponent] = Field(description="List of template components") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["name", "language", "components"] diff --git a/messente_api/models/whats_app_video.py b/messente_api/models/whats_app_video.py new file mode 100644 index 0000000..f7c9c0b --- /dev/null +++ b/messente_api/models/whats_app_video.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class WhatsAppVideo(BaseModel): + """ + WhatsApp video content. Either \"id\" or \"link\" must be provided, but not both. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier for the video file.") + caption: Optional[StrictStr] = Field(default=None, description="Caption for the video.") + mime_type: Optional[StrictStr] = Field(default=None, description="MIME type of the video file.") + link: Optional[StrictStr] = Field(default=None, description="URL link to the video file.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "caption", "mime_type", "link"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsAppVideo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if caption (nullable) is None + # and model_fields_set contains the field + if self.caption is None and "caption" in self.model_fields_set: + _dict['caption'] = None + + # set to None if mime_type (nullable) is None + # and model_fields_set contains the field + if self.mime_type is None and "mime_type" in self.model_fields_set: + _dict['mime_type'] = None + + # set to None if link (nullable) is None + # and model_fields_set contains the field + if self.link is None and "link" in self.model_fields_set: + _dict['link'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsAppVideo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "caption": obj.get("caption"), + "mime_type": obj.get("mime_type"), + "link": obj.get("link") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whatsapp_button_type.py b/messente_api/models/whatsapp_button_type.py new file mode 100644 index 0000000..f69e71e --- /dev/null +++ b/messente_api/models/whatsapp_button_type.py @@ -0,0 +1,43 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class WhatsappButtonType(str, Enum): + """ + Type of the button + """ + + """ + allowed enum values + """ + QUICK_REPLY = 'quick_reply' + PHONE_NUMBER = 'phone_number' + OTP = 'otp' + URL = 'url' + CATALOG = 'catalog' + FLOW = 'flow' + COPY_CODE = 'copy_code' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of WhatsappButtonType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/messente_api/models/whatsapp_component_type.py b/messente_api/models/whatsapp_component_type.py new file mode 100644 index 0000000..519265d --- /dev/null +++ b/messente_api/models/whatsapp_component_type.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class WhatsappComponentType(str, Enum): + """ + Type of the component + """ + + """ + allowed enum values + """ + BODY = 'body' + HEADER = 'header' + FOOTER = 'footer' + BUTTONS = 'buttons' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of WhatsappComponentType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/messente_api/models/whatsapp_create_template_request.py b/messente_api/models/whatsapp_create_template_request.py new file mode 100644 index 0000000..7289ab2 --- /dev/null +++ b/messente_api/models/whatsapp_create_template_request.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from messente_api.models.whatsapp_template_category import WhatsappTemplateCategory +from messente_api.models.whatsapp_template_component import WhatsappTemplateComponent +from typing import Optional, Set +from typing_extensions import Self + +class WhatsappCreateTemplateRequest(BaseModel): + """ + Request to create a WhatsApp template + """ # noqa: E501 + name: StrictStr = Field(description="Name of the template") + category: WhatsappTemplateCategory + language: StrictStr = Field(description="Language of the template") + components: List[WhatsappTemplateComponent] = Field(description="List of template components") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "category", "language", "components"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsappCreateTemplateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in components (list) + _items = [] + if self.components: + for _item_components in self.components: + if _item_components: + _items.append(_item_components.to_dict()) + _dict['components'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsappCreateTemplateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "category": obj.get("category"), + "language": obj.get("language"), + "components": [WhatsappTemplateComponent.from_dict(_item) for _item in obj["components"]] if obj.get("components") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whatsapp_create_template_response.py b/messente_api/models/whatsapp_create_template_response.py new file mode 100644 index 0000000..07c0366 --- /dev/null +++ b/messente_api/models/whatsapp_create_template_response.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from messente_api.models.whatsapp_template_category import WhatsappTemplateCategory +from messente_api.models.whatsapp_template_status import WhatsappTemplateStatus +from typing import Optional, Set +from typing_extensions import Self + +class WhatsappCreateTemplateResponse(BaseModel): + """ + Response for creating a WhatsApp template + """ # noqa: E501 + id: StrictStr = Field(description="Template ID") + status: WhatsappTemplateStatus + category: WhatsappTemplateCategory + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "status", "category"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsappCreateTemplateResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsappCreateTemplateResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "category": obj.get("category") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whatsapp_header_format.py b/messente_api/models/whatsapp_header_format.py new file mode 100644 index 0000000..ed0a067 --- /dev/null +++ b/messente_api/models/whatsapp_header_format.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class WhatsappHeaderFormat(str, Enum): + """ + Format of the header component + """ + + """ + allowed enum values + """ + TEXT = 'text' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of WhatsappHeaderFormat from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/messente_api/models/whatsapp_list_templates_response.py b/messente_api/models/whatsapp_list_templates_response.py new file mode 100644 index 0000000..a601679 --- /dev/null +++ b/messente_api/models/whatsapp_list_templates_response.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from messente_api.models.whatsapp_pagination import WhatsappPagination +from messente_api.models.whatsapp_template_response import WhatsappTemplateResponse +from typing import Optional, Set +from typing_extensions import Self + +class WhatsappListTemplatesResponse(BaseModel): + """ + Whatsapp Cloud API list of templates response + """ # noqa: E501 + templates: List[WhatsappTemplateResponse] = Field(description="List of templates") + paging: WhatsappPagination + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["templates", "paging"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsappListTemplatesResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in templates (list) + _items = [] + if self.templates: + for _item_templates in self.templates: + if _item_templates: + _items.append(_item_templates.to_dict()) + _dict['templates'] = _items + # override the default output from pydantic by calling `to_dict()` of paging + if self.paging: + _dict['paging'] = self.paging.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsappListTemplatesResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "templates": [WhatsappTemplateResponse.from_dict(_item) for _item in obj["templates"]] if obj.get("templates") is not None else None, + "paging": WhatsappPagination.from_dict(obj["paging"]) if obj.get("paging") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whatsapp_otp_button_type.py b/messente_api/models/whatsapp_otp_button_type.py new file mode 100644 index 0000000..06a5dcd --- /dev/null +++ b/messente_api/models/whatsapp_otp_button_type.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class WhatsappOtpButtonType(str, Enum): + """ + Type of the OTP button + """ + + """ + allowed enum values + """ + COPY_CODE = 'copy_code' + ONE_TAP = 'one_tap' + ZERO_TAP = 'zero_tap' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of WhatsappOtpButtonType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/messente_api/models/whatsapp_pagination.py b/messente_api/models/whatsapp_pagination.py new file mode 100644 index 0000000..e354e53 --- /dev/null +++ b/messente_api/models/whatsapp_pagination.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from messente_api.models.whatsapp_paging_cursors import WhatsappPagingCursors +from typing import Optional, Set +from typing_extensions import Self + +class WhatsappPagination(BaseModel): + """ + Whatsapp media object. + """ # noqa: E501 + previous: Optional[StrictStr] = Field(default=None, description="A URL to ge the previous paginated page.") + next: Optional[StrictStr] = Field(default=None, description="A URL to ge the next paginated page.") + cursors: WhatsappPagingCursors + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["previous", "next", "cursors"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsappPagination from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of cursors + if self.cursors: + _dict['cursors'] = self.cursors.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsappPagination from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "previous": obj.get("previous"), + "next": obj.get("next"), + "cursors": WhatsappPagingCursors.from_dict(obj["cursors"]) if obj.get("cursors") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whatsapp_paging_cursors.py b/messente_api/models/whatsapp_paging_cursors.py new file mode 100644 index 0000000..1080b45 --- /dev/null +++ b/messente_api/models/whatsapp_paging_cursors.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class WhatsappPagingCursors(BaseModel): + """ + WhatsApp paging cursors object. + """ # noqa: E501 + before: Optional[StrictStr] = Field(default=None, description="The template before the first template in the current list") + after: Optional[StrictStr] = Field(default=None, description="The template after the last template in the current list") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["before", "after"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsappPagingCursors from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsappPagingCursors from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "before": obj.get("before"), + "after": obj.get("after") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whatsapp_supported_app.py b/messente_api/models/whatsapp_supported_app.py new file mode 100644 index 0000000..ec9fc4b --- /dev/null +++ b/messente_api/models/whatsapp_supported_app.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class WhatsappSupportedApp(BaseModel): + """ + Supported app for the button + """ # noqa: E501 + package_name: StrictStr = Field(description="Package name") + signature_hash: StrictStr = Field(description="Signature hash") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["package_name", "signature_hash"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsappSupportedApp from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsappSupportedApp from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "package_name": obj.get("package_name"), + "signature_hash": obj.get("signature_hash") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whatsapp_template_button.py b/messente_api/models/whatsapp_template_button.py new file mode 100644 index 0000000..5a117a8 --- /dev/null +++ b/messente_api/models/whatsapp_template_button.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from messente_api.models.whatsapp_button_type import WhatsappButtonType +from messente_api.models.whatsapp_otp_button_type import WhatsappOtpButtonType +from messente_api.models.whatsapp_supported_app import WhatsappSupportedApp +from typing import Optional, Set +from typing_extensions import Self + +class WhatsappTemplateButton(BaseModel): + """ + Whatsapp button object. + """ # noqa: E501 + type: Optional[WhatsappButtonType] = None + otp_type: Optional[WhatsappOtpButtonType] = None + autofill_text: Optional[StrictStr] = Field(default=None, description="Text to be autofilled in the OTP field") + supported_apps: Optional[List[WhatsappSupportedApp]] = Field(default=None, description="List of supported apps for the button") + text: Optional[Annotated[str, Field(strict=True, max_length=25)]] = Field(default=None, description="Text content of the button") + phone_number: Optional[Annotated[str, Field(strict=True, max_length=20)]] = Field(default=None, description="Phone number for the button") + url: Optional[Annotated[str, Field(strict=True, max_length=2000)]] = Field(default=None, description="URL for the button") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "otp_type", "autofill_text", "supported_apps", "text", "phone_number", "url"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsappTemplateButton from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in supported_apps (list) + _items = [] + if self.supported_apps: + for _item_supported_apps in self.supported_apps: + if _item_supported_apps: + _items.append(_item_supported_apps.to_dict()) + _dict['supported_apps'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsappTemplateButton from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "otp_type": obj.get("otp_type"), + "autofill_text": obj.get("autofill_text"), + "supported_apps": [WhatsappSupportedApp.from_dict(_item) for _item in obj["supported_apps"]] if obj.get("supported_apps") is not None else None, + "text": obj.get("text"), + "phone_number": obj.get("phone_number"), + "url": obj.get("url") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whatsapp_template_category.py b/messente_api/models/whatsapp_template_category.py new file mode 100644 index 0000000..d319742 --- /dev/null +++ b/messente_api/models/whatsapp_template_category.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class WhatsappTemplateCategory(str, Enum): + """ + Template category + """ + + """ + allowed enum values + """ + AUTHENTICATION = 'authentication' + MARKETING = 'marketing' + UTILITY = 'utility' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of WhatsappTemplateCategory from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/messente_api/models/whatsapp_template_component.py b/messente_api/models/whatsapp_template_component.py new file mode 100644 index 0000000..c1bd75b --- /dev/null +++ b/messente_api/models/whatsapp_template_component.py @@ -0,0 +1,123 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from messente_api.models.whatsapp_component_type import WhatsappComponentType +from messente_api.models.whatsapp_header_format import WhatsappHeaderFormat +from messente_api.models.whatsapp_template_button import WhatsappTemplateButton +from messente_api.models.whatsapp_template_example import WhatsappTemplateExample +from typing import Optional, Set +from typing_extensions import Self + +class WhatsappTemplateComponent(BaseModel): + """ + Template component object + """ # noqa: E501 + type: Optional[WhatsappComponentType] = None + format: Optional[WhatsappHeaderFormat] = None + text: Optional[StrictStr] = Field(default=None, description="Text content of the component") + example: Optional[WhatsappTemplateExample] = None + buttons: Optional[List[WhatsappTemplateButton]] = Field(default=None, description="List of buttons for the component") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "format", "text", "example", "buttons"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsappTemplateComponent from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of example + if self.example: + _dict['example'] = self.example.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in buttons (list) + _items = [] + if self.buttons: + for _item_buttons in self.buttons: + if _item_buttons: + _items.append(_item_buttons.to_dict()) + _dict['buttons'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsappTemplateComponent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "format": obj.get("format"), + "text": obj.get("text"), + "example": WhatsappTemplateExample.from_dict(obj["example"]) if obj.get("example") is not None else None, + "buttons": [WhatsappTemplateButton.from_dict(_item) for _item in obj["buttons"]] if obj.get("buttons") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whatsapp_template_example.py b/messente_api/models/whatsapp_template_example.py new file mode 100644 index 0000000..fe42e24 --- /dev/null +++ b/messente_api/models/whatsapp_template_example.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class WhatsappTemplateExample(BaseModel): + """ + Example of the templated content + """ # noqa: E501 + header_text: Optional[List[StrictStr]] = Field(default=None, description="Example of the templated text for the header") + body_text: Optional[List[List[StrictStr]]] = Field(default=None, description="Example of the templated text for the body") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["header_text", "body_text"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsappTemplateExample from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsappTemplateExample from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "header_text": obj.get("header_text"), + "body_text": obj.get("body_text") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whatsapp_template_response.py b/messente_api/models/whatsapp_template_response.py new file mode 100644 index 0000000..7ccc083 --- /dev/null +++ b/messente_api/models/whatsapp_template_response.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from messente_api.models.whatsapp_template_category import WhatsappTemplateCategory +from messente_api.models.whatsapp_template_component import WhatsappTemplateComponent +from messente_api.models.whatsapp_template_status import WhatsappTemplateStatus +from typing import Optional, Set +from typing_extensions import Self + +class WhatsappTemplateResponse(BaseModel): + """ + Whatsapp Cloud API template + """ # noqa: E501 + id: StrictStr = Field(description="Template ID") + components: List[WhatsappTemplateComponent] = Field(description="List of template components") + language: StrictStr = Field(description="Language of the template") + name: StrictStr = Field(description="Name of the template") + category: WhatsappTemplateCategory + status: WhatsappTemplateStatus + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "components", "language", "name", "category", "status"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsappTemplateResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in components (list) + _items = [] + if self.components: + for _item_components in self.components: + if _item_components: + _items.append(_item_components.to_dict()) + _dict['components'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsappTemplateResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "components": [WhatsappTemplateComponent.from_dict(_item) for _item in obj["components"]] if obj.get("components") is not None else None, + "language": obj.get("language"), + "name": obj.get("name"), + "category": obj.get("category"), + "status": obj.get("status") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/messente_api/models/whatsapp_template_status.py b/messente_api/models/whatsapp_template_status.py new file mode 100644 index 0000000..de9dc07 --- /dev/null +++ b/messente_api/models/whatsapp_template_status.py @@ -0,0 +1,45 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class WhatsappTemplateStatus(str, Enum): + """ + Template status + """ + + """ + allowed enum values + """ + APPROVED = 'approved' + IN_APPEAL = 'in_appeal' + REJECTED = 'rejected' + PENDING = 'pending' + PENDING_DELETION = 'pending_deletion' + DELETED = 'deleted' + DISABLED = 'disabled' + PAUSED = 'paused' + LIMIT_EXCEEDED = 'limit_exceeded' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of WhatsappTemplateStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/messente_api/models/whatsapp_update_template_request.py b/messente_api/models/whatsapp_update_template_request.py new file mode 100644 index 0000000..fc53593 --- /dev/null +++ b/messente_api/models/whatsapp_update_template_request.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Messente API + + [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + + The version of the OpenAPI document: 2.0.0 + Contact: messente@messente.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from messente_api.models.whatsapp_template_category import WhatsappTemplateCategory +from messente_api.models.whatsapp_template_component import WhatsappTemplateComponent +from typing import Optional, Set +from typing_extensions import Self + +class WhatsappUpdateTemplateRequest(BaseModel): + """ + Request to create a WhatsApp template + """ # noqa: E501 + category: Optional[WhatsappTemplateCategory] = None + components: Optional[List[WhatsappTemplateComponent]] = Field(default=None, description="List of template components") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = [] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhatsappUpdateTemplateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhatsappUpdateTemplateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/pyproject.toml b/pyproject.toml index deba9d2..68d4c5b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "messente_api" -version = "2.4.0" +version = "2.5.0" description = "Messente API" authors = ["Messente "] license = "Apache-2.0" diff --git a/setup.py b/setup.py index e239050..223dbd8 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools NAME = "messente-api" -VERSION = "2.4.0" +VERSION = "2.5.0" PYTHON_REQUIRES = ">= 3.8" REQUIRES = [ "urllib3 >= 1.25.3, < 3.0.0",