4. Filtering result with specific fields - SphereMall/Android-MS-Client GitHub Wiki

Filtering result with specific fields

// Get resource by id with specific fields:
client.products()
       .fields("price", "title")
       .get(productId);
       
// Get list of resources with specific fields:
client.products()
       .fields("id", "title")
       .limit(10)
       .all();

Filtering Results

client.products()
       .filters(
                new Predicate("title", FilterOperators.EQUAL, "Product title"),
                new Predicate("id", FilterOperators.NOT_EQUAL, "6329"))
       .all()

Available filter operators

  • LIKE = "l";
  • LIKE_LEFT = "ll"
  • LIKE_RIGHT = "lr";
  • EQUAL = "e";
  • NOT_EQUAL = "ne";
  • GREATER_THAN = "gt";
  • LESS_THAN = "lt";
  • GREATER_THAN_OR_EQUAL = "gte";
  • LESS_THAN_OR_EQUAL = "lte";
  • IS_NULL = "is";

In filter with list if values for field (title IN ('title1', 'title2')):

client.products()
       .in("id", "6329", "6351")
       .all();

Get list by ids

client.products()
       .ids(id1, id2, id3)
       .all();