Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions docs/DefaultApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
15 changes: 15 additions & 0 deletions docs/EmailReputationResponse.md
Original file line number Diff line number Diff line change
@@ -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)


14 changes: 14 additions & 0 deletions docs/EmailReputationWindow.md
Original file line number Diff line number Diff line change
@@ -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)


135 changes: 135 additions & 0 deletions onesignal/api/default_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,),
Expand Down Expand Up @@ -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,
Expand Down
Loading