Get() public method

Issues a GET request
public Get ( string url, NameValueCollection headers = null, bool retry = true ) : string
url string Url to issues the request to
headers System.Collections.Specialized.NameValueCollection Additional header information
retry bool Retry if unsuccessful
return string
示例#1
0
        /// <summary>
        /// Get a list of all queues in a project. By default, 30 queues are listed at a time. To see more, use the page parameter or the per_page parameter. Up to 100 queues may be listed on a single page.
        /// </summary>
        /// <param name="projectId">Project identifier available from the HUD</param>
        /// <param name="token">Token available from the HUD</param>
        /// <param name="page">Page index (zero based)</param>
        /// <param name="perPage">Number of results per page</param>
        /// <returns>An IList of queue names</returns>
        public static IList<string> Queues(string projectId = null, string token = null, int page = 0, int perPage = 30)
        {
            var client = new IronClient("IronWorker .NET", "0.1", "iron_mq", projectId: projectId, token: token);
            var url = string.Format("{0}?page={1}&per_page={2}", QueueCore, page, perPage);

            var json = client.Get(url);
            var template = new[] { new { id = string.Empty, name = string.Empty, projectId = string.Empty } };
            var queues = JsonConvert.DeserializeAnonymousType(json, template);
            return queues.Select(q => q.name).ToList();
        }
示例#2
0
        /// <summary>
        /// Get a list of all queues in a project. By default, 30 queues are listed at a time. To see more, use the page parameter or the per_page parameter. Up to 100 queues may be listed on a single page.
        /// </summary>
        /// <param name="projectId">Project identifier available from the HUD</param>
        /// <param name="token">Token available from the HUD</param>
        /// <param name="page">Page index (zero based)</param>
        /// <param name="perPage">Number of results per page</param>
        /// <returns>An IList of queue names</returns>
        public static IList <string> Queues(string projectId = null, string token = null, int page = 0, int perPage = 30)
        {
            var client = new IronClient("IronWorker .NET", "0.1", "iron_mq", projectId: projectId, token: token);
            var url    = string.Format("{0}?page={1}&per_page={2}", QueueCore, page, perPage);

            var json     = client.Get(url);
            var template = new[] { new { id = string.Empty, name = string.Empty, projectId = string.Empty } };
            var queues   = JsonConvert.DeserializeAnonymousType(json, template);

            return(queues.Select(q => q.name).ToList());
        }