Skip to content

Commit

Permalink
refactor: [breaking] remove sync methods from VoiceClient
Browse files Browse the repository at this point in the history
  • Loading branch information
Tr00d committed Mar 14, 2024
1 parent 36fb4f0 commit 70428e7
Show file tree
Hide file tree
Showing 24 changed files with 83 additions and 789 deletions.

This file was deleted.

This file was deleted.

482 changes: 65 additions & 417 deletions Vonage.Test/VoiceTests.cs

Large diffs are not rendered by default.

42 changes: 18 additions & 24 deletions Vonage.Test/Vonage.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
<None Update="Data\NumberInsightsTests\AdvancedNIRequestSyncWithNotRoamingStatus-response.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\CreateCall-request.json">
<None Update="Data\VoiceTests\CreateCallAsync-request.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\RedactTests\RedactReturns429-response.json">
Expand Down Expand Up @@ -687,13 +687,7 @@
<None Update="Data\NccoTests\TestConnectWithAdvancedMachineDetection-request.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\CreateCall-response.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\CreateCallWithEndpointAndNcco-response.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\CreateCallWithEndpointAndNcco-request.json">
<None Update="Data\VoiceTests\CreateCallAsync-response.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\CreateCallWithUnicodeCharacters-request.json">
Expand All @@ -702,28 +696,28 @@
<None Update="Data\VoiceTests\CreateCallWithUnicodeCharacters-response.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\CreateCallWithStringParameters-response.json">
<None Update="Data\VoiceTests\CreateCallWithStringParametersAsync-response.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\CreateCallWithStringParameters-request.json">
<None Update="Data\VoiceTests\CreateCallWithStringParametersAsync-request.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\StopStream-response.json">
<None Update="Data\VoiceTests\StopStreamAsync-response.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\StopTalk-response.json">
<None Update="Data\VoiceTests\StopTalkAsync-response.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\CreateCallWithRandomFromNumber-request.json">
<None Update="Data\VoiceTests\CreateCallAsyncWithRandomFromNumber-request.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\CreateCallWithRandomFromNumber-response.json">
<None Update="Data\VoiceTests\CreateCallAsyncWithRandomFromNumber-response.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\GetSpecificCall-response.json">
<None Update="Data\VoiceTests\GetSpecificCallAsync-response.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\ListCalls-response.json">
<None Update="Data\VoiceTests\ListCallsAsync-response.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\UpdateCallWithActionsType-request.json">
Expand All @@ -732,19 +726,19 @@
<None Update="Data\VoiceTests\UpdateCallWithInlineNcco-request.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\StartDtmf-response.json">
<None Update="Data\VoiceTests\StartDtmfAsync-response.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\StartDtmf-request.json">
<None Update="Data\VoiceTests\StartDtmfAsync-request.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\StartStream-response.json">
<None Update="Data\VoiceTests\StartStreamAsync-response.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\StartStream-request.json">
<None Update="Data\VoiceTests\StartStreamAsync-request.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\StartStreamWithCredentials-request.json">
<None Update="Data\VoiceTests\StartStreamAsyncWithCredentials-request.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\UpdateCallWithCredentials-request.json">
Expand All @@ -753,13 +747,13 @@
<None Update="Data\VoiceTests\UpdateCallAsync-request.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\StartTalk-response.json">
<None Update="Data\VoiceTests\StartTalkAsync-response.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\StartTalk-request.json">
<None Update="Data\VoiceTests\StartTalkAsync-request.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Data\VoiceTests\StartTalkWithCredentials-request.json">
<None Update="Data\VoiceTests\StartTalkAsyncWithCredentials-request.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="SubAccounts\GetSubAccounts\Data\ShouldDeserialize200-response.json">
Expand Down
128 changes: 0 additions & 128 deletions Vonage/Voice/IVoiceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
using Vonage.Common;
using Vonage.Common.Exceptions;
using Vonage.Request;
using Vonage.Voice.Nccos;
using Vonage.Voice.Nccos.Endpoints;

