Skip to main content

Function: categoryService()

categoryService(client): object

Defined in: service/CategoryService.ts:64

Service class for Category-related GraphQL operations

Parameters​

client​

GraphQLClient

Returns​

addProductsClustersToCategory()​

addProductsClustersToCategory(variables): Promise<CategoryAddProductsClustersResponse>

Adds products/clusters to a category *

Parameters​

variables​

CategoryAddProductsClustersVariables

Category add products/clusters input data *

Returns​

Promise<CategoryAddProductsClustersResponse>

Promise<Category> The updated category

categoryMoveAbove()​

categoryMoveAbove(variables): Promise&lt;Category[]>

Reorder a category so it appears immediately before another category within the same parent.

Parameters​

variables​

CategoryMoveAboveVariables

Returns​

Promise&lt;Category[]>

categoryMoveBelow()​

categoryMoveBelow(variables): Promise&lt;Category[]>

Reorder a category so it appears immediately after another category within the same parent.

Parameters​

variables​

CategoryMoveBelowVariables

Returns​

Promise&lt;Category[]>

createCategory()​

createCategory(variables): Promise&lt;Category>

Creates a new category *

Parameters​

variables​

CategoryCreateVariables

Category creation input data *

Returns​

Promise&lt;Category>

Promise<Category> The created category

getAttributeResultByCategoryId()​

getAttributeResultByCategoryId(categoryId, input): Promise&lt;AttributeResultResponse>

Fetches attribute results for a category *

Parameters​

categoryId​

number

Category ID *

input​

AttributeResultSearchInput

Attribute result search input *

Returns​

Promise&lt;AttributeResultResponse>

Promise<AttributeResultResponse> The attribute result response

getCategories()​

getCategories(filter?, userId?): Promise&lt;CategoryResponse>

Fetches a list of categories *

Parameters​

filter?​

any

Category filter criteria *

userId?​

number

User ID for personalization *

Returns​

Promise&lt;CategoryResponse>

Promise<Category[]> Array of categories

getCategory()​

getCategory(variables, fetchOptions?): Promise&lt;Category>

Fetches a single category by ID or slug *

Parameters​

variables​

CategoryQueryVariables

Variables for the category query

    • categoryId: number - Category ID to fetch
    • slug: string - Category slug to fetch
    • userId: number - User ID for personalization
    • hidden: boolean - Whether to include hidden categories
    • language: string - Language for localized content
    • priceCalculateProductInput: PriceCalculateProductInput - Price calculation input
    • categoryProductSearchInput: CategoryProductSearchInput - Category product search input
    • imageSearchFilters: MediaImageProductSearchInput - Image search filters
    • imageVariantFilters: TransformationsInput! - Image transformation filters
    • filterAvailableAttributeInput: FilterAvailableAttributeInput - Filter available attributes
fetchOptions?​

GraphQLFetchOptions

Returns​

Promise&lt;Category>

Promise<Category> The category data

getCategoryBySlug()​

getCategoryBySlug(variables): Promise&lt;Category>

Retrieve a single category by localized slug and language.

Parameters​

variables​

CategoryBySlugVariables

Returns​

Promise&lt;Category>

getCategoryBySource()​

getCategoryBySource(variables): Promise&lt;Category>

Retrieve a single category by its external source / source identifier pair.

Parameters​

variables​

CategoryBySourceVariables

Returns​

Promise&lt;Category>

getCategoryChildren()​

getCategoryChildren(variables): Promise&lt;Category[]>

Retrieve the direct child categories of a category.

Parameters​

variables​

CategoryChildrenVariables

Returns​

Promise&lt;Category[]>

getCategoryHierarchy()​

getCategoryHierarchy(variables): Promise&lt;Category[]>

Retrieve the ancestor chain of a category, ordered from the category itself up to the root.

Parameters​

variables​

CategoryHierarchyVariables

Returns​

Promise&lt;Category[]>

importCategoriesCsv()​

importCategoriesCsv(input): Promise&lt;CsvImportResponse>

Imports categories from CSV *

Parameters​

input​

CategoryCsvInput

CSV import input data *

Returns​

Promise&lt;CsvImportResponse>

Promise<CsvImportResponse> The import response

removeProductsClustersFromCategory()​

removeProductsClustersFromCategory(variables): Promise&lt;CategoryRemoveProductsClustersResponse>

Removes products/clusters from a category *

Parameters​

variables​

CategoryRemoveProductsClustersVariables

Category remove products/clusters input data *

Returns​

Promise&lt;CategoryRemoveProductsClustersResponse>

Promise<Category> The updated category

updateCategory()​

updateCategory(variables): Promise&lt;Category>

Updates an existing category *

Parameters​

variables​

CategoryUpdateVariables

Category update input data *

Returns​

Promise&lt;Category>

Promise<Category> The updated category