async Task <WrikeTask> IWrikeTasksClient.CreateAsync(WrikeClientIdParameter folderId, WrikeTask newTask, string priorityBefore, string priorityAfter) { if (newTask == null) { throw new ArgumentNullException(nameof(newTask)); } var postDataBuilder = new WrikeFormUrlEncodedContentBuilder() .AddParameter("title", newTask.Title) .AddParameter("description", newTask.Description) .AddParameter("importance", newTask.Importance) .AddParameter("dates", newTask.Dates) .AddParameter("shareds", newTask.SharedIds) .AddParameter("parents", newTask.ParentIds) .AddParameter("responsibles", newTask.ResponsibleIds) .AddParameter("followers", newTask.FollowerIds) .AddParameter("follow", newTask.FollowedByMe) .AddParameter("priorityBefore", priorityBefore) .AddParameter("priorityAfter", priorityAfter) .AddParameter("superTasks", newTask.SuperTaskIds) .AddParameter("metadata", newTask.Metadata) .AddParameter("customFields", newTask.CustomFields); if (string.IsNullOrWhiteSpace(newTask.CustomStatusId)) { postDataBuilder.AddParameter("status", newTask.Status); } else { postDataBuilder.AddParameter("customStatus", newTask.CustomStatusId); } var response = await SendRequest <WrikeTask>($"folders/{folderId}/tasks", HttpMethods.Post, postDataBuilder.GetContent()).ConfigureAwait(false); return(GetReponseDataFirstItem(response)); }
async Task <WrikeDependency> IWrikeDependenciesClient.CreateAsync(WrikeDependency newDependency) { if (newDependency == null) { throw new ArgumentNullException(nameof(newDependency)); } var contentBuilder = new WrikeFormUrlEncodedContentBuilder() .AddParameter("relationType", newDependency.RelationType); contentBuilder.AddParameter("successorId", newDependency.SuccessorId); var response = await SendRequest <WrikeDependency>($"tasks/{newDependency.PredecessorId}/dependencies", HttpMethods.Post, contentBuilder.GetContent()).ConfigureAwait(false); return(GetReponseDataFirstItem(response)); }