@@ -405,13 +405,12 @@ verify_signature(TOKEN, SIGNATURE_SECRET) # Returns a boolean
405
405
406
406
## Messages API
407
407
408
-
409
408
### How to Construct a Message
410
409
411
- In order to send a message, you must construct a message object of the correct type. These are all found under ` vonage_messages.models ` .
410
+ In order to send a message, you must construct a message object of the correct type.
412
411
413
412
``` python
414
- from vonage_messages.models import Sms
413
+ from vonage_messages import Sms
415
414
416
415
message = Sms(
417
416
from_ = ' Vonage APIs' ,
@@ -435,7 +434,7 @@ Some message types have submodels with additional fields. In this case, import t
435
434
e.g.
436
435
437
436
``` python
438
- from vonage_messages.models import MessengerImage, MessengerOptions, MessengerResource
437
+ from vonage_messages import MessengerImage, MessengerOptions, MessengerResource
439
438
440
439
messenger = MessengerImage(
441
440
to = ' 1234567890' ,
@@ -451,7 +450,7 @@ To send a message, access the `Messages.send` method via the main Vonage object,
451
450
452
451
``` python
453
452
from vonage import Auth, Vonage
454
- from vonage_messages.models import Sms
453
+ from vonage_messages import Sms
455
454
456
455
vonage_client = Vonage(Auth(application_id = ' my-application-id' , private_key = ' my-private-key' ))
457
456
@@ -970,12 +969,10 @@ response = vonage_client.verify_legacy.request_network_unblock('23410')
970
969
971
970
## Video API
972
971
973
- You will use the custom Pydantic data models to make most of the API calls in this package. They are accessed from the ` vonage_video.models ` package.
974
-
975
972
### Generate a Client Token
976
973
977
974
``` python
978
- from vonage_video.models import TokenOptions
975
+ from vonage_video import TokenOptions
979
976
980
977
token_options = TokenOptions(session_id = ' your_session_id' , role = ' publisher' )
981
978
client_token = vonage_client.video.generate_client_token(token_options)
@@ -984,7 +981,7 @@ client_token = vonage_client.video.generate_client_token(token_options)
984
981
### Create a Session
985
982
986
983
``` python
987
- from vonage_video.models import SessionOptions
984
+ from vonage_video import SessionOptions
988
985
989
986
session_options = SessionOptions(media_mode = ' routed' )
990
987
video_session = vonage_client.video.create_session(session_options)
@@ -1005,7 +1002,7 @@ stream_info = vonage_client.video.get_stream(session_id='your_session_id', strea
1005
1002
### Change Stream Layout
1006
1003
1007
1004
``` python
1008
- from vonage_video.models import StreamLayoutOptions
1005
+ from vonage_video import StreamLayoutOptions
1009
1006
1010
1007
layout_options = StreamLayoutOptions(type = ' bestFit' )
1011
1008
updated_streams = vonage_client.video.change_stream_layout(session_id = ' your_session_id' , stream_layout_options = layout_options)
@@ -1014,7 +1011,7 @@ updated_streams = vonage_client.video.change_stream_layout(session_id='your_sess
1014
1011
### Send a Signal
1015
1012
1016
1013
``` python
1017
- from vonage_video.models import SignalData
1014
+ from vonage_video import SignalData
1018
1015
1019
1016
signal_data = SignalData(type = ' chat' , data = ' Hello, World!' )
1020
1017
vonage_client.video.send_signal(session_id = ' your_session_id' , data = signal_data)
@@ -1047,7 +1044,7 @@ vonage_client.video.disable_mute_all_streams(session_id='your_session_id')
1047
1044
### Start Captions
1048
1045
1049
1046
``` python
1050
- from vonage_video.models import CaptionsOptions
1047
+ from vonage_video import CaptionsOptions
1051
1048
1052
1049
captions_options = CaptionsOptions(language = ' en-US' )
1053
1050
captions_data = vonage_client.video.start_captions(captions_options)
@@ -1056,7 +1053,7 @@ captions_data = vonage_client.video.start_captions(captions_options)
1056
1053
### Stop Captions
1057
1054
1058
1055
``` python
1059
- from vonage_video.models import CaptionsData
1056
+ from vonage_video import CaptionsData
1060
1057
1061
1058
captions_data = CaptionsData(captions_id = ' your_captions_id' )
1062
1059
vonage_client.video.stop_captions(captions_data)
@@ -1065,7 +1062,7 @@ vonage_client.video.stop_captions(captions_data)
1065
1062
### Start Audio Connector
1066
1063
1067
1064
``` python
1068
- from vonage_video.models import AudioConnectorOptions
1065
+ from vonage_video import AudioConnectorOptions
1069
1066
1070
1067
audio_connector_options = AudioConnectorOptions(session_id = ' your_session_id' , token = ' your_token' , url = ' https://example.com' )
1071
1068
audio_connector_data = vonage_client.video.start_audio_connector(audio_connector_options)
@@ -1074,7 +1071,7 @@ audio_connector_data = vonage_client.video.start_audio_connector(audio_connector
1074
1071
### Start Experience Composer
1075
1072
1076
1073
``` python
1077
- from vonage_video.models import ExperienceComposerOptions
1074
+ from vonage_video import ExperienceComposerOptions
1078
1075
1079
1076
experience_composer_options = ExperienceComposerOptions(session_id = ' your_session_id' , token = ' your_token' , url = ' https://example.com' )
1080
1077
experience_composer = vonage_client.video.start_experience_composer(experience_composer_options)
@@ -1083,7 +1080,7 @@ experience_composer = vonage_client.video.start_experience_composer(experience_c
1083
1080
### List Experience Composers
1084
1081
1085
1082
``` python
1086
- from vonage_video.models import ListExperienceComposersFilter
1083
+ from vonage_video import ListExperienceComposersFilter
1087
1084
1088
1085
filter = ListExperienceComposersFilter(page_size = 10 )
1089
1086
experience_composers, count, next_page_offset = vonage_client.video.list_experience_composers(filter )
@@ -1105,7 +1102,7 @@ vonage_client.video.stop_experience_composer(experience_composer_id='experience_
1105
1102
### List Archives
1106
1103
1107
1104
``` python
1108
- from vonage_video.models import ListArchivesFilter
1105
+ from vonage_video import ListArchivesFilter
1109
1106
1110
1107
filter = ListArchivesFilter(offset = 2 )
1111
1108
archives, count, next_page_offset = vonage_client.video.list_archives(filter )
@@ -1115,7 +1112,7 @@ print(archives)
1115
1112
### Start Archive
1116
1113
1117
1114
``` python
1118
- from vonage_video.models import CreateArchiveRequest
1115
+ from vonage_video import CreateArchiveRequest
1119
1116
1120
1117
archive_options = CreateArchiveRequest(session_id = ' your_session_id' , name = ' My Archive' )
1121
1118
archive = vonage_client.video.start_archive(archive_options)
@@ -1137,7 +1134,7 @@ vonage_client.video.delete_archive(archive_id='your_archive_id')
1137
1134
### Add Stream to Archive
1138
1135
1139
1136
``` python
1140
- from vonage_video.models import AddStreamRequest
1137
+ from vonage_video import AddStreamRequest
1141
1138
1142
1139
add_stream_request = AddStreamRequest(stream_id = ' your_stream_id' )
1143
1140
vonage_client.video.add_stream_to_archive(archive_id = ' your_archive_id' , params = add_stream_request)
@@ -1159,7 +1156,7 @@ print(archive)
1159
1156
### Change Archive Layout
1160
1157
1161
1158
``` python
1162
- from vonage_video.models import ComposedLayout
1159
+ from vonage_video import ComposedLayout
1163
1160
1164
1161
layout = ComposedLayout(type = ' bestFit' )
1165
1162
archive = vonage_client.video.change_archive_layout(archive_id = ' your_archive_id' , layout = layout)
@@ -1169,7 +1166,7 @@ print(archive)
1169
1166
### List Broadcasts
1170
1167
1171
1168
``` python
1172
- from vonage_video.models import ListBroadcastsFilter
1169
+ from vonage_video import ListBroadcastsFilter
1173
1170
1174
1171
filter = ListBroadcastsFilter(page_size = 10 )
1175
1172
broadcasts, count, next_page_offset = vonage_client.video.list_broadcasts(filter )
@@ -1179,7 +1176,7 @@ print(broadcasts)
1179
1176
### Start Broadcast
1180
1177
1181
1178
``` python
1182
- from vonage_video.models import CreateBroadcastRequest, BroadcastOutputSettings, BroadcastHls, BroadcastRtmp
1179
+ from vonage_video import CreateBroadcastRequest, BroadcastOutputSettings, BroadcastHls, BroadcastRtmp
1183
1180
1184
1181
broadcast_options = CreateBroadcastRequest(session_id = ' your_session_id' , outputs = BroadcastOutputSettings(
1185
1182
hls = BroadcastHls(dvr = True , low_latency = False ),
@@ -1213,7 +1210,7 @@ print(broadcast)
1213
1210
### Change Broadcast Layout
1214
1211
1215
1212
``` python
1216
- from vonage_video.models import ComposedLayout
1213
+ from vonage_video import ComposedLayout
1217
1214
1218
1215
layout = ComposedLayout(type = ' bestFit' )
1219
1216
broadcast = vonage_client.video.change_broadcast_layout(broadcast_id = ' your_broadcast_id' , layout = layout)
@@ -1223,7 +1220,7 @@ print(broadcast)
1223
1220
### Add Stream to Broadcast
1224
1221
1225
1222
``` python
1226
- from vonage_video.models import AddStreamRequest
1223
+ from vonage_video import AddStreamRequest
1227
1224
1228
1225
add_stream_request = AddStreamRequest(stream_id = ' your_stream_id' )
1229
1226
vonage_client.video.add_stream_to_broadcast(broadcast_id = ' your_broadcast_id' , params = add_stream_request)
@@ -1238,7 +1235,7 @@ vonage_client.video.remove_stream_from_broadcast(broadcast_id='your_broadcast_id
1238
1235
### Initiate SIP Call
1239
1236
1240
1237
``` python
1241
- from vonage_video.models import InitiateSipRequest, SipOptions, SipAuth
1238
+ from vonage_video import InitiateSipRequest, SipOptions, SipAuth
1242
1239
1243
1240
sip_request_params = InitiateSipRequest(
1244
1241
session_id = ' your_session_id' ,
@@ -1281,7 +1278,7 @@ vonage_client.video.play_dtmf(session_id=session_id, digits=digits, connection_i
1281
1278
To create a call, you must pass an instance of the ` CreateCallRequest ` model to the ` create_call ` method. If supplying an NCCO, import the NCCO actions you want to use and pass them in as a list to the ` ncco ` model field.
1282
1279
1283
1280
``` python
1284
- from vonage_voice.models import CreateCallRequest, Talk
1281
+ from vonage_voice import CreateCallRequest, Talk
1285
1282
1286
1283
ncco = [Talk(text = ' Hello world' , loop = 3 , language = ' en-GB' )]
1287
1284
@@ -1303,7 +1300,7 @@ print(response.model_dump())
1303
1300
calls, next_record_index = vonage_client.voice.list_calls()
1304
1301
1305
1302
# Specify filtering options
1306
- from vonage_voice.models import ListCallsFilter
1303
+ from vonage_voice import ListCallsFilter
1307
1304
1308
1305
call_filter = ListCallsFilter(
1309
1306
status = ' completed' ,
@@ -1364,7 +1361,7 @@ vonage_client.voice.unearmuff('UUID')
1364
1361
### Play Audio Into a Call
1365
1362
1366
1363
``` python
1367
- from vonage_voice.models import AudioStreamOptions
1364
+ from vonage_voice import AudioStreamOptions
1368
1365
1369
1366
# Only the `stream_url` option is required
1370
1367
options = AudioStreamOptions(
@@ -1382,7 +1379,7 @@ vonage_client.voice.stop_audio_stream('UUID')
1382
1379
### Play TTS Into a Call
1383
1380
1384
1381
``` python
1385
- from vonage_voice.models import TtsStreamOptions
1382
+ from vonage_voice import TtsStreamOptions
1386
1383
1387
1384
# Only the `text` field is required
1388
1385
options = TtsStreamOptions(
0 commit comments