diff --git a/docs/DefaultApi.md b/docs/DefaultApi.md index 17e0c0d..3632faa 100644 --- a/docs/DefaultApi.md +++ b/docs/DefaultApi.md @@ -32,6 +32,7 @@ Method | HTTP request | Description [**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 [**get_outcomes**](DefaultApi.md#get_outcomes) | **GET** /apps/{app_id}/outcomes | View Outcomes +[**get_segment**](DefaultApi.md#get_segment) | **GET** /apps/{app_id}/segments/{segment_id} | View Segment [**get_segments**](DefaultApi.md#get_segments) | **GET** /apps/{app_id}/segments | Get Segments [**get_user**](DefaultApi.md#get_user) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id} | [**rotate_api_key**](DefaultApi.md#rotate_api_key) | **POST** /apps/{app_id}/auth/tokens/{token_id}/rotate | Rotate API key @@ -2609,6 +2610,85 @@ Name | Type | Description | Notes [[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_segment** +> GetSegmentSuccessResponse get_segment(app_id, segment_id) + +View Segment + +Retrieve details for a single segment by its ID, including subscriber count and optionally segment metadata and filters. + +### 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" # The OneSignal App ID for your app. Available in Keys & IDs. + segment_id = "d6c5a3e1-9f17-44a1-9d10-7c0e4a2b1c8e" # The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. + include_segment_detail = True # Set to true to include segment metadata and filters in the response. (optional) + + try: + # View Segment + api_response = api_instance.get_segment(app_id, segment_id, include_segment_detail=include_segment_detail) + pprint(api_response) + except onesignal.ApiException as e: + print("Exception when calling DefaultApi->get_segment: %s\n" % e) + print("Status Code: %s" % e.status) + print("Response Body: %s" % e.body) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **app_id** | **str**| The OneSignal App ID for your app. Available in Keys & IDs. | + **segment_id** | **str**| The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. | + **include_segment_detail** | **bool**| Set to true to include segment metadata and filters in the response. | [optional] + +### Return type + +[**GetSegmentSuccessResponse**](GetSegmentSuccessResponse.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_segments** > GetSegmentsSuccessResponse get_segments(app_id) diff --git a/docs/GetSegmentSuccessResponse.md b/docs/GetSegmentSuccessResponse.md new file mode 100644 index 0000000..cc2547e --- /dev/null +++ b/docs/GetSegmentSuccessResponse.md @@ -0,0 +1,13 @@ +# GetSegmentSuccessResponse + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**subscriber_count** | **int** | The number of subscribers matching this segment. | [optional] +**payload** | [**SegmentDetails**](SegmentDetails.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/SegmentDetails.md b/docs/SegmentDetails.md new file mode 100644 index 0000000..078368f --- /dev/null +++ b/docs/SegmentDetails.md @@ -0,0 +1,18 @@ +# SegmentDetails + +Segment details. Only included when the include-segment-detail query parameter is set to true. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The unique identifier for the segment (UUID v4). | [optional] +**name** | **str** | The segment name. | [optional] +**description** | **str, none_type** | Human-readable description for the segment. `null` when unset. Maximum 255 characters. | [optional] +**created_at** | **int** | Unix timestamp when the segment was created. | [optional] +**source** | **str** | The source of the segment. | [optional] +**filters** | [**[FilterExpression]**](FilterExpression.md) | Array of filter and operator objects defining the segment criteria. Uses the same format as the Create Segment API, so filters can be directly used to recreate or update the segment. | [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/api/default_api.py b/onesignal/api/default_api.py index 1a41164..cebfd81 100644 --- a/onesignal/api/default_api.py +++ b/onesignal/api/default_api.py @@ -40,6 +40,7 @@ from onesignal.model.generic_error import GenericError from onesignal.model.generic_success_bool_response import GenericSuccessBoolResponse from onesignal.model.get_notification_history_request_body import GetNotificationHistoryRequestBody +from onesignal.model.get_segment_success_response import GetSegmentSuccessResponse from onesignal.model.get_segments_success_response import GetSegmentsSuccessResponse from onesignal.model.notification import Notification from onesignal.model.notification_history_success_response import NotificationHistorySuccessResponse @@ -1746,6 +1747,68 @@ def __init__(self, api_client=None): }, api_client=api_client ) + self.get_segment_endpoint = _Endpoint( + settings={ + 'response_type': (GetSegmentSuccessResponse,), + 'auth': [ + 'rest_api_key' + ], + 'endpoint_path': '/apps/{app_id}/segments/{segment_id}', + 'operation_id': 'get_segment', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'app_id', + 'segment_id', + 'include_segment_detail', + ], + 'required': [ + 'app_id', + 'segment_id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'app_id': + (str,), + 'segment_id': + (str,), + 'include_segment_detail': + (bool,), + }, + 'attribute_map': { + 'app_id': 'app_id', + 'segment_id': 'segment_id', + 'include_segment_detail': 'include-segment-detail', + }, + 'location_map': { + 'app_id': 'path', + 'segment_id': 'path', + 'include_segment_detail': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client + ) self.get_segments_endpoint = _Endpoint( settings={ 'response_type': (GetSegmentsSuccessResponse,), @@ -5203,6 +5266,94 @@ def get_outcomes( outcome_names return self.get_outcomes_endpoint.call_with_http_info(**kwargs) + def get_segment( + self, + app_id, + segment_id, + **kwargs + ): + """View Segment # noqa: E501 + + Retrieve details for a single segment by its ID, including subscriber count and optionally segment metadata and filters. # 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_segment(app_id, segment_id, async_req=True) + >>> result = thread.get() + + Args: + app_id (str): The OneSignal App ID for your app. Available in Keys & IDs. + segment_id (str): The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. + + Keyword Args: + include_segment_detail (bool): Set to true to include segment metadata and filters in the response.. [optional] + _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: + GetSegmentSuccessResponse + 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 + kwargs['segment_id'] = \ + segment_id + return self.get_segment_endpoint.call_with_http_info(**kwargs) + def get_segments( self, app_id, diff --git a/onesignal/model/get_segment_success_response.py b/onesignal/model/get_segment_success_response.py new file mode 100644 index 0000000..84b0c0f --- /dev/null +++ b/onesignal/model/get_segment_success_response.py @@ -0,0 +1,274 @@ +""" + OneSignal + + A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501 + + The version of the OpenAPI document: 5.10.0 + 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.segment_details import SegmentDetails + globals()['SegmentDetails'] = SegmentDetails + + +class GetSegmentSuccessResponse(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 { + 'subscriber_count': (int,), # noqa: E501 + 'payload': (SegmentDetails,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'subscriber_count': 'subscriber_count', # noqa: E501 + 'payload': 'payload', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """GetSegmentSuccessResponse - 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,) + subscriber_count (int): The number of subscribers matching this segment.. [optional] # noqa: E501 + payload (SegmentDetails): [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 + """GetSegmentSuccessResponse - 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,) + subscriber_count (int): The number of subscribers matching this segment.. [optional] # noqa: E501 + payload (SegmentDetails): [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/segment_details.py b/onesignal/model/segment_details.py new file mode 100644 index 0000000..e71b31a --- /dev/null +++ b/onesignal/model/segment_details.py @@ -0,0 +1,295 @@ +""" + OneSignal + + A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501 + + The version of the OpenAPI document: 5.10.0 + 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.filter_expression import FilterExpression + globals()['FilterExpression'] = FilterExpression + + +class SegmentDetails(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 = { + ('source',): { + 'DEFAULT': "default", + 'CUSTOM': "custom", + 'QUICKSTART': "quickstart", + }, + } + + 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 { + 'id': (str,), # noqa: E501 + 'name': (str,), # noqa: E501 + 'description': (str, none_type,), # noqa: E501 + 'created_at': (int,), # noqa: E501 + 'source': (str,), # noqa: E501 + 'filters': ([FilterExpression],), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'id': 'id', # noqa: E501 + 'name': 'name', # noqa: E501 + 'description': 'description', # noqa: E501 + 'created_at': 'created_at', # noqa: E501 + 'source': 'source', # noqa: E501 + 'filters': 'filters', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """SegmentDetails - 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,) + id (str): The unique identifier for the segment (UUID v4).. [optional] # noqa: E501 + name (str): The segment name.. [optional] # noqa: E501 + description (str, none_type): Human-readable description for the segment. `null` when unset. Maximum 255 characters.. [optional] # noqa: E501 + created_at (int): Unix timestamp when the segment was created.. [optional] # noqa: E501 + source (str): The source of the segment.. [optional] # noqa: E501 + filters ([FilterExpression]): Array of filter and operator objects defining the segment criteria. Uses the same format as the Create Segment API, so filters can be directly used to recreate or update the segment.. [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 + """SegmentDetails - 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,) + id (str): The unique identifier for the segment (UUID v4).. [optional] # noqa: E501 + name (str): The segment name.. [optional] # noqa: E501 + description (str, none_type): Human-readable description for the segment. `null` when unset. Maximum 255 characters.. [optional] # noqa: E501 + created_at (int): Unix timestamp when the segment was created.. [optional] # noqa: E501 + source (str): The source of the segment.. [optional] # noqa: E501 + filters ([FilterExpression]): Array of filter and operator objects defining the segment criteria. Uses the same format as the Create Segment API, so filters can be directly used to recreate or update the segment.. [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 091dcfb..38aab23 100644 --- a/onesignal/models/__init__.py +++ b/onesignal/models/__init__.py @@ -38,6 +38,7 @@ from onesignal.model.generic_error import GenericError from onesignal.model.generic_success_bool_response import GenericSuccessBoolResponse from onesignal.model.get_notification_history_request_body import GetNotificationHistoryRequestBody +from onesignal.model.get_segment_success_response import GetSegmentSuccessResponse from onesignal.model.get_segments_success_response import GetSegmentsSuccessResponse from onesignal.model.identity_object import IdentityObject from onesignal.model.include_aliases import IncludeAliases @@ -62,6 +63,7 @@ from onesignal.model.rate_limit_error import RateLimitError from onesignal.model.segment import Segment from onesignal.model.segment_data import SegmentData +from onesignal.model.segment_details import SegmentDetails from onesignal.model.segment_notification_target import SegmentNotificationTarget from onesignal.model.start_live_activity_request import StartLiveActivityRequest from onesignal.model.start_live_activity_success_response import StartLiveActivitySuccessResponse diff --git a/test/test_default_api.py b/test/test_default_api.py index 945404e..b65c3f7 100644 --- a/test/test_default_api.py +++ b/test/test_default_api.py @@ -211,6 +211,13 @@ def test_get_outcomes(self): """ pass + def test_get_segment(self): + """Test case for get_segment + + View Segment # noqa: E501 + """ + pass + def test_get_segments(self): """Test case for get_segments diff --git a/test/test_get_segment_success_response.py b/test/test_get_segment_success_response.py new file mode 100644 index 0000000..31f5864 --- /dev/null +++ b/test/test_get_segment_success_response.py @@ -0,0 +1,38 @@ +""" + OneSignal + + A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501 + + The version of the OpenAPI document: 5.10.0 + Contact: devrel@onesignal.com + Generated by: https://openapi-generator.tech +""" + + +import sys +import unittest + +import onesignal +from onesignal.model.segment_details import SegmentDetails +globals()['SegmentDetails'] = SegmentDetails +from onesignal.model.get_segment_success_response import GetSegmentSuccessResponse + + +class TestGetSegmentSuccessResponse(unittest.TestCase): + """GetSegmentSuccessResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testGetSegmentSuccessResponse(self): + """Test GetSegmentSuccessResponse""" + # FIXME: construct object with mandatory attributes with example values + # model = GetSegmentSuccessResponse() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_segment_details.py b/test/test_segment_details.py new file mode 100644 index 0000000..8500e4f --- /dev/null +++ b/test/test_segment_details.py @@ -0,0 +1,38 @@ +""" + OneSignal + + A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501 + + The version of the OpenAPI document: 5.10.0 + Contact: devrel@onesignal.com + Generated by: https://openapi-generator.tech +""" + + +import sys +import unittest + +import onesignal +from onesignal.model.filter_expression import FilterExpression +globals()['FilterExpression'] = FilterExpression +from onesignal.model.segment_details import SegmentDetails + + +class TestSegmentDetails(unittest.TestCase): + """SegmentDetails unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testSegmentDetails(self): + """Test SegmentDetails""" + # FIXME: construct object with mandatory attributes with example values + # model = SegmentDetails() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main()