Skip to content

Commit

Permalink
Add new APIs, fix test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
KhalilMohammad committed Aug 3, 2023
1 parent 3883be5 commit 60e29d4
Show file tree
Hide file tree
Showing 544 changed files with 4,836 additions and 5,355 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/before_install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
npm install -g @stoplight/prism-cli
npm i -g @stoplight/prism-cli@4.10.5

echo "Starting up Prism Mock Server with spec file at ${TELNYX_MOCK_OPEN_API_URI}"
prism mock ${TELNYX_MOCK_OPEN_API_URI} > /dev/null &
Expand Down
115 changes: 115 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Rules in this file were initially inferred by Visual Studio IntelliCode from the G:\Programming\DotNetCore\telnyx-dotnet\src codebase based on best match to current usage at 8/2/2023
# You can modify the rules from these initially generated values to suit your own policies
# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
[*.cs]


#Core editorconfig formatting - indentation

#use soft tabs (spaces) for indentation
indent_style = space

#Formatting - new line options

#place catch statements on a new line
csharp_new_line_before_catch = true
#place else statements on a new line
csharp_new_line_before_else = true
#require members of object intializers to be on separate lines
csharp_new_line_before_members_in_object_initializers = true
#require braces to be on a new line for methods, control_blocks, object_collection_array_initializers, types, and properties (also known as "Allman" style)
csharp_new_line_before_open_brace = methods, control_blocks, object_collection_array_initializers, types, properties

#Formatting - organize using options

#sort System.* using directives alphabetically, and place them before other usings
dotnet_sort_system_directives_first = true

#Formatting - spacing options

#require NO space between a cast and the value
csharp_space_after_cast = false
#require a space before the colon for bases or interfaces in a type declaration
csharp_space_after_colon_in_inheritance_clause = true
#require a space after a keyword in a control flow statement such as a for loop
csharp_space_after_keywords_in_control_flow_statements = true
#require a space before the colon for bases or interfaces in a type declaration
csharp_space_before_colon_in_inheritance_clause = true
#remove space within empty argument list parentheses
csharp_space_between_method_call_empty_parameter_list_parentheses = false
#remove space between method call name and opening parenthesis
csharp_space_between_method_call_name_and_opening_parenthesis = false
#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call
csharp_space_between_method_call_parameter_list_parentheses = false
#remove space within empty parameter list parentheses for a method declaration
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list.
csharp_space_between_method_declaration_parameter_list_parentheses = false

#Formatting - wrapping options

#leave code block on single line
csharp_preserve_single_line_blocks = true
#leave statements and member declarations on the same line
csharp_preserve_single_line_statements = true

#Style - Code block preferences

#prefer curly braces even for one line of code
csharp_prefer_braces = true:suggestion

#Style - expression bodied member options

#prefer expression-bodied members for accessors
csharp_style_expression_bodied_accessors = true:suggestion
#prefer block bodies for constructors
csharp_style_expression_bodied_constructors = false:suggestion
#prefer block bodies for methods
csharp_style_expression_bodied_methods = false:suggestion
#prefer expression-bodied members for properties
csharp_style_expression_bodied_properties = true:suggestion

#Style - expression level options

#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them
dotnet_style_predefined_type_for_member_access = true:suggestion

#Style - Expression-level preferences

#prefer default over default(T)
csharp_prefer_simple_default_expression = true:suggestion
#prefer objects to be initialized using object initializers when possible
dotnet_style_object_initializer = true:suggestion

#Style - implicit and explicit types

#prefer var over explicit type in all cases, unless overridden by another code style rule
csharp_style_var_elsewhere = true:suggestion
#prefer var is used to declare variables with built-in system types such as int
csharp_style_var_for_built_in_types = true:suggestion
#prefer explicit type over var when the type is already mentioned on the right-hand side of a declaration
csharp_style_var_when_type_is_apparent = true:suggestion

#Style - language keyword and framework type options

#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion

#Style - modifier options

#prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods.
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion

#Style - Modifier preferences

#when this rule is set to a list of modifiers, prefer the specified ordering.
csharp_preferred_modifier_order = public,private,protected,internal,async,readonly,virtual,static,override,abstract,new:suggestion

#Style - qualification options

#prefer fields not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_field = false:suggestion
#prefer methods to be prefaced with this. in C# or Me. in Visual Basic
dotnet_style_qualification_for_method = true:suggestion
#prefer properties not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_property = false:suggestion
7 changes: 2 additions & 5 deletions src/Telnyx.Example/CallControlApplicationsExample.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
using Telnyx.net.Entities;
using Telnyx.net.Entities.Calls.CallControlApplications;
using Telnyx.net.Entities.Enum;
using Telnyx.net.Services.Calls.CallCommands;
using Telnyx.net.Services.Calls.CallControlApplications;

