From 1473270dc2a4f8e7504f19459a4b5bf0504c177d Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sun, 23 May 2021 21:58:53 +0530 Subject: [PATCH 1/2] add sdk usage example to print users count :tada: --- examples/list-users/Program.cs | 22 ++++++++++++++++++++++ examples/list-users/list-users.csproj | 13 +++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 examples/list-users/Program.cs create mode 100644 examples/list-users/list-users.csproj diff --git a/examples/list-users/Program.cs b/examples/list-users/Program.cs new file mode 100644 index 00000000..0358b1f2 --- /dev/null +++ b/examples/list-users/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Threading.Tasks; +using System.Linq; +using Notion.Client; + +namespace list_users +{ + class Program + { + static async Task Main(string[] args) + { + var client = new NotionClient(new ClientOptions + { + AuthToken = "" + }); + + var usersList = await client.Users.ListAsync(); + + Console.WriteLine(usersList.Results.Count()); + } + } +} diff --git a/examples/list-users/list-users.csproj b/examples/list-users/list-users.csproj new file mode 100644 index 00000000..712c266b --- /dev/null +++ b/examples/list-users/list-users.csproj @@ -0,0 +1,13 @@ + + + + Exe + net5.0 + list_users + + + + + + + From fdd5a90b5a8681ed50ccfc6201957d122c168d7a Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sun, 23 May 2021 22:06:42 +0530 Subject: [PATCH 2/2] Update README.md add usage example. --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 70464870..6b137803 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,17 @@ dotnet add package Notion.Net ## Usage -Todo +> 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). + +Import and initialize the client using the integration token created above. + +![image](https://user-images.githubusercontent.com/18693839/119268863-79925b00-bc12-11eb-92cb-d5a9a8c57fdc.png) + +Make A request to any Endpoint. For example you can call below to fetch the paginated list of users. + +![image](https://user-images.githubusercontent.com/18693839/119268924-ae9ead80-bc12-11eb-9d1a-925267896d9e.png) + + ## Contribution Guideline