Logo

Categories

The categories module provides methods to interact with the categories API.

getCategories

Get all contents from the workspace.

import { postivaClient } from "@/libs/postiva";
 
async function getCategories() {
  try {
    const categories = await postivaClient.categories.getCategories();
    console.log(categories);
  } catch (error) {
    console.error('Error fetching categories:', error);
  }
}

Parameters

PropTypeDefault
query
string
-

getCategoryById

Get a category by its ID.

import { postivaClient } from "@/libs/postiva";
 
async function getCategoryById(id: string) {
  try {
    const category = await postivaClient.categories.getCategoryById(id);
    console.log(category);
  } catch (error) {
    console.error('Error fetching category:', error);
  }
}

On this page