UNPKG

l7note

Version:

Access your notion notes quick

36 lines (30 loc) 838 B
import { Client } from '@notionhq/client/build/src/index.js'; import { Note } from '../Note.js'; import { globalConfig } from '../setup.js'; import chalk from 'chalk'; import { exit } from 'process'; const markAsDeleteByNote = async (note: Note) => { try { const notion = new Client({ auth: globalConfig.token }); await notion.pages.update({ page_id: note.id, archived: true, }); } catch (err) { console.log(chalk.red('Page id not found')); exit(1); } }; const markAsDeleteById = async (noteId: string) => { try { const notion = new Client({ auth: globalConfig.token }); await notion.pages.update({ page_id: noteId, archived: true, }); } catch (err) { console.log(chalk.red('Page id not found')); exit(1); } }; export { markAsDeleteByNote, markAsDeleteById };