Skip to content

Category

Nicolas-B06 edited this page Feb 15, 2022 · 15 revisions

/src/api/category/index.js

Functions

Get a list of categories

getCategories(lang, postBody)
  • lang - string? : current language ("fr" is the default value) - Optional
  • postBody - any : request body overload - Optional
Example
import { getCategories } from 'aquila-connector/api/category';
const postBody = { PostBody: { filter: { [`translation.fr.slug`]: { $in: ['code1', 'code2'] } }, limit: 9999 } };
const categories = await getCategories('fr', postBody );

Get a category

getCategory(lang, postBody)
  • lang - string? : current language ("fr" is the default value) - Optional
  • postBody - any : request body overload - Optional
Example
import { getCategory } from 'aquila-connector/api/category';
const postbody = { lang, PostBody: { filter: { code: attributes.value }};
const category = await getCategory('fr', postbody);

Retrieves the products of a category

getCategoryProducts(slug, id, lang, postBody)
  • slug - string : Category slug
  • id - string : Category ID
  • lang - string? : current language ("fr" is the default value) - Optional
  • postBody - any : request body overload
Examples
import { getCategoryProducts } from 'aquila-connector/api/category';
const categories = await getCategoryProducts('category_slug');
import { getCategoryProducts } from 'aquila-connector/api/category';
const categories = await getCategoryProducts('', 'category_id');
import { getCategoryProducts } from 'aquila-connector/api/category';
const postBody = PostBody: {filter: {$and: [{ "$or": [{"price.ati.normal":{"$gte":0,"$lte":20}}, {"price.ati.special":{"$gte":0,"$lte":20}}]}]}, limit: 15};
const categories = await getCategoryProducts('', 'category_id', 'fr', postBody);

Clone this wiki locally