Skip to content

Commit a7bf03f

Browse files
Update Readme with DI extension details 📝
1 parent 21e5cea commit a7bf03f

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ dotnet add package Notion.Net
5252
Import and initialize the client using the integration token created above.
5353

5454
```csharp
55-
var client = new NotionClient(new ClientOptions
55+
var client = NotionClientFactory.Create(new ClientOptions
5656
{
5757
AuthToken = "<Token>"
5858
});
@@ -64,6 +64,16 @@ Make A request to any Endpoint. For example you can call below to fetch the pagi
6464
var usersList = await client.Users.ListAsync();
6565
```
6666

67+
## Dependency Injection
68+
69+
Library also provides extension method to register NotionClient with Microsoft dependency injection.
70+
71+
```
72+
services.AddNotionClient(options => {
73+
AuthToken = "<Token>"
74+
});
75+
```
76+
6777
### Querying a database
6878

6979
After you initialized your client and got an id of a database, you can query it for any contained pages. You can add filters and sorts to your request. Here is a simple example:

docs/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dotnet add package Notion.Net
1919
Import and initialize the client using the integration token created above.
2020

2121
```csharp
22-
var client = new NotionClient(new ClientOptions
22+
var client = NotionClientFactory.Create(new ClientOptions
2323
{
2424
AuthToken = "<Token>"
2525
});
@@ -31,6 +31,16 @@ Make A request to any Endpoint. For example you can call below to fetch the pagi
3131
var usersList = await client.Users.ListAsync();
3232
```
3333

34+
## Register using Microsoft.Extensions.DependencyInjection
35+
36+
Library also provides extension method to register NotionClient with Microsoft dependency injection.
37+
38+
```
39+
services.AddNotionClient(options => {
40+
AuthToken = "<Token>"
41+
});
42+
```
43+
3444
### Querying a database
3545

3646
After you initialized your client and got an id of a database, you can query it for any contained pages. You can add filters and sorts to your request. Here is a simple example:

0 commit comments

Comments
 (0)