API Reference
getBlogs()
Returns a paginated list of blogs, optionally filtered by a search query across title, description, and slug.
Code
const result = await client.getBlogs(pagination?: PaginationOptions)
// returns: PaginatedResult<Blog>Parameters
| Param | Type | Default | Description |
|---|---|---|---|
| page | number | 1 | 1-indexed page number. Clamped to min 1. |
| limit | number | 10 | Items per page. Clamped to 1-100. |
| query | string | "" | Search string. Matched case-insensitively against title, description, and slug. |
Return value
For Relevant TypeScript types.
Code
{
data: Blog[],
pagination: {
page: number, // current page
limit: number, // items per page
total: number, // total matching blogs
totalPages: number, // Math.ceil(total / limit)
hasMore: boolean, // page < totalPages
}
}Example
Code
const result = await client.getBlogs({
page: 2,
limit: 6,
query: "react",
});
console.log(result.pagination.total); // e.g. 14
console.log(result.pagination.hasMore); // true
result.data.forEach((b) => console.log(b.title));Info
The
query string is trimmed and collapsed before it is sent to client methods.