Skip to content

Commit

Permalink
Add a core library and a class to retrieve todo items
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetseckin committed Oct 11, 2019
1 parent 3a8a317 commit a5afc14
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Todo.CLI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
13 changes: 13 additions & 0 deletions src/Todo.Core/ITodoItemRetriever.cs
Original file line number Diff line number Diff line change
@@ -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<IEnumerable<OutlookTask>> ListAsync();
}
}
12 changes: 12 additions & 0 deletions src/Todo.Core/Todo.Core.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Graph.Auth" Version="1.0.0-preview.1" />
<PackageReference Include="Microsoft.Graph.Beta" Version="0.8.0-preview" />
</ItemGroup>

</Project>
24 changes: 24 additions & 0 deletions src/Todo.Core/TodoItemRetriever.cs
Original file line number Diff line number Diff line change
@@ -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<IEnumerable<OutlookTask>> ListAsync()
{
var graphServiceClient = new GraphServiceClient(AuthenticationProvider);
return await graphServiceClient.Me.Outlook.Tasks.Request().GetAsync();
}
}
}

0 comments on commit a5afc14

Please sign in to comment.