/// <summary>
        /// Updates the section.
        /// </summary>
        /// <param name="moveArgument">The move argument.</param>
        /// <returns>
        /// Returns <see cref="T:System.Threading.Tasks.Task" />.The task object representing the asynchronous operation.
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="moveArgument" /> is <see langword="null" /></exception>
        /// <exception cref="AggregateException">Command execution exception.</exception>
        /// <exception cref="HttpRequestException">API exception.</exception>
        public Task MoveAsync(SectionMoveArgument moveArgument)
        {
            if (moveArgument == null)
            {
                throw new ArgumentNullException(nameof(moveArgument));
            }

            var command = new Command(CommandType.MoveSection, moveArgument);

            return(ExecuteCommandAsync(command));
        }
Exemplo n.º 2
0
        public async Task CreateArchiveUnarchiveDelete_Success()
        {
            var client = TodoistClientFactory.Create();

            var projectId = await client.Projects.AddAsync(new Project("test"));

            var sectionId = await client.Sections.AddAsync(new Section("test", projectId));

            await client.Sections.ArchiveAsync(sectionId);

            await client.Sections.UnarchiveAsync(sectionId);

            var projectTwoId = await client.Projects.AddAsync(new Project("test2"));

            var sectionMoveArgument = new SectionMoveArgument(sectionId, projectTwoId);
            await client.Sections.MoveAsync(sectionMoveArgument);

            await client.Sections.DeleteAsync(sectionId);

            await client.Projects.DeleteAsync(projectId);

            await client.Projects.DeleteAsync(projectTwoId);
        }