Skip to content

Notion API Client for Unity

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta
Notifications You must be signed in to change notification settings

BennyKok/unity-notion-api

Repository files navigation

Notion API for Unity

This is very initial draft of non-official Notion Beta API Client for Unity

Aim

  • Zero dependencies
  • Optional Json parser
  • Focus on Database related endpoint
  • Using Unity WebRequest + JsonUtility, basically should work on all platform

Example

Creating a NotionAPI object.

var api = new NotionAPI(apiKey);

Example db scenario

Card Database

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;
}

TO-DO

  • Implement basic data model for Page
  • Type parsed method for QueryDatabaseJSON
  • Data Model accessibility (Implicit operator + Date conversion)
  • Filter options for db query?

About

Notion API Client for Unity

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages