1.0.1 • Published 1 year ago

react-notion-cacher-client v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

install

# yarn
yarn add react-notion-cacher-client

# npm
npm install react-notion-cacher-client

Usage

import { ReactNotionCacherClient } from "react-notion-cacher-client";

const client = new ReactNotionCacherClient({
    auth: "...", // client.page.get() 만 이용할 예정이라면 auth는 작성하지 않아도 됩니다.
    baseUrl: "...",
});

// 만약 auth 속성을 인스턴스 생성 시점이 아닌 다른 시점에서 하고 싶다면 client.updateAuth('TOKEN') 을 사용하세요
client.updateAuth("TOKEN");

(async () => {
    console.log(
        await client.page.get({
            pageId: "...",
        })
    );
})();

API Map

각 엔드포인트의 payload는 API 문서에 적힌 내용과 같습니다. API 자체에 대한 문서는 react-notion-cacher-backend의 README.md를 참고하세요.

EndpointFunction
POST /auth/signinclient.auth.signIn()
POST /auth/signupclient.auth.signUp()
DELETE /auth/accountclient.auth.deleteAccount()
GET /pageclient.page.get()
GET /pagesclient.page.list()
PATCH /page/:pageIdclient.page.patch()
DELETE /page/:pageIdclient.page.delete()

API Object

자주 사용되는 오브젝트는 별도의 타입으로 분리되어 있습니다.

  • PageObject
type PageObject = {
    pageId: string;
    pageCode: string | undefined;
    domain: string;
    cachedAt: string;
    recordMap: any;
};
1.0.1

1 year ago

1.0.0

1 year ago