From 9c370e6a92496e3c484e9588acc1a2291bb86c95 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 13:47:52 +0000 Subject: [PATCH] Regenerate from the latest API spec --- .openapi-generator/FILES | 4 +- docs/BusinessApi.md | 4 + docs/CarrierApi.md | 4 + docs/ESIMsApi.md | 714 -------- docs/InformationApi.md | 85 +- docs/PricingApi.md | 4 + docs/RentalApi.md | 25 +- docs/SMSApi.md | 267 ++- docs/StatusApi.md | 73 + docs/VoucherApi.md | 6 +- setup.py | 4 +- smspool_sdk/__init__.py | 6 +- smspool_sdk/api/__init__.py | 2 +- smspool_sdk/api/business_api.py | 5 +- smspool_sdk/api/carrier_api.py | 8 +- smspool_sdk/api/esims_api.py | 2616 ---------------------------- smspool_sdk/api/information_api.py | 301 +++- smspool_sdk/api/preorders_api.py | 2 +- smspool_sdk/api/pricing_api.py | 5 +- smspool_sdk/api/rental_api.py | 33 +- smspool_sdk/api/sms_api.py | 1002 +++++++++-- smspool_sdk/api/status_api.py | 283 +++ smspool_sdk/api/voucher_api.py | 19 +- smspool_sdk/api_client.py | 2 +- smspool_sdk/configuration.py | 2 +- smspool_sdk/exceptions.py | 2 +- smspool_sdk/models/__init__.py | 2 +- smspool_sdk/rest.py | 2 +- 28 files changed, 1901 insertions(+), 3581 deletions(-) delete mode 100644 docs/ESIMsApi.md create mode 100644 docs/StatusApi.md delete mode 100644 smspool_sdk/api/esims_api.py create mode 100644 smspool_sdk/api/status_api.py diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 95b7074..fbb04d7 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,12 +1,12 @@ .gitignore docs/BusinessApi.md docs/CarrierApi.md -docs/ESIMsApi.md docs/InformationApi.md docs/PreordersApi.md docs/PricingApi.md docs/RentalApi.md docs/SMSApi.md +docs/StatusApi.md docs/VoucherApi.md pyproject.toml requirements.txt @@ -16,12 +16,12 @@ smspool_sdk/__init__.py smspool_sdk/api/__init__.py smspool_sdk/api/business_api.py smspool_sdk/api/carrier_api.py -smspool_sdk/api/esims_api.py smspool_sdk/api/information_api.py smspool_sdk/api/preorders_api.py smspool_sdk/api/pricing_api.py smspool_sdk/api/rental_api.py smspool_sdk/api/sms_api.py +smspool_sdk/api/status_api.py smspool_sdk/api/voucher_api.py smspool_sdk/api_client.py smspool_sdk/api_response.py diff --git a/docs/BusinessApi.md b/docs/BusinessApi.md index c9f78e2..9bfa2b1 100644 --- a/docs/BusinessApi.md +++ b/docs/BusinessApi.md @@ -175,6 +175,10 @@ Name | Type | Description | Notes Update +Updates a sub-account. Send only the fields you want to change. + +`query` holds the result of each requested change. `success` is 1 only when every one of them succeeded; otherwise it is 0, `failed` lists the fields that were refused and `message` repeats the first refusal. + ### Example * Bearer Authentication (bearerAuth): diff --git a/docs/CarrierApi.md b/docs/CarrierApi.md index 0df0414..f22fded 100644 --- a/docs/CarrierApi.md +++ b/docs/CarrierApi.md @@ -34,6 +34,10 @@ To use this endpoint, send an HTTP POST request to the provided URL with the nec Make sure to handle any errors that may occur during the lookup process and check the `success` field in the response to determine the outcome of the operation. +A lookup costs $0.01. When the lookup fails (`success: false`) the charge is returned and the response carries `refunded: true`. + +`phonenumber` is the number with its country code; a leading `+`, spaces and dashes are ignored. + ### Example * Bearer Authentication (bearerAuth): diff --git a/docs/ESIMsApi.md b/docs/ESIMsApi.md deleted file mode 100644 index d655002..0000000 --- a/docs/ESIMsApi.md +++ /dev/null @@ -1,714 +0,0 @@ -# smspool_sdk.ESIMsApi - -All URIs are relative to *https://api.smspool.net* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**esim_delete**](ESIMsApi.md#esim_delete) | **POST** /esim/delete | Delete eSIM -[**esim_history**](ESIMsApi.md#esim_history) | **POST** /esim/history | View eSIM history -[**esim_label_update**](ESIMsApi.md#esim_label_update) | **POST** /esim/label/update | Update eSIM label -[**esim_plans**](ESIMsApi.md#esim_plans) | **POST** /esim/plans | View eSIM plans per country -[**esim_pricing**](ESIMsApi.md#esim_pricing) | **POST** /esim/pricing | View eSIM countries -[**esim_profile**](ESIMsApi.md#esim_profile) | **POST** /esim/profile | View eSIM profile -[**esim_purchase**](ESIMsApi.md#esim_purchase) | **POST** /esim/purchase | Purchase eSIM -[**esim_topup**](ESIMsApi.md#esim_topup) | **POST** /esim/topup | Top up eSIM -[**esim_topup_plans**](ESIMsApi.md#esim_topup_plans) | **POST** /esim/topup_plans | Top Up Plans - - -# **esim_delete** -> object esim_delete(transaction_id) - -Delete eSIM - -### Example - -* Bearer Authentication (bearerAuth): - -```python -import smspool_sdk -from smspool_sdk.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to https://api.smspool.net -# See configuration.py for a list of all supported configuration parameters. -configuration = smspool_sdk.Configuration( - host = "https://api.smspool.net" -) - -# 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 Bearer authorization: bearerAuth -configuration = smspool_sdk.Configuration( - access_token = os.environ["BEARER_TOKEN"] -) - -# Enter a context with an instance of the API client -with smspool_sdk.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = smspool_sdk.ESIMsApi(api_client) - transaction_id = 'transaction_id_example' # str | transactionId retrieved from /esim/purchase - - try: - # Delete eSIM - api_response = api_instance.esim_delete(transaction_id) - print("The response of ESIMsApi->esim_delete:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling ESIMsApi->esim_delete: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **transaction_id** | **str**| transactionId retrieved from /esim/purchase | - -### Return type - -**object** - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**401** | Malformed API key | - | -**403** | Unknown or revoked API key | - | - -[[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) - -# **esim_history** -> object esim_history(start=start, length=length, search=search) - -View eSIM history - -### Example - -* Bearer Authentication (bearerAuth): - -```python -import smspool_sdk -from smspool_sdk.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to https://api.smspool.net -# See configuration.py for a list of all supported configuration parameters. -configuration = smspool_sdk.Configuration( - host = "https://api.smspool.net" -) - -# 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 Bearer authorization: bearerAuth -configuration = smspool_sdk.Configuration( - access_token = os.environ["BEARER_TOKEN"] -) - -# Enter a context with an instance of the API client -with smspool_sdk.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = smspool_sdk.ESIMsApi(api_client) - start = 56 # int | Start page (optional) - length = 56 # int | Amount of rows per page (optional) - search = 'search_example' # str | Alphanumeric search (optional) - - try: - # View eSIM history - api_response = api_instance.esim_history(start=start, length=length, search=search) - print("The response of ESIMsApi->esim_history:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling ESIMsApi->esim_history: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **start** | **int**| Start page | [optional] - **length** | **int**| Amount of rows per page | [optional] - **search** | **str**| Alphanumeric search | [optional] - -### Return type - -**object** - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**401** | Malformed API key | - | -**403** | Unknown or revoked API key | - | - -[[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) - -# **esim_label_update** -> object esim_label_update(transaction_id, label=label) - -Update eSIM label - -Set or clear the label of one of your eSIMs. The label is returned as `label` by **View eSIM history**, so you can use it to tell your eSIMs apart. - -A label can be up to 30 characters long and may only contain letters, numbers and spaces. Leave `label` out, or send it empty, to remove the label. - -### Example - -* Bearer Authentication (bearerAuth): - -```python -import smspool_sdk -from smspool_sdk.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to https://api.smspool.net -# See configuration.py for a list of all supported configuration parameters. -configuration = smspool_sdk.Configuration( - host = "https://api.smspool.net" -) - -# 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 Bearer authorization: bearerAuth -configuration = smspool_sdk.Configuration( - access_token = os.environ["BEARER_TOKEN"] -) - -# Enter a context with an instance of the API client -with smspool_sdk.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = smspool_sdk.ESIMsApi(api_client) - transaction_id = 'transaction_id_example' # str | transactionId retrieved from /esim/purchase - label = 'label_example' # str | The new label: letters, numbers and spaces, at most 30 characters. Empty or left out removes the label. (optional) - - try: - # Update eSIM label - api_response = api_instance.esim_label_update(transaction_id, label=label) - print("The response of ESIMsApi->esim_label_update:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling ESIMsApi->esim_label_update: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **transaction_id** | **str**| transactionId retrieved from /esim/purchase | - **label** | **str**| The new label: letters, numbers and spaces, at most 30 characters. Empty or left out removes the label. | [optional] - -### Return type - -**object** - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**401** | Malformed API key | - | -**403** | Unknown or revoked API key | - | - -[[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) - -# **esim_plans** -> object esim_plans(country) - -View eSIM plans per country - -### Example - -* Bearer Authentication (bearerAuth): - -```python -import smspool_sdk -from smspool_sdk.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to https://api.smspool.net -# See configuration.py for a list of all supported configuration parameters. -configuration = smspool_sdk.Configuration( - host = "https://api.smspool.net" -) - -# 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 Bearer authorization: bearerAuth -configuration = smspool_sdk.Configuration( - access_token = os.environ["BEARER_TOKEN"] -) - -# Enter a context with an instance of the API client -with smspool_sdk.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = smspool_sdk.ESIMsApi(api_client) - country = 'country_example' # str | ISO 3166 country code - - try: - # View eSIM plans per country - api_response = api_instance.esim_plans(country) - print("The response of ESIMsApi->esim_plans:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling ESIMsApi->esim_plans: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **country** | **str**| ISO 3166 country code | - -### Return type - -**object** - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**401** | Malformed API key | - | -**403** | Unknown or revoked API key | - | - -[[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) - -# **esim_pricing** -> object esim_pricing(start=start, length=length, search=search) - -View eSIM countries - -### Example - -* Bearer Authentication (bearerAuth): - -```python -import smspool_sdk -from smspool_sdk.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to https://api.smspool.net -# See configuration.py for a list of all supported configuration parameters. -configuration = smspool_sdk.Configuration( - host = "https://api.smspool.net" -) - -# 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 Bearer authorization: bearerAuth -configuration = smspool_sdk.Configuration( - access_token = os.environ["BEARER_TOKEN"] -) - -# Enter a context with an instance of the API client -with smspool_sdk.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = smspool_sdk.ESIMsApi(api_client) - start = 56 # int | Start page (optional) - length = 56 # int | Amount of rows per page (optional) - search = 'search_example' # str | Search query for country (optional) - - try: - # View eSIM countries - api_response = api_instance.esim_pricing(start=start, length=length, search=search) - print("The response of ESIMsApi->esim_pricing:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling ESIMsApi->esim_pricing: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **start** | **int**| Start page | [optional] - **length** | **int**| Amount of rows per page | [optional] - **search** | **str**| Search query for country | [optional] - -### Return type - -**object** - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**401** | Malformed API key | - | -**403** | Unknown or revoked API key | - | - -[[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) - -# **esim_profile** -> object esim_profile(transaction_id=transaction_id) - -View eSIM profile - -### Example - -* Bearer Authentication (bearerAuth): - -```python -import smspool_sdk -from smspool_sdk.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to https://api.smspool.net -# See configuration.py for a list of all supported configuration parameters. -configuration = smspool_sdk.Configuration( - host = "https://api.smspool.net" -) - -# 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 Bearer authorization: bearerAuth -configuration = smspool_sdk.Configuration( - access_token = os.environ["BEARER_TOKEN"] -) - -# Enter a context with an instance of the API client -with smspool_sdk.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = smspool_sdk.ESIMsApi(api_client) - transaction_id = 'transaction_id_example' # str | transactionId retrieved from /esim/purchase (optional) - - try: - # View eSIM profile - api_response = api_instance.esim_profile(transaction_id=transaction_id) - print("The response of ESIMsApi->esim_profile:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling ESIMsApi->esim_profile: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **transaction_id** | **str**| transactionId retrieved from /esim/purchase | [optional] - -### Return type - -**object** - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**401** | Malformed API key | - | -**403** | Unknown or revoked API key | - | - -[[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) - -# **esim_purchase** -> object esim_purchase(plan) - -Purchase eSIM - -### Example - -* Bearer Authentication (bearerAuth): - -```python -import smspool_sdk -from smspool_sdk.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to https://api.smspool.net -# See configuration.py for a list of all supported configuration parameters. -configuration = smspool_sdk.Configuration( - host = "https://api.smspool.net" -) - -# 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 Bearer authorization: bearerAuth -configuration = smspool_sdk.Configuration( - access_token = os.environ["BEARER_TOKEN"] -) - -# Enter a context with an instance of the API client -with smspool_sdk.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = smspool_sdk.ESIMsApi(api_client) - plan = 56 # int | The plan ID which is obtained from /esim/pricing - - try: - # Purchase eSIM - api_response = api_instance.esim_purchase(plan) - print("The response of ESIMsApi->esim_purchase:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling ESIMsApi->esim_purchase: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **plan** | **int**| The plan ID which is obtained from /esim/pricing | - -### Return type - -**object** - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**401** | Malformed API key | - | -**403** | Unknown or revoked API key | - | - -[[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) - -# **esim_topup** -> object esim_topup(transaction_id, plan) - -Top up eSIM - -### Example - -* Bearer Authentication (bearerAuth): - -```python -import smspool_sdk -from smspool_sdk.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to https://api.smspool.net -# See configuration.py for a list of all supported configuration parameters. -configuration = smspool_sdk.Configuration( - host = "https://api.smspool.net" -) - -# 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 Bearer authorization: bearerAuth -configuration = smspool_sdk.Configuration( - access_token = os.environ["BEARER_TOKEN"] -) - -# Enter a context with an instance of the API client -with smspool_sdk.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = smspool_sdk.ESIMsApi(api_client) - transaction_id = 'transaction_id_example' # str | Transaction ID retrieved from eSIM history - plan = 56 # int | Topup plan retrieved from \\\"Top Up Plans\\\" - - try: - # Top up eSIM - api_response = api_instance.esim_topup(transaction_id, plan) - print("The response of ESIMsApi->esim_topup:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling ESIMsApi->esim_topup: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **transaction_id** | **str**| Transaction ID retrieved from eSIM history | - **plan** | **int**| Topup plan retrieved from \\\"Top Up Plans\\\" | - -### Return type - -**object** - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**401** | Malformed API key | - | -**403** | Unknown or revoked API key | - | - -[[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) - -# **esim_topup_plans** -> object esim_topup_plans(plan) - -Top Up Plans - -### Example - - -```python -import smspool_sdk -from smspool_sdk.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to https://api.smspool.net -# See configuration.py for a list of all supported configuration parameters. -configuration = smspool_sdk.Configuration( - host = "https://api.smspool.net" -) - - -# Enter a context with an instance of the API client -with smspool_sdk.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = smspool_sdk.ESIMsApi(api_client) - plan = 56 # int | `plan` retrieved from eSIM history - - try: - # Top Up Plans - api_response = api_instance.esim_topup_plans(plan) - print("The response of ESIMsApi->esim_topup_plans:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling ESIMsApi->esim_topup_plans: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **plan** | **int**| `plan` retrieved from eSIM history | - -### Return type - -**object** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | - -[[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/InformationApi.md b/docs/InformationApi.md index ad7927c..02f510c 100644 --- a/docs/InformationApi.md +++ b/docs/InformationApi.md @@ -7,6 +7,7 @@ Method | HTTP request | Description [**country_retrieve_all**](InformationApi.md#country_retrieve_all) | **GET** /country/retrieve_all | Country list [**pool_retrieve_all**](InformationApi.md#pool_retrieve_all) | **POST** /pool/retrieve_all | Pool list [**pool_retrieve_valid**](InformationApi.md#pool_retrieve_valid) | **POST** /pool/retrieve_valid | Suggested Pools +[**request_auto_country**](InformationApi.md#request_auto_country) | **POST** /request/auto_country | Pick the best country for a service [**request_balance**](InformationApi.md#request_balance) | **POST** /request/balance | Balance [**request_success_rate**](InformationApi.md#request_success_rate) | **POST** /request/success_rate | Retrieve country success rates per service [**request_suggested_countries**](InformationApi.md#request_suggested_countries) | **POST** /request/suggested_countries | Suggested Countries @@ -219,22 +220,96 @@ No authorization required [[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) +# **request_auto_country** +> object request_auto_country(service, pricing_option=pricing_option) + +Pick the best country for a service + +Returns the country SMSPool would order from for this service when you do not want to choose one (the quick order's "Pick for me"). It sends an HTTP POST request to the URL `https://api.smspool.net/request/auto_country`. + +Every country with stock is scored on its expected success rate, weighed down when little stock backs it, minus a little per dollar, plus a bonus when it matches the country your request's IP resolves to (a local number verifies more often). The IP country is only used for that comparison; it is neither stored nor returned. Ties go to more stock, then the lower price. With `pricing_option=1` the cheapest country within reach of the best score wins instead. + +`success_rate` is that expected rate. Where the service has at least 20 recent orders in the country it is the measured rate and `rate_measured` is true. With fewer, it is an estimate that blends those orders (`rate_orders` of them) with how the country does across all services and how the service does elsewhere, and `rate_measured` is false. + +Send `auto_country=1` to `/purchase/sms` to order with the same choice in one call. + +### Example + + +```python +import smspool_sdk +from smspool_sdk.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.smspool.net +# See configuration.py for a list of all supported configuration parameters. +configuration = smspool_sdk.Configuration( + host = "https://api.smspool.net" +) + + +# Enter a context with an instance of the API client +with smspool_sdk.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = smspool_sdk.InformationApi(api_client) + service = 'service_example' # str | Service name or service ID which can be retrieved at the /service/retrieve_all endpoint + pricing_option = 56 # int | Set to 1 to prefer the cheapest country among those close to the best score; 0 (default) picks purely on the score. (optional) + + try: + # Pick the best country for a service + api_response = api_instance.request_auto_country(service, pricing_option=pricing_option) + print("The response of InformationApi->request_auto_country:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling InformationApi->request_auto_country: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **service** | **str**| Service name or service ID which can be retrieved at the /service/retrieve_all endpoint | + **pricing_option** | **int**| Set to 1 to prefer the cheapest country among those close to the best score; 0 (default) picks purely on the score. | [optional] + +### Return type + +**object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | 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) + # **request_balance** > object request_balance() Balance -This HTTP POST request is used to retrieve the balance for a specific SMSPool. The request is sent to the URL `https://api.smspool.net/request/balance`. +Retrieves your account balance in USD. ### Request Parameters -This request require the \`key\` param which is your API key +Only your API key, sent as a bearer token. ### Response -The response to this request will have a status code of 200 if the request is successful. The response body will be in JSON format and will include a `balance` field. However, the last execution of this request returned an empty string for the `balance` field. - -Please note that the actual value of the `balance` field may vary depending on the user and its configuration. +A JSON object with a `balance` field: the balance as a string with two decimals, for example `"5.00"`. ### Example diff --git a/docs/PricingApi.md b/docs/PricingApi.md index a39c9f1..66b522f 100644 --- a/docs/PricingApi.md +++ b/docs/PricingApi.md @@ -85,6 +85,10 @@ No authorization required Retrieve all pricing +Retrieves prices, optionally filtered by country, service, pool and maximum price (`max_price` is rounded to two decimals). + +Without any filter the response is the full catalog (about 20 MB), rebuilt once an hour. It is sent with `ETag`, `Last-Modified` and `Cache-Control` headers: send `If-None-Match` (or `If-Modified-Since`) with your next request and you get `304 Not Modified` with no body while the catalog has not changed. + ### Example diff --git a/docs/RentalApi.md b/docs/RentalApi.md index c68be8f..17bd53d 100644 --- a/docs/RentalApi.md +++ b/docs/RentalApi.md @@ -23,7 +23,7 @@ Method | HTTP request | Description # **purchase_rental** -> object purchase_rental(id, days, service_id=service_id, create_token=create_token, city=city, state=state, zipcode=zipcode) +> object purchase_rental(id, days, idempotency_key=idempotency_key, service_id=service_id, create_token=create_token, city=city, state=state, zipcode=zipcode) Order Rental @@ -58,6 +58,7 @@ with smspool_sdk.ApiClient(configuration) as api_client: api_instance = smspool_sdk.RentalApi(api_client) id = 56 # int | Rental ID retrieved from Retrieve Rental IDs days = 56 # int | + idempotency_key = '3f1c2c0e-7d5b-4a52-9a53-1f6f0f0f2b11' # str | (optional) service_id = 56 # int | Optional value on which service you'd purchase the rental for (optional) create_token = 56 # int | Create a rental token which allows you to share this specific rental (optional) city = 'city_example' # str | (optional) @@ -66,7 +67,7 @@ with smspool_sdk.ApiClient(configuration) as api_client: try: # Order Rental - api_response = api_instance.purchase_rental(id, days, service_id=service_id, create_token=create_token, city=city, state=state, zipcode=zipcode) + api_response = api_instance.purchase_rental(id, days, idempotency_key=idempotency_key, service_id=service_id, create_token=create_token, city=city, state=state, zipcode=zipcode) print("The response of RentalApi->purchase_rental:\n") pprint(api_response) except Exception as e: @@ -82,6 +83,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| Rental ID retrieved from Retrieve Rental IDs | **days** | **int**| | + **idempotency_key** | **str**| | [optional] **service_id** | **int**| Optional value on which service you'd purchase the rental for | [optional] **create_token** | **int**| Create a rental token which allows you to share this specific rental | [optional] **city** | **str**| | [optional] @@ -109,6 +111,7 @@ Name | Type | Description | Notes **400** | Error | - | **401** | Malformed API key | - | **403** | Unknown or revoked API key | - | +**409** | 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) @@ -810,6 +813,8 @@ This endpoint does not need any parameter. Retrieve Rental Messages +Successful answers are cached for 3 seconds per rental, so polling faster than that returns the same data. + ### Example * Bearer Authentication (bearerAuth): @@ -1020,6 +1025,8 @@ No authorization required Retrieve Rental Status +Successful answers are cached for 3 seconds per rental, so polling faster than that returns the same data. + ### Example * Bearer Authentication (bearerAuth): @@ -1181,6 +1188,7 @@ Retrieve Rental Stock ### Example +* Bearer Authentication (bearerAuth): ```python import smspool_sdk @@ -1193,6 +1201,15 @@ configuration = smspool_sdk.Configuration( host = "https://api.smspool.net" ) +# 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 Bearer authorization: bearerAuth +configuration = smspool_sdk.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) # Enter a context with an instance of the API client with smspool_sdk.ApiClient(configuration) as api_client: @@ -1228,7 +1245,7 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[bearerAuth](../README.md#bearerAuth) ### HTTP request headers @@ -1240,6 +1257,8 @@ No authorization required | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | OK | - | +**401** | Malformed API key | - | +**403** | Unknown or revoked API key | - | [[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/SMSApi.md b/docs/SMSApi.md index d11c027..6aca6e9 100644 --- a/docs/SMSApi.md +++ b/docs/SMSApi.md @@ -9,8 +9,10 @@ Method | HTTP request | Description [**request_archive**](SMSApi.md#request_archive) | **POST** /request/archive | Archive all orders [**request_areacodes**](SMSApi.md#request_areacodes) | **POST** /request/areacodes | Request available areacodes [**request_history**](SMSApi.md#request_history) | **POST** /request/history | Order History +[**request_history_search**](SMSApi.md#request_history_search) | **POST** /request/history_search | Search order history [**sms_activate**](SMSApi.md#sms_activate) | **POST** /sms/activate | Activate SMS [**sms_all_stock**](SMSApi.md#sms_all_stock) | **POST** /sms/all_stock | One-time stock for all services +[**sms_archive**](SMSApi.md#sms_archive) | **POST** /sms/archive | Archive one order [**sms_cancel**](SMSApi.md#sms_cancel) | **POST** /sms/cancel | Cancel SMS [**sms_cancel_all**](SMSApi.md#sms_cancel_all) | **POST** /sms/cancel_all | Cancel All SMS [**sms_check**](SMSApi.md#sms_check) | **POST** /sms/check | Check SMS @@ -24,10 +26,34 @@ Method | HTTP request | Description # **purchase_sms** -> object purchase_sms(service, country=country, pool=pool, max_price=max_price, pricing_option=pricing_option, quantity=quantity, areacode=areacode, exclude=exclude, create_token=create_token, activation_type=activation_type, carrier=carrier, phonenumber=phonenumber, software=software) +> object purchase_sms(service, idempotency_key=idempotency_key, country=country, pool=pool, max_price=max_price, pricing_option=pricing_option, quantity=quantity, areacode=areacode, exclude=exclude, create_token=create_token, activation_type=activation_type, carrier=carrier, phonenumber=phonenumber, auto_country=auto_country, response=response, software=software) Order SMS +Orders one or more numbers for a service. + +### Response shapes + +Without `response=v2` the shape depends on `quantity`: one number returns the order object; several return a JSON array of order objects; if ordering stops part-way, an object with the orders bought so far under `"0"`, `"1"`, ... plus `message`. + +With `response=v2` every case returns the same object: + +- `success`: 1 when every requested number was ordered, otherwise 0 +- `orders`: the orders that were placed (may be empty) +- `failed`: the error that stopped the request, as a one-element list (empty on success) +- `message`: a summary +- `auto_country`: only with `auto_country=1`, the chosen country + +`response=v2` is ignored together with `create_token=1`. + +### Pool + +`pool` is a pool ID or name from the `Pool List` endpoint. A name that does not exist answers 400 with `type: INVALID_POOL`. Leave it out (or send it empty or `0`) for any pool. + +### Retrying safely + +Send an `Idempotency-Key` header so a retry after a timeout cannot buy twice. + ### Example * Bearer Authentication (bearerAuth): @@ -58,22 +84,25 @@ with smspool_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = smspool_sdk.SMSApi(api_client) service = 'service_example' # str | The service or number retrieved from the `Service List` endpoint + idempotency_key = '3f1c2c0e-7d5b-4a52-9a53-1f6f0f0f2b11' # str | (optional) country = 'country_example' # str | The country in ISO format or number retrieved from the `Country List` endpoint (optional) - pool = 'pool_example' # str | The pool or number retrieved from the `Pool List` endpoint (optional) (optional) + pool = 'pool_example' # str | The pool ID or name retrieved from the `Pool List` endpoint (optional). An unknown name answers 400 `INVALID_POOL`. (optional) max_price = 3.4 # float | The max price you are willing to pay per number (optional) pricing_option = 56 # int | Set to 0 if you'd like the cheapest numbers, set to 1 for highest success rate (optional) - quantity = 56 # int | Quantity of numbers ordered (optional) + quantity = 56 # int | Quantity of numbers ordered, 1 to 20. Must be a whole number. (optional) areacode = 'areacode_example' # str | Areacodes you would like to include or exclude in JSON format (optional) exclude = 56 # int | Set exclude to 1 if you would like to exclude all listed area codes. (optional) create_token = 56 # int | Optional param; set to 1 if you'd like to create a token link that anyone can access. (optional) activation_type = 'activation_type_example' # str | Options: SMS, VOICE, FLASH. SMS will receive regular SMS, VOICE will receive phone calls that mentions the SMS and FLASH is for FLASH calls for verification. (optional) carrier = 56 # int | Options: 1 or 2. Pick a carrier (only works for pool Foxtrot US) (optional) - phonenumber = 56 # int | In case you want to select a specific phone number to order (optional) + phonenumber = 56 # int | In case you want to select a specific phone number to order. Digits with the country code; a leading +, spaces and dashes are ignored. (optional) + auto_country = 56 # int | Set to 1 to let SMSPool pick the country: every country with stock is scored on its expected success rate (estimated from the country's record across all services when the service has few orders there; weighed down when little stock backs it, minus a little per dollar) with a bonus for a local number, the country your request's IP resolves to; with pricing_option=1 the cheapest country close to the best score wins. Ignored when country is sent. The response then carries auto_country with the chosen country and the reason. (optional) + response = 'response_example' # str | Set to `v2` for one response shape whatever the quantity: `{success, orders, failed, message}`. Leave out for the legacy shapes. (optional) software = 56 # int | (optional) try: # Order SMS - api_response = api_instance.purchase_sms(service, country=country, pool=pool, max_price=max_price, pricing_option=pricing_option, quantity=quantity, areacode=areacode, exclude=exclude, create_token=create_token, activation_type=activation_type, carrier=carrier, phonenumber=phonenumber, software=software) + api_response = api_instance.purchase_sms(service, idempotency_key=idempotency_key, country=country, pool=pool, max_price=max_price, pricing_option=pricing_option, quantity=quantity, areacode=areacode, exclude=exclude, create_token=create_token, activation_type=activation_type, carrier=carrier, phonenumber=phonenumber, auto_country=auto_country, response=response, software=software) print("The response of SMSApi->purchase_sms:\n") pprint(api_response) except Exception as e: @@ -88,17 +117,20 @@ with smspool_sdk.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **service** | **str**| The service or number retrieved from the `Service List` endpoint | + **idempotency_key** | **str**| | [optional] **country** | **str**| The country in ISO format or number retrieved from the `Country List` endpoint | [optional] - **pool** | **str**| The pool or number retrieved from the `Pool List` endpoint (optional) | [optional] + **pool** | **str**| The pool ID or name retrieved from the `Pool List` endpoint (optional). An unknown name answers 400 `INVALID_POOL`. | [optional] **max_price** | **float**| The max price you are willing to pay per number | [optional] **pricing_option** | **int**| Set to 0 if you'd like the cheapest numbers, set to 1 for highest success rate | [optional] - **quantity** | **int**| Quantity of numbers ordered | [optional] + **quantity** | **int**| Quantity of numbers ordered, 1 to 20. Must be a whole number. | [optional] **areacode** | **str**| Areacodes you would like to include or exclude in JSON format | [optional] **exclude** | **int**| Set exclude to 1 if you would like to exclude all listed area codes. | [optional] **create_token** | **int**| Optional param; set to 1 if you'd like to create a token link that anyone can access. | [optional] **activation_type** | **str**| Options: SMS, VOICE, FLASH. SMS will receive regular SMS, VOICE will receive phone calls that mentions the SMS and FLASH is for FLASH calls for verification. | [optional] **carrier** | **int**| Options: 1 or 2. Pick a carrier (only works for pool Foxtrot US) | [optional] - **phonenumber** | **int**| In case you want to select a specific phone number to order | [optional] + **phonenumber** | **int**| In case you want to select a specific phone number to order. Digits with the country code; a leading +, spaces and dashes are ignored. | [optional] + **auto_country** | **int**| Set to 1 to let SMSPool pick the country: every country with stock is scored on its expected success rate (estimated from the country's record across all services when the service has few orders there; weighed down when little stock backs it, minus a little per dollar) with a bonus for a local number, the country your request's IP resolves to; with pricing_option=1 the cheapest country close to the best score wins. Ignored when country is sent. The response then carries auto_country with the chosen country and the reason. | [optional] + **response** | **str**| Set to `v2` for one response shape whatever the quantity: `{success, orders, failed, message}`. Leave out for the legacy shapes. | [optional] **software** | **int**| | [optional] ### Return type @@ -119,8 +151,10 @@ Name | Type | Description | Notes | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | OK | - | +**400** | Error | - | **401** | Malformed API key | - | **403** | Unknown or revoked API key | - | +**409** | Error | - | **422** | 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) @@ -296,6 +330,7 @@ Request available areacodes ### Example +* Bearer Authentication (bearerAuth): ```python import smspool_sdk @@ -308,6 +343,15 @@ configuration = smspool_sdk.Configuration( host = "https://api.smspool.net" ) +# 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 Bearer authorization: bearerAuth +configuration = smspool_sdk.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) # Enter a context with an instance of the API client with smspool_sdk.ApiClient(configuration) as api_client: @@ -343,7 +387,7 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[bearerAuth](../README.md#bearerAuth) ### HTTP request headers @@ -355,6 +399,8 @@ No authorization required | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | JSON response | - | +**401** | Malformed API key | - | +**403** | Unknown or revoked API key | - | [[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) @@ -466,6 +512,90 @@ Name | Type | Description | Notes [[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) +# **request_history_search** +> object request_history_search(search, cursor=cursor, limit=limit) + +Search order history + +One step of a search through your order history, newest orders first. Each call reads a bounded slice of your orders and returns the matches in it plus `next`. Pass `next` back as `cursor` to continue; the search is complete when `next` is `null`. A call can return no matches and still have a `next`. + +### Example + +* Bearer Authentication (bearerAuth): + +```python +import smspool_sdk +from smspool_sdk.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.smspool.net +# See configuration.py for a list of all supported configuration parameters. +configuration = smspool_sdk.Configuration( + host = "https://api.smspool.net" +) + +# 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 Bearer authorization: bearerAuth +configuration = smspool_sdk.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with smspool_sdk.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = smspool_sdk.SMSApi(api_client) + search = 'search_example' # str | The search term, as typed into the order history's search box. At most 32 characters. + cursor = 'cursor_example' # str | `next` from the previous call. Leave out for the first call. (optional) + limit = 56 # int | Matches per call, 1 to 500 (default 100). (optional) + + try: + # Search order history + api_response = api_instance.request_history_search(search, cursor=cursor, limit=limit) + print("The response of SMSApi->request_history_search:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling SMSApi->request_history_search: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **search** | **str**| The search term, as typed into the order history's search box. At most 32 characters. | + **cursor** | **str**| `next` from the previous call. Leave out for the first call. | [optional] + **limit** | **int**| Matches per call, 1 to 500 (default 100). | [optional] + +### Return type + +**object** + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**401** | Malformed API key | - | +**403** | Unknown or revoked API key | - | +**422** | 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) + # **sms_activate** > object sms_activate(orderid) @@ -552,22 +682,9 @@ Name | Type | Description | Notes One-time stock for all services -This API endpoint is used to retrieve one-time SMS stock in the SMSPool system. The HTTP POST request should be sent to `https://api.smspool.net/sms/stock`. +Retrieves the one-time SMS stock for every country, service and pool, optionally filtered by `country`, `service` and `pool`. The API key is optional. -### Request Parameters - -The \`key\` parameter is required for this endpoint, this is your API key. - -### Response - -The response for this API endpoint will have a status code of 200, indicating a successful request. The response body will be in JSON format and will contain the following properties: - -- `success` (integer): A flag indicating the success of the request. A value of 0 indicates failure. - -- `message` (string): An optional message providing additional information about the request. In this case, the message is empty. - - -Please note that the response may contain additional properties not mentioned here, but they can be ignored for the purpose of this documentation. +The unfiltered list is large and rebuilt once a minute. It is sent with `ETag`, `Last-Modified` and `Cache-Control` headers: send `If-None-Match` (or `If-Modified-Since`) with your next request and you get `304 Not Modified` with no body while the list has not changed. ### Example @@ -633,17 +750,95 @@ No authorization required [[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) +# **sms_archive** +> object sms_archive(orderid) + +Archive one order + +Removes one finished order from your active orders. Nothing is refunded and the order stays in your history; `/sms/unarchive` brings it back. An order that is still waiting for an SMS cannot be archived: cancel it with `/sms/cancel` instead. + +### Example + +* Bearer Authentication (bearerAuth): + +```python +import smspool_sdk +from smspool_sdk.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.smspool.net +# See configuration.py for a list of all supported configuration parameters. +configuration = smspool_sdk.Configuration( + host = "https://api.smspool.net" +) + +# 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 Bearer authorization: bearerAuth +configuration = smspool_sdk.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with smspool_sdk.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = smspool_sdk.SMSApi(api_client) + orderid = 'orderid_example' # str | The order code from the `Order SMS` endpoint. + + try: + # Archive one order + api_response = api_instance.sms_archive(orderid) + print("The response of SMSApi->sms_archive:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling SMSApi->sms_archive: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderid** | **str**| The order code from the `Order SMS` endpoint. | + +### Return type + +**object** + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**401** | Malformed API key | - | +**403** | Unknown or revoked API key | - | + +[[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) + # **sms_cancel** > object sms_cancel(orderid=orderid, orderids=orderids, expiry=expiry, ban=ban) Cancel SMS -# Cancel your SMS order +Cancels an order. An order that has not received a code is cancelled and refunded. An order that already has its code cannot be refunded; it is only archived (removed from your active orders). -## Responses +Both answer `success: 1`; `action` tells them apart: `refunded` or `archived`. -| **Success** | {"success":1} | -| **Fail** | {"success":0} | +Send `orderids` (comma-separated) to cancel several orders at once; the response then lists one result per order under `results`. ### Example @@ -1050,7 +1245,7 @@ This endpoint does not need any parameter. Missed SMS -Some messages arrive on a number from your one-time orders but cannot finish the order, such as Ticketmaster and Seated codes or Hark reward payouts. This returns those messages, the same ones the Missed SMS tool on the website shows. Only numbers from pool Foxtrot are covered. +Some messages arrive on a number from your one-time orders but cannot finish the order, such as Ticketmaster and Seated codes, Hark reward payouts or Neon Money Talks messages. This returns those messages, the same ones the Missed SMS tool on the website shows. Only numbers from pool Foxtrot are covered. The newest messages come first. `url`, `code` and `email` hold the first link, code and email address found in the message, or an empty string. @@ -1300,22 +1495,16 @@ Name | Type | Description | Notes One-time SMS stock -This API endpoint is used to retrieve one-time SMS stock in the SMSPool system. The HTTP POST request should be sent to `https://api.smspool.net/sms/stock`. +Retrieves the one-time SMS stock for a country and service, optionally for one pool. ### Request Parameters -The \`key\` parameter is required for this endpoint, this is your API key. +The API key is optional. Without it the request is limited to 20 calls a minute per IP address; with it the limit is 200 a minute. ### Response -The response for this API endpoint will have a status code of 200, indicating a successful request. The response body will be in JSON format and will contain the following properties: - -- `success` (integer): A flag indicating the success of the request. A value of 0 indicates failure. - -- `message` (string): An optional message providing additional information about the request. In this case, the message is empty. - - -Please note that the response may contain additional properties not mentioned here, but they can be ignored for the purpose of this documentation. +- `success` (integer): 1 when the stock could be read, 0 otherwise. +- `amount` (integer): the numbers in stock. ### Example diff --git a/docs/StatusApi.md b/docs/StatusApi.md new file mode 100644 index 0000000..7e7604a --- /dev/null +++ b/docs/StatusApi.md @@ -0,0 +1,73 @@ +# smspool_sdk.StatusApi + +All URIs are relative to *https://api.smspool.net* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**up**](StatusApi.md#up) | **GET** /up | Health check + + +# **up** +> object up() + +Health check + +For uptime monitors. Needs no API key. `db` and `cache` say whether the database and the cache answered; `status` is `ok` when both did. The result is refreshed every few seconds. + +### Example + + +```python +import smspool_sdk +from smspool_sdk.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.smspool.net +# See configuration.py for a list of all supported configuration parameters. +configuration = smspool_sdk.Configuration( + host = "https://api.smspool.net" +) + + +# Enter a context with an instance of the API client +with smspool_sdk.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = smspool_sdk.StatusApi(api_client) + + try: + # Health check + api_response = api_instance.up() + print("The response of StatusApi->up:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling StatusApi->up: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**503** | 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/VoucherApi.md b/docs/VoucherApi.md index 2320be4..b3afe9a 100644 --- a/docs/VoucherApi.md +++ b/docs/VoucherApi.md @@ -167,7 +167,7 @@ Name | Type | Description | Notes [[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) # **voucher_generate** -> object voucher_generate(amount) +> object voucher_generate(amount, idempotency_key=idempotency_key) Generate voucher @@ -201,10 +201,11 @@ with smspool_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = smspool_sdk.VoucherApi(api_client) amount = 3.4 # float | The amount per promocode + idempotency_key = '3f1c2c0e-7d5b-4a52-9a53-1f6f0f0f2b11' # str | (optional) try: # Generate voucher - api_response = api_instance.voucher_generate(amount) + api_response = api_instance.voucher_generate(amount, idempotency_key=idempotency_key) print("The response of VoucherApi->voucher_generate:\n") pprint(api_response) except Exception as e: @@ -219,6 +220,7 @@ with smspool_sdk.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **amount** | **float**| The amount per promocode | + **idempotency_key** | **str**| | [optional] ### Return type diff --git a/setup.py b/setup.py index ffd3428..cdf08b3 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -42,7 +42,7 @@ license="MIT", long_description_content_type='text/markdown', long_description="""\ - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer <key>`) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer <key>`. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. """, # noqa: E501 package_data={"smspool_sdk": ["py.typed"]}, ) diff --git a/smspool_sdk/__init__.py b/smspool_sdk/__init__.py index b104167..c4ebb96 100644 --- a/smspool_sdk/__init__.py +++ b/smspool_sdk/__init__.py @@ -5,7 +5,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -25,8 +25,8 @@ "PricingApi", "RentalApi", "SMSApi", + "StatusApi", "VoucherApi", - "ESIMsApi", "ApiResponse", "ApiClient", "Configuration", @@ -47,8 +47,8 @@ from smspool_sdk.api.pricing_api import PricingApi as PricingApi from smspool_sdk.api.rental_api import RentalApi as RentalApi from smspool_sdk.api.sms_api import SMSApi as SMSApi +from smspool_sdk.api.status_api import StatusApi as StatusApi from smspool_sdk.api.voucher_api import VoucherApi as VoucherApi -from smspool_sdk.api.esims_api import ESIMsApi as ESIMsApi # import ApiClient from smspool_sdk.api_response import ApiResponse as ApiResponse diff --git a/smspool_sdk/api/__init__.py b/smspool_sdk/api/__init__.py index c2944c9..89cfbd3 100644 --- a/smspool_sdk/api/__init__.py +++ b/smspool_sdk/api/__init__.py @@ -8,6 +8,6 @@ from smspool_sdk.api.pricing_api import PricingApi from smspool_sdk.api.rental_api import RentalApi from smspool_sdk.api.sms_api import SMSApi +from smspool_sdk.api.status_api import StatusApi from smspool_sdk.api.voucher_api import VoucherApi -from smspool_sdk.api.esims_api import ESIMsApi diff --git a/smspool_sdk/api/business_api.py b/smspool_sdk/api/business_api.py index 9691598..7e5501d 100644 --- a/smspool_sdk/api/business_api.py +++ b/smspool_sdk/api/business_api.py @@ -1,7 +1,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -650,6 +650,7 @@ def business_user_update( ) -> object: """Update + Updates a sub-account. Send only the fields you want to change. `query` holds the result of each requested change. `success` is 1 only when every one of them succeeded; otherwise it is 0, `failed` lists the fields that were refused and `message` repeats the first refusal. :param id: User ID retrievd from `Retrieve users` endpoint (required) :type id: int @@ -735,6 +736,7 @@ def business_user_update_with_http_info( ) -> ApiResponse[object]: """Update + Updates a sub-account. Send only the fields you want to change. `query` holds the result of each requested change. `success` is 1 only when every one of them succeeded; otherwise it is 0, `failed` lists the fields that were refused and `message` repeats the first refusal. :param id: User ID retrievd from `Retrieve users` endpoint (required) :type id: int @@ -820,6 +822,7 @@ def business_user_update_without_preload_content( ) -> RESTResponseType: """Update + Updates a sub-account. Send only the fields you want to change. `query` holds the result of each requested change. `success` is 1 only when every one of them succeeded; otherwise it is 0, `failed` lists the fields that were refused and `message` repeats the first refusal. :param id: User ID retrievd from `Retrieve users` endpoint (required) :type id: int diff --git a/smspool_sdk/api/carrier_api.py b/smspool_sdk/api/carrier_api.py index ed7d058..ed2ac62 100644 --- a/smspool_sdk/api/carrier_api.py +++ b/smspool_sdk/api/carrier_api.py @@ -1,7 +1,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -55,7 +55,7 @@ def carrier_paid_lookup( ) -> object: """Lookup - This API endpoint is used to perform a paid lookup for a phone number. The request is sent via an HTTP POST method to the following URL: `https://api.smspool.net/carrier/paid_lookup` ``` json { \"success\": true, \"phonenumber\": \"\", \"country\": \"\", \"carrier\": \"\", \"carrier_type\": \"\", \"charge\": 0 } ``` The `success` field indicates whether the lookup was successful or not. The `phonenumber` field represents the phone number for which the lookup was performed. The `country` field indicates the country associated with the phone number. The `carrier` field provides the name of the carrier associated with the phone number. The `carrier_type` field specifies the type of carrier. The `charge` field represents the cost charged for the lookup operation. Please note that specific values for `phonenumber`, `country`, `carrier`, and `carrier_type` were not provided in the response, and the `charge` field had a value of 0. To use this endpoint, send an HTTP POST request to the provided URL with the necessary parameters. The request should include the phone number for which you want to perform the lookup. The response will contain the details of the carrier and associated information. Make sure to handle any errors that may occur during the lookup process and check the `success` field in the response to determine the outcome of the operation. + This API endpoint is used to perform a paid lookup for a phone number. The request is sent via an HTTP POST method to the following URL: `https://api.smspool.net/carrier/paid_lookup` ``` json { \"success\": true, \"phonenumber\": \"\", \"country\": \"\", \"carrier\": \"\", \"carrier_type\": \"\", \"charge\": 0 } ``` The `success` field indicates whether the lookup was successful or not. The `phonenumber` field represents the phone number for which the lookup was performed. The `country` field indicates the country associated with the phone number. The `carrier` field provides the name of the carrier associated with the phone number. The `carrier_type` field specifies the type of carrier. The `charge` field represents the cost charged for the lookup operation. Please note that specific values for `phonenumber`, `country`, `carrier`, and `carrier_type` were not provided in the response, and the `charge` field had a value of 0. To use this endpoint, send an HTTP POST request to the provided URL with the necessary parameters. The request should include the phone number for which you want to perform the lookup. The response will contain the details of the carrier and associated information. Make sure to handle any errors that may occur during the lookup process and check the `success` field in the response to determine the outcome of the operation. A lookup costs $0.01. When the lookup fails (`success: false`) the charge is returned and the response carries `refunded: true`. `phonenumber` is the number with its country code; a leading `+`, spaces and dashes are ignored. :param phonenumber: (required) :type phonenumber: int @@ -125,7 +125,7 @@ def carrier_paid_lookup_with_http_info( ) -> ApiResponse[object]: """Lookup - This API endpoint is used to perform a paid lookup for a phone number. The request is sent via an HTTP POST method to the following URL: `https://api.smspool.net/carrier/paid_lookup` ``` json { \"success\": true, \"phonenumber\": \"\", \"country\": \"\", \"carrier\": \"\", \"carrier_type\": \"\", \"charge\": 0 } ``` The `success` field indicates whether the lookup was successful or not. The `phonenumber` field represents the phone number for which the lookup was performed. The `country` field indicates the country associated with the phone number. The `carrier` field provides the name of the carrier associated with the phone number. The `carrier_type` field specifies the type of carrier. The `charge` field represents the cost charged for the lookup operation. Please note that specific values for `phonenumber`, `country`, `carrier`, and `carrier_type` were not provided in the response, and the `charge` field had a value of 0. To use this endpoint, send an HTTP POST request to the provided URL with the necessary parameters. The request should include the phone number for which you want to perform the lookup. The response will contain the details of the carrier and associated information. Make sure to handle any errors that may occur during the lookup process and check the `success` field in the response to determine the outcome of the operation. + This API endpoint is used to perform a paid lookup for a phone number. The request is sent via an HTTP POST method to the following URL: `https://api.smspool.net/carrier/paid_lookup` ``` json { \"success\": true, \"phonenumber\": \"\", \"country\": \"\", \"carrier\": \"\", \"carrier_type\": \"\", \"charge\": 0 } ``` The `success` field indicates whether the lookup was successful or not. The `phonenumber` field represents the phone number for which the lookup was performed. The `country` field indicates the country associated with the phone number. The `carrier` field provides the name of the carrier associated with the phone number. The `carrier_type` field specifies the type of carrier. The `charge` field represents the cost charged for the lookup operation. Please note that specific values for `phonenumber`, `country`, `carrier`, and `carrier_type` were not provided in the response, and the `charge` field had a value of 0. To use this endpoint, send an HTTP POST request to the provided URL with the necessary parameters. The request should include the phone number for which you want to perform the lookup. The response will contain the details of the carrier and associated information. Make sure to handle any errors that may occur during the lookup process and check the `success` field in the response to determine the outcome of the operation. A lookup costs $0.01. When the lookup fails (`success: false`) the charge is returned and the response carries `refunded: true`. `phonenumber` is the number with its country code; a leading `+`, spaces and dashes are ignored. :param phonenumber: (required) :type phonenumber: int @@ -195,7 +195,7 @@ def carrier_paid_lookup_without_preload_content( ) -> RESTResponseType: """Lookup - This API endpoint is used to perform a paid lookup for a phone number. The request is sent via an HTTP POST method to the following URL: `https://api.smspool.net/carrier/paid_lookup` ``` json { \"success\": true, \"phonenumber\": \"\", \"country\": \"\", \"carrier\": \"\", \"carrier_type\": \"\", \"charge\": 0 } ``` The `success` field indicates whether the lookup was successful or not. The `phonenumber` field represents the phone number for which the lookup was performed. The `country` field indicates the country associated with the phone number. The `carrier` field provides the name of the carrier associated with the phone number. The `carrier_type` field specifies the type of carrier. The `charge` field represents the cost charged for the lookup operation. Please note that specific values for `phonenumber`, `country`, `carrier`, and `carrier_type` were not provided in the response, and the `charge` field had a value of 0. To use this endpoint, send an HTTP POST request to the provided URL with the necessary parameters. The request should include the phone number for which you want to perform the lookup. The response will contain the details of the carrier and associated information. Make sure to handle any errors that may occur during the lookup process and check the `success` field in the response to determine the outcome of the operation. + This API endpoint is used to perform a paid lookup for a phone number. The request is sent via an HTTP POST method to the following URL: `https://api.smspool.net/carrier/paid_lookup` ``` json { \"success\": true, \"phonenumber\": \"\", \"country\": \"\", \"carrier\": \"\", \"carrier_type\": \"\", \"charge\": 0 } ``` The `success` field indicates whether the lookup was successful or not. The `phonenumber` field represents the phone number for which the lookup was performed. The `country` field indicates the country associated with the phone number. The `carrier` field provides the name of the carrier associated with the phone number. The `carrier_type` field specifies the type of carrier. The `charge` field represents the cost charged for the lookup operation. Please note that specific values for `phonenumber`, `country`, `carrier`, and `carrier_type` were not provided in the response, and the `charge` field had a value of 0. To use this endpoint, send an HTTP POST request to the provided URL with the necessary parameters. The request should include the phone number for which you want to perform the lookup. The response will contain the details of the carrier and associated information. Make sure to handle any errors that may occur during the lookup process and check the `success` field in the response to determine the outcome of the operation. A lookup costs $0.01. When the lookup fails (`success: false`) the charge is returned and the response carries `refunded: true`. `phonenumber` is the number with its country code; a leading `+`, spaces and dashes are ignored. :param phonenumber: (required) :type phonenumber: int diff --git a/smspool_sdk/api/esims_api.py b/smspool_sdk/api/esims_api.py deleted file mode 100644 index 86eb44e..0000000 --- a/smspool_sdk/api/esims_api.py +++ /dev/null @@ -1,2616 +0,0 @@ -""" - SMSPool API - - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. - - The version of the OpenAPI document: 1.0 - 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, StrictInt, StrictStr -from typing import Any, Optional -from typing_extensions import Annotated - -from smspool_sdk.api_client import ApiClient, RequestSerialized -from smspool_sdk.api_response import ApiResponse -from smspool_sdk.rest import RESTResponseType - - -class ESIMsApi: - """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 esim_delete( - self, - transaction_id: Annotated[StrictStr, Field(description="transactionId retrieved from /esim/purchase")], - _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: - """Delete eSIM - - - :param transaction_id: transactionId retrieved from /esim/purchase (required) - :type transaction_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._esim_delete_serialize( - transaction_id=transaction_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_delete_with_http_info( - self, - transaction_id: Annotated[StrictStr, Field(description="transactionId retrieved from /esim/purchase")], - _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]: - """Delete eSIM - - - :param transaction_id: transactionId retrieved from /esim/purchase (required) - :type transaction_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._esim_delete_serialize( - transaction_id=transaction_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_delete_without_preload_content( - self, - transaction_id: Annotated[StrictStr, Field(description="transactionId retrieved from /esim/purchase")], - _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: - """Delete eSIM - - - :param transaction_id: transactionId retrieved from /esim/purchase (required) - :type transaction_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._esim_delete_serialize( - transaction_id=transaction_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _esim_delete_serialize( - self, - transaction_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 - # process the query parameters - # process the header parameters - # process the form parameters - if transaction_id is not None: - _form_params.append(('transactionId', transaction_id)) - # 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' - ] - ) - - # 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/x-www-form-urlencoded' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - 'bearerAuth' - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/esim/delete', - 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 esim_history( - self, - start: Annotated[Optional[StrictInt], Field(description="Start page")] = None, - length: Annotated[Optional[StrictInt], Field(description="Amount of rows per page")] = None, - search: Annotated[Optional[StrictStr], Field(description="Alphanumeric search")] = 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: - """View eSIM history - - - :param start: Start page - :type start: int - :param length: Amount of rows per page - :type length: int - :param search: Alphanumeric search - :type search: 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._esim_history_serialize( - start=start, - length=length, - search=search, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_history_with_http_info( - self, - start: Annotated[Optional[StrictInt], Field(description="Start page")] = None, - length: Annotated[Optional[StrictInt], Field(description="Amount of rows per page")] = None, - search: Annotated[Optional[StrictStr], Field(description="Alphanumeric search")] = 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]: - """View eSIM history - - - :param start: Start page - :type start: int - :param length: Amount of rows per page - :type length: int - :param search: Alphanumeric search - :type search: 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._esim_history_serialize( - start=start, - length=length, - search=search, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_history_without_preload_content( - self, - start: Annotated[Optional[StrictInt], Field(description="Start page")] = None, - length: Annotated[Optional[StrictInt], Field(description="Amount of rows per page")] = None, - search: Annotated[Optional[StrictStr], Field(description="Alphanumeric search")] = 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: - """View eSIM history - - - :param start: Start page - :type start: int - :param length: Amount of rows per page - :type length: int - :param search: Alphanumeric search - :type search: 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._esim_history_serialize( - start=start, - length=length, - search=search, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _esim_history_serialize( - self, - start, - length, - search, - _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 - # process the query parameters - # process the header parameters - # process the form parameters - if start is not None: - _form_params.append(('start', start)) - if length is not None: - _form_params.append(('length', length)) - if search is not None: - _form_params.append(('search', search)) - # 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' - ] - ) - - # 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/x-www-form-urlencoded' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - 'bearerAuth' - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/esim/history', - 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 esim_label_update( - self, - transaction_id: Annotated[StrictStr, Field(description="transactionId retrieved from /esim/purchase")], - label: Annotated[Optional[StrictStr], Field(description="The new label: letters, numbers and spaces, at most 30 characters. Empty or left out removes the label.")] = 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: - """Update eSIM label - - Set or clear the label of one of your eSIMs. The label is returned as `label` by **View eSIM history**, so you can use it to tell your eSIMs apart. A label can be up to 30 characters long and may only contain letters, numbers and spaces. Leave `label` out, or send it empty, to remove the label. - - :param transaction_id: transactionId retrieved from /esim/purchase (required) - :type transaction_id: str - :param label: The new label: letters, numbers and spaces, at most 30 characters. Empty or left out removes the label. - :type label: 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._esim_label_update_serialize( - transaction_id=transaction_id, - label=label, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_label_update_with_http_info( - self, - transaction_id: Annotated[StrictStr, Field(description="transactionId retrieved from /esim/purchase")], - label: Annotated[Optional[StrictStr], Field(description="The new label: letters, numbers and spaces, at most 30 characters. Empty or left out removes the label.")] = 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]: - """Update eSIM label - - Set or clear the label of one of your eSIMs. The label is returned as `label` by **View eSIM history**, so you can use it to tell your eSIMs apart. A label can be up to 30 characters long and may only contain letters, numbers and spaces. Leave `label` out, or send it empty, to remove the label. - - :param transaction_id: transactionId retrieved from /esim/purchase (required) - :type transaction_id: str - :param label: The new label: letters, numbers and spaces, at most 30 characters. Empty or left out removes the label. - :type label: 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._esim_label_update_serialize( - transaction_id=transaction_id, - label=label, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_label_update_without_preload_content( - self, - transaction_id: Annotated[StrictStr, Field(description="transactionId retrieved from /esim/purchase")], - label: Annotated[Optional[StrictStr], Field(description="The new label: letters, numbers and spaces, at most 30 characters. Empty or left out removes the label.")] = 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: - """Update eSIM label - - Set or clear the label of one of your eSIMs. The label is returned as `label` by **View eSIM history**, so you can use it to tell your eSIMs apart. A label can be up to 30 characters long and may only contain letters, numbers and spaces. Leave `label` out, or send it empty, to remove the label. - - :param transaction_id: transactionId retrieved from /esim/purchase (required) - :type transaction_id: str - :param label: The new label: letters, numbers and spaces, at most 30 characters. Empty or left out removes the label. - :type label: 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._esim_label_update_serialize( - transaction_id=transaction_id, - label=label, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _esim_label_update_serialize( - self, - transaction_id, - label, - _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 - # process the query parameters - # process the header parameters - # process the form parameters - if transaction_id is not None: - _form_params.append(('transactionId', transaction_id)) - if label is not None: - _form_params.append(('label', label)) - # 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' - ] - ) - - # 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/x-www-form-urlencoded' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - 'bearerAuth' - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/esim/label/update', - 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 esim_plans( - self, - country: Annotated[StrictStr, Field(description="ISO 3166 country code")], - _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: - """View eSIM plans per country - - - :param country: ISO 3166 country code (required) - :type country: 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._esim_plans_serialize( - country=country, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_plans_with_http_info( - self, - country: Annotated[StrictStr, Field(description="ISO 3166 country code")], - _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]: - """View eSIM plans per country - - - :param country: ISO 3166 country code (required) - :type country: 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._esim_plans_serialize( - country=country, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_plans_without_preload_content( - self, - country: Annotated[StrictStr, Field(description="ISO 3166 country code")], - _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: - """View eSIM plans per country - - - :param country: ISO 3166 country code (required) - :type country: 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._esim_plans_serialize( - country=country, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _esim_plans_serialize( - self, - country, - _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 - # process the query parameters - # process the header parameters - # process the form parameters - if country is not None: - _form_params.append(('country', country)) - # 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' - ] - ) - - # 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/x-www-form-urlencoded' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - 'bearerAuth' - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/esim/plans', - 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 esim_pricing( - self, - start: Annotated[Optional[StrictInt], Field(description="Start page")] = None, - length: Annotated[Optional[StrictInt], Field(description="Amount of rows per page")] = None, - search: Annotated[Optional[StrictStr], Field(description="Search query for country")] = 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: - """View eSIM countries - - - :param start: Start page - :type start: int - :param length: Amount of rows per page - :type length: int - :param search: Search query for country - :type search: 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._esim_pricing_serialize( - start=start, - length=length, - search=search, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_pricing_with_http_info( - self, - start: Annotated[Optional[StrictInt], Field(description="Start page")] = None, - length: Annotated[Optional[StrictInt], Field(description="Amount of rows per page")] = None, - search: Annotated[Optional[StrictStr], Field(description="Search query for country")] = 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]: - """View eSIM countries - - - :param start: Start page - :type start: int - :param length: Amount of rows per page - :type length: int - :param search: Search query for country - :type search: 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._esim_pricing_serialize( - start=start, - length=length, - search=search, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_pricing_without_preload_content( - self, - start: Annotated[Optional[StrictInt], Field(description="Start page")] = None, - length: Annotated[Optional[StrictInt], Field(description="Amount of rows per page")] = None, - search: Annotated[Optional[StrictStr], Field(description="Search query for country")] = 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: - """View eSIM countries - - - :param start: Start page - :type start: int - :param length: Amount of rows per page - :type length: int - :param search: Search query for country - :type search: 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._esim_pricing_serialize( - start=start, - length=length, - search=search, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _esim_pricing_serialize( - self, - start, - length, - search, - _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 - # process the query parameters - # process the header parameters - # process the form parameters - if start is not None: - _form_params.append(('start', start)) - if length is not None: - _form_params.append(('length', length)) - if search is not None: - _form_params.append(('search', search)) - # 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' - ] - ) - - # 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/x-www-form-urlencoded' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - 'bearerAuth' - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/esim/pricing', - 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 esim_profile( - self, - transaction_id: Annotated[Optional[StrictStr], Field(description="transactionId retrieved from /esim/purchase")] = 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: - """View eSIM profile - - - :param transaction_id: transactionId retrieved from /esim/purchase - :type transaction_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._esim_profile_serialize( - transaction_id=transaction_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_profile_with_http_info( - self, - transaction_id: Annotated[Optional[StrictStr], Field(description="transactionId retrieved from /esim/purchase")] = 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]: - """View eSIM profile - - - :param transaction_id: transactionId retrieved from /esim/purchase - :type transaction_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._esim_profile_serialize( - transaction_id=transaction_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_profile_without_preload_content( - self, - transaction_id: Annotated[Optional[StrictStr], Field(description="transactionId retrieved from /esim/purchase")] = 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: - """View eSIM profile - - - :param transaction_id: transactionId retrieved from /esim/purchase - :type transaction_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._esim_profile_serialize( - transaction_id=transaction_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _esim_profile_serialize( - self, - transaction_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 - # process the query parameters - # process the header parameters - # process the form parameters - if transaction_id is not None: - _form_params.append(('transactionId', transaction_id)) - # 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' - ] - ) - - # 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/x-www-form-urlencoded' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - 'bearerAuth' - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/esim/profile', - 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 esim_purchase( - self, - plan: Annotated[StrictInt, Field(description="The plan ID which is obtained from /esim/pricing")], - _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: - """Purchase eSIM - - - :param plan: The plan ID which is obtained from /esim/pricing (required) - :type plan: int - :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._esim_purchase_serialize( - plan=plan, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_purchase_with_http_info( - self, - plan: Annotated[StrictInt, Field(description="The plan ID which is obtained from /esim/pricing")], - _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]: - """Purchase eSIM - - - :param plan: The plan ID which is obtained from /esim/pricing (required) - :type plan: int - :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._esim_purchase_serialize( - plan=plan, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_purchase_without_preload_content( - self, - plan: Annotated[StrictInt, Field(description="The plan ID which is obtained from /esim/pricing")], - _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: - """Purchase eSIM - - - :param plan: The plan ID which is obtained from /esim/pricing (required) - :type plan: int - :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._esim_purchase_serialize( - plan=plan, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _esim_purchase_serialize( - self, - plan, - _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 - # process the query parameters - # process the header parameters - # process the form parameters - if plan is not None: - _form_params.append(('plan', plan)) - # 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' - ] - ) - - # 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/x-www-form-urlencoded' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - 'bearerAuth' - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/esim/purchase', - 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 esim_topup( - self, - transaction_id: Annotated[StrictStr, Field(description="Transaction ID retrieved from eSIM history")], - plan: Annotated[StrictInt, Field(description="Topup plan retrieved from \\\"Top Up Plans\\\"")], - _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: - """Top up eSIM - - - :param transaction_id: Transaction ID retrieved from eSIM history (required) - :type transaction_id: str - :param plan: Topup plan retrieved from \\\"Top Up Plans\\\" (required) - :type plan: int - :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._esim_topup_serialize( - transaction_id=transaction_id, - plan=plan, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_topup_with_http_info( - self, - transaction_id: Annotated[StrictStr, Field(description="Transaction ID retrieved from eSIM history")], - plan: Annotated[StrictInt, Field(description="Topup plan retrieved from \\\"Top Up Plans\\\"")], - _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]: - """Top up eSIM - - - :param transaction_id: Transaction ID retrieved from eSIM history (required) - :type transaction_id: str - :param plan: Topup plan retrieved from \\\"Top Up Plans\\\" (required) - :type plan: int - :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._esim_topup_serialize( - transaction_id=transaction_id, - plan=plan, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - 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 esim_topup_without_preload_content( - self, - transaction_id: Annotated[StrictStr, Field(description="Transaction ID retrieved from eSIM history")], - plan: Annotated[StrictInt, Field(description="Topup plan retrieved from \\\"Top Up Plans\\\"")], - _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: - """Top up eSIM - - - :param transaction_id: Transaction ID retrieved from eSIM history (required) - :type transaction_id: str - :param plan: Topup plan retrieved from \\\"Top Up Plans\\\" (required) - :type plan: int - :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._esim_topup_serialize( - transaction_id=transaction_id, - plan=plan, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '401': "object", - '403': "object", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _esim_topup_serialize( - self, - transaction_id, - plan, - _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 - # process the query parameters - # process the header parameters - # process the form parameters - if transaction_id is not None: - _form_params.append(('transactionId', transaction_id)) - if plan is not None: - _form_params.append(('plan', plan)) - # 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' - ] - ) - - # 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/x-www-form-urlencoded' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - 'bearerAuth' - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/esim/topup', - 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 esim_topup_plans( - self, - plan: Annotated[StrictInt, Field(description="`plan` retrieved from eSIM history")], - _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: - """Top Up Plans - - - :param plan: `plan` retrieved from eSIM history (required) - :type plan: int - :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._esim_topup_plans_serialize( - plan=plan, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - } - 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 esim_topup_plans_with_http_info( - self, - plan: Annotated[StrictInt, Field(description="`plan` retrieved from eSIM history")], - _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]: - """Top Up Plans - - - :param plan: `plan` retrieved from eSIM history (required) - :type plan: int - :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._esim_topup_plans_serialize( - plan=plan, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - } - 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 esim_topup_plans_without_preload_content( - self, - plan: Annotated[StrictInt, Field(description="`plan` retrieved from eSIM history")], - _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: - """Top Up Plans - - - :param plan: `plan` retrieved from eSIM history (required) - :type plan: int - :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._esim_topup_plans_serialize( - plan=plan, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _esim_topup_plans_serialize( - self, - plan, - _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 - # process the query parameters - # process the header parameters - # process the form parameters - if plan is not None: - _form_params.append(('plan', plan)) - # 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' - ] - ) - - # 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/x-www-form-urlencoded' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/esim/topup_plans', - 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/smspool_sdk/api/information_api.py b/smspool_sdk/api/information_api.py index fbd91bf..c0a894d 100644 --- a/smspool_sdk/api/information_api.py +++ b/smspool_sdk/api/information_api.py @@ -1,7 +1,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -15,7 +15,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr +from pydantic import Field, StrictInt, StrictStr from typing import Any, Optional from typing_extensions import Annotated @@ -865,6 +865,297 @@ def _pool_retrieve_valid_serialize( + @validate_call + def request_auto_country( + self, + service: Annotated[StrictStr, Field(description="Service name or service ID which can be retrieved at the /service/retrieve_all endpoint")], + pricing_option: Annotated[Optional[StrictInt], Field(description="Set to 1 to prefer the cheapest country among those close to the best score; 0 (default) picks purely on the score.")] = 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: + """Pick the best country for a service + + Returns the country SMSPool would order from for this service when you do not want to choose one (the quick order's \"Pick for me\"). It sends an HTTP POST request to the URL `https://api.smspool.net/request/auto_country`. Every country with stock is scored on its expected success rate, weighed down when little stock backs it, minus a little per dollar, plus a bonus when it matches the country your request's IP resolves to (a local number verifies more often). The IP country is only used for that comparison; it is neither stored nor returned. Ties go to more stock, then the lower price. With `pricing_option=1` the cheapest country within reach of the best score wins instead. `success_rate` is that expected rate. Where the service has at least 20 recent orders in the country it is the measured rate and `rate_measured` is true. With fewer, it is an estimate that blends those orders (`rate_orders` of them) with how the country does across all services and how the service does elsewhere, and `rate_measured` is false. Send `auto_country=1` to `/purchase/sms` to order with the same choice in one call. + + :param service: Service name or service ID which can be retrieved at the /service/retrieve_all endpoint (required) + :type service: str + :param pricing_option: Set to 1 to prefer the cheapest country among those close to the best score; 0 (default) picks purely on the score. + :type pricing_option: int + :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._request_auto_country_serialize( + service=service, + pricing_option=pricing_option, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '400': "object", + } + 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 request_auto_country_with_http_info( + self, + service: Annotated[StrictStr, Field(description="Service name or service ID which can be retrieved at the /service/retrieve_all endpoint")], + pricing_option: Annotated[Optional[StrictInt], Field(description="Set to 1 to prefer the cheapest country among those close to the best score; 0 (default) picks purely on the score.")] = 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]: + """Pick the best country for a service + + Returns the country SMSPool would order from for this service when you do not want to choose one (the quick order's \"Pick for me\"). It sends an HTTP POST request to the URL `https://api.smspool.net/request/auto_country`. Every country with stock is scored on its expected success rate, weighed down when little stock backs it, minus a little per dollar, plus a bonus when it matches the country your request's IP resolves to (a local number verifies more often). The IP country is only used for that comparison; it is neither stored nor returned. Ties go to more stock, then the lower price. With `pricing_option=1` the cheapest country within reach of the best score wins instead. `success_rate` is that expected rate. Where the service has at least 20 recent orders in the country it is the measured rate and `rate_measured` is true. With fewer, it is an estimate that blends those orders (`rate_orders` of them) with how the country does across all services and how the service does elsewhere, and `rate_measured` is false. Send `auto_country=1` to `/purchase/sms` to order with the same choice in one call. + + :param service: Service name or service ID which can be retrieved at the /service/retrieve_all endpoint (required) + :type service: str + :param pricing_option: Set to 1 to prefer the cheapest country among those close to the best score; 0 (default) picks purely on the score. + :type pricing_option: int + :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._request_auto_country_serialize( + service=service, + pricing_option=pricing_option, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '400': "object", + } + 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 request_auto_country_without_preload_content( + self, + service: Annotated[StrictStr, Field(description="Service name or service ID which can be retrieved at the /service/retrieve_all endpoint")], + pricing_option: Annotated[Optional[StrictInt], Field(description="Set to 1 to prefer the cheapest country among those close to the best score; 0 (default) picks purely on the score.")] = 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: + """Pick the best country for a service + + Returns the country SMSPool would order from for this service when you do not want to choose one (the quick order's \"Pick for me\"). It sends an HTTP POST request to the URL `https://api.smspool.net/request/auto_country`. Every country with stock is scored on its expected success rate, weighed down when little stock backs it, minus a little per dollar, plus a bonus when it matches the country your request's IP resolves to (a local number verifies more often). The IP country is only used for that comparison; it is neither stored nor returned. Ties go to more stock, then the lower price. With `pricing_option=1` the cheapest country within reach of the best score wins instead. `success_rate` is that expected rate. Where the service has at least 20 recent orders in the country it is the measured rate and `rate_measured` is true. With fewer, it is an estimate that blends those orders (`rate_orders` of them) with how the country does across all services and how the service does elsewhere, and `rate_measured` is false. Send `auto_country=1` to `/purchase/sms` to order with the same choice in one call. + + :param service: Service name or service ID which can be retrieved at the /service/retrieve_all endpoint (required) + :type service: str + :param pricing_option: Set to 1 to prefer the cheapest country among those close to the best score; 0 (default) picks purely on the score. + :type pricing_option: int + :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._request_auto_country_serialize( + service=service, + pricing_option=pricing_option, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '400': "object", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _request_auto_country_serialize( + self, + service, + pricing_option, + _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 + # process the query parameters + # process the header parameters + # process the form parameters + if service is not None: + _form_params.append(('service', service)) + if pricing_option is not None: + _form_params.append(('pricing_option', pricing_option)) + # 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' + ] + ) + + # 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/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/request/auto_country', + 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 request_balance( self, @@ -883,7 +1174,7 @@ def request_balance( ) -> object: """Balance - This HTTP POST request is used to retrieve the balance for a specific SMSPool. The request is sent to the URL `https://api.smspool.net/request/balance`. ### Request Parameters This request require the \\`key\\` param which is your API key ### Response The response to this request will have a status code of 200 if the request is successful. The response body will be in JSON format and will include a `balance` field. However, the last execution of this request returned an empty string for the `balance` field. Please note that the actual value of the `balance` field may vary depending on the user and its configuration. + Retrieves your account balance in USD. ### Request Parameters Only your API key, sent as a bearer token. ### Response A JSON object with a `balance` field: the balance as a string with two decimals, for example `\"5.00\"`. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -949,7 +1240,7 @@ def request_balance_with_http_info( ) -> ApiResponse[object]: """Balance - This HTTP POST request is used to retrieve the balance for a specific SMSPool. The request is sent to the URL `https://api.smspool.net/request/balance`. ### Request Parameters This request require the \\`key\\` param which is your API key ### Response The response to this request will have a status code of 200 if the request is successful. The response body will be in JSON format and will include a `balance` field. However, the last execution of this request returned an empty string for the `balance` field. Please note that the actual value of the `balance` field may vary depending on the user and its configuration. + Retrieves your account balance in USD. ### Request Parameters Only your API key, sent as a bearer token. ### Response A JSON object with a `balance` field: the balance as a string with two decimals, for example `\"5.00\"`. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -1015,7 +1306,7 @@ def request_balance_without_preload_content( ) -> RESTResponseType: """Balance - This HTTP POST request is used to retrieve the balance for a specific SMSPool. The request is sent to the URL `https://api.smspool.net/request/balance`. ### Request Parameters This request require the \\`key\\` param which is your API key ### Response The response to this request will have a status code of 200 if the request is successful. The response body will be in JSON format and will include a `balance` field. However, the last execution of this request returned an empty string for the `balance` field. Please note that the actual value of the `balance` field may vary depending on the user and its configuration. + Retrieves your account balance in USD. ### Request Parameters Only your API key, sent as a bearer token. ### Response A JSON object with a `balance` field: the balance as a string with two decimals, for example `\"5.00\"`. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request diff --git a/smspool_sdk/api/preorders_api.py b/smspool_sdk/api/preorders_api.py index 762dbdd..76130ca 100644 --- a/smspool_sdk/api/preorders_api.py +++ b/smspool_sdk/api/preorders_api.py @@ -1,7 +1,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) diff --git a/smspool_sdk/api/pricing_api.py b/smspool_sdk/api/pricing_api.py index 6c9777a..bbf4274 100644 --- a/smspool_sdk/api/pricing_api.py +++ b/smspool_sdk/api/pricing_api.py @@ -1,7 +1,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -377,6 +377,7 @@ def request_pricing( ) -> object: """Retrieve all pricing + Retrieves prices, optionally filtered by country, service, pool and maximum price (`max_price` is rounded to two decimals). Without any filter the response is the full catalog (about 20 MB), rebuilt once an hour. It is sent with `ETag`, `Last-Modified` and `Cache-Control` headers: send `If-None-Match` (or `If-Modified-Since`) with your next request and you get `304 Not Modified` with no body while the catalog has not changed. :param country: Optional parameter to request services per country :type country: str @@ -455,6 +456,7 @@ def request_pricing_with_http_info( ) -> ApiResponse[object]: """Retrieve all pricing + Retrieves prices, optionally filtered by country, service, pool and maximum price (`max_price` is rounded to two decimals). Without any filter the response is the full catalog (about 20 MB), rebuilt once an hour. It is sent with `ETag`, `Last-Modified` and `Cache-Control` headers: send `If-None-Match` (or `If-Modified-Since`) with your next request and you get `304 Not Modified` with no body while the catalog has not changed. :param country: Optional parameter to request services per country :type country: str @@ -533,6 +535,7 @@ def request_pricing_without_preload_content( ) -> RESTResponseType: """Retrieve all pricing + Retrieves prices, optionally filtered by country, service, pool and maximum price (`max_price` is rounded to two decimals). Without any filter the response is the full catalog (about 20 MB), rebuilt once an hour. It is sent with `ETag`, `Last-Modified` and `Cache-Control` headers: send `If-None-Match` (or `If-Modified-Since`) with your next request and you get `304 Not Modified` with no body while the catalog has not changed. :param country: Optional parameter to request services per country :type country: str diff --git a/smspool_sdk/api/rental_api.py b/smspool_sdk/api/rental_api.py index f29307b..51ce607 100644 --- a/smspool_sdk/api/rental_api.py +++ b/smspool_sdk/api/rental_api.py @@ -1,7 +1,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -42,6 +42,7 @@ def purchase_rental( self, id: Annotated[StrictInt, Field(description="Rental ID retrieved from Retrieve Rental IDs")], days: StrictInt, + idempotency_key: Optional[StrictStr] = None, service_id: Annotated[Optional[StrictInt], Field(description="Optional value on which service you'd purchase the rental for")] = None, create_token: Annotated[Optional[StrictInt], Field(description="Create a rental token which allows you to share this specific rental")] = None, city: Optional[StrictStr] = None, @@ -67,6 +68,8 @@ def purchase_rental( :type id: int :param days: (required) :type days: int + :param idempotency_key: + :type idempotency_key: str :param service_id: Optional value on which service you'd purchase the rental for :type service_id: int :param create_token: Create a rental token which allows you to share this specific rental @@ -102,6 +105,7 @@ def purchase_rental( _param = self._purchase_rental_serialize( id=id, days=days, + idempotency_key=idempotency_key, service_id=service_id, create_token=create_token, city=city, @@ -118,6 +122,7 @@ def purchase_rental( '400': "object", '401': "object", '403': "object", + '409': "object", } response_data = self.api_client.call_api( *_param, @@ -135,6 +140,7 @@ def purchase_rental_with_http_info( self, id: Annotated[StrictInt, Field(description="Rental ID retrieved from Retrieve Rental IDs")], days: StrictInt, + idempotency_key: Optional[StrictStr] = None, service_id: Annotated[Optional[StrictInt], Field(description="Optional value on which service you'd purchase the rental for")] = None, create_token: Annotated[Optional[StrictInt], Field(description="Create a rental token which allows you to share this specific rental")] = None, city: Optional[StrictStr] = None, @@ -160,6 +166,8 @@ def purchase_rental_with_http_info( :type id: int :param days: (required) :type days: int + :param idempotency_key: + :type idempotency_key: str :param service_id: Optional value on which service you'd purchase the rental for :type service_id: int :param create_token: Create a rental token which allows you to share this specific rental @@ -195,6 +203,7 @@ def purchase_rental_with_http_info( _param = self._purchase_rental_serialize( id=id, days=days, + idempotency_key=idempotency_key, service_id=service_id, create_token=create_token, city=city, @@ -211,6 +220,7 @@ def purchase_rental_with_http_info( '400': "object", '401': "object", '403': "object", + '409': "object", } response_data = self.api_client.call_api( *_param, @@ -228,6 +238,7 @@ def purchase_rental_without_preload_content( self, id: Annotated[StrictInt, Field(description="Rental ID retrieved from Retrieve Rental IDs")], days: StrictInt, + idempotency_key: Optional[StrictStr] = None, service_id: Annotated[Optional[StrictInt], Field(description="Optional value on which service you'd purchase the rental for")] = None, create_token: Annotated[Optional[StrictInt], Field(description="Create a rental token which allows you to share this specific rental")] = None, city: Optional[StrictStr] = None, @@ -253,6 +264,8 @@ def purchase_rental_without_preload_content( :type id: int :param days: (required) :type days: int + :param idempotency_key: + :type idempotency_key: str :param service_id: Optional value on which service you'd purchase the rental for :type service_id: int :param create_token: Create a rental token which allows you to share this specific rental @@ -288,6 +301,7 @@ def purchase_rental_without_preload_content( _param = self._purchase_rental_serialize( id=id, days=days, + idempotency_key=idempotency_key, service_id=service_id, create_token=create_token, city=city, @@ -304,6 +318,7 @@ def purchase_rental_without_preload_content( '400': "object", '401': "object", '403': "object", + '409': "object", } response_data = self.api_client.call_api( *_param, @@ -316,6 +331,7 @@ def _purchase_rental_serialize( self, id, days, + idempotency_key, service_id, create_token, city, @@ -344,6 +360,8 @@ def _purchase_rental_serialize( # process the path parameters # process the query parameters # process the header parameters + if idempotency_key is not None: + _header_params['Idempotency-Key'] = idempotency_key # process the form parameters if id is not None: _form_params.append(('id', id)) @@ -2876,6 +2894,7 @@ def rental_retrieve_messages( ) -> object: """Retrieve Rental Messages + Successful answers are cached for 3 seconds per rental, so polling faster than that returns the same data. :param rental_code: The retrieved rental code from the `Order rental` endpoint. (required) :type rental_code: str @@ -2945,6 +2964,7 @@ def rental_retrieve_messages_with_http_info( ) -> ApiResponse[object]: """Retrieve Rental Messages + Successful answers are cached for 3 seconds per rental, so polling faster than that returns the same data. :param rental_code: The retrieved rental code from the `Order rental` endpoint. (required) :type rental_code: str @@ -3014,6 +3034,7 @@ def rental_retrieve_messages_without_preload_content( ) -> RESTResponseType: """Retrieve Rental Messages + Successful answers are cached for 3 seconds per rental, so polling faster than that returns the same data. :param rental_code: The retrieved rental code from the `Order rental` endpoint. (required) :type rental_code: str @@ -3711,6 +3732,7 @@ def rental_retrieve_status( ) -> object: """Retrieve Rental Status + Successful answers are cached for 3 seconds per rental, so polling faster than that returns the same data. :param rental_code: The retrieved rental code from the `Order rental` endpoint. (required) :type rental_code: str @@ -3780,6 +3802,7 @@ def rental_retrieve_status_with_http_info( ) -> ApiResponse[object]: """Retrieve Rental Status + Successful answers are cached for 3 seconds per rental, so polling faster than that returns the same data. :param rental_code: The retrieved rental code from the `Order rental` endpoint. (required) :type rental_code: str @@ -3849,6 +3872,7 @@ def rental_retrieve_status_without_preload_content( ) -> RESTResponseType: """Retrieve Rental Status + Successful answers are cached for 3 seconds per rental, so polling faster than that returns the same data. :param rental_code: The retrieved rental code from the `Order rental` endpoint. (required) :type rental_code: str @@ -4329,6 +4353,8 @@ def rental_stock( _response_types_map: Dict[str, Optional[str]] = { '200': "object", + '401': "object", + '403': "object", } response_data = self.api_client.call_api( *_param, @@ -4403,6 +4429,8 @@ def rental_stock_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "object", + '401': "object", + '403': "object", } response_data = self.api_client.call_api( *_param, @@ -4477,6 +4505,8 @@ def rental_stock_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "object", + '401': "object", + '403': "object", } response_data = self.api_client.call_api( *_param, @@ -4547,6 +4577,7 @@ def _rental_stock_serialize( # authentication setting _auth_settings: List[str] = [ + 'bearerAuth' ] return self.api_client.param_serialize( diff --git a/smspool_sdk/api/sms_api.py b/smspool_sdk/api/sms_api.py index 5ec97cd..e1a9bc4 100644 --- a/smspool_sdk/api/sms_api.py +++ b/smspool_sdk/api/sms_api.py @@ -1,7 +1,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -41,17 +41,20 @@ def __init__(self, api_client=None) -> None: def purchase_sms( self, service: Annotated[StrictStr, Field(description="The service or number retrieved from the `Service List` endpoint")], + idempotency_key: Optional[StrictStr] = None, country: Annotated[Optional[StrictStr], Field(description="The country in ISO format or number retrieved from the `Country List` endpoint")] = None, - pool: Annotated[Optional[StrictStr], Field(description="The pool or number retrieved from the `Pool List` endpoint (optional)")] = None, + pool: Annotated[Optional[StrictStr], Field(description="The pool ID or name retrieved from the `Pool List` endpoint (optional). An unknown name answers 400 `INVALID_POOL`.")] = None, max_price: Annotated[Optional[Union[StrictFloat, StrictInt]], Field(description="The max price you are willing to pay per number")] = None, pricing_option: Annotated[Optional[StrictInt], Field(description="Set to 0 if you'd like the cheapest numbers, set to 1 for highest success rate")] = None, - quantity: Annotated[Optional[StrictInt], Field(description="Quantity of numbers ordered")] = None, + quantity: Annotated[Optional[StrictInt], Field(description="Quantity of numbers ordered, 1 to 20. Must be a whole number.")] = None, areacode: Annotated[Optional[StrictStr], Field(description="Areacodes you would like to include or exclude in JSON format")] = None, exclude: Annotated[Optional[StrictInt], Field(description="Set exclude to 1 if you would like to exclude all listed area codes.")] = None, create_token: Annotated[Optional[StrictInt], Field(description="Optional param; set to 1 if you'd like to create a token link that anyone can access.")] = None, activation_type: Annotated[Optional[StrictStr], Field(description="Options: SMS, VOICE, FLASH. SMS will receive regular SMS, VOICE will receive phone calls that mentions the SMS and FLASH is for FLASH calls for verification.")] = None, carrier: Annotated[Optional[StrictInt], Field(description="Options: 1 or 2. Pick a carrier (only works for pool Foxtrot US)")] = None, - phonenumber: Annotated[Optional[StrictInt], Field(description="In case you want to select a specific phone number to order")] = None, + phonenumber: Annotated[Optional[StrictInt], Field(description="In case you want to select a specific phone number to order. Digits with the country code; a leading +, spaces and dashes are ignored.")] = None, + auto_country: Annotated[Optional[StrictInt], Field(description="Set to 1 to let SMSPool pick the country: every country with stock is scored on its expected success rate (estimated from the country's record across all services when the service has few orders there; weighed down when little stock backs it, minus a little per dollar) with a bonus for a local number, the country your request's IP resolves to; with pricing_option=1 the cheapest country close to the best score wins. Ignored when country is sent. The response then carries auto_country with the chosen country and the reason.")] = None, + response: Annotated[Optional[StrictStr], Field(description="Set to `v2` for one response shape whatever the quantity: `{success, orders, failed, message}`. Leave out for the legacy shapes.")] = None, software: Optional[StrictInt] = None, _request_timeout: Union[ None, @@ -68,18 +71,21 @@ def purchase_sms( ) -> object: """Order SMS + Orders one or more numbers for a service. ### Response shapes Without `response=v2` the shape depends on `quantity`: one number returns the order object; several return a JSON array of order objects; if ordering stops part-way, an object with the orders bought so far under `\"0\"`, `\"1\"`, ... plus `message`. With `response=v2` every case returns the same object: - `success`: 1 when every requested number was ordered, otherwise 0 - `orders`: the orders that were placed (may be empty) - `failed`: the error that stopped the request, as a one-element list (empty on success) - `message`: a summary - `auto_country`: only with `auto_country=1`, the chosen country `response=v2` is ignored together with `create_token=1`. ### Pool `pool` is a pool ID or name from the `Pool List` endpoint. A name that does not exist answers 400 with `type: INVALID_POOL`. Leave it out (or send it empty or `0`) for any pool. ### Retrying safely Send an `Idempotency-Key` header so a retry after a timeout cannot buy twice. :param service: The service or number retrieved from the `Service List` endpoint (required) :type service: str + :param idempotency_key: + :type idempotency_key: str :param country: The country in ISO format or number retrieved from the `Country List` endpoint :type country: str - :param pool: The pool or number retrieved from the `Pool List` endpoint (optional) + :param pool: The pool ID or name retrieved from the `Pool List` endpoint (optional). An unknown name answers 400 `INVALID_POOL`. :type pool: str :param max_price: The max price you are willing to pay per number :type max_price: float :param pricing_option: Set to 0 if you'd like the cheapest numbers, set to 1 for highest success rate :type pricing_option: int - :param quantity: Quantity of numbers ordered + :param quantity: Quantity of numbers ordered, 1 to 20. Must be a whole number. :type quantity: int :param areacode: Areacodes you would like to include or exclude in JSON format :type areacode: str @@ -91,8 +97,12 @@ def purchase_sms( :type activation_type: str :param carrier: Options: 1 or 2. Pick a carrier (only works for pool Foxtrot US) :type carrier: int - :param phonenumber: In case you want to select a specific phone number to order + :param phonenumber: In case you want to select a specific phone number to order. Digits with the country code; a leading +, spaces and dashes are ignored. :type phonenumber: int + :param auto_country: Set to 1 to let SMSPool pick the country: every country with stock is scored on its expected success rate (estimated from the country's record across all services when the service has few orders there; weighed down when little stock backs it, minus a little per dollar) with a bonus for a local number, the country your request's IP resolves to; with pricing_option=1 the cheapest country close to the best score wins. Ignored when country is sent. The response then carries auto_country with the chosen country and the reason. + :type auto_country: int + :param response: Set to `v2` for one response shape whatever the quantity: `{success, orders, failed, message}`. Leave out for the legacy shapes. + :type response: str :param software: :type software: int :param _request_timeout: timeout setting for this request. If one @@ -119,6 +129,7 @@ def purchase_sms( _param = self._purchase_sms_serialize( service=service, + idempotency_key=idempotency_key, country=country, pool=pool, max_price=max_price, @@ -130,6 +141,8 @@ def purchase_sms( activation_type=activation_type, carrier=carrier, phonenumber=phonenumber, + auto_country=auto_country, + response=response, software=software, _request_auth=_request_auth, _content_type=_content_type, @@ -139,8 +152,10 @@ def purchase_sms( _response_types_map: Dict[str, Optional[str]] = { '200': "object", + '400': "object", '401': "object", '403': "object", + '409': "object", '422': "object", } response_data = self.api_client.call_api( @@ -158,17 +173,20 @@ def purchase_sms( def purchase_sms_with_http_info( self, service: Annotated[StrictStr, Field(description="The service or number retrieved from the `Service List` endpoint")], + idempotency_key: Optional[StrictStr] = None, country: Annotated[Optional[StrictStr], Field(description="The country in ISO format or number retrieved from the `Country List` endpoint")] = None, - pool: Annotated[Optional[StrictStr], Field(description="The pool or number retrieved from the `Pool List` endpoint (optional)")] = None, + pool: Annotated[Optional[StrictStr], Field(description="The pool ID or name retrieved from the `Pool List` endpoint (optional). An unknown name answers 400 `INVALID_POOL`.")] = None, max_price: Annotated[Optional[Union[StrictFloat, StrictInt]], Field(description="The max price you are willing to pay per number")] = None, pricing_option: Annotated[Optional[StrictInt], Field(description="Set to 0 if you'd like the cheapest numbers, set to 1 for highest success rate")] = None, - quantity: Annotated[Optional[StrictInt], Field(description="Quantity of numbers ordered")] = None, + quantity: Annotated[Optional[StrictInt], Field(description="Quantity of numbers ordered, 1 to 20. Must be a whole number.")] = None, areacode: Annotated[Optional[StrictStr], Field(description="Areacodes you would like to include or exclude in JSON format")] = None, exclude: Annotated[Optional[StrictInt], Field(description="Set exclude to 1 if you would like to exclude all listed area codes.")] = None, create_token: Annotated[Optional[StrictInt], Field(description="Optional param; set to 1 if you'd like to create a token link that anyone can access.")] = None, activation_type: Annotated[Optional[StrictStr], Field(description="Options: SMS, VOICE, FLASH. SMS will receive regular SMS, VOICE will receive phone calls that mentions the SMS and FLASH is for FLASH calls for verification.")] = None, carrier: Annotated[Optional[StrictInt], Field(description="Options: 1 or 2. Pick a carrier (only works for pool Foxtrot US)")] = None, - phonenumber: Annotated[Optional[StrictInt], Field(description="In case you want to select a specific phone number to order")] = None, + phonenumber: Annotated[Optional[StrictInt], Field(description="In case you want to select a specific phone number to order. Digits with the country code; a leading +, spaces and dashes are ignored.")] = None, + auto_country: Annotated[Optional[StrictInt], Field(description="Set to 1 to let SMSPool pick the country: every country with stock is scored on its expected success rate (estimated from the country's record across all services when the service has few orders there; weighed down when little stock backs it, minus a little per dollar) with a bonus for a local number, the country your request's IP resolves to; with pricing_option=1 the cheapest country close to the best score wins. Ignored when country is sent. The response then carries auto_country with the chosen country and the reason.")] = None, + response: Annotated[Optional[StrictStr], Field(description="Set to `v2` for one response shape whatever the quantity: `{success, orders, failed, message}`. Leave out for the legacy shapes.")] = None, software: Optional[StrictInt] = None, _request_timeout: Union[ None, @@ -185,18 +203,21 @@ def purchase_sms_with_http_info( ) -> ApiResponse[object]: """Order SMS + Orders one or more numbers for a service. ### Response shapes Without `response=v2` the shape depends on `quantity`: one number returns the order object; several return a JSON array of order objects; if ordering stops part-way, an object with the orders bought so far under `\"0\"`, `\"1\"`, ... plus `message`. With `response=v2` every case returns the same object: - `success`: 1 when every requested number was ordered, otherwise 0 - `orders`: the orders that were placed (may be empty) - `failed`: the error that stopped the request, as a one-element list (empty on success) - `message`: a summary - `auto_country`: only with `auto_country=1`, the chosen country `response=v2` is ignored together with `create_token=1`. ### Pool `pool` is a pool ID or name from the `Pool List` endpoint. A name that does not exist answers 400 with `type: INVALID_POOL`. Leave it out (or send it empty or `0`) for any pool. ### Retrying safely Send an `Idempotency-Key` header so a retry after a timeout cannot buy twice. :param service: The service or number retrieved from the `Service List` endpoint (required) :type service: str + :param idempotency_key: + :type idempotency_key: str :param country: The country in ISO format or number retrieved from the `Country List` endpoint :type country: str - :param pool: The pool or number retrieved from the `Pool List` endpoint (optional) + :param pool: The pool ID or name retrieved from the `Pool List` endpoint (optional). An unknown name answers 400 `INVALID_POOL`. :type pool: str :param max_price: The max price you are willing to pay per number :type max_price: float :param pricing_option: Set to 0 if you'd like the cheapest numbers, set to 1 for highest success rate :type pricing_option: int - :param quantity: Quantity of numbers ordered + :param quantity: Quantity of numbers ordered, 1 to 20. Must be a whole number. :type quantity: int :param areacode: Areacodes you would like to include or exclude in JSON format :type areacode: str @@ -208,8 +229,12 @@ def purchase_sms_with_http_info( :type activation_type: str :param carrier: Options: 1 or 2. Pick a carrier (only works for pool Foxtrot US) :type carrier: int - :param phonenumber: In case you want to select a specific phone number to order + :param phonenumber: In case you want to select a specific phone number to order. Digits with the country code; a leading +, spaces and dashes are ignored. :type phonenumber: int + :param auto_country: Set to 1 to let SMSPool pick the country: every country with stock is scored on its expected success rate (estimated from the country's record across all services when the service has few orders there; weighed down when little stock backs it, minus a little per dollar) with a bonus for a local number, the country your request's IP resolves to; with pricing_option=1 the cheapest country close to the best score wins. Ignored when country is sent. The response then carries auto_country with the chosen country and the reason. + :type auto_country: int + :param response: Set to `v2` for one response shape whatever the quantity: `{success, orders, failed, message}`. Leave out for the legacy shapes. + :type response: str :param software: :type software: int :param _request_timeout: timeout setting for this request. If one @@ -236,6 +261,7 @@ def purchase_sms_with_http_info( _param = self._purchase_sms_serialize( service=service, + idempotency_key=idempotency_key, country=country, pool=pool, max_price=max_price, @@ -247,6 +273,8 @@ def purchase_sms_with_http_info( activation_type=activation_type, carrier=carrier, phonenumber=phonenumber, + auto_country=auto_country, + response=response, software=software, _request_auth=_request_auth, _content_type=_content_type, @@ -256,8 +284,10 @@ def purchase_sms_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "object", + '400': "object", '401': "object", '403': "object", + '409': "object", '422': "object", } response_data = self.api_client.call_api( @@ -275,17 +305,20 @@ def purchase_sms_with_http_info( def purchase_sms_without_preload_content( self, service: Annotated[StrictStr, Field(description="The service or number retrieved from the `Service List` endpoint")], + idempotency_key: Optional[StrictStr] = None, country: Annotated[Optional[StrictStr], Field(description="The country in ISO format or number retrieved from the `Country List` endpoint")] = None, - pool: Annotated[Optional[StrictStr], Field(description="The pool or number retrieved from the `Pool List` endpoint (optional)")] = None, + pool: Annotated[Optional[StrictStr], Field(description="The pool ID or name retrieved from the `Pool List` endpoint (optional). An unknown name answers 400 `INVALID_POOL`.")] = None, max_price: Annotated[Optional[Union[StrictFloat, StrictInt]], Field(description="The max price you are willing to pay per number")] = None, pricing_option: Annotated[Optional[StrictInt], Field(description="Set to 0 if you'd like the cheapest numbers, set to 1 for highest success rate")] = None, - quantity: Annotated[Optional[StrictInt], Field(description="Quantity of numbers ordered")] = None, + quantity: Annotated[Optional[StrictInt], Field(description="Quantity of numbers ordered, 1 to 20. Must be a whole number.")] = None, areacode: Annotated[Optional[StrictStr], Field(description="Areacodes you would like to include or exclude in JSON format")] = None, exclude: Annotated[Optional[StrictInt], Field(description="Set exclude to 1 if you would like to exclude all listed area codes.")] = None, create_token: Annotated[Optional[StrictInt], Field(description="Optional param; set to 1 if you'd like to create a token link that anyone can access.")] = None, activation_type: Annotated[Optional[StrictStr], Field(description="Options: SMS, VOICE, FLASH. SMS will receive regular SMS, VOICE will receive phone calls that mentions the SMS and FLASH is for FLASH calls for verification.")] = None, carrier: Annotated[Optional[StrictInt], Field(description="Options: 1 or 2. Pick a carrier (only works for pool Foxtrot US)")] = None, - phonenumber: Annotated[Optional[StrictInt], Field(description="In case you want to select a specific phone number to order")] = None, + phonenumber: Annotated[Optional[StrictInt], Field(description="In case you want to select a specific phone number to order. Digits with the country code; a leading +, spaces and dashes are ignored.")] = None, + auto_country: Annotated[Optional[StrictInt], Field(description="Set to 1 to let SMSPool pick the country: every country with stock is scored on its expected success rate (estimated from the country's record across all services when the service has few orders there; weighed down when little stock backs it, minus a little per dollar) with a bonus for a local number, the country your request's IP resolves to; with pricing_option=1 the cheapest country close to the best score wins. Ignored when country is sent. The response then carries auto_country with the chosen country and the reason.")] = None, + response: Annotated[Optional[StrictStr], Field(description="Set to `v2` for one response shape whatever the quantity: `{success, orders, failed, message}`. Leave out for the legacy shapes.")] = None, software: Optional[StrictInt] = None, _request_timeout: Union[ None, @@ -302,18 +335,21 @@ def purchase_sms_without_preload_content( ) -> RESTResponseType: """Order SMS + Orders one or more numbers for a service. ### Response shapes Without `response=v2` the shape depends on `quantity`: one number returns the order object; several return a JSON array of order objects; if ordering stops part-way, an object with the orders bought so far under `\"0\"`, `\"1\"`, ... plus `message`. With `response=v2` every case returns the same object: - `success`: 1 when every requested number was ordered, otherwise 0 - `orders`: the orders that were placed (may be empty) - `failed`: the error that stopped the request, as a one-element list (empty on success) - `message`: a summary - `auto_country`: only with `auto_country=1`, the chosen country `response=v2` is ignored together with `create_token=1`. ### Pool `pool` is a pool ID or name from the `Pool List` endpoint. A name that does not exist answers 400 with `type: INVALID_POOL`. Leave it out (or send it empty or `0`) for any pool. ### Retrying safely Send an `Idempotency-Key` header so a retry after a timeout cannot buy twice. :param service: The service or number retrieved from the `Service List` endpoint (required) :type service: str + :param idempotency_key: + :type idempotency_key: str :param country: The country in ISO format or number retrieved from the `Country List` endpoint :type country: str - :param pool: The pool or number retrieved from the `Pool List` endpoint (optional) + :param pool: The pool ID or name retrieved from the `Pool List` endpoint (optional). An unknown name answers 400 `INVALID_POOL`. :type pool: str :param max_price: The max price you are willing to pay per number :type max_price: float :param pricing_option: Set to 0 if you'd like the cheapest numbers, set to 1 for highest success rate :type pricing_option: int - :param quantity: Quantity of numbers ordered + :param quantity: Quantity of numbers ordered, 1 to 20. Must be a whole number. :type quantity: int :param areacode: Areacodes you would like to include or exclude in JSON format :type areacode: str @@ -325,8 +361,12 @@ def purchase_sms_without_preload_content( :type activation_type: str :param carrier: Options: 1 or 2. Pick a carrier (only works for pool Foxtrot US) :type carrier: int - :param phonenumber: In case you want to select a specific phone number to order + :param phonenumber: In case you want to select a specific phone number to order. Digits with the country code; a leading +, spaces and dashes are ignored. :type phonenumber: int + :param auto_country: Set to 1 to let SMSPool pick the country: every country with stock is scored on its expected success rate (estimated from the country's record across all services when the service has few orders there; weighed down when little stock backs it, minus a little per dollar) with a bonus for a local number, the country your request's IP resolves to; with pricing_option=1 the cheapest country close to the best score wins. Ignored when country is sent. The response then carries auto_country with the chosen country and the reason. + :type auto_country: int + :param response: Set to `v2` for one response shape whatever the quantity: `{success, orders, failed, message}`. Leave out for the legacy shapes. + :type response: str :param software: :type software: int :param _request_timeout: timeout setting for this request. If one @@ -353,6 +393,7 @@ def purchase_sms_without_preload_content( _param = self._purchase_sms_serialize( service=service, + idempotency_key=idempotency_key, country=country, pool=pool, max_price=max_price, @@ -364,6 +405,8 @@ def purchase_sms_without_preload_content( activation_type=activation_type, carrier=carrier, phonenumber=phonenumber, + auto_country=auto_country, + response=response, software=software, _request_auth=_request_auth, _content_type=_content_type, @@ -373,8 +416,10 @@ def purchase_sms_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "object", + '400': "object", '401': "object", '403': "object", + '409': "object", '422': "object", } response_data = self.api_client.call_api( @@ -387,6 +432,7 @@ def purchase_sms_without_preload_content( def _purchase_sms_serialize( self, service, + idempotency_key, country, pool, max_price, @@ -398,6 +444,8 @@ def _purchase_sms_serialize( activation_type, carrier, phonenumber, + auto_country, + response, software, _request_auth, _content_type, @@ -422,6 +470,8 @@ def _purchase_sms_serialize( # process the path parameters # process the query parameters # process the header parameters + if idempotency_key is not None: + _header_params['Idempotency-Key'] = idempotency_key # process the form parameters if country is not None: _form_params.append(('country', country)) @@ -447,6 +497,10 @@ def _purchase_sms_serialize( _form_params.append(('carrier', carrier)) if phonenumber is not None: _form_params.append(('phonenumber', phonenumber)) + if auto_country is not None: + _form_params.append(('auto_country', auto_country)) + if response is not None: + _form_params.append(('response', response)) if software is not None: _form_params.append(('software', software)) # process the body parameter @@ -1063,6 +1117,8 @@ def request_areacodes( _response_types_map: Dict[str, Optional[str]] = { '200': "object", + '401': "object", + '403': "object", } response_data = self.api_client.call_api( *_param, @@ -1137,6 +1193,8 @@ def request_areacodes_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "object", + '401': "object", + '403': "object", } response_data = self.api_client.call_api( *_param, @@ -1211,6 +1269,8 @@ def request_areacodes_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "object", + '401': "object", + '403': "object", } response_data = self.api_client.call_api( *_param, @@ -1281,6 +1341,7 @@ def _request_areacodes_serialize( # authentication setting _auth_settings: List[str] = [ + 'bearerAuth' ] return self.api_client.param_serialize( @@ -1612,9 +1673,11 @@ def _request_history_serialize( @validate_call - def sms_activate( + def request_history_search( self, - orderid: StrictStr, + search: Annotated[StrictStr, Field(description="The search term, as typed into the order history's search box. At most 32 characters.")], + cursor: Annotated[Optional[StrictStr], Field(description="`next` from the previous call. Leave out for the first call.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Matches per call, 1 to 500 (default 100).")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1628,12 +1691,16 @@ def sms_activate( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> object: - """Activate SMS + """Search order history - This endpoint will forcefully activate an SMS to set it available for future resends, please keep in mind that these orders are NOT eligible for a refund after activating them. + One step of a search through your order history, newest orders first. Each call reads a bounded slice of your orders and returns the matches in it plus `next`. Pass `next` back as `cursor` to continue; the search is complete when `next` is `null`. A call can return no matches and still have a `next`. - :param orderid: (required) - :type orderid: str + :param search: The search term, as typed into the order history's search box. At most 32 characters. (required) + :type search: str + :param cursor: `next` from the previous call. Leave out for the first call. + :type cursor: str + :param limit: Matches per call, 1 to 500 (default 100). + :type limit: int :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 @@ -1656,8 +1723,10 @@ def sms_activate( :return: Returns the result object. """ # noqa: E501 - _param = self._sms_activate_serialize( - orderid=orderid, + _param = self._request_history_search_serialize( + search=search, + cursor=cursor, + limit=limit, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1666,10 +1735,9 @@ def sms_activate( _response_types_map: Dict[str, Optional[str]] = { '200': "object", - '400': "object", '401': "object", '403': "object", - '404': "object", + '422': "object", } response_data = self.api_client.call_api( *_param, @@ -1683,9 +1751,11 @@ def sms_activate( @validate_call - def sms_activate_with_http_info( + def request_history_search_with_http_info( self, - orderid: StrictStr, + search: Annotated[StrictStr, Field(description="The search term, as typed into the order history's search box. At most 32 characters.")], + cursor: Annotated[Optional[StrictStr], Field(description="`next` from the previous call. Leave out for the first call.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Matches per call, 1 to 500 (default 100).")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1699,12 +1769,16 @@ def sms_activate_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[object]: - """Activate SMS + """Search order history - This endpoint will forcefully activate an SMS to set it available for future resends, please keep in mind that these orders are NOT eligible for a refund after activating them. + One step of a search through your order history, newest orders first. Each call reads a bounded slice of your orders and returns the matches in it plus `next`. Pass `next` back as `cursor` to continue; the search is complete when `next` is `null`. A call can return no matches and still have a `next`. - :param orderid: (required) - :type orderid: str + :param search: The search term, as typed into the order history's search box. At most 32 characters. (required) + :type search: str + :param cursor: `next` from the previous call. Leave out for the first call. + :type cursor: str + :param limit: Matches per call, 1 to 500 (default 100). + :type limit: int :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 @@ -1727,8 +1801,10 @@ def sms_activate_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._sms_activate_serialize( - orderid=orderid, + _param = self._request_history_search_serialize( + search=search, + cursor=cursor, + limit=limit, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1737,10 +1813,9 @@ def sms_activate_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "object", - '400': "object", '401': "object", '403': "object", - '404': "object", + '422': "object", } response_data = self.api_client.call_api( *_param, @@ -1754,9 +1829,11 @@ def sms_activate_with_http_info( @validate_call - def sms_activate_without_preload_content( + def request_history_search_without_preload_content( self, - orderid: StrictStr, + search: Annotated[StrictStr, Field(description="The search term, as typed into the order history's search box. At most 32 characters.")], + cursor: Annotated[Optional[StrictStr], Field(description="`next` from the previous call. Leave out for the first call.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Matches per call, 1 to 500 (default 100).")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1770,12 +1847,16 @@ def sms_activate_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Activate SMS + """Search order history - This endpoint will forcefully activate an SMS to set it available for future resends, please keep in mind that these orders are NOT eligible for a refund after activating them. + One step of a search through your order history, newest orders first. Each call reads a bounded slice of your orders and returns the matches in it plus `next`. Pass `next` back as `cursor` to continue; the search is complete when `next` is `null`. A call can return no matches and still have a `next`. - :param orderid: (required) - :type orderid: str + :param search: The search term, as typed into the order history's search box. At most 32 characters. (required) + :type search: str + :param cursor: `next` from the previous call. Leave out for the first call. + :type cursor: str + :param limit: Matches per call, 1 to 500 (default 100). + :type limit: int :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 @@ -1798,8 +1879,10 @@ def sms_activate_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._sms_activate_serialize( - orderid=orderid, + _param = self._request_history_search_serialize( + search=search, + cursor=cursor, + limit=limit, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1808,10 +1891,9 @@ def sms_activate_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "object", - '400': "object", '401': "object", '403': "object", - '404': "object", + '422': "object", } response_data = self.api_client.call_api( *_param, @@ -1820,9 +1902,11 @@ def sms_activate_without_preload_content( return response_data.response - def _sms_activate_serialize( + def _request_history_search_serialize( self, - orderid, + search, + cursor, + limit, _request_auth, _content_type, _headers, @@ -1847,8 +1931,12 @@ def _sms_activate_serialize( # process the query parameters # process the header parameters # process the form parameters - if orderid is not None: - _form_params.append(('orderid', orderid)) + if search is not None: + _form_params.append(('search', search)) + if cursor is not None: + _form_params.append(('cursor', cursor)) + if limit is not None: + _form_params.append(('limit', limit)) # process the body parameter @@ -1881,7 +1969,7 @@ def _sms_activate_serialize( return self.api_client.param_serialize( method='POST', - resource_path='/sms/activate', + resource_path='/request/history_search', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1898,11 +1986,9 @@ def _sms_activate_serialize( @validate_call - def sms_all_stock( + def sms_activate( self, - country: Annotated[Optional[StrictStr], Field(description="Country retrieved from ''Country list\\\" endpoint (optional)")] = None, - service: Annotated[Optional[StrictStr], Field(description="Service retrieved from ''Service list\\\" endpoint (optional)")] = None, - pool: Annotated[Optional[StrictStr], Field(description="Pool retrieved from ''Pool list\\\" endpoint (optional)")] = None, + orderid: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1916,16 +2002,12 @@ def sms_all_stock( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> object: - """One-time stock for all services + """Activate SMS - This API endpoint is used to retrieve one-time SMS stock in the SMSPool system. The HTTP POST request should be sent to `https://api.smspool.net/sms/stock`. ### Request Parameters The \\`key\\` parameter is required for this endpoint, this is your API key. ### Response The response for this API endpoint will have a status code of 200, indicating a successful request. The response body will be in JSON format and will contain the following properties: - `success` (integer): A flag indicating the success of the request. A value of 0 indicates failure. - `message` (string): An optional message providing additional information about the request. In this case, the message is empty. Please note that the response may contain additional properties not mentioned here, but they can be ignored for the purpose of this documentation. + This endpoint will forcefully activate an SMS to set it available for future resends, please keep in mind that these orders are NOT eligible for a refund after activating them. - :param country: Country retrieved from ''Country list\\\" endpoint (optional) - :type country: str - :param service: Service retrieved from ''Service list\\\" endpoint (optional) - :type service: str - :param pool: Pool retrieved from ''Pool list\\\" endpoint (optional) - :type pool: str + :param orderid: (required) + :type orderid: 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 @@ -1948,10 +2030,8 @@ def sms_all_stock( :return: Returns the result object. """ # noqa: E501 - _param = self._sms_all_stock_serialize( - country=country, - service=service, - pool=pool, + _param = self._sms_activate_serialize( + orderid=orderid, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1960,6 +2040,10 @@ def sms_all_stock( _response_types_map: Dict[str, Optional[str]] = { '200': "object", + '400': "object", + '401': "object", + '403': "object", + '404': "object", } response_data = self.api_client.call_api( *_param, @@ -1973,11 +2057,9 @@ def sms_all_stock( @validate_call - def sms_all_stock_with_http_info( + def sms_activate_with_http_info( self, - country: Annotated[Optional[StrictStr], Field(description="Country retrieved from ''Country list\\\" endpoint (optional)")] = None, - service: Annotated[Optional[StrictStr], Field(description="Service retrieved from ''Service list\\\" endpoint (optional)")] = None, - pool: Annotated[Optional[StrictStr], Field(description="Pool retrieved from ''Pool list\\\" endpoint (optional)")] = None, + orderid: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1991,16 +2073,12 @@ def sms_all_stock_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[object]: - """One-time stock for all services + """Activate SMS - This API endpoint is used to retrieve one-time SMS stock in the SMSPool system. The HTTP POST request should be sent to `https://api.smspool.net/sms/stock`. ### Request Parameters The \\`key\\` parameter is required for this endpoint, this is your API key. ### Response The response for this API endpoint will have a status code of 200, indicating a successful request. The response body will be in JSON format and will contain the following properties: - `success` (integer): A flag indicating the success of the request. A value of 0 indicates failure. - `message` (string): An optional message providing additional information about the request. In this case, the message is empty. Please note that the response may contain additional properties not mentioned here, but they can be ignored for the purpose of this documentation. + This endpoint will forcefully activate an SMS to set it available for future resends, please keep in mind that these orders are NOT eligible for a refund after activating them. - :param country: Country retrieved from ''Country list\\\" endpoint (optional) - :type country: str - :param service: Service retrieved from ''Service list\\\" endpoint (optional) - :type service: str - :param pool: Pool retrieved from ''Pool list\\\" endpoint (optional) - :type pool: str + :param orderid: (required) + :type orderid: 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 @@ -2023,10 +2101,8 @@ def sms_all_stock_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._sms_all_stock_serialize( - country=country, - service=service, - pool=pool, + _param = self._sms_activate_serialize( + orderid=orderid, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2035,6 +2111,10 @@ def sms_all_stock_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "object", + '400': "object", + '401': "object", + '403': "object", + '404': "object", } response_data = self.api_client.call_api( *_param, @@ -2048,11 +2128,9 @@ def sms_all_stock_with_http_info( @validate_call - def sms_all_stock_without_preload_content( + def sms_activate_without_preload_content( self, - country: Annotated[Optional[StrictStr], Field(description="Country retrieved from ''Country list\\\" endpoint (optional)")] = None, - service: Annotated[Optional[StrictStr], Field(description="Service retrieved from ''Service list\\\" endpoint (optional)")] = None, - pool: Annotated[Optional[StrictStr], Field(description="Pool retrieved from ''Pool list\\\" endpoint (optional)")] = None, + orderid: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2066,16 +2144,12 @@ def sms_all_stock_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """One-time stock for all services + """Activate SMS - This API endpoint is used to retrieve one-time SMS stock in the SMSPool system. The HTTP POST request should be sent to `https://api.smspool.net/sms/stock`. ### Request Parameters The \\`key\\` parameter is required for this endpoint, this is your API key. ### Response The response for this API endpoint will have a status code of 200, indicating a successful request. The response body will be in JSON format and will contain the following properties: - `success` (integer): A flag indicating the success of the request. A value of 0 indicates failure. - `message` (string): An optional message providing additional information about the request. In this case, the message is empty. Please note that the response may contain additional properties not mentioned here, but they can be ignored for the purpose of this documentation. + This endpoint will forcefully activate an SMS to set it available for future resends, please keep in mind that these orders are NOT eligible for a refund after activating them. - :param country: Country retrieved from ''Country list\\\" endpoint (optional) - :type country: str - :param service: Service retrieved from ''Service list\\\" endpoint (optional) - :type service: str - :param pool: Pool retrieved from ''Pool list\\\" endpoint (optional) - :type pool: str + :param orderid: (required) + :type orderid: 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 @@ -2098,10 +2172,8 @@ def sms_all_stock_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._sms_all_stock_serialize( - country=country, - service=service, - pool=pool, + _param = self._sms_activate_serialize( + orderid=orderid, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2110,6 +2182,10 @@ def sms_all_stock_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "object", + '400': "object", + '401': "object", + '403': "object", + '404': "object", } response_data = self.api_client.call_api( *_param, @@ -2118,11 +2194,9 @@ def sms_all_stock_without_preload_content( return response_data.response - def _sms_all_stock_serialize( + def _sms_activate_serialize( self, - country, - service, - pool, + orderid, _request_auth, _content_type, _headers, @@ -2147,12 +2221,8 @@ def _sms_all_stock_serialize( # process the query parameters # process the header parameters # process the form parameters - if country is not None: - _form_params.append(('country', country)) - if service is not None: - _form_params.append(('service', service)) - if pool is not None: - _form_params.append(('pool', pool)) + if orderid is not None: + _form_params.append(('orderid', orderid)) # process the body parameter @@ -2180,11 +2250,12 @@ def _sms_all_stock_serialize( # authentication setting _auth_settings: List[str] = [ + 'bearerAuth' ] return self.api_client.param_serialize( method='POST', - resource_path='/sms/all_stock', + resource_path='/sms/activate', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2201,12 +2272,11 @@ def _sms_all_stock_serialize( @validate_call - def sms_cancel( + def sms_all_stock( self, - orderid: Optional[StrictStr] = None, - orderids: Optional[StrictStr] = None, - expiry: Optional[StrictInt] = None, - ban: Optional[StrictInt] = None, + country: Annotated[Optional[StrictStr], Field(description="Country retrieved from ''Country list\\\" endpoint (optional)")] = None, + service: Annotated[Optional[StrictStr], Field(description="Service retrieved from ''Service list\\\" endpoint (optional)")] = None, + pool: Annotated[Optional[StrictStr], Field(description="Pool retrieved from ''Pool list\\\" endpoint (optional)")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2220,18 +2290,16 @@ def sms_cancel( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> object: - """Cancel SMS + """One-time stock for all services - # Cancel your SMS order ## Responses | **Success** | {\"success\":1} | | **Fail** | {\"success\":0} | + Retrieves the one-time SMS stock for every country, service and pool, optionally filtered by `country`, `service` and `pool`. The API key is optional. The unfiltered list is large and rebuilt once a minute. It is sent with `ETag`, `Last-Modified` and `Cache-Control` headers: send `If-None-Match` (or `If-Modified-Since`) with your next request and you get `304 Not Modified` with no body while the list has not changed. - :param orderid: - :type orderid: str - :param orderids: - :type orderids: str - :param expiry: - :type expiry: int - :param ban: - :type ban: int + :param country: Country retrieved from ''Country list\\\" endpoint (optional) + :type country: str + :param service: Service retrieved from ''Service list\\\" endpoint (optional) + :type service: str + :param pool: Pool retrieved from ''Pool list\\\" endpoint (optional) + :type pool: 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 @@ -2254,11 +2322,10 @@ def sms_cancel( :return: Returns the result object. """ # noqa: E501 - _param = self._sms_cancel_serialize( - orderid=orderid, - orderids=orderids, - expiry=expiry, - ban=ban, + _param = self._sms_all_stock_serialize( + country=country, + service=service, + pool=pool, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2267,10 +2334,6 @@ def sms_cancel( _response_types_map: Dict[str, Optional[str]] = { '200': "object", - '400': "object", - '401': "object", - '403': "object", - '404': "object", } response_data = self.api_client.call_api( *_param, @@ -2284,12 +2347,11 @@ def sms_cancel( @validate_call - def sms_cancel_with_http_info( + def sms_all_stock_with_http_info( self, - orderid: Optional[StrictStr] = None, - orderids: Optional[StrictStr] = None, - expiry: Optional[StrictInt] = None, - ban: Optional[StrictInt] = None, + country: Annotated[Optional[StrictStr], Field(description="Country retrieved from ''Country list\\\" endpoint (optional)")] = None, + service: Annotated[Optional[StrictStr], Field(description="Service retrieved from ''Service list\\\" endpoint (optional)")] = None, + pool: Annotated[Optional[StrictStr], Field(description="Pool retrieved from ''Pool list\\\" endpoint (optional)")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2303,18 +2365,16 @@ def sms_cancel_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[object]: - """Cancel SMS + """One-time stock for all services - # Cancel your SMS order ## Responses | **Success** | {\"success\":1} | | **Fail** | {\"success\":0} | + Retrieves the one-time SMS stock for every country, service and pool, optionally filtered by `country`, `service` and `pool`. The API key is optional. The unfiltered list is large and rebuilt once a minute. It is sent with `ETag`, `Last-Modified` and `Cache-Control` headers: send `If-None-Match` (or `If-Modified-Since`) with your next request and you get `304 Not Modified` with no body while the list has not changed. - :param orderid: - :type orderid: str - :param orderids: - :type orderids: str - :param expiry: - :type expiry: int - :param ban: - :type ban: int + :param country: Country retrieved from ''Country list\\\" endpoint (optional) + :type country: str + :param service: Service retrieved from ''Service list\\\" endpoint (optional) + :type service: str + :param pool: Pool retrieved from ''Pool list\\\" endpoint (optional) + :type pool: 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 @@ -2337,11 +2397,10 @@ def sms_cancel_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._sms_cancel_serialize( - orderid=orderid, - orderids=orderids, - expiry=expiry, - ban=ban, + _param = self._sms_all_stock_serialize( + country=country, + service=service, + pool=pool, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2350,10 +2409,6 @@ def sms_cancel_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "object", - '400': "object", - '401': "object", - '403': "object", - '404': "object", } response_data = self.api_client.call_api( *_param, @@ -2367,12 +2422,11 @@ def sms_cancel_with_http_info( @validate_call - def sms_cancel_without_preload_content( + def sms_all_stock_without_preload_content( self, - orderid: Optional[StrictStr] = None, - orderids: Optional[StrictStr] = None, - expiry: Optional[StrictInt] = None, - ban: Optional[StrictInt] = None, + country: Annotated[Optional[StrictStr], Field(description="Country retrieved from ''Country list\\\" endpoint (optional)")] = None, + service: Annotated[Optional[StrictStr], Field(description="Service retrieved from ''Service list\\\" endpoint (optional)")] = None, + pool: Annotated[Optional[StrictStr], Field(description="Pool retrieved from ''Pool list\\\" endpoint (optional)")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2386,9 +2440,609 @@ def sms_cancel_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Cancel SMS + """One-time stock for all services - # Cancel your SMS order ## Responses | **Success** | {\"success\":1} | | **Fail** | {\"success\":0} | + Retrieves the one-time SMS stock for every country, service and pool, optionally filtered by `country`, `service` and `pool`. The API key is optional. The unfiltered list is large and rebuilt once a minute. It is sent with `ETag`, `Last-Modified` and `Cache-Control` headers: send `If-None-Match` (or `If-Modified-Since`) with your next request and you get `304 Not Modified` with no body while the list has not changed. + + :param country: Country retrieved from ''Country list\\\" endpoint (optional) + :type country: str + :param service: Service retrieved from ''Service list\\\" endpoint (optional) + :type service: str + :param pool: Pool retrieved from ''Pool list\\\" endpoint (optional) + :type pool: 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._sms_all_stock_serialize( + country=country, + service=service, + pool=pool, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _sms_all_stock_serialize( + self, + country, + service, + pool, + _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 + # process the query parameters + # process the header parameters + # process the form parameters + if country is not None: + _form_params.append(('country', country)) + if service is not None: + _form_params.append(('service', service)) + if pool is not None: + _form_params.append(('pool', pool)) + # 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' + ] + ) + + # 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/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/sms/all_stock', + 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 sms_archive( + self, + orderid: Annotated[StrictStr, Field(description="The order code from the `Order SMS` endpoint.")], + _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: + """Archive one order + + Removes one finished order from your active orders. Nothing is refunded and the order stays in your history; `/sms/unarchive` brings it back. An order that is still waiting for an SMS cannot be archived: cancel it with `/sms/cancel` instead. + + :param orderid: The order code from the `Order SMS` endpoint. (required) + :type orderid: 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._sms_archive_serialize( + orderid=orderid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '401': "object", + '403': "object", + } + 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 sms_archive_with_http_info( + self, + orderid: Annotated[StrictStr, Field(description="The order code from the `Order SMS` endpoint.")], + _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]: + """Archive one order + + Removes one finished order from your active orders. Nothing is refunded and the order stays in your history; `/sms/unarchive` brings it back. An order that is still waiting for an SMS cannot be archived: cancel it with `/sms/cancel` instead. + + :param orderid: The order code from the `Order SMS` endpoint. (required) + :type orderid: 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._sms_archive_serialize( + orderid=orderid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '401': "object", + '403': "object", + } + 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 sms_archive_without_preload_content( + self, + orderid: Annotated[StrictStr, Field(description="The order code from the `Order SMS` endpoint.")], + _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: + """Archive one order + + Removes one finished order from your active orders. Nothing is refunded and the order stays in your history; `/sms/unarchive` brings it back. An order that is still waiting for an SMS cannot be archived: cancel it with `/sms/cancel` instead. + + :param orderid: The order code from the `Order SMS` endpoint. (required) + :type orderid: 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._sms_archive_serialize( + orderid=orderid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '401': "object", + '403': "object", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _sms_archive_serialize( + self, + orderid, + _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 + # process the query parameters + # process the header parameters + # process the form parameters + if orderid is not None: + _form_params.append(('orderid', orderid)) + # 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' + ] + ) + + # 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/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/sms/archive', + 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 sms_cancel( + self, + orderid: Optional[StrictStr] = None, + orderids: Optional[StrictStr] = None, + expiry: Optional[StrictInt] = None, + ban: Optional[StrictInt] = 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: + """Cancel SMS + + Cancels an order. An order that has not received a code is cancelled and refunded. An order that already has its code cannot be refunded; it is only archived (removed from your active orders). Both answer `success: 1`; `action` tells them apart: `refunded` or `archived`. Send `orderids` (comma-separated) to cancel several orders at once; the response then lists one result per order under `results`. + + :param orderid: + :type orderid: str + :param orderids: + :type orderids: str + :param expiry: + :type expiry: int + :param ban: + :type ban: int + :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._sms_cancel_serialize( + orderid=orderid, + orderids=orderids, + expiry=expiry, + ban=ban, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '400': "object", + '401': "object", + '403': "object", + '404': "object", + } + 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 sms_cancel_with_http_info( + self, + orderid: Optional[StrictStr] = None, + orderids: Optional[StrictStr] = None, + expiry: Optional[StrictInt] = None, + ban: Optional[StrictInt] = 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]: + """Cancel SMS + + Cancels an order. An order that has not received a code is cancelled and refunded. An order that already has its code cannot be refunded; it is only archived (removed from your active orders). Both answer `success: 1`; `action` tells them apart: `refunded` or `archived`. Send `orderids` (comma-separated) to cancel several orders at once; the response then lists one result per order under `results`. + + :param orderid: + :type orderid: str + :param orderids: + :type orderids: str + :param expiry: + :type expiry: int + :param ban: + :type ban: int + :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._sms_cancel_serialize( + orderid=orderid, + orderids=orderids, + expiry=expiry, + ban=ban, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '400': "object", + '401': "object", + '403': "object", + '404': "object", + } + 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 sms_cancel_without_preload_content( + self, + orderid: Optional[StrictStr] = None, + orderids: Optional[StrictStr] = None, + expiry: Optional[StrictInt] = None, + ban: Optional[StrictInt] = 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: + """Cancel SMS + + Cancels an order. An order that has not received a code is cancelled and refunded. An order that already has its code cannot be refunded; it is only archived (removed from your active orders). Both answer `success: 1`; `action` tells them apart: `refunded` or `archived`. Send `orderids` (comma-separated) to cancel several orders at once; the response then lists one result per order under `results`. :param orderid: :type orderid: str @@ -3621,7 +4275,7 @@ def sms_missed( ) -> object: """Missed SMS - Some messages arrive on a number from your one-time orders but cannot finish the order, such as Ticketmaster and Seated codes or Hark reward payouts. This returns those messages, the same ones the Missed SMS tool on the website shows. Only numbers from pool Foxtrot are covered. The newest messages come first. `url`, `code` and `email` hold the first link, code and email address found in the message, or an empty string. + Some messages arrive on a number from your one-time orders but cannot finish the order, such as Ticketmaster and Seated codes, Hark reward payouts or Neon Money Talks messages. This returns those messages, the same ones the Missed SMS tool on the website shows. Only numbers from pool Foxtrot are covered. The newest messages come first. `url`, `code` and `email` hold the first link, code and email address found in the message, or an empty string. :param phonenumber: Only return messages for this number, including the country code. Leave it out for all your numbers. :type phonenumber: int @@ -3694,7 +4348,7 @@ def sms_missed_with_http_info( ) -> ApiResponse[object]: """Missed SMS - Some messages arrive on a number from your one-time orders but cannot finish the order, such as Ticketmaster and Seated codes or Hark reward payouts. This returns those messages, the same ones the Missed SMS tool on the website shows. Only numbers from pool Foxtrot are covered. The newest messages come first. `url`, `code` and `email` hold the first link, code and email address found in the message, or an empty string. + Some messages arrive on a number from your one-time orders but cannot finish the order, such as Ticketmaster and Seated codes, Hark reward payouts or Neon Money Talks messages. This returns those messages, the same ones the Missed SMS tool on the website shows. Only numbers from pool Foxtrot are covered. The newest messages come first. `url`, `code` and `email` hold the first link, code and email address found in the message, or an empty string. :param phonenumber: Only return messages for this number, including the country code. Leave it out for all your numbers. :type phonenumber: int @@ -3767,7 +4421,7 @@ def sms_missed_without_preload_content( ) -> RESTResponseType: """Missed SMS - Some messages arrive on a number from your one-time orders but cannot finish the order, such as Ticketmaster and Seated codes or Hark reward payouts. This returns those messages, the same ones the Missed SMS tool on the website shows. Only numbers from pool Foxtrot are covered. The newest messages come first. `url`, `code` and `email` hold the first link, code and email address found in the message, or an empty string. + Some messages arrive on a number from your one-time orders but cannot finish the order, such as Ticketmaster and Seated codes, Hark reward payouts or Neon Money Talks messages. This returns those messages, the same ones the Missed SMS tool on the website shows. Only numbers from pool Foxtrot are covered. The newest messages come first. `url`, `code` and `email` hold the first link, code and email address found in the message, or an empty string. :param phonenumber: Only return messages for this number, including the country code. Leave it out for all your numbers. :type phonenumber: int @@ -4484,7 +5138,7 @@ def sms_stock( ) -> object: """One-time SMS stock - This API endpoint is used to retrieve one-time SMS stock in the SMSPool system. The HTTP POST request should be sent to `https://api.smspool.net/sms/stock`. ### Request Parameters The \\`key\\` parameter is required for this endpoint, this is your API key. ### Response The response for this API endpoint will have a status code of 200, indicating a successful request. The response body will be in JSON format and will contain the following properties: - `success` (integer): A flag indicating the success of the request. A value of 0 indicates failure. - `message` (string): An optional message providing additional information about the request. In this case, the message is empty. Please note that the response may contain additional properties not mentioned here, but they can be ignored for the purpose of this documentation. + Retrieves the one-time SMS stock for a country and service, optionally for one pool. ### Request Parameters The API key is optional. Without it the request is limited to 20 calls a minute per IP address; with it the limit is 200 a minute. ### Response - `success` (integer): 1 when the stock could be read, 0 otherwise. - `amount` (integer): the numbers in stock. :param country: Country retrieved from ''Country list\\\" endpoint (required) :type country: str @@ -4563,7 +5217,7 @@ def sms_stock_with_http_info( ) -> ApiResponse[object]: """One-time SMS stock - This API endpoint is used to retrieve one-time SMS stock in the SMSPool system. The HTTP POST request should be sent to `https://api.smspool.net/sms/stock`. ### Request Parameters The \\`key\\` parameter is required for this endpoint, this is your API key. ### Response The response for this API endpoint will have a status code of 200, indicating a successful request. The response body will be in JSON format and will contain the following properties: - `success` (integer): A flag indicating the success of the request. A value of 0 indicates failure. - `message` (string): An optional message providing additional information about the request. In this case, the message is empty. Please note that the response may contain additional properties not mentioned here, but they can be ignored for the purpose of this documentation. + Retrieves the one-time SMS stock for a country and service, optionally for one pool. ### Request Parameters The API key is optional. Without it the request is limited to 20 calls a minute per IP address; with it the limit is 200 a minute. ### Response - `success` (integer): 1 when the stock could be read, 0 otherwise. - `amount` (integer): the numbers in stock. :param country: Country retrieved from ''Country list\\\" endpoint (required) :type country: str @@ -4642,7 +5296,7 @@ def sms_stock_without_preload_content( ) -> RESTResponseType: """One-time SMS stock - This API endpoint is used to retrieve one-time SMS stock in the SMSPool system. The HTTP POST request should be sent to `https://api.smspool.net/sms/stock`. ### Request Parameters The \\`key\\` parameter is required for this endpoint, this is your API key. ### Response The response for this API endpoint will have a status code of 200, indicating a successful request. The response body will be in JSON format and will contain the following properties: - `success` (integer): A flag indicating the success of the request. A value of 0 indicates failure. - `message` (string): An optional message providing additional information about the request. In this case, the message is empty. Please note that the response may contain additional properties not mentioned here, but they can be ignored for the purpose of this documentation. + Retrieves the one-time SMS stock for a country and service, optionally for one pool. ### Request Parameters The API key is optional. Without it the request is limited to 20 calls a minute per IP address; with it the limit is 200 a minute. ### Response - `success` (integer): 1 when the stock could be read, 0 otherwise. - `amount` (integer): the numbers in stock. :param country: Country retrieved from ''Country list\\\" endpoint (required) :type country: str diff --git a/smspool_sdk/api/status_api.py b/smspool_sdk/api/status_api.py new file mode 100644 index 0000000..e5776b2 --- /dev/null +++ b/smspool_sdk/api/status_api.py @@ -0,0 +1,283 @@ +""" + SMSPool API + + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. + + The version of the OpenAPI document: 1.0 + 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 typing import Any + +from smspool_sdk.api_client import ApiClient, RequestSerialized +from smspool_sdk.api_response import ApiResponse +from smspool_sdk.rest import RESTResponseType + + +class StatusApi: + """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 up( + self, + _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: + """Health check + + For uptime monitors. Needs no API key. `db` and `cache` say whether the database and the cache answered; `status` is `ok` when both did. The result is refreshed every few seconds. + + :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._up_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '503': "object", + } + 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 up_with_http_info( + self, + _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]: + """Health check + + For uptime monitors. Needs no API key. `db` and `cache` say whether the database and the cache answered; `status` is `ok` when both did. The result is refreshed every few seconds. + + :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._up_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '503': "object", + } + 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 up_without_preload_content( + self, + _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: + """Health check + + For uptime monitors. Needs no API key. `db` and `cache` say whether the database and the cache answered; `status` is `ok` when both did. The result is refreshed every few seconds. + + :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._up_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '503': "object", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _up_serialize( + self, + _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 + # 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] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/up', + 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/smspool_sdk/api/voucher_api.py b/smspool_sdk/api/voucher_api.py index 32765ca..77295ed 100644 --- a/smspool_sdk/api/voucher_api.py +++ b/smspool_sdk/api/voucher_api.py @@ -1,7 +1,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -16,7 +16,7 @@ from typing_extensions import Annotated from pydantic import Field, StrictFloat, StrictInt, StrictStr -from typing import Any, Union +from typing import Any, Optional, Union from typing_extensions import Annotated from smspool_sdk.api_client import ApiClient, RequestSerialized @@ -610,6 +610,7 @@ def _voucher_delete_serialize( def voucher_generate( self, amount: Annotated[Union[StrictFloat, StrictInt], Field(description="The amount per promocode")], + idempotency_key: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -628,6 +629,8 @@ def voucher_generate( :param amount: The amount per promocode (required) :type amount: float + :param idempotency_key: + :type idempotency_key: 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 @@ -652,6 +655,7 @@ def voucher_generate( _param = self._voucher_generate_serialize( amount=amount, + idempotency_key=idempotency_key, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -678,6 +682,7 @@ def voucher_generate( def voucher_generate_with_http_info( self, amount: Annotated[Union[StrictFloat, StrictInt], Field(description="The amount per promocode")], + idempotency_key: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -696,6 +701,8 @@ def voucher_generate_with_http_info( :param amount: The amount per promocode (required) :type amount: float + :param idempotency_key: + :type idempotency_key: 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 @@ -720,6 +727,7 @@ def voucher_generate_with_http_info( _param = self._voucher_generate_serialize( amount=amount, + idempotency_key=idempotency_key, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -746,6 +754,7 @@ def voucher_generate_with_http_info( def voucher_generate_without_preload_content( self, amount: Annotated[Union[StrictFloat, StrictInt], Field(description="The amount per promocode")], + idempotency_key: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -764,6 +773,8 @@ def voucher_generate_without_preload_content( :param amount: The amount per promocode (required) :type amount: float + :param idempotency_key: + :type idempotency_key: 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 @@ -788,6 +799,7 @@ def voucher_generate_without_preload_content( _param = self._voucher_generate_serialize( amount=amount, + idempotency_key=idempotency_key, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -809,6 +821,7 @@ def voucher_generate_without_preload_content( def _voucher_generate_serialize( self, amount, + idempotency_key, _request_auth, _content_type, _headers, @@ -832,6 +845,8 @@ def _voucher_generate_serialize( # process the path parameters # process the query parameters # process the header parameters + if idempotency_key is not None: + _header_params['Idempotency-Key'] = idempotency_key # process the form parameters if amount is not None: _form_params.append(('amount', amount)) diff --git a/smspool_sdk/api_client.py b/smspool_sdk/api_client.py index 52330fe..e5bee4c 100644 --- a/smspool_sdk/api_client.py +++ b/smspool_sdk/api_client.py @@ -1,7 +1,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) diff --git a/smspool_sdk/configuration.py b/smspool_sdk/configuration.py index e461d60..ac06640 100644 --- a/smspool_sdk/configuration.py +++ b/smspool_sdk/configuration.py @@ -1,7 +1,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) diff --git a/smspool_sdk/exceptions.py b/smspool_sdk/exceptions.py index 3901d74..d129d7a 100644 --- a/smspool_sdk/exceptions.py +++ b/smspool_sdk/exceptions.py @@ -1,7 +1,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) diff --git a/smspool_sdk/models/__init__.py b/smspool_sdk/models/__init__.py index 25cc602..858351b 100644 --- a/smspool_sdk/models/__init__.py +++ b/smspool_sdk/models/__init__.py @@ -4,7 +4,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) diff --git a/smspool_sdk/rest.py b/smspool_sdk/rest.py index de99493..0b14512 100644 --- a/smspool_sdk/rest.py +++ b/smspool_sdk/rest.py @@ -3,7 +3,7 @@ """ SMSPool API - Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). Authenticate with your API key from https://www.smspool.net/my/settings, either as a bearer token (`Authorization: Bearer `) or as a `key` parameter. + Every endpoint accepts its parameters as form fields (POST) or query parameters (GET). A JSON object body (`Content-Type: application/json`) works too: its top-level fields are read as parameters; a parameter that is also in the query string or form body wins. Authenticate with your API key from https://www.smspool.net/my/settings as a bearer token: `Authorization: Bearer `. A `key` field in a POST body works too. Keep the key out of the URL: a URL is saved in browser history and can be recorded by proxies and logs on the way to us. Use of the API is subject to the [Terms of Service](https://www.smspool.net/tos#api). Article 11 covers API use: sanctions and geographic restrictions, what you must require of your own users if you resell the service, and the safekeeping of keys. ## Errors An error answers with `success: 0`, a human-readable `message` and, where the API can name the cause, a machine-readable `type`. Check `type`, not the text of `message`. Parameter and key errors also carry `errors`, one entry per problem (`message`, `param`, `type`); the top-level `message` and `type` repeat the API key's entry when there is one, otherwise the first. | `type` | HTTP | Meaning | | --- | --- | --- | | `MISSING_PARAMETER` | 400 | A required parameter was not sent | | `INVALID_PARAMETER` | varies | A parameter has a value the endpoint cannot use | | `INVALID_POOL` | 400 | `/purchase/sms`: the `pool` name does not exist | | `INVALID_KEY` | 401 / 403 | The API key is malformed (401) or unknown or revoked (403) | | `API_KEY_SCOPE` | 403 | The API key is not allowed to call this endpoint, or not from this IP address | | `RATE_LIMITED` | 429 | Too many requests; wait for the `Retry-After` header's seconds | | `IDEMPOTENCY_IN_PROGRESS` | 409 | The first request with this `Idempotency-Key` has not finished | Endpoints add their own types (for example `OUT_OF_STOCK`). Older errors may have no `type`. ## Idempotent purchases `/purchase/sms`, `/purchase/rental`, `/esim/purchase` and `/voucher/generate` accept an optional `Idempotency-Key` header (or an `idempotency_key` parameter): 1 to 128 printable ASCII characters that you choose, unique per purchase, for example a UUID. If a request times out, send it again with the same key: - the first request runs normally; - a repeat within 24 hours answers with the first request's status and body and the header `Idempotent-Replay: true`, and buys nothing; - a repeat while the first is still running answers `409` with `type: IDEMPOTENCY_IN_PROGRESS`; retry shortly. A request that bought nothing (`success: 0`) does not use up its key, so it can be retried with the same one. A key belongs to your account and the endpoint. Requests without a key behave as they always have. ## Webhooks Instead of polling `/sms/check`, set a webhook URL under Settings → Developer and receive each SMS as a signed JSON `POST`. The events are listed under Webhooks below; setup, retries and signature checks are described in [How to set up webhooks](https://www.smspool.net/article/how-to-setup-webhooks-for-smspool-ec19b80ade92). ## Health check `GET /up` needs no key and answers `200 {\"status\":\"ok\",...}` or `503 {\"status\":\"degraded\",...}`. The version of the OpenAPI document: 1.0 Generated by OpenAPI Generator (https://openapi-generator.tech)