totalvoice csharp
Versão 1.2.1
Client C # pour l'API de TotalVoice
Fonctionnalité
Pré-exception
Utiliser
Pour utiliser cette bibliothèque, vous devez d'abord vous inscrire sur le site Web de la voix totale. Une fois la création de l'enregistrement sera disponible un Accessostoken pour accéder à l'API.
Avec un accès à la main, il sera possible de faire les consultations / inscriptions en fonction de la documentation de l'API
Installation avec Nuget Package Manager
PM> Install-Package TotalVoice -Version 1.0.1
ou .net CLI
dotnet add package TotalVoice --version 1.0.1
Voici quelques exemples de la façon dont cette bibliothèque peut être utilisée.
Passez un appel téléphonique entre deux numéros: A et B
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Chamada chamada = new Chamada ( client ) ;
var json = new {
numero_origem = "48988888888" ,
numero_destino = "48999999999"
} ;
string response = chamada . Ligar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Consultation d'appel par ID
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Chamada chamada = new Chamada ( client ) ;
string response = chamada . Buscar ( 123 ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Envoyer un SMS
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Sms sms = new Sms ( client ) ;
var json = new {
numero_destino = "48999999999" ,
mensagem = "Mensagem de teste"
} ;
string response = sms . Enviar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Recherchez les données d'un SMS par l'ID
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Sms sms = new Sms ( client ) ;
string response = sms . Buscar ( 123 ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Envoyer un TTS
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Tts tts = new Tts ( client ) ;
var json = new {
numero_destino = "48999999999" ,
mensagem = "Mensagem de TTS"
} ;
string response = tts . Enviar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Validation du nombre
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
ValidaNumero validacao = new ValidaNumero ( client ) ;
var json = new {
numero_destino = "48999999999" ,
gravar_audio = true ,
bina = "48808880804" ,
max_tentativas = 1
} ;
string response = validacao . Enviar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Envoyer un composé
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Composto composto = new Composto ( client ) ;
var json = new {
numero_destino = "48988888888" ,
dados = new [ ] {
new {
acao = "tts" ,
acao_dados = new {
mensagem = "O número digitado não consta em nosso cadastro. Por gentileza, tente novamente" ,
tipo_voz = "br-Ricardo"
}
} ,
new {
acao = "audio" ,
acao_dados = new {
url_audio = "https://minhaurl.com.br/audio.mp3"
}
}
} ,
gravar_audio = false ,
bina = "48988888888" ,
tags = "clienteX" ,
detecta_caixa = false
} ;
string response = composto . Enviar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
}Licence
Cette bibliothèque suit les conditions d'utilisation du MIT