File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+ using Notion . Client ;
3+
4+ namespace Microsoft . Extensions . DependencyInjection
5+ {
6+ public static class ServiceCollectionExtensions
7+ {
8+ public static IServiceCollection AddNotionClient ( this IServiceCollection services , Action < ClientOptions > options )
9+ {
10+ services . AddSingleton < INotionClient , NotionClient > ( sp => {
11+ var clientOptions = new ClientOptions ( ) ;
12+ options ? . Invoke ( clientOptions ) ;
13+
14+ return NotionClientFactory . Create ( clientOptions ) ;
15+ } ) ;
16+
17+ return services ;
18+ }
19+ }
20+ }
Original file line number Diff line number Diff line change 2323 <PackageReference Include =" Newtonsoft.Json" Version =" 13.0.1" />
2424 <PackageReference Include =" JsonSubTypes" Version =" 1.8.0" />
2525 <PackageReference Include =" Microsoft.Extensions.Logging.Abstractions" Version =" 5.0.0" />
26+ <PackageReference Include =" Microsoft.Extensions.DependencyInjection.Abstractions" Version =" 5.0.0" />
2627 </ItemGroup >
2728
2829 <ItemGroup >
You can’t perform that action at this time.
0 commit comments