async Task <List <WrikeTask> > IWrikeTasksClient.GetAsync(string folderId, bool?addDescendants, string title, WrikeTaskStatus?status, WrikeTaskImportance?importance, IWrikeDateFilter startDate, IWrikeDateFilter dueDate, IWrikeDateFilter scheduledDate, WrikeDateFilterRange createdDate, WrikeDateFilterRange updatedDate, WrikeDateFilterRange completedDate, List <string> authors, List <string> responsibles, List <string> shareds, string permalink, WrikeTaskDateType?type, int?limit, WrikeTaskSortField?sortField, WrikeSortOrder?sortOrder, bool?addSubTasks, int?pageSize, string nextPageToken, WrikeMetadata metadata, WrikeCustomFieldData customField, List <string> customStatuses, List <string> fields) { var requestUri = "tasks"; if (!string.IsNullOrWhiteSpace(folderId)) { requestUri = $"folders/{folderId}/tasks"; } var uriBuilder = new WrikeUriBuilder(requestUri) .AddParameter("descendants", addDescendants) .AddParameter("title", title) .AddParameter("status", status) .AddParameter("importance", importance) .AddParameter("startDate", startDate, new CustomDateTimeConverter("yyyy-MM-dd'T'HH:mm:ss")) .AddParameter("dueDate", dueDate, new CustomDateTimeConverter("yyyy-MM-dd'T'HH:mm:ss")) .AddParameter("scheduledDate", scheduledDate, new CustomDateTimeConverter("yyyy-MM-dd")) .AddParameter("createdDate", createdDate, new CustomDateTimeConverter("yyyy-MM-dd'T'HH:mm:ss'Z'")) .AddParameter("updatedDate", updatedDate, new CustomDateTimeConverter("yyyy-MM-dd'T'HH:mm:ss'Z'")) .AddParameter("completedDate", completedDate, new CustomDateTimeConverter("yyyy-MM-dd'T'HH:mm:ss'Z'")) .AddParameter("authors", authors) .AddParameter("responsibles", responsibles) .AddParameter("shareds", shareds) .AddParameter("permalink", permalink) .AddParameter("type", type) .AddParameter("limit", limit) .AddParameter("sortField", sortField) .AddParameter("sortOrder", sortOrder) .AddParameter("subTasks", addSubTasks) .AddParameter("pageSize", pageSize) .AddParameter("nextPageToken", nextPageToken) .AddParameter("metadata", metadata) .AddParameter("customField", customField) .AddParameter("customStatuses", customStatuses) .AddParameter("fields", fields); var response = await SendRequest <WrikeTask>(uriBuilder.GetUri(), HttpMethods.Get).ConfigureAwait(false); _lastResponseSize = response.ResponseSize; _lastNextPageToken = response.NextPageToken; return(GetReponseDataList(response)); }
async Task <List <WrikeTaskAttachment> > IWrikeAttachmentsClient.GetInTaskAsync(WrikeClientIdParameter taskId, bool?versions, WrikeDateFilterRange createdDate, bool?withUrls) { var uriBuilder = new WrikeUriBuilder($"tasks/{taskId}/attachments") .AddParameter("versions", versions) .AddParameter("createdDate", createdDate, new CustomDateTimeConverter("yyyy-MM-dd'T'HH:mm:ss'Z'")) .AddParameter("withUrls", withUrls); var response = await SendRequest <WrikeTaskAttachment>(uriBuilder.GetUri(), HttpMethods.Get).ConfigureAwait(false); return(GetReponseDataList(response)); }
async Task <List <WrikeTimelog> > IWrikeTimelogsClient.GetAsync(string contactId, string folderId, string taskId, string categoryId, WrikeDateFilterRange createdDate, WrikeDateFilterRange updatedDate, IWrikeDateFilter trackedDate, bool?me, bool?descendants, bool?subTasks, bool?plainText, List <string> categoryIds) { int notNullCount = 0; string requestUri = "timelogs"; if (!string.IsNullOrWhiteSpace(contactId)) { requestUri = $"contacts/{contactId}/timelogs"; notNullCount++; } else if (!string.IsNullOrWhiteSpace(folderId)) { requestUri = $"folders/{folderId}/timelogs"; notNullCount++; } else if (!string.IsNullOrWhiteSpace(taskId)) { requestUri = $"tasks/{taskId}/timelogs"; notNullCount++; } else if (!string.IsNullOrWhiteSpace(categoryId)) { requestUri = $"timelog_categories/{categoryId}/timelogs"; notNullCount++; } if (notNullCount > 1) { throw new ArgumentException("only one of contactId, folderId, taskId or categoryId can be used"); } var uriBuilder = new WrikeUriBuilder(requestUri) .AddParameter("createdDate", createdDate, new CustomDateTimeConverter("yyyy-MM-dd'T'HH:mm:ss'Z'")) .AddParameter("updatedDate", updatedDate, new CustomDateTimeConverter("yyyy-MM-dd'T'HH:mm:ss'Z'")) .AddParameter("trackedDate", trackedDate, new CustomDateTimeConverter("yyyy-MM-dd'T'HH:mm:ss")) .AddParameter("me", me) .AddParameter("descendants", descendants) .AddParameter("subTasks", subTasks) .AddParameter("plainText", plainText) .AddParameter("timelogCategories", categoryIds); var response = await SendRequest <WrikeTimelog>(uriBuilder.GetUri(), HttpMethods.Get).ConfigureAwait(false); return(GetReponseDataList(response)); }
async Task <List <WrikeComment> > IWrikeCommentsClient.GetAsync(bool?plainText, int?limit, WrikeDateFilterRange updatedDate) { var requestUri = "comments"; var uriBuilder = new WrikeUriBuilder(requestUri) .AddParameter("plainText", plainText) .AddParameter("limit", limit) .AddParameter("updatedDate", updatedDate); var response = await SendRequest <WrikeComment>(uriBuilder.GetUri(), HttpMethods.Get, jsonConverter : new WrikeCommentConverter()).ConfigureAwait(false); return(GetReponseDataList(response)); }
async Task <List <WrikeFolderTree> > IWrikeFoldersAndProjectsClient.GetFolderTreeAsync(string folderId, string permalink, bool?addDescendants, WrikeMetadata metadata, WrikeCustomFieldData customField, WrikeDateFilterRange updatedDate, bool?isProject, bool?isDeleted, List <string> optionalFields) { if (optionalFields != null && optionalFields.Count > 0 && optionalFields.Except(WrikeFolderTree.OptionalFields.List).Any()) { throw new ArgumentOutOfRangeException(nameof(optionalFields), "Use only values in WrikeFolderTree.OptionalFields"); } var requestUri = "folders"; bool useFolderId = !string.IsNullOrWhiteSpace(folderId); if (useFolderId) { requestUri = $"folders/{folderId}/folders"; } var uriBuilder = new WrikeUriBuilder(requestUri) .AddParameter("permalink", permalink) .AddParameter("descendants", addDescendants) .AddParameter("metadata", metadata) .AddParameter("customField", customField) .AddParameter("updatedDate", updatedDate, new CustomDateTimeConverter("yyyy-MM-dd'T'HH:mm:ss'Z'")) .AddParameter("project", isProject) .AddParameter("deleted", isDeleted) .AddParameter("fields", optionalFields); if (!useFolderId) { uriBuilder.AddParameter("deleted", isDeleted); } var response = await SendRequest <WrikeFolderTree>(uriBuilder.GetUri(), HttpMethods.Get).ConfigureAwait(false); return(GetReponseDataList(response)); }