From a5afc14fc8dfdde24d106408a2ed57b382394a60 Mon Sep 17 00:00:00 2001 From: Mehmet Seckin <1876867+mehmetseckin@users.noreply.github.com> Date: Fri, 11 Oct 2019 00:03:27 +0000 Subject: [PATCH] Add a core library and a class to retrieve todo items --- src/Todo.CLI.sln | 6 ++++++ src/Todo.Core/ITodoItemRetriever.cs | 13 +++++++++++++ src/Todo.Core/Todo.Core.csproj | 12 ++++++++++++ src/Todo.Core/TodoItemRetriever.cs | 24 ++++++++++++++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 src/Todo.Core/ITodoItemRetriever.cs create mode 100644 src/Todo.Core/Todo.Core.csproj create mode 100644 src/Todo.Core/TodoItemRetriever.cs diff --git a/src/Todo.CLI.sln b/src/Todo.CLI.sln index f38724c..fd60de8 100644 --- a/src/Todo.CLI.sln +++ b/src/Todo.CLI.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.29326.143 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Todo.CLI", "Todo.CLI\Todo.CLI.csproj", "{DAE1B155-3197-4C6A-A447-E042DE7185F3}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Todo.Core", "Todo.Core\Todo.Core.csproj", "{B0359C3C-B44F-4F18-9A7F-D879B7C368E4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {DAE1B155-3197-4C6A-A447-E042DE7185F3}.Debug|Any CPU.Build.0 = Debug|Any CPU {DAE1B155-3197-4C6A-A447-E042DE7185F3}.Release|Any CPU.ActiveCfg = Release|Any CPU {DAE1B155-3197-4C6A-A447-E042DE7185F3}.Release|Any CPU.Build.0 = Release|Any CPU + {B0359C3C-B44F-4F18-9A7F-D879B7C368E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0359C3C-B44F-4F18-9A7F-D879B7C368E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0359C3C-B44F-4F18-9A7F-D879B7C368E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0359C3C-B44F-4F18-9A7F-D879B7C368E4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Todo.Core/ITodoItemRetriever.cs b/src/Todo.Core/ITodoItemRetriever.cs new file mode 100644 index 0000000..bf8af56 --- /dev/null +++ b/src/Todo.Core/ITodoItemRetriever.cs @@ -0,0 +1,13 @@ +using Microsoft.Graph; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace Todo.Core +{ + public interface ITodoItemRetriever + { + Task> ListAsync(); + } +} diff --git a/src/Todo.Core/Todo.Core.csproj b/src/Todo.Core/Todo.Core.csproj new file mode 100644 index 0000000..80480b6 --- /dev/null +++ b/src/Todo.Core/Todo.Core.csproj @@ -0,0 +1,12 @@ + + + + netcoreapp3.0 + + + + + + + + diff --git a/src/Todo.Core/TodoItemRetriever.cs b/src/Todo.Core/TodoItemRetriever.cs new file mode 100644 index 0000000..e43e7d3 --- /dev/null +++ b/src/Todo.Core/TodoItemRetriever.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Graph; + +namespace Todo.Core +{ + public class TodoItemRetriever : ITodoItemRetriever + { + private IAuthenticationProvider AuthenticationProvider { get; } + + public TodoItemRetriever(IAuthenticationProvider authenticationProvider) + { + AuthenticationProvider = authenticationProvider; + } + + public async Task> ListAsync() + { + var graphServiceClient = new GraphServiceClient(AuthenticationProvider); + return await graphServiceClient.Me.Outlook.Tasks.Request().GetAsync(); + } + } +}