@@ -19,47 +19,59 @@ applications, next_page = vonage_client.application.list_applications()
1919
2020# With options
2121options = ListApplicationsFilter(page_size = 3 , page = 2 )
22- applications, next_page = vonage_client.applications .list_applications(options)
22+ applications, next_page = vonage_client.application .list_applications(options)
2323```
2424
25-
26- --------
27-
28-
29- ### Create a New User
25+ ### Create a New Application
3026
3127``` python
32- from vonage_users import User, Channels, SmsChannel
33- user_options = User(
34- name = ' my_user_name' ,
35- display_name = ' My User Name' ,
36- properties = {' custom_key' : ' custom_value' },
37- channels = Channels(sms = [SmsChannel(number = ' 1234567890' )]),
28+ from vonage_application import ApplicationConfig
29+
30+ app_data = vonage_client.application.create_application()
31+
32+ # Create with custom options (can also be done with a dict)
33+ from vonage_application import ApplicationConfig, Keys, Voice, VoiceWebhooks
34+ voice = Voice(
35+ webhooks = VoiceWebhooks(
36+ event_url = VoiceUrl(
37+ address = ' https://example.com/event' ,
38+ http_method = ' POST' ,
39+ connect_timeout = 500 ,
40+ socket_timeout = 3000 ,
41+ ),
42+ ),
43+ signed_callbacks = True ,
44+ )
45+ capabilities = Capabilities(voice = voice)
46+ keys = Keys(public_key = ' MY_PUBLIC_KEY' )
47+ config = ApplicationConfig(
48+ name = ' My Customised Application' ,
49+ capabilities = capabilities,
50+ keys = keys,
3851)
39- user = vonage_client.users.create_user(user_options )
52+ app_data = vonage_client.application.create_application(config )
4053```
4154
42- ### Get a User
55+ ### Get an Application
4356
4457``` python
45- user = client.users.get_user( ' USR-87e3e6b0-cd7b-45ef-a0a7-bcd5566a672b ' )
46- user_as_dict = user .model_dump(exclude_none = True )
58+ app_data = client.application.get_application( ' MY_APP_ID ' )
59+ app_data_as_dict = app .model_dump(exclude_none = True )
4760```
4861
49- ### Update a User
62+ ### Update an Application
63+
64+ To update an application, pass config for the updated field(s) in an ApplicationConfig object
65+
5066``` python
51- from vonage_users import User, Channels, SmsChannel, WhatsappChannel
52- user_options = User(
53- name = ' my_user_name' ,
54- display_name = ' My User Name' ,
55- properties = {' custom_key' : ' custom_value' },
56- channels = Channels(sms = [SmsChannel(number = ' 1234567890' )], whatsapp = [WhatsappChannel(number = ' 9876543210' )]),
57- )
58- user = vonage_client.users.update_user(id , user_options)
67+ from vonage_application import ApplicationConfig, Keys, Voice, VoiceWebhooks
68+
69+ config = ApplicationConfig(name = ' My Updated Application' )
70+ app_data = vonage_client.application.update_application(' MY_APP_ID' , config)
5971```
6072
61- ### Delete a User
73+ ### Delete an Application
6274
6375``` python
64- vonage_client.users.delete_user( id )
76+ vonage_client.applications.delete_application( ' MY_APP_ID ' )
6577```
0 commit comments