namespace Telnyx.Example
Expand All @@ -17,8 +14,8 @@ public class CallControlApplicationsExample
public TelnyxList<CallControlApplication> List()
{
TelnyxList<CallControlApplication> callControlApplications = new TelnyxList<CallControlApplication>();
ListCallControlApplicationOptions listCallControlApplicationOptions = new ListCallControlApplicationOptions
{
ListCallControlApplicationOptions listCallControlApplicationOptions = new ListCallControlApplicationOptions
{
PageNumber = 1,
PageSize = 20
};
Expand Down
23 changes: 11 additions & 12 deletions src/Telnyx.Example/CallControlExample.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
using Telnyx.net.Entities;
using Telnyx.net.Services.Calls.CallCommands;
using Telnyx.net.Services.Calls.CallControl.RecordActions;
Expand All @@ -20,16 +18,17 @@ public void SetCallControlId(string callControlId)
public CallDialResponse Dial()
{
CallDialResponse callDialResponse = new CallDialResponse();
CallControlDialOptions callControlDialOptions = new CallControlDialOptions {
CallControlDialOptions callControlDialOptions = new CallControlDialOptions
{
To = "+18005550100 or SIP:[email protected]",
From = "+18005550101",
ConnectionId = "string",
AudioUrl = "http://example.com/message.wav",
TimeoutSecs= 60,
TimeoutSecs = 60,
TimeLimitSecs = 600,
ClientState = "aGF2ZSBhIG5pY2UgZGF5ID1d",
CommandId = new Guid("891510ac-f3e4-11e8-af5b-de00688a4901"),
LinkTo = "ilditnZK_eVysupV21KzmzN_sM29ygfauQojpm4BgFtfX5hXAcjotg==",
LinkTo = "ilditnZK_eVysupV21KzmzN_sM29ygfauQojpm4BgFtfX5hXAcjotg==",
SipAuthUsername = "string",
SipAuthPassword = "string",
FromDisplayName = "string"
Expand All @@ -54,9 +53,9 @@ public CallSpeakResponse Speak()
CallSpeakResponse callSpeakResponse = new CallSpeakResponse();
CallControlSpeakOptions callControlSpeakOptions = new CallControlSpeakOptions
{
Payload = "Say this on the call",
Language = "en-US",
Voice = "female"
Payload = "Say this on the call",
Language = "en-US",
Voice = "female"
};
Console.WriteLine(JsonConvert.SerializeObject(callControlSpeakOptions));

Expand All @@ -78,7 +77,7 @@ public CallBridgeResponse Bridge()
CallBridgeResponse response = new CallBridgeResponse();
CallControlBridgeOptions options = new CallControlBridgeOptions
{

};
Console.WriteLine(JsonConvert.SerializeObject(options));

Expand Down Expand Up @@ -166,15 +165,15 @@ public CallGatherUsingSpeakResponse GatherUsingSpeak()
CallGatherUsingSpeakResponse response = new CallGatherUsingSpeakResponse();
CallControlGatherUsingSpeakOptions options = new CallControlGatherUsingSpeakOptions
{
Language = "en-US",
Voice = "female",
Language = "en-US",
Voice = "female",
Payload = "Telnyx call control test"
};
Console.WriteLine(JsonConvert.SerializeObject(options));

try
{
response = callControlService.GatherUsingSpeak( options);
response = callControlService.GatherUsingSpeak(options);
Console.WriteLine(JsonConvert.SerializeObject(response));
}
catch (TelnyxException ex)
Expand Down
4 changes: 2 additions & 2 deletions src/Telnyx.Example/ConferenceCommandsExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public CreateConferenceResponse Create()
};
return conferenceCommandsService.Create(options);
}
catch(Exception ex)
catch (Exception ex)
{
Console.WriteLine(ex);
return null;
Expand All @@ -33,7 +33,7 @@ public TelnyxList<ListConferenceResponse> List()
{
ListConferenceOptions options = new ListConferenceOptions
{

};
var response = listConferenceService.List(options);
return response;
Expand Down
4 changes: 1 addition & 3 deletions src/Telnyx.Example/ConfigEnvironmentVariableExtension.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Text;

namespace Telnyx.Example
{
public static class ConfigEnvironmentVariableExtension
public static class ConfigEnvironmentVariableExtension
{
public static IConfiguration LoadAppSettingsIntoEnvironmentVariables(this IConfiguration config)
{
Expand Down
2 changes: 0 additions & 2 deletions src/Telnyx.Example/ConnectionsExample.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Telnyx.net.Entities;
using Telnyx.net.Entities.Connections;
Expand Down
6 changes: 1 addition & 5 deletions src/Telnyx.Example/FaxExample.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Telnyx.net.Entities;
using Telnyx.net.Entities.Faxes;
using Telnyx.net.Entities.Faxes.Webhooks;
using Telnyx.net.Infrastructure.Public;
using Telnyx.net.Services.Faxes;

Expand Down
3 changes: 1 addition & 2 deletions src/Telnyx.Example/HostedNumbersExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Telnyx.net.Services.HostedNumbers;
Expand Down Expand Up @@ -31,7 +30,7 @@ public async Task CreatedHostedNumberAsync(IEnumerable<string> numbers)
}
public async Task ListAsync()
{
var result = await orderService.ListHostedNumberOrdersAsync(new ListOptions(1,25));
var result = await orderService.ListHostedNumberOrdersAsync(new ListOptions(1, 25));
Console.WriteLine("Number Orders Listed: ");
Console.WriteLine(JsonConvert.SerializeObject(result));
}
Expand Down
12 changes: 6 additions & 6 deletions src/Telnyx.Example/MessagesExample.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace Telnyx.Example
{
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace Telnyx.Example
{
/// <summary>
/// Messages example
/// </summary>
Expand Down
19 changes: 9 additions & 10 deletions src/Telnyx.Example/MessagingProfilesExample.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
namespace Telnyx.Example
{
using System;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Telnyx.net.Entities.Messaging.Messaging_Profiles;
using Telnyx.net.Entities.Messaging.Messaging_Profiles.Metrics;
using Telnyx.net.Services.Messaging.Messaging_Profiles.Metrics;
using System;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Telnyx.net.Entities.Messaging.Messaging_Profiles;
using Telnyx.net.Services.Messaging.Messaging_Profiles.Metrics;

namespace Telnyx.Example
{
/// <summary>
/// Messaging Profiles Example
/// </summary>
Expand Down Expand Up @@ -172,7 +171,7 @@ public void ListAllMessagingProfilePhoneNumbers()
try
{
var messagingPhoneNumber = this.phoneNumbersService.List(MessagingProfileId, listOptions);

Console.WriteLine(JsonConvert.SerializeObject(messagingPhoneNumber));
}
catch (TelnyxException ex)
Expand All @@ -193,7 +192,7 @@ public async Task GetDetailAsync(string messagingProfileId = null)
TimeFrame = "16h"
};
var response = await metricsService.GetDetailedMetricsAsync(messagingProfileId, getOptions);
Console.WriteLine(JsonConvert.SerializeObject(response,Formatting.Indented));
Console.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
}

public async Task ListOverviewAsync()
Expand Down
2 changes: 1 addition & 1 deletion src/Telnyx.Example/MobileOperatorNetworksExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public TelnyxList<MobileOperatorNetworksRecord> List()
{
TelnyxList<MobileOperatorNetworksRecord> result = new TelnyxList<MobileOperatorNetworksRecord>();
ListMobileOperatorNetworksOptions listOptions = new ListMobileOperatorNetworksOptions
{
{
PageNumber = 1,
PageSize = 20
};
Expand Down
2 changes: 0 additions & 2 deletions src/Telnyx.Example/NumberConfigurationExample.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Telnyx.net.Entities.PhoneNumbers.NumberConfigurations;
using Telnyx.net.Services.PhoneNumbers.NumberConfigurations;
Expand Down
3 changes: 1 addition & 2 deletions src/Telnyx.Example/NumberLookupExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Telnyx.net.Entities;
using Telnyx.net.Entities.NumberLookup;
using Telnyx.net.Services;

Expand All @@ -23,7 +22,7 @@ public NumberLookupRecord Get()

try
{
record = service.Get(phoneNumber,options);
record = service.Get(phoneNumber, options);
Console.WriteLine(JsonConvert.SerializeObject(record));
}
catch (TelnyxException ex)
Expand Down
12 changes: 6 additions & 6 deletions src/Telnyx.Example/NumberOrderExample.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace Telnyx.Example
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Telnyx.Example
{
/// <summary>
/// Number Order Example
/// </summary>
Expand Down Expand Up @@ -35,7 +35,7 @@ public void CreateNumberOrder()
Console.WriteLine("result");
Console.WriteLine(JsonConvert.SerializeObject(result));
}
catch(TelnyxException ex)
catch (TelnyxException ex)
{
Console.WriteLine("exception");
Console.WriteLine(JsonConvert.SerializeObject(ex));
Expand Down
Loading

0 comments on commit 60e29d4

Please sign in to comment.