Exemplo n.º 1
0
        /// <summary>
        /// Create a new queue through the Persephony API using a registered
        /// Persephony application.
        /// </summary>
        /// <param name="queueOptions">Optional QueueOptions instance to be used when creating a queue.</param>
        /// <returns>A Queue object returned by Persephony that represents the queue that was created.</returns>
        /// <exception cref="PersyException">Thrown upon failed request.</exception>
        /// <see cref="QueueOptions">QueueOptions class.</see>
        public Queue create(QueueOptions queueOptions = null)
        {
            string json = base.POST(this.path, ((queueOptions != null) ? queueOptions.toJson() : null));

            if (string.IsNullOrEmpty(json) == true)
            {
                throw new PersyException(String.Format("Failed to create queue with options {0}", ((queueOptions != null) ? queueOptions.toJson() : string.Empty)));
            }

            return(Queue.fromJson(json));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update a single queue.
        /// </summary>
        /// <param name="queueId">The queueId of the target queueId.</param>
        /// <param name="queueOptions">Optional QueueOptions instance to be used when updating a queue.</param>
        /// <returns>The queue matching the queueId provided.</returns>
        /// <exception cref="PersyException">Thrown upon failed request.</exception>
        public Queue update(string queueId, QueueOptions queueOptions = null)
        {
            string json = base.POST(String.Format("{0}/{1}", this.path, queueId), ((queueOptions != null) ? queueOptions.toJson() : null));

            if (string.IsNullOrEmpty(json) == true)
            {
                throw new PersyException(String.Format("Failed to update queue {0} information", queueId ?? ""));
            }

            return(Queue.fromJson(json));
        }