diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index acb0f106..1380f48c 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -145,8 +145,10 @@ bandwidth/models/rbm_message_content_file.py bandwidth/models/rbm_message_content_rich_card.py bandwidth/models/rbm_message_content_text.py bandwidth/models/rbm_message_media.py +bandwidth/models/rbm_open_url_enum.py bandwidth/models/rbm_standalone_card.py bandwidth/models/rbm_suggestion_response.py +bandwidth/models/rbm_web_view_enum.py bandwidth/models/recording_available_callback.py bandwidth/models/recording_complete_callback.py bandwidth/models/recording_state_enum.py @@ -328,8 +330,10 @@ docs/RbmMessageContentFile.md docs/RbmMessageContentRichCard.md docs/RbmMessageContentText.md docs/RbmMessageMedia.md +docs/RbmOpenUrlEnum.md docs/RbmStandaloneCard.md docs/RbmSuggestionResponse.md +docs/RbmWebViewEnum.md docs/RecordingAvailableCallback.md docs/RecordingCompleteCallback.md docs/RecordingStateEnum.md diff --git a/README.md b/README.md index 8ee7e5c5..1a9d687d 100644 --- a/README.md +++ b/README.md @@ -283,8 +283,10 @@ Class | Method | HTTP request | Description - [RbmMessageContentRichCard](docs/RbmMessageContentRichCard.md) - [RbmMessageContentText](docs/RbmMessageContentText.md) - [RbmMessageMedia](docs/RbmMessageMedia.md) + - [RbmOpenUrlEnum](docs/RbmOpenUrlEnum.md) - [RbmStandaloneCard](docs/RbmStandaloneCard.md) - [RbmSuggestionResponse](docs/RbmSuggestionResponse.md) + - [RbmWebViewEnum](docs/RbmWebViewEnum.md) - [RecordingAvailableCallback](docs/RecordingAvailableCallback.md) - [RecordingCompleteCallback](docs/RecordingCompleteCallback.md) - [RecordingStateEnum](docs/RecordingStateEnum.md) diff --git a/bandwidth.yml b/bandwidth.yml index 866e5280..d7c32953 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -8,8 +8,8 @@ info: email: letstalk@bandwidth.com version: 1.0.0 security: - - OAuth2: [] - Basic: [] + - OAuth2: [] tags: - name: Messages - name: Media @@ -2378,6 +2378,35 @@ components: - OPEN_URL - REQUEST_LOCATION example: REPLY + rbmOpenUrlEnum: + type: string + description: >- + Specifies how the URL should be opened on a mobile device. + + - `BROWSER` Opens the URL in the device's default browser. If + application is not set or the device doesn’t support WebView, this + option is used by default. + + - `WEBVIEW` Opens the URL in an in-app WebView. + enum: + - BROWSER + - WEBVIEW + example: WEBVIEW + rbmWebViewEnum: + type: string + description: >- + Defines the layout of the WebView on a mobile device. It must be defined + when application is set to `WEBVIEW` + + - `FULL` WebView takes the full screen. + + - `HALF` WebView takes half of the screen. + + - `TALL` WebView takes three-quarters of the screen. + enum: + - FULL + - HALF + - TALL rbmActionText: title: Text type: string @@ -2482,6 +2511,10 @@ components: description: The URL to open in browser. example: https://dev.bandwidth.com maxLength: 2048 + application: + $ref: '#/components/schemas/rbmOpenUrlEnum' + webviewViewMode: + $ref: '#/components/schemas/rbmWebViewEnum' required: - url multiChannelFullActions: diff --git a/bandwidth/__init__.py b/bandwidth/__init__.py index 553e14dd..5d5b6304 100644 --- a/bandwidth/__init__.py +++ b/bandwidth/__init__.py @@ -165,8 +165,10 @@ "RbmMessageContentRichCard", "RbmMessageContentText", "RbmMessageMedia", + "RbmOpenUrlEnum", "RbmStandaloneCard", "RbmSuggestionResponse", + "RbmWebViewEnum", "RecordingAvailableCallback", "RecordingCompleteCallback", "RecordingStateEnum", @@ -366,8 +368,10 @@ from bandwidth.models.rbm_message_content_rich_card import RbmMessageContentRichCard as RbmMessageContentRichCard from bandwidth.models.rbm_message_content_text import RbmMessageContentText as RbmMessageContentText from bandwidth.models.rbm_message_media import RbmMessageMedia as RbmMessageMedia +from bandwidth.models.rbm_open_url_enum import RbmOpenUrlEnum as RbmOpenUrlEnum from bandwidth.models.rbm_standalone_card import RbmStandaloneCard as RbmStandaloneCard from bandwidth.models.rbm_suggestion_response import RbmSuggestionResponse as RbmSuggestionResponse +from bandwidth.models.rbm_web_view_enum import RbmWebViewEnum as RbmWebViewEnum from bandwidth.models.recording_available_callback import RecordingAvailableCallback as RecordingAvailableCallback from bandwidth.models.recording_complete_callback import RecordingCompleteCallback as RecordingCompleteCallback from bandwidth.models.recording_state_enum import RecordingStateEnum as RecordingStateEnum diff --git a/bandwidth/models/__init__.py b/bandwidth/models/__init__.py index 44352f8c..58a7cc68 100644 --- a/bandwidth/models/__init__.py +++ b/bandwidth/models/__init__.py @@ -140,8 +140,10 @@ from bandwidth.models.rbm_message_content_rich_card import RbmMessageContentRichCard from bandwidth.models.rbm_message_content_text import RbmMessageContentText from bandwidth.models.rbm_message_media import RbmMessageMedia +from bandwidth.models.rbm_open_url_enum import RbmOpenUrlEnum from bandwidth.models.rbm_standalone_card import RbmStandaloneCard from bandwidth.models.rbm_suggestion_response import RbmSuggestionResponse +from bandwidth.models.rbm_web_view_enum import RbmWebViewEnum from bandwidth.models.recording_available_callback import RecordingAvailableCallback from bandwidth.models.recording_complete_callback import RecordingCompleteCallback from bandwidth.models.recording_state_enum import RecordingStateEnum diff --git a/bandwidth/models/rbm_action_open_url.py b/bandwidth/models/rbm_action_open_url.py index 8ea946e6..ec6dca2a 100644 --- a/bandwidth/models/rbm_action_open_url.py +++ b/bandwidth/models/rbm_action_open_url.py @@ -19,9 +19,11 @@ import json from pydantic import BaseModel, ConfigDict, Field -from typing import Any, ClassVar, Dict, List, Union +from typing import Any, ClassVar, Dict, List, Optional, Union from typing_extensions import Annotated from bandwidth.models.rbm_action_type_enum import RbmActionTypeEnum +from bandwidth.models.rbm_open_url_enum import RbmOpenUrlEnum +from bandwidth.models.rbm_web_view_enum import RbmWebViewEnum from typing import Optional, Set from typing_extensions import Self @@ -33,8 +35,10 @@ class RbmActionOpenUrl(BaseModel): text: Annotated[str, Field(strict=True, max_length=25)] = Field(description="Displayed text for user to click") postback_data: Union[Annotated[bytes, Field(strict=True, max_length=2048)], Annotated[str, Field(strict=True, max_length=2048)]] = Field(description="Base64 payload the customer receives when the reply is clicked.", alias="postbackData") url: Annotated[str, Field(strict=True, max_length=2048)] = Field(description="The URL to open in browser.") + application: Optional[RbmOpenUrlEnum] = None + webview_view_mode: Optional[RbmWebViewEnum] = Field(default=None, alias="webviewViewMode") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["type", "text", "postbackData", "url"] + __properties: ClassVar[List[str]] = ["type", "text", "postbackData", "url", "application", "webviewViewMode"] model_config = ConfigDict( populate_by_name=True, @@ -97,7 +101,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "type": obj.get("type"), "text": obj.get("text"), "postbackData": obj.get("postbackData"), - "url": obj.get("url") + "url": obj.get("url"), + "application": obj.get("application"), + "webviewViewMode": obj.get("webviewViewMode") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/bandwidth/models/rbm_open_url_enum.py b/bandwidth/models/rbm_open_url_enum.py new file mode 100644 index 00000000..6ccce730 --- /dev/null +++ b/bandwidth/models/rbm_open_url_enum.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class RbmOpenUrlEnum(str, Enum): + """ + Specifies how the URL should be opened on a mobile device. - `BROWSER` Opens the URL in the device's default browser. If application is not set or the device doesn’t support WebView, this option is used by default. - `WEBVIEW` Opens the URL in an in-app WebView. + """ + + """ + allowed enum values + """ + BROWSER = 'BROWSER' + WEBVIEW = 'WEBVIEW' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of RbmOpenUrlEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bandwidth/models/rbm_web_view_enum.py b/bandwidth/models/rbm_web_view_enum.py new file mode 100644 index 00000000..1ebbd851 --- /dev/null +++ b/bandwidth/models/rbm_web_view_enum.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class RbmWebViewEnum(str, Enum): + """ + Defines the layout of the WebView on a mobile device. It must be defined when application is set to `WEBVIEW` - `FULL` WebView takes the full screen. - `HALF` WebView takes half of the screen. - `TALL` WebView takes three-quarters of the screen. + """ + + """ + allowed enum values + """ + FULL = 'FULL' + HALF = 'HALF' + TALL = 'TALL' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of RbmWebViewEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/custom_templates/configuration.mustache b/custom_templates/configuration.mustache index 137adb93..dd059307 100644 --- a/custom_templates/configuration.mustache +++ b/custom_templates/configuration.mustache @@ -646,7 +646,6 @@ conf = {{{packageName}}}.Configuration( if self.temp_access_token and self.temp_access_token_expiration > now + 60: return self.temp_access_token else: - print("Fetching new access token") _bytes = f"{self.client_id}:{self.client_secret}".encode('utf-8') _encoded_string = base64.b64encode(_bytes).decode('utf-8') auth_header = f"Basic {_encoded_string}" diff --git a/docs/MultiChannelAction.md b/docs/MultiChannelAction.md index 580c7470..1f08cadf 100644 --- a/docs/MultiChannelAction.md +++ b/docs/MultiChannelAction.md @@ -17,6 +17,8 @@ Name | Type | Description | Notes **end_time** | **datetime** | The end time of the event. | **description** | **str** | The description of the event. | [optional] **url** | **str** | The URL to open in browser. | +**application** | [**RbmOpenUrlEnum**](RbmOpenUrlEnum.md) | | [optional] +**webview_view_mode** | [**RbmWebViewEnum**](RbmWebViewEnum.md) | | [optional] ## Example diff --git a/docs/RbmActionOpenUrl.md b/docs/RbmActionOpenUrl.md index 8f864050..d42aa2b3 100644 --- a/docs/RbmActionOpenUrl.md +++ b/docs/RbmActionOpenUrl.md @@ -9,6 +9,8 @@ Name | Type | Description | Notes **text** | **str** | Displayed text for user to click | **postback_data** | **bytearray** | Base64 payload the customer receives when the reply is clicked. | **url** | **str** | The URL to open in browser. | +**application** | [**RbmOpenUrlEnum**](RbmOpenUrlEnum.md) | | [optional] +**webview_view_mode** | [**RbmWebViewEnum**](RbmWebViewEnum.md) | | [optional] ## Example diff --git a/docs/RbmOpenUrlEnum.md b/docs/RbmOpenUrlEnum.md new file mode 100644 index 00000000..19bac259 --- /dev/null +++ b/docs/RbmOpenUrlEnum.md @@ -0,0 +1,13 @@ +# RbmOpenUrlEnum + +Specifies how the URL should be opened on a mobile device. - `BROWSER` Opens the URL in the device's default browser. If application is not set or the device doesn’t support WebView, this option is used by default. - `WEBVIEW` Opens the URL in an in-app WebView. + +## Enum + +* `BROWSER` (value: `'BROWSER'`) + +* `WEBVIEW` (value: `'WEBVIEW'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RbmWebViewEnum.md b/docs/RbmWebViewEnum.md new file mode 100644 index 00000000..a7753830 --- /dev/null +++ b/docs/RbmWebViewEnum.md @@ -0,0 +1,15 @@ +# RbmWebViewEnum + +Defines the layout of the WebView on a mobile device. It must be defined when application is set to `WEBVIEW` - `FULL` WebView takes the full screen. - `HALF` WebView takes half of the screen. - `TALL` WebView takes three-quarters of the screen. + +## Enum + +* `FULL` (value: `'FULL'`) + +* `HALF` (value: `'HALF'`) + +* `TALL` (value: `'TALL'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/test/unit/models/test_rbm_action_open_url.py b/test/unit/models/test_rbm_action_open_url.py index 9e27c51f..c9350838 100644 --- a/test/unit/models/test_rbm_action_open_url.py +++ b/test/unit/models/test_rbm_action_open_url.py @@ -16,6 +16,9 @@ import unittest from bandwidth.models.rbm_action_open_url import RbmActionOpenUrl +from bandwidth.models.rbm_action_type_enum import RbmActionTypeEnum +from bandwidth.models.rbm_open_url_enum import RbmOpenUrlEnum +from bandwidth.models.rbm_web_view_enum import RbmWebViewEnum class TestRbmActionOpenUrl(unittest.TestCase): """RbmActionOpenUrl unit test stubs""" @@ -33,10 +36,12 @@ def make_instance(self, include_optional) -> RbmActionOpenUrl: optional params are included """ if include_optional: return RbmActionOpenUrl( - type = 'REPLY', + type = RbmActionTypeEnum.REPLY, text = 'Hello world', postback_data = 'U0dWc2JHOGdkMjl5YkdRPQ==', - url = 'https://dev.bandwidth.com' + url = 'https://dev.bandwidth.com', + application=RbmOpenUrlEnum.BROWSER, + webview_view_mode=RbmWebViewEnum.FULL, ) else: return RbmActionOpenUrl( @@ -55,6 +60,8 @@ def testRbmActionOpenUrl(self): assert instance.text == 'Hello world' assert instance.postback_data == 'U0dWc2JHOGdkMjl5YkdRPQ==' assert instance.url == 'https://dev.bandwidth.com' + assert instance.application == 'BROWSER' + assert instance.webview_view_mode == 'FULL' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_rbm_open_url_enum.py b/test/unit/models/test_rbm_open_url_enum.py new file mode 100644 index 00000000..4a5d8188 --- /dev/null +++ b/test/unit/models/test_rbm_open_url_enum.py @@ -0,0 +1,35 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.rbm_open_url_enum import RbmOpenUrlEnum + +class TestRbmOpenUrlEnum(unittest.TestCase): + """RbmOpenUrlEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testRbmOpenUrlEnum(self): + """Test RbmOpenUrlEnum""" + assert RbmOpenUrlEnum('BROWSER') == 'BROWSER' + assert RbmOpenUrlEnum('WEBVIEW') == 'WEBVIEW' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_rbm_web_view_enum.py b/test/unit/models/test_rbm_web_view_enum.py new file mode 100644 index 00000000..1a900429 --- /dev/null +++ b/test/unit/models/test_rbm_web_view_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.rbm_web_view_enum import RbmWebViewEnum + +class TestRbmWebViewEnum(unittest.TestCase): + """RbmWebViewEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testRbmWebViewEnum(self): + """Test RbmWebViewEnum""" + assert RbmWebViewEnum('FULL') == 'FULL' + assert RbmWebViewEnum('HALF') == 'HALF' + assert RbmWebViewEnum('TALL') == 'TALL' + +if __name__ == '__main__': + unittest.main()