Skip to content

Commit 3190b90

Browse files
band-swi-release-engineering[bot]DX-Bandwidthckoegel
authored
SWI-9203 Update SDK Based on Recent Spec Changes (#278)
* Generate SDK with OpenAPI Generator Version * unit tests * rename for typo --------- Co-authored-by: DX-Bandwidth <[email protected]> Co-authored-by: ckoegel <[email protected]>
1 parent 79cb63e commit 3190b90

16 files changed

+244
-7
lines changed

.openapi-generator/FILES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,10 @@ bandwidth/models/rbm_message_content_file.py
145145
bandwidth/models/rbm_message_content_rich_card.py
146146
bandwidth/models/rbm_message_content_text.py
147147
bandwidth/models/rbm_message_media.py
148+
bandwidth/models/rbm_open_url_enum.py
148149
bandwidth/models/rbm_standalone_card.py
149150
bandwidth/models/rbm_suggestion_response.py
151+
bandwidth/models/rbm_web_view_enum.py
150152
bandwidth/models/recording_available_callback.py
151153
bandwidth/models/recording_complete_callback.py
152154
bandwidth/models/recording_state_enum.py
@@ -328,8 +330,10 @@ docs/RbmMessageContentFile.md
328330
docs/RbmMessageContentRichCard.md
329331
docs/RbmMessageContentText.md
330332
docs/RbmMessageMedia.md
333+
docs/RbmOpenUrlEnum.md
331334
docs/RbmStandaloneCard.md
332335
docs/RbmSuggestionResponse.md
336+
docs/RbmWebViewEnum.md
333337
docs/RecordingAvailableCallback.md
334338
docs/RecordingCompleteCallback.md
335339
docs/RecordingStateEnum.md

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,10 @@ Class | Method | HTTP request | Description
283283
- [RbmMessageContentRichCard](docs/RbmMessageContentRichCard.md)
284284
- [RbmMessageContentText](docs/RbmMessageContentText.md)
285285
- [RbmMessageMedia](docs/RbmMessageMedia.md)
286+
- [RbmOpenUrlEnum](docs/RbmOpenUrlEnum.md)
286287
- [RbmStandaloneCard](docs/RbmStandaloneCard.md)
287288
- [RbmSuggestionResponse](docs/RbmSuggestionResponse.md)
289+
- [RbmWebViewEnum](docs/RbmWebViewEnum.md)
288290
- [RecordingAvailableCallback](docs/RecordingAvailableCallback.md)
289291
- [RecordingCompleteCallback](docs/RecordingCompleteCallback.md)
290292
- [RecordingStateEnum](docs/RecordingStateEnum.md)

bandwidth.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ info:
88
99
version: 1.0.0
1010
security:
11-
- OAuth2: []
1211
- Basic: []
12+
- OAuth2: []
1313
tags:
1414
- name: Messages
1515
- name: Media
@@ -2378,6 +2378,35 @@ components:
23782378
- OPEN_URL
23792379
- REQUEST_LOCATION
23802380
example: REPLY
2381+
rbmOpenUrlEnum:
2382+
type: string
2383+
description: >-
2384+
Specifies how the URL should be opened on a mobile device.
2385+
2386+
- `BROWSER` Opens the URL in the device's default browser. If
2387+
application is not set or the device doesn’t support WebView, this
2388+
option is used by default.
2389+
2390+
- `WEBVIEW` Opens the URL in an in-app WebView.
2391+
enum:
2392+
- BROWSER
2393+
- WEBVIEW
2394+
example: WEBVIEW
2395+
rbmWebViewEnum:
2396+
type: string
2397+
description: >-
2398+
Defines the layout of the WebView on a mobile device. It must be defined
2399+
when application is set to `WEBVIEW`
2400+
2401+
- `FULL` WebView takes the full screen.
2402+
2403+
- `HALF` WebView takes half of the screen.
2404+
2405+
- `TALL` WebView takes three-quarters of the screen.
2406+
enum:
2407+
- FULL
2408+
- HALF
2409+
- TALL
23812410
rbmActionText:
23822411
title: Text
23832412
type: string
@@ -2482,6 +2511,10 @@ components:
24822511
description: The URL to open in browser.
24832512
example: https://dev.bandwidth.com
24842513
maxLength: 2048
2514+
application:
2515+
$ref: '#/components/schemas/rbmOpenUrlEnum'
2516+
webviewViewMode:
2517+
$ref: '#/components/schemas/rbmWebViewEnum'
24852518
required:
24862519
- url
24872520
multiChannelFullActions:

bandwidth/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,10 @@
165165
"RbmMessageContentRichCard",
166166
"RbmMessageContentText",
167167
"RbmMessageMedia",
168+
"RbmOpenUrlEnum",
168169
"RbmStandaloneCard",
169170
"RbmSuggestionResponse",
171+
"RbmWebViewEnum",
170172
"RecordingAvailableCallback",
171173
"RecordingCompleteCallback",
172174
"RecordingStateEnum",
@@ -366,8 +368,10 @@
366368
from bandwidth.models.rbm_message_content_rich_card import RbmMessageContentRichCard as RbmMessageContentRichCard
367369
from bandwidth.models.rbm_message_content_text import RbmMessageContentText as RbmMessageContentText
368370
from bandwidth.models.rbm_message_media import RbmMessageMedia as RbmMessageMedia
371+
from bandwidth.models.rbm_open_url_enum import RbmOpenUrlEnum as RbmOpenUrlEnum
369372
from bandwidth.models.rbm_standalone_card import RbmStandaloneCard as RbmStandaloneCard
370373
from bandwidth.models.rbm_suggestion_response import RbmSuggestionResponse as RbmSuggestionResponse
374+
from bandwidth.models.rbm_web_view_enum import RbmWebViewEnum as RbmWebViewEnum
371375
from bandwidth.models.recording_available_callback import RecordingAvailableCallback as RecordingAvailableCallback
372376
from bandwidth.models.recording_complete_callback import RecordingCompleteCallback as RecordingCompleteCallback
373377
from bandwidth.models.recording_state_enum import RecordingStateEnum as RecordingStateEnum

bandwidth/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,10 @@
140140
from bandwidth.models.rbm_message_content_rich_card import RbmMessageContentRichCard
141141
from bandwidth.models.rbm_message_content_text import RbmMessageContentText
142142
from bandwidth.models.rbm_message_media import RbmMessageMedia
143+
from bandwidth.models.rbm_open_url_enum import RbmOpenUrlEnum
143144
from bandwidth.models.rbm_standalone_card import RbmStandaloneCard
144145
from bandwidth.models.rbm_suggestion_response import RbmSuggestionResponse
146+
from bandwidth.models.rbm_web_view_enum import RbmWebViewEnum
145147
from bandwidth.models.recording_available_callback import RecordingAvailableCallback
146148
from bandwidth.models.recording_complete_callback import RecordingCompleteCallback
147149
from bandwidth.models.recording_state_enum import RecordingStateEnum

bandwidth/models/rbm_action_open_url.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
import json
2020

2121
from pydantic import BaseModel, ConfigDict, Field
22-
from typing import Any, ClassVar, Dict, List, Union
22+
from typing import Any, ClassVar, Dict, List, Optional, Union
2323
from typing_extensions import Annotated
2424
from bandwidth.models.rbm_action_type_enum import RbmActionTypeEnum
25+
from bandwidth.models.rbm_open_url_enum import RbmOpenUrlEnum
26+
from bandwidth.models.rbm_web_view_enum import RbmWebViewEnum
2527
from typing import Optional, Set
2628
from typing_extensions import Self
2729

@@ -33,8 +35,10 @@ class RbmActionOpenUrl(BaseModel):
3335
text: Annotated[str, Field(strict=True, max_length=25)] = Field(description="Displayed text for user to click")
3436
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")
3537
url: Annotated[str, Field(strict=True, max_length=2048)] = Field(description="The URL to open in browser.")
38+
application: Optional[RbmOpenUrlEnum] = None
39+
webview_view_mode: Optional[RbmWebViewEnum] = Field(default=None, alias="webviewViewMode")
3640
additional_properties: Dict[str, Any] = {}
37-
__properties: ClassVar[List[str]] = ["type", "text", "postbackData", "url"]
41+
__properties: ClassVar[List[str]] = ["type", "text", "postbackData", "url", "application", "webviewViewMode"]
3842

3943
model_config = ConfigDict(
4044
populate_by_name=True,
@@ -97,7 +101,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97101
"type": obj.get("type"),
98102
"text": obj.get("text"),
99103
"postbackData": obj.get("postbackData"),
100-
"url": obj.get("url")
104+
"url": obj.get("url"),
105+
"application": obj.get("application"),
106+
"webviewViewMode": obj.get("webviewViewMode")
101107
})
102108
# store additional fields in additional_properties
103109
for _key in obj.keys():
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# coding: utf-8
2+
3+
"""
4+
Bandwidth
5+
6+
Bandwidth's Communication APIs
7+
8+
The version of the OpenAPI document: 1.0.0
9+
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501
14+
15+
16+
from __future__ import annotations
17+
import json
18+
from enum import Enum
19+
from typing_extensions import Self
20+
21+
22+
class RbmOpenUrlEnum(str, Enum):
23+
"""
24+
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.
25+
"""
26+
27+
"""
28+
allowed enum values
29+
"""
30+
BROWSER = 'BROWSER'
31+
WEBVIEW = 'WEBVIEW'
32+
33+
@classmethod
34+
def from_json(cls, json_str: str) -> Self:
35+
"""Create an instance of RbmOpenUrlEnum from a JSON string"""
36+
return cls(json.loads(json_str))
37+
38+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# coding: utf-8
2+
3+
"""
4+
Bandwidth
5+
6+
Bandwidth's Communication APIs
7+
8+
The version of the OpenAPI document: 1.0.0
9+
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501
14+
15+
16+
from __future__ import annotations
17+
import json
18+
from enum import Enum
19+
from typing_extensions import Self
20+
21+
22+
class RbmWebViewEnum(str, Enum):
23+
"""
24+
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.
25+
"""
26+
27+
"""
28+
allowed enum values
29+
"""
30+
FULL = 'FULL'
31+
HALF = 'HALF'
32+
TALL = 'TALL'
33+
34+
@classmethod
35+
def from_json(cls, json_str: str) -> Self:
36+
"""Create an instance of RbmWebViewEnum from a JSON string"""
37+
return cls(json.loads(json_str))
38+
39+

custom_templates/configuration.mustache

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,6 @@ conf = {{{packageName}}}.Configuration(
646646
if self.temp_access_token and self.temp_access_token_expiration > now + 60:
647647
return self.temp_access_token
648648
else:
649-
print("Fetching new access token")
650649
_bytes = f"{self.client_id}:{self.client_secret}".encode('utf-8')
651650
_encoded_string = base64.b64encode(_bytes).decode('utf-8')
652651
auth_header = f"Basic {_encoded_string}"

docs/MultiChannelAction.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Name | Type | Description | Notes
1717
**end_time** | **datetime** | The end time of the event. |
1818
**description** | **str** | The description of the event. | [optional]
1919
**url** | **str** | The URL to open in browser. |
20+
**application** | [**RbmOpenUrlEnum**](RbmOpenUrlEnum.md) | | [optional]
21+
**webview_view_mode** | [**RbmWebViewEnum**](RbmWebViewEnum.md) | | [optional]
2022

2123
## Example
2224

0 commit comments

Comments
 (0)