Exemplo n.º 1
0
        /// <summary>
        /// Purchases a new phone number.
        /// </summary>
        /// <param name="phoneNumberType">Type of phone number.</param>
        /// <param name="phoneNumber">Phone number.</param>
        /// <param name="areaCode">Area code.</param>
        /// <param name="messageStatusCallback">Message status callback.</param>
        /// <param name="name">Name.</param>
        /// <param name="smsConfigurationId">SMS configuration ID.</param>
        /// <param name="smsFallbackMethod">SMS fallback method.</param>
        /// <param name="smsFallbackUrl">SMS fallback URL.</param>
        /// <param name="smsMethod">SMS method.</param>
        /// <param name="smsUrl">SMS URL.</param>
        /// <param name="client">REST client.</param>
        /// <returns></returns>
        public static Number Buy(PhoneNumberTypeEnum phoneNumberType,
                                 string phoneNumber                = null,
                                 int?areaCode                      = null,
                                 string name                       = null,
                                 int?connectorId                   = null,
                                 string statusTextUrl              = null,
                                 string incomingTextUrl            = null,
                                 string incomingTextMethod         = null,
                                 string incomingTextFallbackUrl    = null,
                                 string incomingTextFallbackMethod = null,
                                 IVcRestClient client              = null)
        {
            if (phoneNumberType == PhoneNumberTypeEnum.Local)
            {
                CreateNumberLocal createNumberLocal = new CreateNumberLocal(phoneNumber)
                {
                    AreaCode                   = areaCode,
                    Name                       = name,
                    ConnectorId                = connectorId,
                    StatusTextUrl              = statusTextUrl,
                    IncomingTextUrl            = incomingTextUrl,
                    IncomingTextMethod         = incomingTextMethod,
                    IncomingTextFallbackUrl    = incomingTextFallbackUrl,
                    IncomingTextFallbackMethod = incomingTextFallbackMethod
                };

                return(CreateLocal(VcClient.AccountId, createNumberLocal, client));
            }

            CreateNumber createNumber = new CreateNumber(phoneNumber, phoneNumberType)
            {
                AreaCode                   = areaCode,
                Name                       = name,
                ConnectorId                = connectorId,
                StatusTextUrl              = statusTextUrl,
                IncomingTextUrl            = incomingTextUrl,
                IncomingTextMethod         = incomingTextMethod,
                IncomingTextFallbackUrl    = incomingTextFallbackUrl,
                IncomingTextFallbackMethod = incomingTextFallbackMethod
            };

            return(Create(VcClient.AccountId, createNumber, client));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a local phone number.
 /// </summary>
 /// <param name="accountId">Account ID.</param>
 /// <param name="createNumberLocal">CreateNumberLocal.</param>
 /// <param name="client">REST client.</param>
 /// <returns></returns>
 private static Number CreateLocal(int accountId, CreateNumberLocal createNumberLocal, IVcRestClient client = null)
 {
     return(Create <Number>(BuildCreateLocalUrl(accountId), createNumberLocal, client: client));
 }