4
4
5
5
from sinch .core .ports .http_transport import HTTPTransport
6
6
from sinch .core .token_manager import TokenManager , TokenManagerAsync
7
+ from sinch .core .enums import HTTPAuthentication
7
8
8
9
9
10
class Configuration :
@@ -22,14 +23,18 @@ def __init__(
22
23
disable_https = False ,
23
24
connection_timeout = 10 ,
24
25
application_key : str = None ,
25
- application_secret : str = None
26
+ application_secret : str = None ,
27
+ service_plan_id : str = None ,
28
+ sms_api_token : str = None
26
29
):
27
30
self .key_id = key_id
28
31
self .key_secret = key_secret
29
32
self .project_id = project_id
30
33
self .application_key = application_key
31
34
self .application_secret = application_secret
32
35
self .connection_timeout = connection_timeout
36
+ self .sms_api_token = sms_api_token
37
+ self .service_plan_id = service_plan_id
33
38
self .auth_origin = "auth.sinch.com"
34
39
self .numbers_origin = "numbers.api.sinch.com"
35
40
self .verification_origin = "verification.api.sinch.com"
@@ -39,7 +44,10 @@ def __init__(
39
44
self ._conversation_region = "eu"
40
45
self ._conversation_domain = ".conversation.api.sinch.com"
41
46
self ._sms_region = "us"
47
+ self ._sms_region_with_service_plan_id = "us"
42
48
self ._sms_domain = "zt.{}.sms.api.sinch.com"
49
+ self ._sms_domain_with_service_plan_id = "{}.sms.api.sinch.com"
50
+ self ._sms_authentication = HTTPAuthentication .OAUTH .value
43
51
self ._templates_region = "eu"
44
52
self ._templates_domain = ".template.api.sinch.com"
45
53
self .token_manager = token_manager
@@ -48,6 +56,7 @@ def __init__(
48
56
49
57
self ._set_conversation_origin ()
50
58
self ._set_sms_origin ()
59
+ self ._set_sms_origin_with_service_plan_id ()
51
60
self ._set_templates_origin ()
52
61
self ._set_voice_origin ()
53
62
@@ -58,23 +67,35 @@ def __init__(
58
67
else :
59
68
self .logger = logging .getLogger ("Sinch" )
60
69
61
- def _set_voice_origin (self ):
62
- if not self ._voice_region :
63
- self .voice_origin = self ._voice_domain .format ("calling" )
64
- else :
65
- self .voice_origin = self ._voice_domain .format ("calling-" + self ._voice_region )
70
+ def _set_sms_origin_with_service_plan_id (self ):
71
+ self .sms_origin_with_service_plan_id = self ._sms_domain_with_service_plan_id .format (
72
+ self ._sms_region_with_service_plan_id
73
+ )
66
74
67
- def _set_voice_region (self , region ):
68
- self ._voice_region = region
69
- self ._set_voice_origin ()
75
+ def _set_sms_region_with_service_plan_id (self , region ):
76
+ self ._sms_region_with_service_plan_id = region
77
+ self ._set_sms_origin_with_service_plan_id ()
70
78
71
- def _get_voice_region (self ):
72
- return self ._voice_region
79
+ def _get_sms_region_with_service_plan_id (self ):
80
+ return self ._sms_region_with_service_plan_id
73
81
74
- voice_region = property (
75
- _get_voice_region ,
76
- _set_voice_region ,
77
- doc = "Voice Region"
82
+ sms_region_with_service_plan_id = property (
83
+ _get_sms_region_with_service_plan_id ,
84
+ _set_sms_region_with_service_plan_id ,
85
+ doc = "SMS Region for service plan id version of the SMS API"
86
+ )
87
+
88
+ def _set_sms_domain_with_service_plan_id (self , domain ):
89
+ self ._sms_domain_with_service_plan_id = domain
90
+ self ._set_sms_origin_with_service_plan_id ()
91
+
92
+ def _get_sms_domain_with_service_plan_id (self ):
93
+ return self ._sms_domain_with_service_plan_id
94
+
95
+ sms_domain_with_service_plan_id = property (
96
+ _get_sms_domain_with_service_plan_id ,
97
+ _set_sms_domain_with_service_plan_id ,
98
+ doc = "SMS Domain for service plan id version of the SMS API"
78
99
)
79
100
80
101
def _set_sms_origin (self ):
@@ -98,7 +119,7 @@ def _set_sms_domain(self, domain):
98
119
self ._set_sms_origin ()
99
120
100
121
def _get_sms_domain (self ):
101
- return self .sms_domain
122
+ return self ._sms_domain
102
123
103
124
sms_domain = property (
104
125
_get_sms_domain ,
@@ -163,3 +184,22 @@ def _get_templates_domain(self):
163
184
_set_templates_domain ,
164
185
doc = "Conversation API Templates Domain"
165
186
)
187
+
188
+ def _set_voice_origin (self ):
189
+ if not self ._voice_region :
190
+ self .voice_origin = self ._voice_domain .format ("calling" )
191
+ else :
192
+ self .voice_origin = self ._voice_domain .format ("calling-" + self ._voice_region )
193
+
194
+ def _set_voice_region (self , region ):
195
+ self ._voice_region = region
196
+ self ._set_voice_origin ()
197
+
198
+ def _get_voice_region (self ):
199
+ return self ._voice_region
200
+
201
+ voice_region = property (
202
+ _get_voice_region ,
203
+ _set_voice_region ,
204
+ doc = "Voice Region"
205
+ )
0 commit comments