-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathverification_request.py
More file actions
184 lines (154 loc) · 12.4 KB
/
verification_request.py
File metadata and controls
184 lines (154 loc) · 12.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# 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 pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from bandwidth.models.address import Address
from bandwidth.models.business_entity_type_enum import BusinessEntityTypeEnum
from bandwidth.models.business_registration_type_enum import BusinessRegistrationTypeEnum
from bandwidth.models.contact import Contact
from bandwidth.models.opt_in_workflow import OptInWorkflow
from typing import Optional, Set
from typing_extensions import Self
class VerificationRequest(BaseModel):
"""
VerificationRequest
""" # noqa: E501
business_address: Address = Field(alias="businessAddress")
business_contact: Contact = Field(alias="businessContact")
message_volume: Annotated[int, Field(le=10000000, strict=True, ge=10)] = Field(description="Estimated monthly volume of messages from the toll-free number.", alias="messageVolume")
phone_numbers: Annotated[List[Annotated[str, Field(min_length=12, strict=True, max_length=12)]], Field(min_length=1, max_length=10)] = Field(alias="phoneNumbers")
use_case: Annotated[str, Field(min_length=0, strict=True, max_length=500)] = Field(description="The category of the use case.", alias="useCase")
use_case_summary: Annotated[str, Field(min_length=0, strict=True, max_length=500)] = Field(description="A general idea of the use case and customer.", alias="useCaseSummary")
production_message_content: Annotated[str, Field(min_length=0, strict=True, max_length=500)] = Field(description="Example of message content.", alias="productionMessageContent")
opt_in_workflow: OptInWorkflow = Field(alias="optInWorkflow")
additional_information: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="Any additional information.", alias="additionalInformation")
isv_reseller: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="ISV name.", alias="isvReseller")
privacy_policy_url: Optional[StrictStr] = Field(default=None, description="The Toll-Free Verification request privacy policy URL.", alias="privacyPolicyUrl")
terms_and_conditions_url: Optional[StrictStr] = Field(default=None, description="The Toll-Free Verification request terms and conditions policy URL.", alias="termsAndConditionsUrl")
business_dba: Optional[StrictStr] = Field(default=None, description="The company 'Doing Business As'.", alias="businessDba")
business_registration_number: Optional[Annotated[str, Field(strict=True, max_length=500)]] = Field(default=None, description="Government-issued business identifying number. **Note:** If this field is provided, it is strongly recommended to also provide `businessRegistrationType` and `businessRegistrationIssuingCountry`. Submissions missing these fields have a high likelihood of rejection. ", alias="businessRegistrationNumber")
business_registration_type: Optional[BusinessRegistrationTypeEnum] = Field(default=None, alias="businessRegistrationType")
business_registration_issuing_country: Optional[StrictStr] = Field(default=None, description="The country issuing the business registration in ISO-3166-1 alpha-3 format. Alpha-2 country codes are acceptable, but the application will convert them to alpha-3 when received, so alpha-3 is encouraged. **Note:** If this field is omitted but `businessRegistrationType` is provided, the application will attempt to infer the country based on the registration type. However, if the application cannot confidently infer the country, the submission may be rejected. To ensure the highest likelihood of acceptance, it is recommended to provide both `businessRegistrationType` and `businessRegistrationIssuingCountry`. | Registration Type | Supported Countries | |----------------------|------------------------------------| | EIN | USA | | CBN | CAN | | NEQ | CAN | | PROVINCIAL_NUMBER | CAN | | CRN | GBR, HKG | | VAT | GBR, IRL, BRA, NLD | | ACN | AUS | | ABN | AUS | | BRN | HKG | | SIREN | FRA | | SIRET | FRA | | NZBN | NZL | | UST_IDNR | DEU | | CIF | ESP | | NIF | ESP | | CNPJ | BRA | | UID | CHE | | OTHER | Must Provide Country Code |", alias="businessRegistrationIssuingCountry")
business_entity_type: BusinessEntityTypeEnum = Field(alias="businessEntityType")
help_message_response: Optional[Annotated[str, Field(strict=True, max_length=500)]] = Field(default=None, description="A message that gets sent to users requesting help.", alias="helpMessageResponse")
age_gated_content: Optional[StrictBool] = Field(default=None, description="Indicates whether the content is age-gated.", alias="ageGatedContent")
cv_token: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. Supplying an empty string will likely result in rejection.", alias="cvToken")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["businessAddress", "businessContact", "messageVolume", "phoneNumbers", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow", "additionalInformation", "isvReseller", "privacyPolicyUrl", "termsAndConditionsUrl", "businessDba", "businessRegistrationNumber", "businessRegistrationType", "businessRegistrationIssuingCountry", "businessEntityType", "helpMessageResponse", "ageGatedContent", "cvToken"]
model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of VerificationRequest from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of business_address
if self.business_address:
_dict['businessAddress'] = self.business_address.to_dict()
# override the default output from pydantic by calling `to_dict()` of business_contact
if self.business_contact:
_dict['businessContact'] = self.business_contact.to_dict()
# override the default output from pydantic by calling `to_dict()` of opt_in_workflow
if self.opt_in_workflow:
_dict['optInWorkflow'] = self.opt_in_workflow.to_dict()
# puts key-value pairs in additional_properties in the top level
if self.additional_properties is not None:
for _key, _value in self.additional_properties.items():
_dict[_key] = _value
# set to None if additional_information (nullable) is None
# and model_fields_set contains the field
if self.additional_information is None and "additional_information" in self.model_fields_set:
_dict['additionalInformation'] = None
# set to None if isv_reseller (nullable) is None
# and model_fields_set contains the field
if self.isv_reseller is None and "isv_reseller" in self.model_fields_set:
_dict['isvReseller'] = None
# set to None if business_registration_number (nullable) is None
# and model_fields_set contains the field
if self.business_registration_number is None and "business_registration_number" in self.model_fields_set:
_dict['businessRegistrationNumber'] = None
# set to None if business_registration_type (nullable) is None
# and model_fields_set contains the field
if self.business_registration_type is None and "business_registration_type" in self.model_fields_set:
_dict['businessRegistrationType'] = None
# set to None if help_message_response (nullable) is None
# and model_fields_set contains the field
if self.help_message_response is None and "help_message_response" in self.model_fields_set:
_dict['helpMessageResponse'] = None
# set to None if cv_token (nullable) is None
# and model_fields_set contains the field
if self.cv_token is None and "cv_token" in self.model_fields_set:
_dict['cvToken'] = None
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of VerificationRequest from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"businessAddress": Address.from_dict(obj["businessAddress"]) if obj.get("businessAddress") is not None else None,
"businessContact": Contact.from_dict(obj["businessContact"]) if obj.get("businessContact") is not None else None,
"messageVolume": obj.get("messageVolume"),
"phoneNumbers": obj.get("phoneNumbers"),
"useCase": obj.get("useCase"),
"useCaseSummary": obj.get("useCaseSummary"),
"productionMessageContent": obj.get("productionMessageContent"),
"optInWorkflow": OptInWorkflow.from_dict(obj["optInWorkflow"]) if obj.get("optInWorkflow") is not None else None,
"additionalInformation": obj.get("additionalInformation"),
"isvReseller": obj.get("isvReseller"),
"privacyPolicyUrl": obj.get("privacyPolicyUrl"),
"termsAndConditionsUrl": obj.get("termsAndConditionsUrl"),
"businessDba": obj.get("businessDba"),
"businessRegistrationNumber": obj.get("businessRegistrationNumber"),
"businessRegistrationType": obj.get("businessRegistrationType"),
"businessRegistrationIssuingCountry": obj.get("businessRegistrationIssuingCountry"),
"businessEntityType": obj.get("businessEntityType"),
"helpMessageResponse": obj.get("helpMessageResponse"),
"ageGatedContent": obj.get("ageGatedContent"),
"cvToken": obj.get("cvToken")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj