public MessageServiceTest(MockHttpClientFixture mockHttpClientFixture)
            : base(mockHttpClientFixture)
        {
            this.service = new MessageService();

            this.createOptions = new NewMessage()
            {
                MessagingProfileId = Guid.NewGuid(),
                MediaUrls          = new List <string>()
                {
                    "example1.com", "example2.com"
                },
                WebhookUrl         = "webhookurl.com",
                WebhookFailoverUrl = "failureurl.com",
                UseProfileWebhooks = true,
                ValidityPeriodSecs = 01,
                IgnoreWireType     = true,
                From = "+18665552368",
                To   = "+18665552367",
                Text = "Hello, World!"
            };

            this.updateOptions = new NumberOrderUpdateOptions();

            this.listOptions = new NumberOrderListOptions();

            this.requestOptions = new RequestOptions();
        }
Example #2
0
        public NumberOrderServiceTest(MockHttpClientFixture mockHttpClientFixture)
            : base(mockHttpClientFixture)
        {
            this.service = new NumberOrderService();

            this.createOptions = new NumberOrderCreateOptions()
            {
                Id                 = Guid.NewGuid(),
                RecordType         = Telnyx.net.Entities.Enum.RecordType.Address,
                PhoneNumbersCount  = 12,
                Status             = NumberOrderCreateOptions.StatusEnum.PendingEnum,
                CustomerReference  = "Test",
                ConnectionId       = "Id001",
                MessagingProfileId = Guid.NewGuid(),
                WebhookUrl         = "TestUrl",
                WebhookFailoverUrl = "FailureUrl",
                CreatedAt          = null,
                UpdatedAt          = null,
                RequirementsMet    = true,
                PhoneNumbers       = new List <PhoneNumber>()
                {
                    new PhoneNumber {
                        Phone_Number = "+13127000090"
                    }
                }
            };

            this.listOptions = new NumberOrderListOptions()
            {
                Status                  = "enabled",
                CreatedAtGt             = null,
                CreatedAtLt             = null,
                PhoneNumbersPhoneNumber = "9089983721",
                CustomerReference       = "Test",
                RequirementsMet         = true
            };

            this.updateOptions = new NumberOrderUpdateOptions
            {
                NumberOrderId = NumberOrderId,
                Body          = new NumberOrder
                {
                    CustomerReference = "MY REF"
                }
            };

            this.requestOptions = new RequestOptions();

            this.cancellationToken = default(CancellationToken);
        }
Example #3
0
        /// <summary>
        /// List number order
        /// </summary>
        public void ListNumberOrder()
        {
            var listOptions = new NumberOrderListOptions();

            Console.WriteLine(JsonConvert.SerializeObject(listOptions));

            var requestOptions = new RequestOptions
            {
                ApiKey = YOURAPIKEY
            };

            Console.WriteLine(JsonConvert.SerializeObject(requestOptions));

            var numberOrderList = this.service.List(listOptions, requestOptions);

            Console.WriteLine(JsonConvert.SerializeObject(numberOrderList));
        }
Example #4
0
        public MessageServiceTest(MockHttpClientFixture mockHttpClientFixture)
            : base(mockHttpClientFixture)
        {
            this.service = new MessageService();

            this.createOptions = new NewMessage()
            {
                From = "+18665552368",
                To   = "+18665552367",
                Text = "Hello, World!"
            };

            this.updateOptions = new NumberOrderUpdateOptions();

            this.listOptions = new NumberOrderListOptions();

            this.requestOptions = new RequestOptions();
        }
        /// <summary>
        /// List number order
        /// </summary>
        public void ListNumberOrder()
        {
            var listOptions = new NumberOrderListOptions();

            Console.WriteLine("listOptions");
            Console.WriteLine(JsonConvert.SerializeObject(listOptions, new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            }));

            var requestOptions = new RequestOptions();

            try
            {
                var numberOrderList = this.service.List(listOptions, requestOptions);
                Console.WriteLine("numberOrderList");
                Console.WriteLine(JsonConvert.SerializeObject(numberOrderList));
            }
            catch (TelnyxException ex)
            {
                Console.WriteLine("exception");
                Console.WriteLine(JsonConvert.SerializeObject(ex));
            }
        }