From e980893f579c604129763b000bc9640ad4d33430 Mon Sep 17 00:00:00 2001 From: OneSignal Date: Wed, 9 Sep 2026 17:20:02 +0000 Subject: [PATCH] feat: add v5.16.0 package updates --- README.md | 4 +- docs/DefaultApi.md | 76 +++++ docs/EmailReputationResponse.md | 15 + docs/EmailReputationWindow.md | 14 + onesignal/__init__.py | 2 +- onesignal/api/default_api.py | 135 +++++++++ onesignal/api_client.py | 4 +- onesignal/configuration.py | 4 +- onesignal/model/email_reputation_response.py | 277 +++++++++++++++++++ onesignal/model/email_reputation_window.py | 267 ++++++++++++++++++ onesignal/models/__init__.py | 2 + setup.py | 2 +- test/test_default_api.py | 7 + test/test_email_reputation_response.py | 37 +++ test/test_email_reputation_window.py | 35 +++ 15 files changed, 873 insertions(+), 8 deletions(-) create mode 100644 docs/EmailReputationResponse.md create mode 100644 docs/EmailReputationWindow.md create mode 100644 onesignal/model/email_reputation_response.py create mode 100644 onesignal/model/email_reputation_window.py create mode 100644 test/test_email_reputation_response.py create mode 100644 test/test_email_reputation_window.py diff --git a/README.md b/README.md index 516bb59..bcb7c73 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com -- API version: 5.15.0 -- Package version: 5.15.0 +- API version: 5.16.0 +- Package version: 5.16.0 ## Requirements diff --git a/docs/DefaultApi.md b/docs/DefaultApi.md index 9096d8b..1635dac 100644 --- a/docs/DefaultApi.md +++ b/docs/DefaultApi.md @@ -31,6 +31,7 @@ Method | HTTP request | Description [**get_aliases_by_subscription**](DefaultApi.md#get_aliases_by_subscription) | **GET** /apps/{app_id}/subscriptions/{subscription_id}/user/identity | [**get_app**](DefaultApi.md#get_app) | **GET** /apps/{app_id} | View an app [**get_apps**](DefaultApi.md#get_apps) | **GET** /apps | View apps +[**get_email_reputation**](DefaultApi.md#get_email_reputation) | **GET** /apps/{app_id}/email_analytics/delivery_metrics | Get email reputation statistics [**get_notification**](DefaultApi.md#get_notification) | **GET** /notifications/{notification_id} | View notification [**get_notification_history**](DefaultApi.md#get_notification_history) | **POST** /notifications/{notification_id}/history | Notification History [**get_notifications**](DefaultApi.md#get_notifications) | **GET** /notifications | View notifications @@ -2637,6 +2638,81 @@ This endpoint does not need any parameter. [[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-python-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-python-api) +# **get_email_reputation** +> EmailReputationResponse get_email_reputation(app_id) + +Get email reputation statistics + +The email bounce and spam complaint rates received for the app over the last 24 hours, 7 days, and 30 days. Rates are expressed as fractions of successfully delivered emails (for example, `0.02` means 2%). A window reports `0` for both rates when the app has not successfully delivered any email in that period. + +### Example + +* Bearer Authentication (rest_api_key): + +```python +import onesignal +from onesignal.api import default_api +from onesignal.models import * +from pprint import pprint + +# See configuration.py for a list of all supported configuration parameters. +# Some of the OneSignal endpoints require ORGANIZATION_API_KEY token for authorization, while others require REST_API_KEY. +# We recommend adding both of them in the configuration page so that you will not need to figure it out yourself. +configuration = onesignal.Configuration( + rest_api_key = "YOUR_REST_API_KEY", # App REST API key required for most endpoints + organization_api_key = "YOUR_ORGANIZATION_API_KEY" # Organization key is only required for creating new apps and other top-level endpoints +) + + +# Enter a context with an instance of the API client +with onesignal.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = default_api.DefaultApi(api_client) + app_id = "YOUR_APP_ID" # Your OneSignal App ID in UUID v4 format. + + try: + # Get email reputation statistics + api_response = api_instance.get_email_reputation(app_id) + pprint(api_response) + except onesignal.ApiException as e: + print("Exception when calling DefaultApi->get_email_reputation: %s\n" % e) + print("Status Code: %s" % e.status) + print("Response Body: %s" % e.body) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **app_id** | **str**| Your OneSignal App ID in UUID v4 format. | + +### Return type + +[**EmailReputationResponse**](EmailReputationResponse.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-python-api#configuration) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | Bad Request | - | +**404** | Not Found | - | +**429** | Rate Limit Exceeded | - | +**0** | Unexpected error | - | + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-python-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-python-api) + # **get_notification** > NotificationWithMeta get_notification(app_id, notification_id) diff --git a/docs/EmailReputationResponse.md b/docs/EmailReputationResponse.md new file mode 100644 index 0000000..f0dd4d0 --- /dev/null +++ b/docs/EmailReputationResponse.md @@ -0,0 +1,15 @@ +# EmailReputationResponse + +App-wide email bounce and spam complaint rates, broken out by time window. `last_24_hours`, `last_7_days`, and `last_30_days` each hold the bounce and complaint rates for email delivered in that window. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**last_24_hours** | [**EmailReputationWindow**](EmailReputationWindow.md) | | [optional] +**last_7_days** | [**EmailReputationWindow**](EmailReputationWindow.md) | | [optional] +**last_30_days** | [**EmailReputationWindow**](EmailReputationWindow.md) | | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-python-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-python-api) + + diff --git a/docs/EmailReputationWindow.md b/docs/EmailReputationWindow.md new file mode 100644 index 0000000..455ab27 --- /dev/null +++ b/docs/EmailReputationWindow.md @@ -0,0 +1,14 @@ +# EmailReputationWindow + +Email reputation rates for a single time window. Each rate is a fraction of successfully delivered emails (for example, `0.02` means 2%). Both rates are `0` when no email was successfully delivered in the window. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bounce_rate** | **float** | The fraction of successfully delivered emails that hard or soft bounced during the window. | [optional] +**complaint_rate** | **float** | The fraction of successfully delivered emails that recipients reported as spam during the window. | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-python-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-python-api) + + diff --git a/onesignal/__init__.py b/onesignal/__init__.py index c636e86..00b59df 100644 --- a/onesignal/__init__.py +++ b/onesignal/__init__.py @@ -10,7 +10,7 @@ """ -__version__ = "5.15.0" +__version__ = "5.16.0" # import ApiClient from onesignal.api_client import ApiClient diff --git a/onesignal/api/default_api.py b/onesignal/api/default_api.py index 4e97a7f..2739b71 100644 --- a/onesignal/api/default_api.py +++ b/onesignal/api/default_api.py @@ -34,6 +34,7 @@ from onesignal.model.create_template_request import CreateTemplateRequest from onesignal.model.create_user_conflict_response import CreateUserConflictResponse from onesignal.model.custom_events_request import CustomEventsRequest +from onesignal.model.email_reputation_response import EmailReputationResponse from onesignal.model.estimate_notification_recipients_request import EstimateNotificationRecipientsRequest from onesignal.model.estimate_notification_recipients_success_response import EstimateNotificationRecipientsSuccessResponse from onesignal.model.export_events_success_response import ExportEventsSuccessResponse @@ -1654,6 +1655,57 @@ def __init__(self, api_client=None): }, api_client=api_client ) + self.get_email_reputation_endpoint = _Endpoint( + settings={ + 'response_type': (EmailReputationResponse,), + 'auth': [ + 'rest_api_key' + ], + 'endpoint_path': '/apps/{app_id}/email_analytics/delivery_metrics', + 'operation_id': 'get_email_reputation', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'app_id', + ], + 'required': [ + 'app_id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'app_id': + (str,), + }, + 'attribute_map': { + 'app_id': 'app_id', + }, + 'location_map': { + 'app_id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client + ) self.get_notification_endpoint = _Endpoint( settings={ 'response_type': (NotificationWithMeta,), @@ -5874,6 +5926,89 @@ def get_apps( kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.get_apps_endpoint.call_with_http_info(**kwargs) + def get_email_reputation( + self, + app_id, + **kwargs + ): + """Get email reputation statistics # noqa: E501 + + The email bounce and spam complaint rates received for the app over the last 24 hours, 7 days, and 30 days. Rates are expressed as fractions of successfully delivered emails (for example, `0.02` means 2%). A window reports `0` for both rates when the app has not successfully delivered any email in that period. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_email_reputation(app_id, async_req=True) + >>> result = thread.get() + + Args: + app_id (str): Your OneSignal App ID in UUID v4 format. + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): 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. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None + async_req (bool): execute request asynchronously + + Returns: + EmailReputationResponse + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_spec_property_naming'] = kwargs.get( + '_spec_property_naming', False + ) + kwargs['_content_type'] = kwargs.get( + '_content_type') + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) + kwargs['app_id'] = \ + app_id + return self.get_email_reputation_endpoint.call_with_http_info(**kwargs) + def get_notification( self, app_id, diff --git a/onesignal/api_client.py b/onesignal/api_client.py index 54a6fe2..0261412 100644 --- a/onesignal/api_client.py +++ b/onesignal/api_client.py @@ -76,7 +76,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/5.15.0/python' + self.user_agent = 'OpenAPI-Generator/5.16.0/python' def __enter__(self): return self @@ -141,7 +141,7 @@ def __call_api( # header parameters header_params = header_params or {} header_params.update(self.default_headers) - header_params['OS-Usage-Data'] = "kind=sdk, sdk-name=onesignal-python, version=5.15.0" + header_params['OS-Usage-Data'] = "kind=sdk, sdk-name=onesignal-python, version=5.16.0" if self.cookie: header_params['Cookie'] = self.cookie if header_params: diff --git a/onesignal/configuration.py b/onesignal/configuration.py index 55c9a17..f66f48e 100644 --- a/onesignal/configuration.py +++ b/onesignal/configuration.py @@ -398,8 +398,8 @@ def to_debug_report(self): return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: 5.15.0\n"\ - "SDK Package Version: 5.15.0".\ + "Version of the API: 5.16.0\n"\ + "SDK Package Version: 5.16.0".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/onesignal/model/email_reputation_response.py b/onesignal/model/email_reputation_response.py new file mode 100644 index 0000000..cd13503 --- /dev/null +++ b/onesignal/model/email_reputation_response.py @@ -0,0 +1,277 @@ +""" + OneSignal + + A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501 + + Contact: devrel@onesignal.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from onesignal.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel +) +from onesignal.exceptions import ApiAttributeError + + +def lazy_import(): + from onesignal.model.email_reputation_window import EmailReputationWindow + globals()['EmailReputationWindow'] = EmailReputationWindow + + +class EmailReputationResponse(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'last_24_hours': (EmailReputationWindow,), # noqa: E501 + 'last_7_days': (EmailReputationWindow,), # noqa: E501 + 'last_30_days': (EmailReputationWindow,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'last_24_hours': 'last_24_hours', # noqa: E501 + 'last_7_days': 'last_7_days', # noqa: E501 + 'last_30_days': 'last_30_days', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """EmailReputationResponse - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + last_24_hours (EmailReputationWindow): [optional] # noqa: E501 + last_7_days (EmailReputationWindow): [optional] # noqa: E501 + last_30_days (EmailReputationWindow): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', True) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + for arg in args: + if isinstance(arg, dict): + kwargs.update(arg) + else: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """EmailReputationResponse - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + last_24_hours (EmailReputationWindow): [optional] # noqa: E501 + last_7_days (EmailReputationWindow): [optional] # noqa: E501 + last_30_days (EmailReputationWindow): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + for arg in args: + if isinstance(arg, dict): + kwargs.update(arg) + else: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/onesignal/model/email_reputation_window.py b/onesignal/model/email_reputation_window.py new file mode 100644 index 0000000..7e65f36 --- /dev/null +++ b/onesignal/model/email_reputation_window.py @@ -0,0 +1,267 @@ +""" + OneSignal + + A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501 + + Contact: devrel@onesignal.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from onesignal.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel +) +from onesignal.exceptions import ApiAttributeError + + + +class EmailReputationWindow(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'bounce_rate': (float,), # noqa: E501 + 'complaint_rate': (float,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'bounce_rate': 'bounce_rate', # noqa: E501 + 'complaint_rate': 'complaint_rate', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """EmailReputationWindow - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + bounce_rate (float): The fraction of successfully delivered emails that hard or soft bounced during the window.. [optional] # noqa: E501 + complaint_rate (float): The fraction of successfully delivered emails that recipients reported as spam during the window.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', True) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + for arg in args: + if isinstance(arg, dict): + kwargs.update(arg) + else: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """EmailReputationWindow - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + bounce_rate (float): The fraction of successfully delivered emails that hard or soft bounced during the window.. [optional] # noqa: E501 + complaint_rate (float): The fraction of successfully delivered emails that recipients reported as spam during the window.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + for arg in args: + if isinstance(arg, dict): + kwargs.update(arg) + else: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/onesignal/models/__init__.py b/onesignal/models/__init__.py index 2147349..69ab915 100644 --- a/onesignal/models/__init__.py +++ b/onesignal/models/__init__.py @@ -35,6 +35,8 @@ from onesignal.model.custom_event import CustomEvent from onesignal.model.custom_events_request import CustomEventsRequest from onesignal.model.delivery_data import DeliveryData +from onesignal.model.email_reputation_response import EmailReputationResponse +from onesignal.model.email_reputation_window import EmailReputationWindow from onesignal.model.email_warm_up import EmailWarmUp from onesignal.model.email_warm_up_request import EmailWarmUpRequest from onesignal.model.email_warm_up_stage import EmailWarmUpStage diff --git a/setup.py b/setup.py index 9b04367..231c933 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "onesignal_python_api" -VERSION = "5.15.0" +VERSION = "5.16.0" # To install the library, run the following # # python setup.py install diff --git a/test/test_default_api.py b/test/test_default_api.py index 81c7bb2..4775328 100644 --- a/test/test_default_api.py +++ b/test/test_default_api.py @@ -203,6 +203,13 @@ def test_get_apps(self): """ pass + def test_get_email_reputation(self): + """Test case for get_email_reputation + + Get email reputation statistics # noqa: E501 + """ + pass + def test_get_notification(self): """Test case for get_notification diff --git a/test/test_email_reputation_response.py b/test/test_email_reputation_response.py new file mode 100644 index 0000000..3d45056 --- /dev/null +++ b/test/test_email_reputation_response.py @@ -0,0 +1,37 @@ +""" + OneSignal + + A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501 + + Contact: devrel@onesignal.com + Generated by: https://openapi-generator.tech +""" + + +import sys +import unittest + +import onesignal +from onesignal.model.email_reputation_window import EmailReputationWindow +globals()['EmailReputationWindow'] = EmailReputationWindow +from onesignal.model.email_reputation_response import EmailReputationResponse + + +class TestEmailReputationResponse(unittest.TestCase): + """EmailReputationResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEmailReputationResponse(self): + """Test EmailReputationResponse""" + # FIXME: construct object with mandatory attributes with example values + # model = EmailReputationResponse() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_email_reputation_window.py b/test/test_email_reputation_window.py new file mode 100644 index 0000000..4a69ab0 --- /dev/null +++ b/test/test_email_reputation_window.py @@ -0,0 +1,35 @@ +""" + OneSignal + + A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501 + + Contact: devrel@onesignal.com + Generated by: https://openapi-generator.tech +""" + + +import sys +import unittest + +import onesignal +from onesignal.model.email_reputation_window import EmailReputationWindow + + +class TestEmailReputationWindow(unittest.TestCase): + """EmailReputationWindow unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEmailReputationWindow(self): + """Test EmailReputationWindow""" + # FIXME: construct object with mandatory attributes with example values + # model = EmailReputationWindow() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main()