@@ -46,3 +46,69 @@ def voices(self):
4646 Returns the list of available voices to use with synthesize
4747 """
4848 return self .request (method = 'GET' , url = '/v1/voices' , accept_json = True )
49+
50+ def pronunciation (self , text , voice = None , pronunciation_format = 'ipa' ):
51+ params = {
52+ 'text' : text ,
53+ 'voice' : voice ,
54+ 'format' : pronunciation_format
55+ }
56+ return self .request (method = 'GET' , url = '/v1/pronunciation' , params = params , accept_json = True )
57+
58+ def customizations (self , language = None ):
59+ params = {
60+ 'language' : language
61+ }
62+ return self .request (method = 'GET' , url = '/v1/customizations' , params = params , accept_json = True )
63+
64+ def get_customization (self , customization_id ):
65+ customization_id = self .unpack_id (customization_id , 'customization_id' )
66+ return self .request (method = 'GET' , url = '/v1/customizations/{0}' .format (customization_id ), accept_json = True )
67+
68+ def create_customization (self , name , language = None , description = None ):
69+ body = {
70+ 'name' : name ,
71+ 'language' : language ,
72+ 'description' : description
73+ }
74+ return self .request (method = 'POST' , url = '/v1/customizations' , json = body , accept_json = True )
75+
76+ def update_customization (self , customization_id , name = None , description = None , words = None ):
77+ body = {
78+ 'name' : name ,
79+ 'description' : description ,
80+ 'words' : words
81+ }
82+ return self .request (method = 'POST' , url = '/v1/customizations/{0}' .format (customization_id ), json = body )
83+
84+ def delete_customization (self , customization_id ):
85+ customization_id = self .unpack_id (customization_id , 'customization_id' )
86+ return self .request (method = 'DELETE' , url = '/v1/customizations/{0}' .format (customization_id ))
87+
88+ def get_customization_words (self , customization_id ):
89+ customization_id = self .unpack_id (customization_id , 'customization_id' )
90+ return self .request (method = 'GET' , url = '/v1/customizations/{0}/words' .format (customization_id ), accept_json = True )
91+
92+ def add_customization_words (self , customization_id , words ):
93+ customization_id = self .unpack_id (customization_id , 'customization_id' )
94+ body = {
95+ 'words' : words
96+ }
97+ return self .request (method = 'POST' , url = '/v1/customizations/{0}/words' .format (customization_id ), json = body )
98+
99+ def get_customization_word (self , customization_id , word ):
100+ customization_id = self .unpack_id (customization_id , 'customization_id' )
101+ return self .request (method = 'GET' , url = '/v1/customizations/{0}/words/{1}' .format (customization_id , word ),
102+ accept_json = True )
103+
104+ def set_customization_word (self , customization_id , word , translation ):
105+ customization_id = self .unpack_id (customization_id , 'customization_id' )
106+ body = {
107+ 'translation' : translation
108+ }
109+ return self .request (method = 'PUT' , url = '/v1/customizations/{0}/words/{1}' .format (customization_id , word ),
110+ json = body )
111+
112+ def delete_customization_word (self , customization_id , word ):
113+ customization_id = self .unpack_id (customization_id , 'customization_id' )
114+ return self .request (method = 'DELETE' , url = '/v1/customizations/{0}/words/{1}' .format (customization_id , word ))
0 commit comments