async Task <WrikeTaskAttachment> IWrikeAttachmentsClient.CreateInTaskAsync(WrikeClientIdParameter taskId, string fileName, byte[] fileBytes)
        {
            var response = await PostFile <WrikeTaskAttachment>($"tasks/{taskId}/attachments", fileName, fileBytes)
                           .ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
        async Task <WrikeFolder> IWrikeFoldersAndProjectsClient.UpdateAsync(WrikeClientIdParameter folderId, string title, string description, List <string> addParents, List <string> removeParents, List <string> addShareds, List <string> removeShareds, List <WrikeMetadata> metadata, bool?restore, List <WrikeCustomFieldData> customFields, List <string> customColumns, WrikeProject project)
        {
            if (title == null)
            {
                throw new ArgumentNullException(nameof(title));
            }

            if (title.Trim() == string.Empty)
            {
                throw new ArgumentException("value can not be empty", nameof(title));
            }

            var contentBuilder = new WrikeFormUrlEncodedContentBuilder()
                                 .AddParameter("title", title)
                                 .AddParameter("description", description)
                                 .AddParameter("addParents", addParents)
                                 .AddParameter("removeParents", removeParents)
                                 .AddParameter("addShareds", addShareds)
                                 .AddParameter("removeShareds", removeShareds)
                                 .AddParameter("metadata", metadata)
                                 .AddParameter("restore", restore)
                                 .AddParameter("customFields", customFields)
                                 .AddParameter("customColumns", customColumns)
                                 .AddParameter("project", project);

            var response = await SendRequest <WrikeFolder>($"folders/{folderId}", HttpMethods.Put, contentBuilder.GetContent()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
示例#3
0
        async Task IWrikeGroupsClient.DeleteAsync(WrikeClientIdParameter id, bool isTest)
        {
            var uriBuilder = new WrikeUriBuilder($"groups/{id}")
                             .AddParameter("test", isTest);

            await SendRequest <WrikeGroup>(uriBuilder.GetUri(), HttpMethods.Delete).ConfigureAwait(false);
        }
示例#4
0
        async Task <WrikeWebHook> IWrikeWebHooksClient.UpdateAsync(WrikeClientIdParameter webHookId, WrikeWebHookStatus status)
        {
            var putDataBuilder = new WrikeFormUrlEncodedContentBuilder()
                                 .AddParameter("status", status);

            var response = await SendRequest <WrikeWebHook>($"webhooks/{webHookId}", HttpMethods.Put, putDataBuilder.GetContent()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
示例#5
0
        async Task <WrikeUser> IWrikeContactsClient.UpdateAsync(WrikeClientIdParameter id, List <WrikeMetadata> metadata)
        {
            var contentBuilder = new WrikeFormUrlEncodedContentBuilder()
                                 .AddParameter("metadata", metadata);

            var response = await SendRequest <WrikeUser>($"contacts/{id}", HttpMethods.Put, contentBuilder.GetContent()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
        async Task <Stream> IWrikeAttachmentsClient.DownloadPreviewAsync(WrikeClientIdParameter id, WrikePreviewDimension?size)
        {
            var uriBuilder = new WrikeUriBuilder($"attachments/{id}/preview")
                             .AddParameter("size", size);

            var response = await SendRequestAndGetStream <Stream>(uriBuilder.GetUri(), HttpMethods.Get).ConfigureAwait(false);

            return(response);
        }
        async Task <WrikeTimelog> IWrikeTimelogsClient.GetAsync(WrikeClientIdParameter id, bool?plainText)
        {
            var uriBuilder = new WrikeUriBuilder($"timelogs/{id}")
                             .AddParameter("plainText", plainText);

            var response = await SendRequest <WrikeTimelog>(uriBuilder.GetUri(), HttpMethods.Get).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
示例#8
0
        async Task <WrikeDependency> IWrikeDependenciesClient.UpdateAsync(WrikeClientIdParameter id, WrikeDependencyRelationType relationType)
        {
            var contentBuilder = new WrikeFormUrlEncodedContentBuilder()
                                 .AddParameter("relationType", relationType);

            var response = await SendRequest <WrikeDependency>($"dependencies/{id}", HttpMethods.Put, contentBuilder.GetContent()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
示例#9
0
        async Task <WrikeInvitation> IWrikeInvitationsClient.UpdateAsync(WrikeClientIdParameter id, bool?resend, WrikeUserRole?role, bool?external)
        {
            var contentBuilder = new WrikeFormUrlEncodedContentBuilder()
                                 .AddParameter("resend", resend)
                                 .AddParameter("role", role)
                                 .AddParameter("external", external);

            var response = await SendRequest <WrikeInvitation>($"invitations/{id}", HttpMethods.Put, contentBuilder.GetContent()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
示例#10
0
        async Task <List <WrikeTaskComment> > IWrikeCommentsClient.GetInTaskAsync(WrikeClientIdParameter taskId, bool?plainText)
        {
            var requestUri = $"tasks/{taskId}/comments";

            var uriBuilder = new WrikeUriBuilder(requestUri)
                             .AddParameter("plainText", plainText);

            var response = await SendRequest <WrikeTaskComment>(uriBuilder.GetUri(), HttpMethods.Get).ConfigureAwait(false);

            return(GetReponseDataList(response));
        }
示例#11
0
        async Task <WrikeWorkflow> IWrikeWorkflowsClient.UpdateAsync(WrikeClientIdParameter id, string name, bool?isHidden, WrikeCustomStatus customStatus)
        {
            var contentBuilder = new WrikeFormUrlEncodedContentBuilder()
                                 .AddParameter("name", name)
                                 .AddParameter("hidden", isHidden)
                                 .AddParameter("customStatus", customStatus);

            var response = await SendRequest <WrikeWorkflow>($"workflows/{id}", HttpMethods.Put, contentBuilder.GetContent()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
        async Task <WrikeTimelog> IWrikeTimelogsClient.UpdateAsync(WrikeClientIdParameter id, string comment, int?hours, DateTime?trackedDate, bool?plainText, string categoryId)
        {
            var contentBuilder = new WrikeFormUrlEncodedContentBuilder()
                                 .AddParameter("comment", comment)
                                 .AddParameter("hours", hours)
                                 .AddParameter("trackedDate", trackedDate)
                                 .AddParameter("plainText", plainText)
                                 .AddParameter("categoryId", categoryId);

            var response = await SendRequest <WrikeTimelog>($"timelogs/{id}", HttpMethods.Put, contentBuilder.GetContent()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
示例#13
0
        async Task <WrikeTask> IWrikeTasksClient.UpdateAsync(
            WrikeClientIdParameter id,
            string title,
            string description,
            WrikeTaskStatus?status,
            WrikeTaskImportance?importance,
            WrikeTaskDate dates,
            List <string> addParents,
            List <string> removeParents,
            List <string> addShareds,
            List <string> removeShareds,
            List <string> addResponsibles,
            List <string> removeResponsibles,
            List <string> addFollowers,
            bool?follow,
            string priorityBefore,
            string priorityAfter,
            List <string> addSuperTasks,
            List <string> removeSuperTasks,
            List <WrikeMetadata> metadata,
            List <WrikeCustomFieldData> customFields,
            string customStatus,
            bool?restore)
        {
            var contentBuilder = new WrikeFormUrlEncodedContentBuilder()
                                 .AddParameter("title", title)
                                 .AddParameter("description", description)
                                 .AddParameter("status", status)
                                 .AddParameter("importance", importance)
                                 .AddParameter("dates", dates)
                                 .AddParameter("addParents", addParents)
                                 .AddParameter("removeParents", removeParents)
                                 .AddParameter("addShareds", addShareds)
                                 .AddParameter("removeShareds", removeShareds)
                                 .AddParameter("addResponsibles", addResponsibles)
                                 .AddParameter("removeResponsibles", removeResponsibles)
                                 .AddParameter("addFollowers", addFollowers)
                                 .AddParameter("follow", follow)
                                 .AddParameter("priorityBefore", priorityBefore)
                                 .AddParameter("priorityAfter", priorityAfter)
                                 .AddParameter("addSuperTasks", addSuperTasks)
                                 .AddParameter("removeSuperTasks", removeSuperTasks)
                                 .AddParameter("metadata", metadata)
                                 .AddParameter("customFields", customFields)
                                 .AddParameter("customStatus", customStatus)
                                 .AddParameter("restore", restore);

            var response = await SendRequest <WrikeTask>($"tasks/{id}", HttpMethods.Put, contentBuilder.GetContent()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
示例#14
0
        async Task <WrikeGroup> IWrikeGroupsClient.GetAsync(WrikeClientIdParameter id, List <string> optionalFields)
        {
            if (optionalFields != null && optionalFields.Count > 0 && optionalFields.Except(WrikeGroup.OptionalFields.List).Any())
            {
                throw new ArgumentOutOfRangeException(nameof(optionalFields), "Use only values in WrikeGroup.OptionalFields");
            }

            var uriBuilder = new WrikeUriBuilder($"groups/{id}")
                             .AddParameter("fields", optionalFields);

            var response = await SendRequest <WrikeGroup>(uriBuilder.GetUri(), HttpMethods.Get).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
示例#15
0
        async Task <WrikeGroup> IWrikeGroupsClient.UpdateAsync(WrikeClientIdParameter id, string title, List <string> membersToAdd, List <string> membersToRemove, string parentId, WrikeGroupAvatar avatar, List <WrikeMetadata> metaData)
        {
            var contentBuilder = new WrikeFormUrlEncodedContentBuilder()
                                 .AddParameter("title", title)
                                 .AddParameter("addMembers", membersToAdd)
                                 .AddParameter("removeMembers", membersToRemove)
                                 .AddParameter("parent", parentId)
                                 .AddParameter("avatar", avatar)
                                 .AddParameter("metadata", metaData);

            var response = await SendRequest <WrikeGroup>($"groups/{id}", HttpMethods.Put, contentBuilder.GetContent()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
示例#16
0
        async Task <WrikeUser> IWrikeUsersClient.UpdateAsync(WrikeClientIdParameter id, WrikeUserProfile profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException(nameof(profile));
            }

            var contentBuilder = new WrikeFormUrlEncodedContentBuilder()
                                 .AddParameter("profile", profile);

            var response = await SendRequest <WrikeUser>($"users/{id}", HttpMethods.Put, contentBuilder.GetContent()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
        async Task <WrikeCustomField> IWrikeCustomFieldsClient.UpdateAsync(
            WrikeClientIdParameter id,
            string title,
            WrikeCustomFieldType?type,
            List <string> addShareds,
            List <string> removeShareds,
            WrikeCustomFieldSettings settings)
        {
            var contentBuilder = new WrikeFormUrlEncodedContentBuilder()
                                 .AddParameter("title", title)
                                 .AddParameter("type", type)
                                 .AddParameter("addShareds", addShareds)
                                 .AddParameter("removeShareds", removeShareds)
                                 .AddParameter("settings", settings);

            var response = await SendRequest <WrikeCustomField>($"customfields/{id}", HttpMethods.Put, contentBuilder.GetContent()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
        async Task <WrikeFolder> IWrikeFoldersAndProjectsClient.CreateAsync(WrikeClientIdParameter folderId, WrikeFolder newFolder)
        {
            if (newFolder == null)
            {
                throw new ArgumentNullException(nameof(newFolder));
            }

            var contentBuilder = new WrikeFormUrlEncodedContentBuilder()
                                 .AddParameter("title", newFolder.Title)
                                 .AddParameter("description", newFolder.Description)
                                 .AddParameter("shareds", newFolder.SharedIds)
                                 .AddParameter("metadata", newFolder.Metadata)
                                 .AddParameter("customFields", newFolder.CustomFields)
                                 .AddParameter("customColumns", newFolder.CustomColumnIds)
                                 .AddParameter("project", newFolder.Project);

            var response = await SendRequest <WrikeFolder>($"folders/{folderId}/folders", HttpMethods.Post, contentBuilder.GetContent()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
示例#19
0
        async Task <WrikeComment> IWrikeCommentsClient.UpdateAsync(WrikeClientIdParameter id, string text, bool?plainText)
        {
            if (text == null)
            {
                throw new ArgumentNullException(nameof(text));
            }

            if (text.Trim() == string.Empty)
            {
                throw new ArgumentException("value can not be empty", nameof(text));
            }

            var contentBuilder = new WrikeFormUrlEncodedContentBuilder()
                                 .AddParameter("text", text)
                                 .AddParameter("plainText", plainText);

            var response = await SendRequest <WrikeComment>($"comments/{id}", HttpMethods.Put,
                                                            contentBuilder.GetContent(), new WrikeCommentConverter()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
        async Task <WrikeFolder> IWrikeFoldersAndProjectsClient.CopyAsync(WrikeClientIdParameter folderId, WrikeClientIdParameter parentFolderId, string title, string titlePrefix, bool?copyDescriptions, bool?copyResponsibles, List <string> addResponsibles, List <string> removeResponsibles, bool copyCustomFields, bool copyCustomStatuses, bool copyStatuses, bool copyParents, DateTime?rescheduleDate, FolderRescheduleMode?rescheduleMode, int entryLimit)
        {
            if (title == null)
            {
                throw new ArgumentNullException(nameof(title));
            }

            if (title.Trim() == string.Empty)
            {
                throw new ArgumentException("title can not be empty", nameof(title));
            }

            if (entryLimit < 1 || entryLimit > 250)
            {
                throw new ArgumentOutOfRangeException(nameof(entryLimit), "value must be in [1,250] range");
            }

            var contentBuilder = new WrikeFormUrlEncodedContentBuilder()
                                 .AddParameter("parent", parentFolderId)
                                 .AddParameter("title", title)
                                 .AddParameter("titlePrefix", titlePrefix)
                                 .AddParameter("copyDescriptions", copyDescriptions)
                                 .AddParameter("copyResponsibles", copyResponsibles)
                                 .AddParameter("addResponsibles", addResponsibles)
                                 .AddParameter("removeResponsibles", removeResponsibles)
                                 .AddParameter("copyCustomFields", copyCustomFields)
                                 .AddParameter("copyCustomStatuses", copyCustomStatuses)
                                 .AddParameter("copyStatuses", copyStatuses)
                                 .AddParameter("copyParents", copyParents)
                                 .AddParameter("rescheduleDate", rescheduleDate, new CustomDateTimeConverter("yyyy-MM-dd"))
                                 .AddParameter("rescheduleMode", rescheduleMode)
                                 .AddParameter("entryLimit", entryLimit);

            var response = await SendRequest <WrikeFolder>($"copy_folder/{folderId}", HttpMethods.Post,
                                                           contentBuilder.GetContent()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
示例#21
0
        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));
        }
示例#22
0
        async Task <WrikeTask> IWrikeTasksClient.DeleteAsync(WrikeClientIdParameter id)
        {
            var response = await SendRequest <WrikeTask>($"tasks/{id}", HttpMethods.Delete).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
        async Task <WrikeFolder> IWrikeFoldersAndProjectsClient.DeleteAsync(WrikeClientIdParameter folderId)
        {
            var response = await SendRequest <WrikeFolder>($"folders/{folderId} ", HttpMethods.Delete).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
 async Task IWrikeAttachmentsClient.DeleteAsync(WrikeClientIdParameter id)
 {
     await SendRequest <WrikeAttachment>($"attachments/{id}", HttpMethods.Delete, jsonConverter : new WrikeAttachmentConverter()).ConfigureAwait(false);
 }
 async Task IWrikeTimelogsClient.DeleteAsync(WrikeClientIdParameter id)
 {
     var response = await SendRequest <WrikeTimelog>($"timelogs/{id}", HttpMethods.Delete).ConfigureAwait(false);
 }
示例#26
0
        async Task <List <WrikeDependency> > IWrikeDependenciesClient.GetInTaskAsync(WrikeClientIdParameter taskId)
        {
            var response = await SendRequest <WrikeDependency>($"tasks/{taskId}/dependencies", HttpMethods.Get).ConfigureAwait(false);

            return(GetReponseDataList(response));
        }
        async Task <Stream> IWrikeAttachmentsClient.DownloadAsync(WrikeClientIdParameter id)
        {
            var response = await SendRequestAndGetStream <Stream>($"attachments/{id}/download", HttpMethods.Get).ConfigureAwait(false);

            return(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 <WrikeAttachmentUrl> IWrikeAttachmentsClient.GetAccessUrlAsync(WrikeClientIdParameter id)
        {
            var response = await SendRequest <WrikeAttachmentUrl>($"attachments/{id}/url", HttpMethods.Get).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }
示例#30
0
 async Task IWrikeDependenciesClient.DeleteAsync(WrikeClientIdParameter id)
 {
     await SendRequest <WrikeDependency>($"dependencies/{id}", HttpMethods.Delete).ConfigureAwait(false);
 }