UNPKG

@padhariyavishal/nextpress

Version:
38 lines (35 loc) 1.22 kB
import { getCollectionArgs } from "./types"; const CollectionModel = require("./model"); export class Collection extends CollectionModel { /** * * @param args * @returns QueryResult * * @example * * ```bash * * get_collections({ * id: 1, // IF want to get Collection by ID * s: "test", // IF want to get data by searched value * ctype : "blog", // Required parameter to fetch collection. Value will be the type of the collection * status: "publish", // Default value will be publish. (eg., publish, draft, private, trash) * per_page: 10, // Default value 10. To fetch more collection per page. * order: "date", // Field key to Order response by that key. * orderby: "ASC", // You can ASC / DESC to fetch data by order. * by_category: { * key: "name", * value: "uncategorie" * }, // Fetch data by filtered categories. * by_author: "admin" // Fetch data by username / author. * parent: 0 // parent collection id if want to fetch data by parent.Default value 0. * }) * * ``` * */ public async get_collections(args: getCollectionArgs) { return await this.get(args); } }