This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
var client = new NotionClient(new ClientOptions | |
{ | |
AuthToken = "secret_d6dNtdaIffTAGhDXRhha4ddsdsy0dAfsr27ct3acszPnNOmGIY" | |
}); | |
var databasesQueryParameters = new DatabasesQueryParameters(); | |
var databaseId = "8a71f62d45aaf24e8dbdsdsd9090f703181e33"; | |
var queryResult = await client.Databases.QueryAsync(databaseId,databasesQueryParameters); | |
Console.WriteLine(queryResult.Results.Count); | |
foreach (var result in queryResult.Results) | |
{ | |
Console.WriteLine("Page Id: " + result.Id); | |
foreach (var property in result.Properties) | |
{ | |
Console.WriteLine(property.Key + " " + GetValue(property.Value)); | |
} | |
} | |
Console.ReadKey(); | |
} | |
static object GetValue(PropertyValue p) | |
{ | |
switch (p) | |
{ | |
case RichTextPropertyValue richTextPropertyValue: | |
return richTextPropertyValue.RichText.FirstOrDefault()?.PlainText; | |
default: | |
return null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment