OneEntry Platform 2.0.1 Help

Sorting and filtering of products

Большинство методов работы с продуктами поддерживаю пагинацию, сортировку и фильтрацию контента. Их можно узнать по следующим параметрам:

  • Пагинация

    • offset: задает смещение

    • limit: задает ограничение выдаваемых элементов

  • Сортировка

    • sortKey: поле, по которому будет сортироваться контент. К примеру: price, rate и тд.

    • sortOrder: направление сортировки ASC, DESC

  • Фильтрация

    • filter: построитель фильтров. По умолчанию фильры не применяются

Kotlin Multiplatform Sample

The presented code demonstrates all the functionality listed. The result of execution will be thirty products sorted in ascending order of product prices, with a rating greater than 5.

val result = CatalogService.all( offset = 0, limit = 30, sortKey = "price", sortOrder = SortOrder.DESC, langCode = "en_US", filter = { put { attributeMarker = "rate" conditionMarker = ConditionMarker.GREATER_THEN conditionValue = AttributeValue.fromDouble(5.0) } } )

Swift Sample

The presented code demonstrates all the functionality listed. The result of execution will be thirty products sorted in ascending order of product prices, with a rating greater than 5.

let result = try await CatalogService.shared.all( offset: 0, limit: 30, sortKey: "price", sortOrder: .desc, langCode: "en_US", filter: { ConditionBlock( attributeMarker: "rate", conditionMarker: .greaterThen, conditionValue: .init(double: 5.0) ) } )
Last modified: 18 February 2025