diff --git a/docs/DefaultApi.md b/docs/DefaultApi.md index 1635dac..bea3f08 100644 --- a/docs/DefaultApi.md +++ b/docs/DefaultApi.md @@ -24,6 +24,7 @@ Method | HTTP request | Description [**delete_subscription**](DefaultApi.md#delete_subscription) | **DELETE** /apps/{app_id}/subscriptions/{subscription_id} | [**delete_template**](DefaultApi.md#delete_template) | **DELETE** /templates/{template_id} | Delete template [**delete_user**](DefaultApi.md#delete_user) | **DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id} | +[**duplicate_journey**](DefaultApi.md#duplicate_journey) | **POST** /apps/{app_id}/journeys/{journey_id}/duplicate | Duplicate journey [**estimate_notification_recipients**](DefaultApi.md#estimate_notification_recipients) | **POST** /notifications/count-unsaved | Estimate notification recipients [**export_events**](DefaultApi.md#export_events) | **POST** /notifications/{notification_id}/export_events | Export CSV of Events [**export_subscriptions**](DefaultApi.md#export_subscriptions) | **POST** /players/csv_export?app_id={app_id} | Export CSV of Subscriptions @@ -2107,6 +2108,201 @@ void (empty response body) [[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) +# **duplicate_journey** +> Journey duplicate_journey(app_id, journey_id) + +Duplicate journey + +The Journeys API is in beta. Endpoints and response fields can still change. Copy an existing journey into a new draft. The source does not change. The copy is always a draft, and started_at and archived_at are null. If you omit the body, or omit overrides, the copy keeps the source description, audience, nodes, early_exit, and reentry_rules. The copy takes the source name plus \" (Copy)\". The copy does not keep schedule. Send schedule under overrides to set it. Server-controlled fields are rejected with 400. The authenticated App API key must have permission to create journeys. + +### 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. + journey_id = "YOUR_JOURNEY_ID" # UUID of the journey to copy. + duplicate_journey_request = DuplicateJourneyRequest( + overrides=DuplicateJourneyOverrides( + name="name_example", + description="description_example", + audience=JourneyAudience( + kind="segment", + included_segment_ids=[ + "included_segment_ids_example", + ], + excluded_segment_ids=[ + "excluded_segment_ids_example", + ], + future_additions_only=True, + name="name_example", + attributes=JourneyEventTriggerAttributes([ + [ + JourneyEventAttribute( + key="key_example", + operator="equal", + value="value_example", + ), + ], + ]), + ), + early_exit=JourneyEarlyExit( + rules=JourneyEarlyExitRules( + on_segment=JourneyEarlyExitRulesOnSegment( + included_segment_ids=[ + "included_segment_ids_example", + ], + ), + when_not_in_audience=True, + on_session=True, + on_event=JourneyEarlyExitRulesOnEvent( + name="name_example", + ), + ), + tag_on_early_exit={ + "key": "key_example", + }, + ), + reentry_rules=JourneyReentryRules( + duration_seconds=600, + ), + schedule=JourneySchedule( + start_at="start_at_example", + stop_at="stop_at_example", + error="error_example", + ), + nodes=[ + JourneyNode( + id="id_example", + kind="wait", + client_node_id="client_node_id_example", + annotation="annotation_example", + duration_seconds=60, + relative_to="schedule_in_timezone", + windows=[ + JourneyTimeWindow( + start=None, + end=None, + day_of_week=1, + ), + ], + time_zone="time_zone_example", + use_user_time_zone=True, + template_id="template_id_example", + iam_id="iam_id_example", + user_ttl_seconds=1, + webhook_id="webhook_id_example", + assignments={ + "key": "key_example", + }, + randomize_on_entry=True, + branches=[ + JourneyBranch( + id="id_example", + condition=JourneyCondition( + kind="segment_membership", + included_segment_ids=[ + "included_segment_ids_example", + ], + excluded_segment_ids=[ + "excluded_segment_ids_example", + ], + action="received", + sending_node_id="sending_node_id_example", + client_node_id="client_node_id_example", + name="name_example", + attributes=JourneyEventTriggerAttributes([ + [ + JourneyEventAttribute( + key="key_example", + operator="equal", + value="value_example", + ), + ], + ]), + entry_event_match_attributes=[ + {}, + ], + ), + weight=3.14, + nodes=[ + JourneyNode(), + ], + ), + ], + expiration=JourneyWaitUntilExpiration( + duration_seconds=60, + exits=True, + ), + ), + ], + ), + ) + + try: + # Duplicate journey + api_response = api_instance.duplicate_journey(app_id, journey_id, duplicate_journey_request=duplicate_journey_request) + pprint(api_response) + except onesignal.ApiException as e: + print("Exception when calling DefaultApi->duplicate_journey: %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. | + **journey_id** | **str**| UUID of the journey to copy. | + **duplicate_journey_request** | [**DuplicateJourneyRequest**](DuplicateJourneyRequest.md)| | [optional] + +### Return type + +[**Journey**](Journey.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-python-api#configuration) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Created | - | +**400** | Bad Request | - | +**403** | Forbidden | - | +**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) + # **estimate_notification_recipients** > EstimateNotificationRecipientsSuccessResponse estimate_notification_recipients(estimate_notification_recipients_request) diff --git a/docs/DuplicateJourneyOverrides.md b/docs/DuplicateJourneyOverrides.md new file mode 100644 index 0000000..f829d1f --- /dev/null +++ b/docs/DuplicateJourneyOverrides.md @@ -0,0 +1,19 @@ +# DuplicateJourneyOverrides + +Journey fields to apply over the copy as a JSON Merge Patch (RFC 7396). Accepts the same writable fields as Create journey, and none of them are required. The patch merges into the copy, not the source. The copy starts without a schedule, so an omitted schedule leaves the copy unscheduled. An object merges key by key. A null value clears a nullable field. An array such as nodes replaces the copied array. Server-controlled fields such as id or state are rejected. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Name for the copy, up to 300 characters. If you omit it, the copy takes the name of the source plus \" (Copy)\". | [optional] +**description** | **str, none_type** | Optional journey description, up to 1024 characters. If you omit it, the copy takes the description of the source. Send null to clear it. | [optional] +**audience** | [**JourneyAudience**](JourneyAudience.md) | | [optional] +**early_exit** | [**JourneyEarlyExit**](JourneyEarlyExit.md) | | [optional] +**reentry_rules** | [**JourneyReentryRules**](JourneyReentryRules.md) | | [optional] +**schedule** | [**JourneySchedule**](JourneySchedule.md) | | [optional] +**nodes** | [**[JourneyNode]**](JourneyNode.md) | Full ordered list of nodes. Replaces the copied graph. Server-assigned id fields are rejected. | [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/DuplicateJourneyRequest.md b/docs/DuplicateJourneyRequest.md new file mode 100644 index 0000000..525b255 --- /dev/null +++ b/docs/DuplicateJourneyRequest.md @@ -0,0 +1,13 @@ +# DuplicateJourneyRequest + +Optional body for Duplicate journey. Only overrides is applied. A journey field sent at the top level is ignored. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**overrides** | [**DuplicateJourneyOverrides**](DuplicateJourneyOverrides.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/Journey.md b/docs/Journey.md index 49116bf..63d60e4 100644 --- a/docs/Journey.md +++ b/docs/Journey.md @@ -1,6 +1,6 @@ # Journey -Full journey representation returned by the detail, create, and update endpoints. +Full journey representation returned by the detail, create, update, and duplicate endpoints. ## Properties Name | Type | Description | Notes diff --git a/onesignal/api/default_api.py b/onesignal/api/default_api.py index 2739b71..3fe8248 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.duplicate_journey_request import DuplicateJourneyRequest 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 @@ -1274,6 +1275,69 @@ def __init__(self, api_client=None): }, api_client=api_client ) + self.duplicate_journey_endpoint = _Endpoint( + settings={ + 'response_type': (Journey,), + 'auth': [ + 'rest_api_key' + ], + 'endpoint_path': '/apps/{app_id}/journeys/{journey_id}/duplicate', + 'operation_id': 'duplicate_journey', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'app_id', + 'journey_id', + 'duplicate_journey_request', + ], + 'required': [ + 'app_id', + 'journey_id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'app_id': + (str,), + 'journey_id': + (str,), + 'duplicate_journey_request': + (DuplicateJourneyRequest,), + }, + 'attribute_map': { + 'app_id': 'app_id', + 'journey_id': 'journey_id', + }, + 'location_map': { + 'app_id': 'path', + 'journey_id': 'path', + 'duplicate_journey_request': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client + ) self.estimate_notification_recipients_endpoint = _Endpoint( settings={ 'response_type': (EstimateNotificationRecipientsSuccessResponse,), @@ -5333,6 +5397,94 @@ def delete_user( alias_id return self.delete_user_endpoint.call_with_http_info(**kwargs) + def duplicate_journey( + self, + app_id, + journey_id, + **kwargs + ): + """Duplicate journey # noqa: E501 + + The Journeys API is in beta. Endpoints and response fields can still change. Copy an existing journey into a new draft. The source does not change. The copy is always a draft, and started_at and archived_at are null. If you omit the body, or omit overrides, the copy keeps the source description, audience, nodes, early_exit, and reentry_rules. The copy takes the source name plus \" (Copy)\". The copy does not keep schedule. Send schedule under overrides to set it. Server-controlled fields are rejected with 400. The authenticated App API key must have permission to create journeys. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.duplicate_journey(app_id, journey_id, async_req=True) + >>> result = thread.get() + + Args: + app_id (str): Your OneSignal App ID in UUID v4 format. + journey_id (str): UUID of the journey to copy. + + Keyword Args: + duplicate_journey_request (DuplicateJourneyRequest): [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: + Journey + 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['journey_id'] = \ + journey_id + return self.duplicate_journey_endpoint.call_with_http_info(**kwargs) + def estimate_notification_recipients( self, estimate_notification_recipients_request, diff --git a/onesignal/model/duplicate_journey_overrides.py b/onesignal/model/duplicate_journey_overrides.py new file mode 100644 index 0000000..d515e1e --- /dev/null +++ b/onesignal/model/duplicate_journey_overrides.py @@ -0,0 +1,301 @@ +""" + 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.journey_audience import JourneyAudience + from onesignal.model.journey_early_exit import JourneyEarlyExit + from onesignal.model.journey_node import JourneyNode + from onesignal.model.journey_reentry_rules import JourneyReentryRules + from onesignal.model.journey_schedule import JourneySchedule + globals()['JourneyAudience'] = JourneyAudience + globals()['JourneyEarlyExit'] = JourneyEarlyExit + globals()['JourneyNode'] = JourneyNode + globals()['JourneyReentryRules'] = JourneyReentryRules + globals()['JourneySchedule'] = JourneySchedule + + +class DuplicateJourneyOverrides(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 { + 'name': (str,), # noqa: E501 + 'description': (str, none_type,), # noqa: E501 + 'audience': (JourneyAudience,), # noqa: E501 + 'early_exit': (JourneyEarlyExit,), # noqa: E501 + 'reentry_rules': (JourneyReentryRules,), # noqa: E501 + 'schedule': (JourneySchedule,), # noqa: E501 + 'nodes': ([JourneyNode],), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'name': 'name', # noqa: E501 + 'description': 'description', # noqa: E501 + 'audience': 'audience', # noqa: E501 + 'early_exit': 'early_exit', # noqa: E501 + 'reentry_rules': 'reentry_rules', # noqa: E501 + 'schedule': 'schedule', # noqa: E501 + 'nodes': 'nodes', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """DuplicateJourneyOverrides - 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,) + name (str): Name for the copy, up to 300 characters. If you omit it, the copy takes the name of the source plus \" (Copy)\".. [optional] # noqa: E501 + description (str, none_type): Optional journey description, up to 1024 characters. If you omit it, the copy takes the description of the source. Send null to clear it.. [optional] # noqa: E501 + audience (JourneyAudience): [optional] # noqa: E501 + early_exit (JourneyEarlyExit): [optional] # noqa: E501 + reentry_rules (JourneyReentryRules): [optional] # noqa: E501 + schedule (JourneySchedule): [optional] # noqa: E501 + nodes ([JourneyNode]): Full ordered list of nodes. Replaces the copied graph. Server-assigned id fields are rejected.. [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 + """DuplicateJourneyOverrides - 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,) + name (str): Name for the copy, up to 300 characters. If you omit it, the copy takes the name of the source plus \" (Copy)\".. [optional] # noqa: E501 + description (str, none_type): Optional journey description, up to 1024 characters. If you omit it, the copy takes the description of the source. Send null to clear it.. [optional] # noqa: E501 + audience (JourneyAudience): [optional] # noqa: E501 + early_exit (JourneyEarlyExit): [optional] # noqa: E501 + reentry_rules (JourneyReentryRules): [optional] # noqa: E501 + schedule (JourneySchedule): [optional] # noqa: E501 + nodes ([JourneyNode]): Full ordered list of nodes. Replaces the copied graph. Server-assigned id fields are rejected.. [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/duplicate_journey_request.py b/onesignal/model/duplicate_journey_request.py new file mode 100644 index 0000000..3f871c0 --- /dev/null +++ b/onesignal/model/duplicate_journey_request.py @@ -0,0 +1,269 @@ +""" + 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.duplicate_journey_overrides import DuplicateJourneyOverrides + globals()['DuplicateJourneyOverrides'] = DuplicateJourneyOverrides + + +class DuplicateJourneyRequest(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 { + 'overrides': (DuplicateJourneyOverrides,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'overrides': 'overrides', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """DuplicateJourneyRequest - 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,) + overrides (DuplicateJourneyOverrides): [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 + """DuplicateJourneyRequest - 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,) + overrides (DuplicateJourneyOverrides): [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 69ab915..dc92adc 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.duplicate_journey_overrides import DuplicateJourneyOverrides +from onesignal.model.duplicate_journey_request import DuplicateJourneyRequest from onesignal.model.email_reputation_response import EmailReputationResponse from onesignal.model.email_reputation_window import EmailReputationWindow from onesignal.model.email_warm_up import EmailWarmUp diff --git a/test/test_default_api.py b/test/test_default_api.py index 4775328..0cf95a2 100644 --- a/test/test_default_api.py +++ b/test/test_default_api.py @@ -156,6 +156,13 @@ def test_delete_user(self): """ pass + def test_duplicate_journey(self): + """Test case for duplicate_journey + + Duplicate journey # noqa: E501 + """ + pass + def test_estimate_notification_recipients(self): """Test case for estimate_notification_recipients diff --git a/test/test_duplicate_journey_overrides.py b/test/test_duplicate_journey_overrides.py new file mode 100644 index 0000000..992e1f6 --- /dev/null +++ b/test/test_duplicate_journey_overrides.py @@ -0,0 +1,45 @@ +""" + 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.journey_audience import JourneyAudience +from onesignal.model.journey_early_exit import JourneyEarlyExit +from onesignal.model.journey_node import JourneyNode +from onesignal.model.journey_reentry_rules import JourneyReentryRules +from onesignal.model.journey_schedule import JourneySchedule +globals()['JourneyAudience'] = JourneyAudience +globals()['JourneyEarlyExit'] = JourneyEarlyExit +globals()['JourneyNode'] = JourneyNode +globals()['JourneyReentryRules'] = JourneyReentryRules +globals()['JourneySchedule'] = JourneySchedule +from onesignal.model.duplicate_journey_overrides import DuplicateJourneyOverrides + + +class TestDuplicateJourneyOverrides(unittest.TestCase): + """DuplicateJourneyOverrides unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testDuplicateJourneyOverrides(self): + """Test DuplicateJourneyOverrides""" + # FIXME: construct object with mandatory attributes with example values + # model = DuplicateJourneyOverrides() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_duplicate_journey_request.py b/test/test_duplicate_journey_request.py new file mode 100644 index 0000000..fa06a62 --- /dev/null +++ b/test/test_duplicate_journey_request.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.duplicate_journey_overrides import DuplicateJourneyOverrides +globals()['DuplicateJourneyOverrides'] = DuplicateJourneyOverrides +from onesignal.model.duplicate_journey_request import DuplicateJourneyRequest + + +class TestDuplicateJourneyRequest(unittest.TestCase): + """DuplicateJourneyRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testDuplicateJourneyRequest(self): + """Test DuplicateJourneyRequest""" + # FIXME: construct object with mandatory attributes with example values + # model = DuplicateJourneyRequest() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main()