This is very initial draft of non-official Notion Beta API Client for Unity
- Zero dependencies
- Optional Json parser
- Focus on Database related endpoint
- Using Unity WebRequest + JsonUtility, basically should work on all platform
Creating a NotionAPI object.
var api = new NotionAPI(apiKey);
Example db scenario
Name (Title) | Tags (Multi-select) |
---|---|
Basic Attack | Attack, Defense |
Ranged Attack | Defense |
Getting the database object and querying the database as JSON.
private IEnumerator Start()
{
var api = new NotionAPI(apiKey);
yield return api.GetDatabase<CardDatabaseProperties>(database_id, (db) =>
{
Debug.Log(db.id);
Debug.Log(db.created_time);
Debug.Log(db.title.First().text.content);
});
yield return api.QueryDatabaseJSON(database_id, (db) =>
{
Debug.Log(db);
});
}
// For type parsing the db Property with JsonUtility
[Serializable]
public class CardDatabaseProperties
{
public MultiSelectProperty Tags;
public TitleProperty Name;
}
- Implement basic data model for Page
- Type parsed method for QueryDatabaseJSON
- Data Model accessibility (Implicit operator + Date conversion)
- Filter options for db query?