Skip to content

Commit ac346e9

Browse files
band-swi-release-engineering[bot]DX-Bandwidthckoegel
authored
SWI-7878 Update SDK Based on Recent Spec Changes (#253)
* Generate SDK with OpenAPI Generator Version * blocked webhook tests --------- Co-authored-by: DX-Bandwidth <[email protected]> Co-authored-by: ckoegel <[email protected]>
1 parent 5295e5f commit ac346e9

File tree

11 files changed

+259
-19
lines changed

11 files changed

+259
-19
lines changed

.openapi-generator/FILES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ bandwidth/models/account_statistics.py
2323
bandwidth/models/additional_denial_reason.py
2424
bandwidth/models/address.py
2525
bandwidth/models/answer_callback.py
26+
bandwidth/models/blocked_webhook.py
2627
bandwidth/models/bridge_complete_callback.py
2728
bandwidth/models/bridge_target_complete_callback.py
2829
bandwidth/models/call_direction_enum.py
@@ -169,6 +170,7 @@ docs/AccountStatistics.md
169170
docs/AdditionalDenialReason.md
170171
docs/Address.md
171172
docs/AnswerCallback.md
173+
docs/BlockedWebhook.md
172174
docs/BridgeCompleteCallback.md
173175
docs/BridgeTargetCompleteCallback.md
174176
docs/CallDirectionEnum.md

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ Class | Method | HTTP request | Description
153153
- [AdditionalDenialReason](docs/AdditionalDenialReason.md)
154154
- [Address](docs/Address.md)
155155
- [AnswerCallback](docs/AnswerCallback.md)
156+
- [BlockedWebhook](docs/BlockedWebhook.md)
156157
- [BridgeCompleteCallback](docs/BridgeCompleteCallback.md)
157158
- [BridgeTargetCompleteCallback](docs/BridgeTargetCompleteCallback.md)
158159
- [CallDirectionEnum](docs/CallDirectionEnum.md)

bandwidth.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5253,17 +5253,17 @@ components:
52535253
description: >-
52545254
The Toll-Free Verification request privacy policy URL. (Not Available
52555255
Until 5/28/2025)
5256-
example: http://your-company.com/privacyPolicyUrl.pdf
5256+
example: http://your-company.com/privacyPolicy
52575257
type: string
52585258
termsAndConditionsUrl:
52595259
description: >-
52605260
The Toll-Free Verification request terms and conditions policy URL. (Not
52615261
Available Until 5/28/2025)
5262-
example: http://your-company.com/termsAndConditionsUrl.pdf
5262+
example: http://your-company.com/termsAndConditions
52635263
type: string
5264-
businessDBA:
5264+
businessDba:
52655265
description: The company 'Doing Business As'. (Not Available Until 5/28/2025)
5266-
example: SecondCompany Name
5266+
example: Another Company Name Inc.
52675267
type: string
52685268
additionalDenialReason:
52695269
properties:
@@ -5349,8 +5349,8 @@ components:
53495349
$ref: '#/components/schemas/privacyPolicyUrl'
53505350
termsAndConditionsUrl:
53515351
$ref: '#/components/schemas/termsAndConditionsUrl'
5352-
businessDBA:
5353-
$ref: '#/components/schemas/businessDBA'
5352+
businessDba:
5353+
$ref: '#/components/schemas/businessDba'
53545354
verificationUpdateRequest:
53555355
type: object
53565356
required:
@@ -5388,8 +5388,8 @@ components:
53885388
$ref: '#/components/schemas/privacyPolicyUrl'
53895389
termsAndConditionsUrl:
53905390
$ref: '#/components/schemas/termsAndConditionsUrl'
5391-
businessDBA:
5392-
$ref: '#/components/schemas/businessDBA'
5391+
businessDba:
5392+
$ref: '#/components/schemas/businessDba'
53935393
tfvBasicAuthentication:
53945394
type: object
53955395
properties:
@@ -5483,6 +5483,21 @@ components:
54835483
$ref: '#/components/schemas/tfvCallbackStatusEnum'
54845484
internalTicketNumber:
54855485
$ref: '#/components/schemas/internalTicketNumberForWebhook'
5486+
blockedWebhook:
5487+
type: object
5488+
properties:
5489+
accountId:
5490+
$ref: '#/components/schemas/accountId1'
5491+
phoneNumber:
5492+
$ref: '#/components/schemas/tfPhoneNumber'
5493+
status:
5494+
$ref: '#/components/schemas/tfvCallbackStatusEnum'
5495+
internalTicketNumber:
5496+
$ref: '#/components/schemas/internalTicketNumberForWebhook'
5497+
blocked:
5498+
$ref: '#/components/schemas/blocked'
5499+
blockedReason:
5500+
$ref: '#/components/schemas/blockedReason'
54865501
tfvSubmissionWrapper:
54875502
type: object
54885503
properties:
@@ -5849,8 +5864,8 @@ components:
58495864
$ref: '#/components/schemas/privacyPolicyUrl'
58505865
termsAndConditionsUrl:
58515866
$ref: '#/components/schemas/termsAndConditionsUrl'
5852-
businessDBA:
5853-
$ref: '#/components/schemas/businessDBA'
5867+
businessDba:
5868+
$ref: '#/components/schemas/businessDba'
58545869
tfvStatusEnum:
58555870
type: string
58565871
enum:
@@ -7468,6 +7483,7 @@ components:
74687483
- $ref: '#/components/schemas/verificationWebhook'
74697484
- $ref: '#/components/schemas/verificationDenialWebhook'
74707485
- $ref: '#/components/schemas/failureWebhook'
7486+
- $ref: '#/components/schemas/blockedWebhook'
74717487
webhookSubscriptionRequest:
74727488
description: >-
74737489
Information about a webhook that Bandwidth should send upon the

bandwidth/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
from bandwidth.models.additional_denial_reason import AdditionalDenialReason
4747
from bandwidth.models.address import Address
4848
from bandwidth.models.answer_callback import AnswerCallback
49+
from bandwidth.models.blocked_webhook import BlockedWebhook
4950
from bandwidth.models.bridge_complete_callback import BridgeCompleteCallback
5051
from bandwidth.models.bridge_target_complete_callback import BridgeTargetCompleteCallback
5152
from bandwidth.models.call_direction_enum import CallDirectionEnum

bandwidth/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from bandwidth.models.additional_denial_reason import AdditionalDenialReason
2020
from bandwidth.models.address import Address
2121
from bandwidth.models.answer_callback import AnswerCallback
22+
from bandwidth.models.blocked_webhook import BlockedWebhook
2223
from bandwidth.models.bridge_complete_callback import BridgeCompleteCallback
2324
from bandwidth.models.bridge_target_complete_callback import BridgeTargetCompleteCallback
2425
from bandwidth.models.call_direction_enum import CallDirectionEnum
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
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 pprint
18+
import re # noqa: F401
19+
import json
20+
21+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
22+
from typing import Any, ClassVar, Dict, List, Optional
23+
from typing_extensions import Annotated
24+
from bandwidth.models.tfv_callback_status_enum import TfvCallbackStatusEnum
25+
from typing import Optional, Set
26+
from typing_extensions import Self
27+
28+
class BlockedWebhook(BaseModel):
29+
"""
30+
BlockedWebhook
31+
""" # noqa: E501
32+
account_id: Optional[StrictStr] = Field(default=None, description="User's account ID.", alias="accountId")
33+
phone_number: Optional[Annotated[str, Field(min_length=12, strict=True, max_length=12)]] = Field(default=None, description="Toll-free telephone number in E.164 format.", alias="phoneNumber")
34+
status: Optional[TfvCallbackStatusEnum] = None
35+
internal_ticket_number: Optional[StrictStr] = Field(default=None, description="Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.", alias="internalTicketNumber")
36+
blocked: Optional[StrictBool] = Field(default=None, description="Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. (Not Available Until 5/28/2025)")
37+
blocked_reason: Optional[StrictStr] = Field(default=None, description="The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. (Not Available Until 5/28/2025)", alias="blockedReason")
38+
additional_properties: Dict[str, Any] = {}
39+
__properties: ClassVar[List[str]] = ["accountId", "phoneNumber", "status", "internalTicketNumber", "blocked", "blockedReason"]
40+
41+
@field_validator('phone_number')
42+
def phone_number_validate_regular_expression(cls, value):
43+
"""Validates the regular expression"""
44+
if value is None:
45+
return value
46+
47+
if not re.match(r"^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$", value):
48+
raise ValueError(r"must validate the regular expression /^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/")
49+
return value
50+
51+
model_config = ConfigDict(
52+
populate_by_name=True,
53+
validate_assignment=True,
54+
protected_namespaces=(),
55+
)
56+
57+
58+
def to_str(self) -> str:
59+
"""Returns the string representation of the model using alias"""
60+
return pprint.pformat(self.model_dump(by_alias=True))
61+
62+
def to_json(self) -> str:
63+
"""Returns the JSON representation of the model using alias"""
64+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
65+
return json.dumps(self.to_dict())
66+
67+
@classmethod
68+
def from_json(cls, json_str: str) -> Optional[Self]:
69+
"""Create an instance of BlockedWebhook from a JSON string"""
70+
return cls.from_dict(json.loads(json_str))
71+
72+
def to_dict(self) -> Dict[str, Any]:
73+
"""Return the dictionary representation of the model using alias.
74+
75+
This has the following differences from calling pydantic's
76+
`self.model_dump(by_alias=True)`:
77+
78+
* `None` is only added to the output dict for nullable fields that
79+
were set at model initialization. Other fields with value `None`
80+
are ignored.
81+
* Fields in `self.additional_properties` are added to the output dict.
82+
"""
83+
excluded_fields: Set[str] = set([
84+
"additional_properties",
85+
])
86+
87+
_dict = self.model_dump(
88+
by_alias=True,
89+
exclude=excluded_fields,
90+
exclude_none=True,
91+
)
92+
# puts key-value pairs in additional_properties in the top level
93+
if self.additional_properties is not None:
94+
for _key, _value in self.additional_properties.items():
95+
_dict[_key] = _value
96+
97+
return _dict
98+
99+
@classmethod
100+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
101+
"""Create an instance of BlockedWebhook from a dict"""
102+
if obj is None:
103+
return None
104+
105+
if not isinstance(obj, dict):
106+
return cls.model_validate(obj)
107+
108+
_obj = cls.model_validate({
109+
"accountId": obj.get("accountId"),
110+
"phoneNumber": obj.get("phoneNumber"),
111+
"status": obj.get("status"),
112+
"internalTicketNumber": obj.get("internalTicketNumber"),
113+
"blocked": obj.get("blocked"),
114+
"blockedReason": obj.get("blockedReason")
115+
})
116+
# store additional fields in additional_properties
117+
for _key in obj.keys():
118+
if _key not in cls.__properties:
119+
_obj.additional_properties[_key] = obj.get(_key)
120+
121+
return _obj
122+
123+

bandwidth/models/tfv_submission_info.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ class TfvSubmissionInfo(BaseModel):
4242
isv_reseller: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="ISV name.", alias="isvReseller")
4343
privacy_policy_url: Optional[StrictStr] = Field(default=None, description="The Toll-Free Verification request privacy policy URL. (Not Available Until 5/28/2025)", alias="privacyPolicyUrl")
4444
terms_and_conditions_url: Optional[StrictStr] = Field(default=None, description="The Toll-Free Verification request terms and conditions policy URL. (Not Available Until 5/28/2025)", alias="termsAndConditionsUrl")
45-
business_dba: Optional[StrictStr] = Field(default=None, description="The company 'Doing Business As'. (Not Available Until 5/28/2025)", alias="businessDBA")
45+
business_dba: Optional[StrictStr] = Field(default=None, description="The company 'Doing Business As'. (Not Available Until 5/28/2025)", alias="businessDba")
4646
additional_properties: Dict[str, Any] = {}
47-
__properties: ClassVar[List[str]] = ["businessAddress", "businessContact", "messageVolume", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow", "additionalInformation", "isvReseller", "privacyPolicyUrl", "termsAndConditionsUrl", "businessDBA"]
47+
__properties: ClassVar[List[str]] = ["businessAddress", "businessContact", "messageVolume", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow", "additionalInformation", "isvReseller", "privacyPolicyUrl", "termsAndConditionsUrl", "businessDba"]
4848

4949
model_config = ConfigDict(
5050
populate_by_name=True,
@@ -134,7 +134,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
134134
"isvReseller": obj.get("isvReseller"),
135135
"privacyPolicyUrl": obj.get("privacyPolicyUrl"),
136136
"termsAndConditionsUrl": obj.get("termsAndConditionsUrl"),
137-
"businessDBA": obj.get("businessDBA")
137+
"businessDba": obj.get("businessDba")
138138
})
139139
# store additional fields in additional_properties
140140
for _key in obj.keys():

bandwidth/models/verification_request.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ class VerificationRequest(BaseModel):
4343
isv_reseller: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="ISV name.", alias="isvReseller")
4444
privacy_policy_url: Optional[StrictStr] = Field(default=None, description="The Toll-Free Verification request privacy policy URL. (Not Available Until 5/28/2025)", alias="privacyPolicyUrl")
4545
terms_and_conditions_url: Optional[StrictStr] = Field(default=None, description="The Toll-Free Verification request terms and conditions policy URL. (Not Available Until 5/28/2025)", alias="termsAndConditionsUrl")
46-
business_dba: Optional[StrictStr] = Field(default=None, description="The company 'Doing Business As'. (Not Available Until 5/28/2025)", alias="businessDBA")
46+
business_dba: Optional[StrictStr] = Field(default=None, description="The company 'Doing Business As'. (Not Available Until 5/28/2025)", alias="businessDba")
4747
additional_properties: Dict[str, Any] = {}
48-
__properties: ClassVar[List[str]] = ["businessAddress", "businessContact", "messageVolume", "phoneNumbers", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow", "additionalInformation", "isvReseller", "privacyPolicyUrl", "termsAndConditionsUrl", "businessDBA"]
48+
__properties: ClassVar[List[str]] = ["businessAddress", "businessContact", "messageVolume", "phoneNumbers", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow", "additionalInformation", "isvReseller", "privacyPolicyUrl", "termsAndConditionsUrl", "businessDba"]
4949

5050
model_config = ConfigDict(
5151
populate_by_name=True,
@@ -136,7 +136,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
136136
"isvReseller": obj.get("isvReseller"),
137137
"privacyPolicyUrl": obj.get("privacyPolicyUrl"),
138138
"termsAndConditionsUrl": obj.get("termsAndConditionsUrl"),
139-
"businessDBA": obj.get("businessDBA")
139+
"businessDba": obj.get("businessDba")
140140
})
141141
# store additional fields in additional_properties
142142
for _key in obj.keys():

bandwidth/models/verification_update_request.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ class VerificationUpdateRequest(BaseModel):
4242
isv_reseller: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="ISV name.", alias="isvReseller")
4343
privacy_policy_url: Optional[StrictStr] = Field(default=None, description="The Toll-Free Verification request privacy policy URL. (Not Available Until 5/28/2025)", alias="privacyPolicyUrl")
4444
terms_and_conditions_url: Optional[StrictStr] = Field(default=None, description="The Toll-Free Verification request terms and conditions policy URL. (Not Available Until 5/28/2025)", alias="termsAndConditionsUrl")
45-
business_dba: Optional[StrictStr] = Field(default=None, description="The company 'Doing Business As'. (Not Available Until 5/28/2025)", alias="businessDBA")
45+
business_dba: Optional[StrictStr] = Field(default=None, description="The company 'Doing Business As'. (Not Available Until 5/28/2025)", alias="businessDba")
4646
additional_properties: Dict[str, Any] = {}
47-
__properties: ClassVar[List[str]] = ["businessAddress", "businessContact", "messageVolume", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow", "additionalInformation", "isvReseller", "privacyPolicyUrl", "termsAndConditionsUrl", "businessDBA"]
47+
__properties: ClassVar[List[str]] = ["businessAddress", "businessContact", "messageVolume", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow", "additionalInformation", "isvReseller", "privacyPolicyUrl", "termsAndConditionsUrl", "businessDba"]
4848

4949
model_config = ConfigDict(
5050
populate_by_name=True,
@@ -134,7 +134,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
134134
"isvReseller": obj.get("isvReseller"),
135135
"privacyPolicyUrl": obj.get("privacyPolicyUrl"),
136136
"termsAndConditionsUrl": obj.get("termsAndConditionsUrl"),
137-
"businessDBA": obj.get("businessDBA")
137+
"businessDba": obj.get("businessDba")
138138
})
139139
# store additional fields in additional_properties
140140
for _key in obj.keys():

docs/BlockedWebhook.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# BlockedWebhook
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**account_id** | **str** | User&#39;s account ID. | [optional]
9+
**phone_number** | **str** | Toll-free telephone number in E.164 format. | [optional]
10+
**status** | [**TfvCallbackStatusEnum**](TfvCallbackStatusEnum.md) | | [optional]
11+
**internal_ticket_number** | **str** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional]
12+
**blocked** | **bool** | Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. (Not Available Until 5/28/2025) | [optional]
13+
**blocked_reason** | **str** | The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. (Not Available Until 5/28/2025) | [optional]
14+
15+
## Example
16+
17+
```python
18+
from bandwidth.models.blocked_webhook import BlockedWebhook
19+
20+
# TODO update the JSON string below
21+
json = "{}"
22+
# create an instance of BlockedWebhook from a JSON string
23+
blocked_webhook_instance = BlockedWebhook.from_json(json)
24+
# print the JSON string representation of the object
25+
print(BlockedWebhook.to_json())
26+
27+
# convert the object into a dict
28+
blocked_webhook_dict = blocked_webhook_instance.to_dict()
29+
# create an instance of BlockedWebhook from a dict
30+
blocked_webhook_from_dict = BlockedWebhook.from_dict(blocked_webhook_dict)
31+
```
32+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
33+
34+

0 commit comments

Comments
 (0)