google custom voice (#245)

* google custom voice

* wip

* wip

* fix failing testcase
This commit is contained in:
Hoan Luu Huu
2023-10-31 07:29:12 +07:00
committed by GitHub
parent a4e767e1e4
commit 30ba84d57b
9 changed files with 509 additions and 43 deletions

View File

@@ -492,6 +492,51 @@ test('speech credentials tests', async(t) => {
});
t.ok(result.statusCode === 204, 'successfully deleted speech credential for Cobalt');
/* add a credential for custom voices google */
result = await request.post(`/Accounts/${account_sid}/SpeechCredentials`, {
resolveWithFullResponse: true,
auth: authUser,
json: true,
body: {
vendor: 'google',
use_for_stt: true,
use_for_tts: false,
service_key: jsonKey
}
});
t.ok(result.statusCode === 201, 'successfully added speech credential for custom voice google');
const customvoice_google_speech_credential_sid = result.body.sid;
result = await request.post(`/GoogleCustomVoices`, {
resolveWithFullResponse: true,
auth: authUser,
json: true,
body: {
speech_credential_sid: customvoice_google_speech_credential_sid,
name: "Sally",
reported_usage: 'REALTIME',
model: "path/to/modelId"
}
});
t.ok(result.statusCode === 201, 'successfully added custom voice google');
const customvoice_google_sid = result.body.sid;
/* delete the credential */
result = await request.delete(`/GoogleCustomVoices/${customvoice_google_sid}`, {
auth: authUser,
resolveWithFullResponse: true,
});
t.ok(result.statusCode === 204, 'successfully deleted custom voice google');
/* delete the credential */
result = await request.delete(`/Accounts/${account_sid}/SpeechCredentials/${customvoice_google_speech_credential_sid}`, {
auth: authUser,
resolveWithFullResponse: true,
});
t.ok(result.statusCode === 204, 'successfully deleted speech credential for custom voice google');
await deleteObjectBySid(request, '/Accounts', account_sid);
await deleteObjectBySid(request, '/ServiceProviders', service_provider_sid);
t.end();