Skip to content

Commit da6cd0c

Browse files
Merge pull request #13 from notion-dotnet/add-basic-usage-example
Add basic usage example 💖
2 parents d74d3df + fdd5a90 commit da6cd0c

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,17 @@ dotnet add package Notion.Net
1919

2020
## Usage
2121

22-
Todo
22+
> Before getting started, you need to [create an integration](https://www.notion.com/my-integrations) and find the token. You can learn more about authorization [here](https://developers.notion.com/docs/authorization).
23+
24+
Import and initialize the client using the integration token created above.
25+
26+
![image](https://user-images.githubusercontent.com/18693839/119268863-79925b00-bc12-11eb-92cb-d5a9a8c57fdc.png)
27+
28+
Make A request to any Endpoint. For example you can call below to fetch the paginated list of users.
29+
30+
![image](https://user-images.githubusercontent.com/18693839/119268924-ae9ead80-bc12-11eb-9d1a-925267896d9e.png)
31+
32+
2333

2434
## Contribution Guideline
2535

examples/list-users/Program.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using System.Linq;
4+
using Notion.Client;
5+
6+
namespace list_users
7+
{
8+
class Program
9+
{
10+
static async Task Main(string[] args)
11+
{
12+
var client = new NotionClient(new ClientOptions
13+
{
14+
AuthToken = "<Token>"
15+
});
16+
17+
var usersList = await client.Users.ListAsync();
18+
19+
Console.WriteLine(usersList.Results.Count());
20+
}
21+
}
22+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net5.0</TargetFramework>
6+
<RootNamespace>list_users</RootNamespace>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Notion.Net" Version="0.2.0-beta" />
11+
</ItemGroup>
12+
13+
</Project>

0 commit comments

Comments
 (0)