Пример #1
0
        public Queue CreateQueue(string name, int size, string waitUrl, int waitTime)
        {
            var queue = twilio.CreateQueue(name);

            TwilioProvider.ThrowIfError(queue);
            return(new Queue(queue.Sid, name, size, waitUrl, waitTime));
        }
Пример #2
0
        public void ShouldDeleteQueue()
        {
            var client        = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);
            var originalQueue = client.CreateQueue("ShouldDeleteQueue");

            var status = client.DeleteQueue(originalQueue.Sid);

            Assert.AreEqual(DeleteStatus.Success, status);
        }
Пример #3
0
        public void ShouldCreateNewQueue()
        {
            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);
            var result = client.CreateQueue("ShouldCreateNewQueue");

            Assert.IsNotNull(result);
            Assert.IsNull(result.RestException);
            Assert.IsNotNull(result.Sid);

            client.DeleteQueue(result.Sid); //cleanup
        }
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/user/account
        string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        string AuthToken  = "your_auth_token";
        var    twilio     = new TwilioRestClient(AccountSid, AuthToken);

        var queue = twilio.CreateQueue("newqueue");

        Console.WriteLine(queue.Sid);
    }
Пример #5
0
        public void ShouldCreateNewQueue()
        {
            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);
            var result = client.CreateQueue("ShouldCreateNewQueue");

            Assert.IsNotNull(result);
            Assert.IsNull(result.RestException);
            Assert.IsNotNull(result.Sid);

            client.DeleteQueue(result.Sid); //cleanup
        }
Пример #6
0
        public Queue CreateQueue(string name, int size, string waitUrl, int waitTime)
        {
            var queues = twilio.ListQueues();
            var queue  = queues.Queues.FirstOrDefault(r => r.FriendlyName == name);

            if (queue == null)
            {
                queue = twilio.CreateQueue(name);
                TwilioProvider.ThrowIfError(queue);
            }
            return(new Queue(queue.Sid, name, size, waitUrl, waitTime));
        }
Пример #7
0
        public void ShouldUpdateQueue()
        {
            var client        = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);
            var originalQueue = client.CreateQueue("ShouldUpdateQueue");

            var queuesid = originalQueue.Sid;

            var result = client.UpdateQueue(queuesid, "ShouldUpdateQueueUpdated", originalQueue.MaxSize.Value);

            Assert.IsNotNull(result);
            Assert.IsNull(result.RestException);
            Assert.AreEqual("ShouldUpdateQueueUpdated", result.FriendlyName);

            client.DeleteQueue(queuesid); //cleanup
        }
Пример #8
0
        public void ShouldGetQueue()
        {
            var client        = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);
            var originalQueue = client.CreateQueue("ShouldGetQueue");

            var queuesid = originalQueue.Sid;

            var result = client.GetQueue(queuesid);

            Assert.IsNotNull(result);
            Assert.IsNull(result.RestException);
            Assert.IsNotNull(result.Sid);

            client.DeleteQueue(queuesid); //cleanup
        }
Пример #9
0
        public void ShouldUpdateQueue()
        {
            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);
            var originalQueue = client.CreateQueue("ShouldUpdateQueue");

            var queuesid = originalQueue.Sid;

            var result = client.UpdateQueue(queuesid, "ShouldUpdateQueueUpdated", originalQueue.MaxSize.Value);

            Assert.IsNotNull(result);
            Assert.IsNull(result.RestException);
            Assert.AreEqual("ShouldUpdateQueueUpdated", result.FriendlyName);

            client.DeleteQueue(queuesid); //cleanup
        }
Пример #10
0
        public void ShouldGetQueue()
        {
            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);
            var originalQueue = client.CreateQueue("ShouldGetQueue");

            var queuesid = originalQueue.Sid;

            var result = client.GetQueue(queuesid);

            Assert.IsNotNull(result);
            Assert.IsNull(result.RestException);
            Assert.IsNotNull(result.Sid);

            client.DeleteQueue(queuesid); //cleanup
        }
Пример #11
0
        public void ShouldDeleteQueue()
        {
            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);
            var originalQueue = client.CreateQueue("ShouldDeleteQueue");

            var status = client.DeleteQueue(originalQueue.Sid);
            Assert.AreEqual(DeleteStatus.Success, status);
        }