Skip to content

Commit 9e12a27

Browse files
authored
DX-2243 Update Machine Detection Model Name (#36)
* Update Naming MachineDetectionRequest -> MachineDetectionConfiguration * Update __init__.py
1 parent d667484 commit 9e12a27

File tree

4 files changed

+159
-159
lines changed

4 files changed

+159
-159
lines changed

bandwidth/tests/test_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from bandwidth.exceptions.api_exception import APIException
1717
from bandwidth.messaging.models.message_request import MessageRequest
1818
from bandwidth.voice.models.create_call_request import CreateCallRequest
19-
from bandwidth.voice.models.machine_detection_request import MachineDetectionRequest
19+
from bandwidth.voice.models.machine_detection_configuration import MachineDetectionConfiguration
2020
from bandwidth.voice.models.callback_method_enum import CallbackMethodEnum
2121
from bandwidth.voice.models.mode_enum import ModeEnum
2222
from bandwidth.multifactorauth.models.two_factor_code_request_schema import TwoFactorCodeRequestSchema
@@ -198,7 +198,7 @@ def test_successful_create_and_get_call(self, voice_client):
198198
voice_client: Contains the basic auth credentials needed to authenticate.
199199
200200
"""
201-
machine_detection_parameters = MachineDetectionRequest()
201+
machine_detection_parameters = MachineDetectionConfiguration()
202202
machine_detection_parameters.mode = ModeEnum.ASYNC
203203
machine_detection_parameters.callback_url = BASE_CALLBACK_URL + "/callbacks/machineDetection"
204204
machine_detection_parameters.callback_method = CallbackMethodEnum.POST

bandwidth/voice/models/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__all__ = [
1+
__all__ = [
22
'create_call_request',
33
'create_call_response',
44
'call_state',
@@ -9,7 +9,7 @@
99
'conference_state',
1010
'conference_member_state',
1111
'conference_recording_metadata',
12-
'machine_detection_request',
12+
'machine_detection_configuration',
1313
'transcribe_recording_request',
1414
'transcription_response',
1515
'transcription_metadata',
@@ -31,5 +31,5 @@
3131
'redirect_method_enum',
3232
'state_enum',
3333
'state_1_enum',
34-
'status_enum',
34+
'status_enum',
3535
]

bandwidth/voice/models/create_call_request.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
This file was automatically generated by APIMATIC v3.0 (
77
https://www.apimatic.io ).
88
"""
9-
from bandwidth.voice.models.machine_detection_request import MachineDetectionRequest
9+
from bandwidth.voice.models.machine_detection_configuration import MachineDetectionConfiguration
1010

1111

1212
class CreateCallRequest(object):
@@ -40,7 +40,7 @@ class CreateCallRequest(object):
4040
here.
4141
tag (string): TODO: type description here.
4242
application_id (string): TODO: type description here.
43-
machine_detection (MachineDetectionRequest): TODO: type description
43+
machine_detection (MachineDetectionConfiguration): TODO: type description
4444
here.
4545
4646
"""
@@ -143,7 +143,7 @@ def from_dictionary(cls,
143143
disconnect_url = dictionary.get('disconnectUrl')
144144
disconnect_method = dictionary.get('disconnectMethod')
145145
tag = dictionary.get('tag')
146-
machine_detection = MachineDetectionRequest.from_dictionary(dictionary.get('machineDetection')) if dictionary.get('machineDetection') else None
146+
machine_detection = MachineDetectionConfiguration.from_dictionary(dictionary.get('machineDetection')) if dictionary.get('machineDetection') else None
147147

148148
# Return an object of this model
149149
return cls(mfrom,

bandwidth/voice/models/machine_detection_request.py renamed to bandwidth/voice/models/machine_detection_configuration.py

Lines changed: 151 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -1,151 +1,151 @@
1-
# -*- coding: utf-8 -*-
2-
3-
"""
4-
bandwidth
5-
6-
This file was automatically generated by APIMATIC v3.0 (
7-
https://www.apimatic.io ).
8-
"""
9-
10-
11-
class MachineDetectionRequest(object):
12-
13-
"""Implementation of the 'MachineDetectionRequest' model.
14-
15-
TODO: type model description here.
16-
17-
Attributes:
18-
mode (ModeEnum): The machine detection mode. If set to 'async', the
19-
detection result will be sent in a 'machineDetectionComplete'
20-
callback. If set to 'sync', the 'answer' callback will wait for
21-
the machine detection to complete and will include its result.
22-
Default is 'async'.
23-
detection_timeout (float): Total amount of time (in seconds) before
24-
giving up.
25-
silence_timeout (float): If no speech is detected in this period, a
26-
callback with a 'silence' result is sent. Default is 10 seconds.
27-
speech_threshold (float): When speech has ended and a result couldn't
28-
be determined based on the audio content itself, this value is
29-
used to determine if the speaker is a machine based on the speech
30-
duration. If the length of the speech detected is greater than or
31-
equal to this threshold, the result will be 'answering-machine'.
32-
If the length of speech detected is below this threshold, the
33-
result will be 'human'. Default is 10 seconds.
34-
speech_end_threshold (float): Amount of silence (in seconds) before
35-
assuming the callee has finished speaking.
36-
delay_result (bool): If set to 'true' and if an answering machine is
37-
detected, the 'answering-machine' callback will be delayed until
38-
the machine is done speaking or until the 'detectionTimeout' is
39-
exceeded. If false, the 'answering-machine' result is sent
40-
immediately. Default is 'false'.
41-
callback_url (string): The URL to send the 'machineDetectionComplete'
42-
callback when the detection is completed. Only for 'async' mode.
43-
callback_method (CallbackMethodEnum): TODO: type description here.
44-
fallback_url (string): TODO: type description here.
45-
fallback_method (FallbackMethodEnum): TODO: type description here.
46-
username (string): TODO: type description here.
47-
password (string): TODO: type description here.
48-
fallback_username (string): TODO: type description here.
49-
fallback_password (string): TODO: type description here.
50-
51-
"""
52-
53-
# Create a mapping from Model property names to API property names
54-
_names = {
55-
"mode": 'mode',
56-
"detection_timeout": 'detectionTimeout',
57-
"silence_timeout": 'silenceTimeout',
58-
"speech_threshold": 'speechThreshold',
59-
"speech_end_threshold": 'speechEndThreshold',
60-
"delay_result": 'delayResult',
61-
"callback_url": 'callbackUrl',
62-
"callback_method": 'callbackMethod',
63-
"fallback_url": 'fallbackUrl',
64-
"fallback_method": 'fallbackMethod',
65-
"username": 'username',
66-
"password": 'password',
67-
"fallback_username": 'fallbackUsername',
68-
"fallback_password": 'fallbackPassword'
69-
}
70-
71-
def __init__(self,
72-
mode=None,
73-
detection_timeout=None,
74-
silence_timeout=None,
75-
speech_threshold=None,
76-
speech_end_threshold=None,
77-
delay_result=None,
78-
callback_url=None,
79-
callback_method=None,
80-
fallback_url=None,
81-
fallback_method=None,
82-
username=None,
83-
password=None,
84-
fallback_username=None,
85-
fallback_password=None):
86-
"""Constructor for the MachineDetectionRequest class"""
87-
88-
# Initialize members of the class
89-
self.mode = mode
90-
self.detection_timeout = detection_timeout
91-
self.silence_timeout = silence_timeout
92-
self.speech_threshold = speech_threshold
93-
self.speech_end_threshold = speech_end_threshold
94-
self.delay_result = delay_result
95-
self.callback_url = callback_url
96-
self.callback_method = callback_method
97-
self.fallback_url = fallback_url
98-
self.fallback_method = fallback_method
99-
self.username = username
100-
self.password = password
101-
self.fallback_username = fallback_username
102-
self.fallback_password = fallback_password
103-
104-
@classmethod
105-
def from_dictionary(cls,
106-
dictionary):
107-
"""Creates an instance of this model from a dictionary
108-
109-
Args:
110-
dictionary (dictionary): A dictionary representation of the object
111-
as obtained from the deserialization of the server's response. The
112-
keys MUST match property names in the API description.
113-
114-
Returns:
115-
object: An instance of this structure class.
116-
117-
"""
118-
if dictionary is None:
119-
return None
120-
121-
# Extract variables from the dictionary
122-
mode = dictionary.get('mode')
123-
detection_timeout = dictionary.get('detectionTimeout')
124-
silence_timeout = dictionary.get('silenceTimeout')
125-
speech_threshold = dictionary.get('speechThreshold')
126-
speech_end_threshold = dictionary.get('speechEndThreshold')
127-
delay_result = dictionary.get('delayResult')
128-
callback_url = dictionary.get('callbackUrl')
129-
callback_method = dictionary.get('callbackMethod')
130-
fallback_url = dictionary.get('fallbackUrl')
131-
fallback_method = dictionary.get('fallbackMethod')
132-
username = dictionary.get('username')
133-
password = dictionary.get('password')
134-
fallback_username = dictionary.get('fallbackUsername')
135-
fallback_password = dictionary.get('fallbackPassword')
136-
137-
# Return an object of this model
138-
return cls(mode,
139-
detection_timeout,
140-
silence_timeout,
141-
speech_threshold,
142-
speech_end_threshold,
143-
delay_result,
144-
callback_url,
145-
callback_method,
146-
fallback_url,
147-
fallback_method,
148-
username,
149-
password,
150-
fallback_username,
151-
fallback_password)
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
bandwidth
5+
6+
This file was automatically generated by APIMATIC v3.0 (
7+
https://www.apimatic.io ).
8+
"""
9+
10+
11+
class MachineDetectionConfiguration(object):
12+
13+
"""Implementation of the 'MachineDetectionRequest' model.
14+
15+
TODO: type model description here.
16+
17+
Attributes:
18+
mode (ModeEnum): The machine detection mode. If set to 'async', the
19+
detection result will be sent in a 'machineDetectionComplete'
20+
callback. If set to 'sync', the 'answer' callback will wait for
21+
the machine detection to complete and will include its result.
22+
Default is 'async'.
23+
detection_timeout (float): Total amount of time (in seconds) before
24+
giving up.
25+
silence_timeout (float): If no speech is detected in this period, a
26+
callback with a 'silence' result is sent. Default is 10 seconds.
27+
speech_threshold (float): When speech has ended and a result couldn't
28+
be determined based on the audio content itself, this value is
29+
used to determine if the speaker is a machine based on the speech
30+
duration. If the length of the speech detected is greater than or
31+
equal to this threshold, the result will be 'answering-machine'.
32+
If the length of speech detected is below this threshold, the
33+
result will be 'human'. Default is 10 seconds.
34+
speech_end_threshold (float): Amount of silence (in seconds) before
35+
assuming the callee has finished speaking.
36+
delay_result (bool): If set to 'true' and if an answering machine is
37+
detected, the 'answering-machine' callback will be delayed until
38+
the machine is done speaking or until the 'detectionTimeout' is
39+
exceeded. If false, the 'answering-machine' result is sent
40+
immediately. Default is 'false'.
41+
callback_url (string): The URL to send the 'machineDetectionComplete'
42+
callback when the detection is completed. Only for 'async' mode.
43+
callback_method (CallbackMethodEnum): TODO: type description here.
44+
fallback_url (string): TODO: type description here.
45+
fallback_method (FallbackMethodEnum): TODO: type description here.
46+
username (string): TODO: type description here.
47+
password (string): TODO: type description here.
48+
fallback_username (string): TODO: type description here.
49+
fallback_password (string): TODO: type description here.
50+
51+
"""
52+
53+
# Create a mapping from Model property names to API property names
54+
_names = {
55+
"mode": 'mode',
56+
"detection_timeout": 'detectionTimeout',
57+
"silence_timeout": 'silenceTimeout',
58+
"speech_threshold": 'speechThreshold',
59+
"speech_end_threshold": 'speechEndThreshold',
60+
"delay_result": 'delayResult',
61+
"callback_url": 'callbackUrl',
62+
"callback_method": 'callbackMethod',
63+
"fallback_url": 'fallbackUrl',
64+
"fallback_method": 'fallbackMethod',
65+
"username": 'username',
66+
"password": 'password',
67+
"fallback_username": 'fallbackUsername',
68+
"fallback_password": 'fallbackPassword'
69+
}
70+
71+
def __init__(self,
72+
mode=None,
73+
detection_timeout=None,
74+
silence_timeout=None,
75+
speech_threshold=None,
76+
speech_end_threshold=None,
77+
delay_result=None,
78+
callback_url=None,
79+
callback_method=None,
80+
fallback_url=None,
81+
fallback_method=None,
82+
username=None,
83+
password=None,
84+
fallback_username=None,
85+
fallback_password=None):
86+
"""Constructor for the MachineDetectionRequest class"""
87+
88+
# Initialize members of the class
89+
self.mode = mode
90+
self.detection_timeout = detection_timeout
91+
self.silence_timeout = silence_timeout
92+
self.speech_threshold = speech_threshold
93+
self.speech_end_threshold = speech_end_threshold
94+
self.delay_result = delay_result
95+
self.callback_url = callback_url
96+
self.callback_method = callback_method
97+
self.fallback_url = fallback_url
98+
self.fallback_method = fallback_method
99+
self.username = username
100+
self.password = password
101+
self.fallback_username = fallback_username
102+
self.fallback_password = fallback_password
103+
104+
@classmethod
105+
def from_dictionary(cls,
106+
dictionary):
107+
"""Creates an instance of this model from a dictionary
108+
109+
Args:
110+
dictionary (dictionary): A dictionary representation of the object
111+
as obtained from the deserialization of the server's response. The
112+
keys MUST match property names in the API description.
113+
114+
Returns:
115+
object: An instance of this structure class.
116+
117+
"""
118+
if dictionary is None:
119+
return None
120+
121+
# Extract variables from the dictionary
122+
mode = dictionary.get('mode')
123+
detection_timeout = dictionary.get('detectionTimeout')
124+
silence_timeout = dictionary.get('silenceTimeout')
125+
speech_threshold = dictionary.get('speechThreshold')
126+
speech_end_threshold = dictionary.get('speechEndThreshold')
127+
delay_result = dictionary.get('delayResult')
128+
callback_url = dictionary.get('callbackUrl')
129+
callback_method = dictionary.get('callbackMethod')
130+
fallback_url = dictionary.get('fallbackUrl')
131+
fallback_method = dictionary.get('fallbackMethod')
132+
username = dictionary.get('username')
133+
password = dictionary.get('password')
134+
fallback_username = dictionary.get('fallbackUsername')
135+
fallback_password = dictionary.get('fallbackPassword')
136+
137+
# Return an object of this model
138+
return cls(mode,
139+
detection_timeout,
140+
silence_timeout,
141+
speech_threshold,
142+
speech_end_threshold,
143+
delay_result,
144+
callback_url,
145+
callback_method,
146+
fallback_url,
147+
fallback_method,
148+
username,
149+
password,
150+
fallback_username,
151+
fallback_password)

0 commit comments

Comments
 (0)