Giter Site home page Giter Site logo

notionapi-agent's Introduction

notionapi-agent

version language license

Unofficial Node.js API client for Notion.so.

โš  If you need to use Notion's API in production, I recommend waiting for their official release.

Installation

npm install notionapi-agent

Getting Started

Basic Usage

Try notionapi-agent on RunKit

const { createAgent } = require("notionapi-agent")

const agent = createAgent()

async function main() {

  const pageId = "181e961a-eb5c-4ee6-9153-07c0dfd5156d"

  try {
    const result = await agent.getRecordValues({
      requests: [{ id: pageId, table: "block" }]
    })
    console.log(result)
  } catch (error) {
    console.log(error)
  }

}

main()

The result is always the response of a successful request (HTTP status 200 OK). If Notion responds with other status code or the request failed, an error is thrown.

Advanced Usage

There is an example to demonstrate how to download all blocks of a page.

To access private content, one need the token.

Development

Project Structure

project structure graph

Documentation

Use TypeStrong/typedoc to generate reference documentation. It needs to be installed globally.

npm i -g typedoc

Packaging

Use rollup/rollup to package multiple source files into one cjs module (dist/index.js) and one esm module (dist/index.esm.js). Use tsc --emitDeclarationOnly to generate TypeScript declaration files.

notionapi-agent's People

Contributors

dragonman225 avatar txus avatar riexn avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.