コード例 #1
0
        public async Task GetAllTasks()
        {
            try
            {
                TaskListFilter filter = new TaskListFilter();

                var    path = @"Responses/tasks.json";
                string json = File.ReadAllText(path);
                _cloudConvertAPI.Setup(cc => cc.GetAllTasksAsync(filter))
                .ReturnsAsync(JsonConvert.DeserializeObject <ListResponse <TaskResponse> >(json));

                var tasks = await _cloudConvertAPI.Object.GetAllTasksAsync(filter);

                Assert.IsNotNull(tasks);
                Assert.IsTrue(tasks.Data.Count >= 0);
            }
            catch (WebApiException ex)
            {
                if (ex.InnerException != null)
                {
                    var error = JsonConvert.DeserializeObject <ErrorResponse>(ex.InnerException.Message);
                }
                else
                {
                    var error = ex.Message;
                }
            }
            catch (Exception ex)
            {
                var error = ex.Message;
            }
        }
コード例 #2
0
 /// <summary>
 /// List all tasks with their status, payload and result. Requires the task.read scope.
 /// </summary>
 /// <param name="taskFilter"></param>
 /// <returns>
 /// The list of tasks. You can find details about the task model response in the documentation about the show tasks endpoint.
 /// </returns>
 public Task <ListResponse <TaskResponse> > GetAllTasksAsync(TaskListFilter taskFilter) => _restHelper.RequestAsync <ListResponse <TaskResponse> >(GetRequest($"{_apiUrl}/tasks?filter[job_id]={taskFilter.JobId}&filter[status]={taskFilter.Status}&filter[operation]={taskFilter.Operation}&include={taskFilter.Include}&per_page={taskFilter.PerPage}&page={taskFilter.Page}", HttpMethod.Get));