l7note
Version:
Access your notion notes quick
29 lines (24 loc) • 709 B
text/typescript
import { Client } from '@notionhq/client/build/src/index.js';
import { UpdatePageParameters } from '@notionhq/client/build/src/api-endpoints';
import { Note } from '../Note.js';
import { globalConfig } from '../setup.js';
import chalk from 'chalk';
import { exit } from 'process';
const markAsDone = async (note: Note) => {
try {
const notion = new Client({ auth: globalConfig.token });
const data: UpdatePageParameters = {
page_id: note.id,
properties: {
Done: {
checkbox: true,
},
},
};
await notion.pages.update(data);
} catch (err) {
console.log(chalk.red('There was an error updating your note'));
exit(1);
}
};
export { markAsDone };