基本的な使用方法
データベースからすべてのアイテムを取得:型安全性
NotCMSはリスト結果に対して完全な型推論を提供します:次のステップ
単一アイテムの取得
個別アイテムの取得方法を学ぶ
クライアントAPI
完全なクライアントAPIを探索
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Notionデータベースから複数のアイテムをクエリして一覧取得
const [posts, error] = await nc.query.blog.list();
if (!error) {
posts.forEach(post => {
console.log(post.title);
});
}
// 配列型を推論
type BlogPosts = typeof nc.query.blog.$inferPages;
// 関数で使用
function processPosts(posts: BlogPosts) {
posts.forEach(post => {
// 完全な型安全性とIDEの自動補完
console.log(post.title);
console.log(post.published);
});
}