diff --git a/src/Todoist.Net.Tests/Services/NotesServiceTests.cs b/src/Todoist.Net.Tests/Services/NotesServiceTests.cs index 0f02290..0c46f9e 100644 --- a/src/Todoist.Net.Tests/Services/NotesServiceTests.cs +++ b/src/Todoist.Net.Tests/Services/NotesServiceTests.cs @@ -33,8 +33,8 @@ public async Task AddNoteGetAndDelete_Success() var note = new Note("Hello"); await todoistClient.Notes.AddToProjectAsync(note, project.Id.PersistentId); - var notes = await todoistClient.Notes.GetAsync(); - Assert.Contains(notes, n => n.Id == note.Id); + var notesInfo = await todoistClient.Notes.GetAsync(); + Assert.Contains(notesInfo.ProjectNotes, n => n.Id == note.Id); await todoistClient.Projects.DeleteAsync(project.Id); } diff --git a/src/Todoist.Net/Models/NotesInfo.cs b/src/Todoist.Net/Models/NotesInfo.cs new file mode 100644 index 0000000..3d690a4 --- /dev/null +++ b/src/Todoist.Net/Models/NotesInfo.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace Todoist.Net.Models +{ + /// + /// Represents collections of item and project notes. + /// + public class NotesInfo + { + /// + /// Gets the item notes. + /// + /// + /// The item notes. + /// + public IReadOnlyCollection ItemNotes { get; internal set; } + + /// + /// Gets the project notes. + /// + /// + /// The project notes. + /// + public IReadOnlyCollection ProjectNotes { get; internal set; } + } +} diff --git a/src/Todoist.Net/Services/INotesServices.cs b/src/Todoist.Net/Services/INotesServices.cs index fd51a59..2e742ce 100644 --- a/src/Todoist.Net/Services/INotesServices.cs +++ b/src/Todoist.Net/Services/INotesServices.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using System.Net.Http; using System.Threading; using System.Threading.Tasks; @@ -19,6 +18,6 @@ public interface INotesServices : INotesCommandServices /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// The notes. /// API exception. - Task> GetAsync(CancellationToken cancellationToken = default); + Task GetAsync(CancellationToken cancellationToken = default); } } diff --git a/src/Todoist.Net/Services/NotesService.cs b/src/Todoist.Net/Services/NotesService.cs index 1bd0c7a..28c0380 100644 --- a/src/Todoist.Net/Services/NotesService.cs +++ b/src/Todoist.Net/Services/NotesService.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -19,11 +18,15 @@ internal NotesService(IAdvancedTodoistClient todoistClient) } /// - public async Task> GetAsync(CancellationToken cancellationToken = default) + public async Task GetAsync(CancellationToken cancellationToken = default) { var response = await TodoistClient.GetResourcesAsync(cancellationToken, ResourceType.Notes).ConfigureAwait(false); - return response.Notes; + return new NotesInfo + { + ItemNotes = response.Notes, + ProjectNotes = response.ProjectNotes + }; } } }