/// <summary>
 /// Adds a new restriction to the trunk (Blacklist and Whitelist items)
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// </param>
 /// <param name='id'>
 /// Trunk Id
 /// </param>
 /// <param name='prefix'>
 /// Called number prefix
 /// </param>
 /// <param name='description'>
 /// </param>
 /// <param name='blacklist'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> AddRestrictionAsync(this ITrunks operations, string subscriptionId, int id, string prefix, string description, bool blacklist, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.AddRestrictionWithHttpMessagesAsync(subscriptionId, id, prefix, description, blacklist, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Create a new SIP Trunk
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// </param>
 /// <param name='description'>
 /// </param>
 /// <param name='endpointId'>
 /// </param>
 /// <param name='autoCreateEndpoint'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <NewSipTrunkResponseModel> CreateTrunkAsync(this ITrunks operations, string subscriptionId, string description, string endpointId, bool autoCreateEndpoint, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateTrunkWithHttpMessagesAsync(subscriptionId, description, endpointId, autoCreateEndpoint, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Get your SIP Trunks as a PagedResponse
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// </param>
 /// <param name='take'>
 /// Number of items to return
 /// </param>
 /// <param name='skip'>
 /// Number of item to skip over
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <PagedResponse <SipTrunkModel> > GetTrunksAsync(this ITrunks operations, string subscriptionId, int take, int skip, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetTrunksWithHttpMessagesAsync(subscriptionId, take, skip, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Update SIP Trunk
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// </param>
 /// <param name='id'>
 /// SIP Trunk ID to get endpoints for
 /// </param>
 /// <param name='model'>
 /// Model used to update Trunk
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <SipTrunkModel> UpdateTrunkAsync(this ITrunks operations, string subscriptionId, int id, UpdateSIPTrunkModel model, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UpdateTrunkWithHttpMessagesAsync(subscriptionId, id, model, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Get specific SIP Trunk endpoint
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// </param>
 /// <param name='id'>
 /// SIP Trunk Id
 /// </param>
 /// <param name='endpointId'>
 /// Endpoint Id
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <SipTrunkEndpointModel> GetTrunkEndpointAsync(this ITrunks operations, string subscriptionId, int id, int endpointId, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetTrunkEndpointWithHttpMessagesAsync(subscriptionId, id, endpointId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #6
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     Applications          = new Applications(this);
     Contacts              = new Contacts(this);
     Domains               = new Domains(this);
     Inbound               = new Inbound(this);
     Numbers               = new Numbers(this);
     Porting               = new Porting(this);
     SMS                   = new SMS(this);
     Trunks                = new Trunks(this);
     BaseUri               = new System.Uri("https://localhost");
     SerializationSettings = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new  List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
 }
 /// <summary>
 /// Create a new SIP Trunk
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// </param>
 /// <param name='description'>
 /// </param>
 /// <param name='endpointId'>
 /// </param>
 /// <param name='autoCreateEndpoint'>
 /// </param>
 public static NewSipTrunkResponseModel CreateTrunk(this ITrunks operations, string subscriptionId, string description, string endpointId, bool autoCreateEndpoint)
 {
     return(operations.CreateTrunkAsync(subscriptionId, description, endpointId, autoCreateEndpoint).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Adds a new restriction to the trunk (Blacklist and Whitelist items)
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// </param>
 /// <param name='id'>
 /// Trunk Id
 /// </param>
 /// <param name='prefix'>
 /// Called number prefix
 /// </param>
 /// <param name='description'>
 /// </param>
 /// <param name='blacklist'>
 /// </param>
 public static object AddRestriction(this ITrunks operations, string subscriptionId, int id, string prefix, string description, bool blacklist)
 {
     return(operations.AddRestrictionAsync(subscriptionId, id, prefix, description, blacklist).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Returns a list of all restrictions on the trunk (Blacklist and Whitelist
 /// items)
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// </param>
 /// <param name='id'>
 /// Trunk Id
 /// </param>
 /// <param name='take'>
 /// </param>
 /// <param name='skip'>
 /// </param>
 public static PagedResponse <SipTrunkRestrictionItemModel> GetRestrictions(this ITrunks operations, string subscriptionId, int id, int take, int skip)
 {
     return(operations.GetRestrictionsAsync(subscriptionId, id, take, skip).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Get specific SIP Trunk endpoint
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// </param>
 /// <param name='id'>
 /// SIP Trunk Id
 /// </param>
 /// <param name='endpointId'>
 /// Endpoint Id
 /// </param>
 public static SipTrunkEndpointModel GetTrunkEndpoint(this ITrunks operations, string subscriptionId, int id, int endpointId)
 {
     return(operations.GetTrunkEndpointAsync(subscriptionId, id, endpointId).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Delete the specified SIP Trunk Endpoint
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// </param>
 /// <param name='id'>
 /// SIP Trunk Id
 /// </param>
 /// <param name='endpointId'>
 /// Endpoint Id
 /// </param>
 public static object DeleteTrunkEndpoint(this ITrunks operations, string subscriptionId, int id, int endpointId)
 {
     return(operations.DeleteTrunkEndpointAsync(subscriptionId, id, endpointId).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Create a new SIP Trunk Endpoint IP Address
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// </param>
 /// <param name='id'>
 /// SIP Trunk Id
 /// </param>
 /// <param name='model'>
 /// Endpoint Model
 /// </param>
 public static SipTrunkEndpointModel CreateTrunkEndpoint(this ITrunks operations, string subscriptionId, int id, NewSipTrunkEndpointModel model)
 {
     return(operations.CreateTrunkEndpointAsync(subscriptionId, id, model).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Update SIP Trunk
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// </param>
 /// <param name='id'>
 /// SIP Trunk ID to get endpoints for
 /// </param>
 /// <param name='model'>
 /// Model used to update Trunk
 /// </param>
 public static SipTrunkModel UpdateTrunk(this ITrunks operations, string subscriptionId, int id, UpdateSIPTrunkModel model)
 {
     return(operations.UpdateTrunkAsync(subscriptionId, id, model).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Get a specific SIP Trunk by Id
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// </param>
 /// <param name='id'>
 /// </param>
 public static SipTrunkModel GetTrunk(this ITrunks operations, string subscriptionId, int id)
 {
     return(operations.GetTrunkAsync(subscriptionId, id).GetAwaiter().GetResult());
 }