import { SnackBaseClient } from "@snackbase/sdk";
const client = new SnackBaseClient({
baseUrl: "https://api.example.com",
});
async function searchPosts() {
// Find published posts from 2024 with "tutorial" in title
const results = await client.records
.query("posts")
.expand("author")
.filter("status", "=", "published")
.filter("createdAt", ">=", "2024-01-01")
.filter("createdAt", "<", "2025-01-01")
.filter("title", "~", "tutorial")
.sort("createdAt", "desc")
.page(1, 20)
.get();
console.log(`Found ${results.total} posts`);
return results.items;
}