Example #1
0
        /// <summary>
        /// </summary>
        /// <param name="codeName"> The name of your worker (code package). </param>
        /// <param name="filter">
        ///     List filtering options, to filter by Status use Status = TaskStates.Running | TaskStates.Queued
        ///     to get all Running or Queued tasks
        /// </param>
        /// <remarks>
        ///     http://dev.iron.io/worker/reference/api/#list_tasks
        /// </remarks>
        public async Task <TaskInfoCollection> List(string codeName, TaskListFilter filter = null)
        {
            var query = new NameValueCollection
            {
                { "code_name", codeName },
            };

            if (filter != null)
            {
                ApplyPageRangeFilter(query, filter.Page, filter.PerPage);

                ApplyDateRangeFilters(query, filter.FromTime, filter.ToTime);

                ApplyStatusFilter(query, filter.Status);
            }

            return(await RestClient.Get <TaskInfoCollection>(_client.Config, EndPoint, query));
        }
Example #2
0
        /// <summary>
        /// </summary>
        /// <param name="codeName"> The name of your worker (code package). </param>
        /// <param name="filter"> List filtering options, to filter by Status use Status = TaskStates.Running | TaskStates.Queued to get all Running or Queued tasks </param>
        /// <remarks>
        /// http://dev.iron.io/worker/reference/api/#list_tasks
        /// </remarks>
        public TaskInfoCollection List(string codeName, TaskListFilter filter = null)
        {
            var query = new NameValueCollection
            {
                {"code_name", codeName},
            };

            if (filter != null)
            {
                ApplyPageRangeFilter(query, filter.Page, filter.PerPage);

                ApplyDateRangeFilters(query, filter.FromTime, filter.ToTime);

                ApplyStatusFilter(query, filter.Status);
            }

            return RestClient.Get<TaskInfoCollection>(_client.Config, EndPoint, query).Result;
        }