Skip to content

Commit 1473270

Browse files
add sdk usage example to print users count 🎉
1 parent d74d3df commit 1473270

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

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)