namespace Vonage.Voice;

Expand All @@ -12,35 +10,6 @@ namespace Vonage.Voice;
/// </summary>
public interface IVoiceClient
{
/// <summary>
/// POST /v1/calls - create an outbound SIP or PSTN Call
/// </summary>
/// <param name="command"></param>
/// <param name="creds">(Optional) Overridden credentials for only this request</param>
/// <returns></returns>
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
CallResponse CreateCall(CallCommand command, Credentials creds = null);

/// <summary>
/// POST /v1/calls - create an outbound PSTN Call
/// </summary>
/// <param name="toNumber"></param>
/// <param name="fromNumber"></param>
/// <param name="ncco"></param>
/// <returns></returns>
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
CallResponse CreateCall(string toNumber, string fromNumber, Ncco ncco);

/// <summary>
/// POST /v1/calls - create an outbound without PSTN Call
/// </summary>
/// <param name="toEndPoint"></param>
/// <param name="fromNumber"></param>
/// <param name="ncco"></param>
/// <returns></returns>
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
CallResponse CreateCall(Endpoint toEndPoint, string fromNumber, Ncco ncco);

/// <summary>
/// POST /v1/calls - create an outbound SIP or PSTN Call
/// </summary>
Expand All @@ -50,34 +19,6 @@ public interface IVoiceClient
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
Task<CallResponse> CreateCallAsync(CallCommand command, Credentials creds = null);

/// <summary>
/// POST /v1/calls - create an outbound PSTN Call
/// </summary>
/// <param name="toNumber"></param>
/// <param name="fromNumber"></param>
/// <param name="ncco"></param>
/// <returns></returns>
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
Task<CallResponse> CreateCallAsync(string toNumber, string fromNumber, Ncco ncco);

/// <summary>
/// POST /v1/calls - create an outbound without PSTN Call
/// </summary>
/// <param name="toEndPoint"></param>
/// <param name="fromNumber"></param>
/// <param name="ncco"></param>
/// <returns></returns>
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
Task<CallResponse> CreateCallAsync(Endpoint toEndPoint, string fromNumber, Ncco ncco);

/// <summary>
/// GET /v1/calls/{uuid} - retrieve information about a single Call
/// </summary>
/// <param name="id">id of call</param>
/// <param name="creds">(Optional) Overridden credentials for only this request</param>
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
CallRecord GetCall(string id, Credentials creds = null);

/// <summary>
/// GET /v1/calls/{uuid} - retrieve information about a single Call
/// </summary>
Expand All @@ -86,14 +27,6 @@ public interface IVoiceClient
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
Task<CallRecord> GetCallAsync(string id, Credentials creds = null);

/// <summary>
/// GET /v1/calls - retrieve information about all your Calls
/// <param name="filter">Filter to search calls on</param>
/// <param name="creds">(Optional) Overridden credentials for only this request</param>
/// </summary>
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
PageResponse<CallList> GetCalls(CallSearchFilter filter, Credentials creds = null);

/// <summary>
/// GET /v1/calls - retrieve information about all your Calls
/// <param name="filter">Filter to search calls on</param>
Expand All @@ -102,15 +35,6 @@ public interface IVoiceClient
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
Task<PageResponse<CallList>> GetCallsAsync(CallSearchFilter filter, Credentials creds = null);

/// <summary>
/// GET - retrieves the recording from a call based off of the input url
/// </summary>
/// <param name="recordingUrl">Url where the recorded call lives</param>
/// <param name="creds">Overridden credentials</param>
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
/// <returns>A response containing a byte array representing the file stream</returns>
GetRecordingResponse GetRecording(string recordingUrl, Credentials creds = null);

/// <summary>
/// GET - retrieves the recording from a call based off of the input url
/// </summary>
Expand All @@ -120,15 +44,6 @@ public interface IVoiceClient
/// <returns>A response containing a byte array representing the file stream</returns>
Task<GetRecordingResponse> GetRecordingAsync(string recordingUrl, Credentials creds = null);

/// <summary>
/// PUT /v1/calls/{uuid}/dtmf - send Dual-tone multi-frequency(DTMF) tones to an active Call
/// </summary>
/// <param name="id">id of call</param>
/// <param name="cmd">Command to execute against call</param>
/// <param name="creds">(Optional) Overridden credentials for only this request</param>
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
CallCommandResponse StartDtmf(string id, DtmfCommand cmd, Credentials creds = null);

/// <summary>
/// PUT /v1/calls/{uuid}/dtmf - send Dual-tone multi-frequency(DTMF) tones to an active Call
/// </summary>
Expand All @@ -138,15 +53,6 @@ public interface IVoiceClient
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
Task<CallCommandResponse> StartDtmfAsync(string id, DtmfCommand cmd, Credentials creds = null);

/// <summary>
/// PUT /v1/calls/{uuid}/stream - stream an audio file to an active Call
/// </summary>
/// <param name="id">id of call</param>
/// <param name="cmd">Command to execute against call</param>
/// <param name="creds">(Optional) Overridden credentials for only this request</param>
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
CallCommandResponse StartStream(string id, StreamCommand command, Credentials creds = null);

/// <summary>
/// PUT /v1/calls/{uuid}/stream - stream an audio file to an active Call
/// </summary>
Expand All @@ -156,15 +62,6 @@ public interface IVoiceClient
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
Task<CallCommandResponse> StartStreamAsync(string id, StreamCommand command, Credentials creds = null);

/// <summary>
/// PUT /v1/calls/{uuid}/talk - send a synthesized speech message to an active Call
/// </summary>
/// <param name="id">id of call</param>
/// <param name="cmd">Command to execute against call</param>
/// <param name="creds">(Optional) Overridden credentials for only this request</param>
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
CallCommandResponse StartTalk(string id, TalkCommand cmd, Credentials creds = null);

/// <summary>
/// PUT /v1/calls/{uuid}/talk - send a synthesized speech message to an active Call
/// </summary>
Expand All @@ -174,14 +71,6 @@ public interface IVoiceClient
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
Task<CallCommandResponse> StartTalkAsync(string id, TalkCommand cmd, Credentials creds = null);

/// <summary>
/// DELETE /v1/calls/{uuid}/stream - stop streaming an audio file to an active Call
/// </summary>
/// <param name="id">id of call</param>
/// <param name="creds">(Optional) Overridden credentials for only this request</param>
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
CallCommandResponse StopStream(string id, Credentials creds = null);

/// <summary>
/// DELETE /v1/calls/{uuid}/stream - stop streaming an audio file to an active Call
/// </summary>
Expand All @@ -190,14 +79,6 @@ public interface IVoiceClient
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
Task<CallCommandResponse> StopStreamAsync(string id, Credentials creds = null);

/// <summary>
/// DELETE /v1/calls/{uuid}/talk - stop sending a synthesized speech message to an active Call
/// </summary>
/// <param name="id">id of call</param>
/// <param name="creds">(Optional) Overridden credentials for only this request</param>
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
CallCommandResponse StopTalk(string id, Credentials creds = null);

/// <summary>
/// DELETE /v1/calls/{uuid}/talk - stop sending a synthesized speech message to an active Call
/// </summary>
Expand All @@ -206,15 +87,6 @@ public interface IVoiceClient
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
Task<CallCommandResponse> StopTalkAsync(string id, Credentials creds = null);

/// <summary>
/// PUT /v1/calls/{uuid} - modify an existing Call
/// </summary>
/// <param name="id">id of call</param>
/// <param name="cmd">Command to execute against call</param>
/// <param name="creds">(Optional) Overridden credentials for only this request</param>
/// <exception cref="VonageHttpRequestException">thrown if an error is encountered when talking to the API</exception>
bool UpdateCall(string id, CallEditCommand command, Credentials creds = null);

/// <summary>
/// PUT /v1/calls/{uuid} - modify an existing Call
/// </summary>
Expand Down
Loading

0 comments on commit 70428e7

Please sign in to comment.