@spree/docs 0.1.305 → 0.1.307

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,7 +43,20 @@ curl -G 'https://store.example.com/api/v3/admin/orders' \
43
43
  | `gt` / `gteq` | Greater than / greater than or equal | `total_gteq: 100` | `q[total_gteq]=100` |
44
44
  | `in` | In a list | `status_in: ['complete', 'canceled']` | `q[status_in][]=complete&q[status_in][]=canceled` |
45
45
  | `null` / `not_null` | Is null / not null | `completed_at_not_null: true` | `q[completed_at_not_null]=true` |
46
- | `true` / `false` | Boolean | `accepts_email_marketing_true: 1` | `q[accepts_email_marketing_true]=1` |
46
+ | `eq` on a true/false field | Is true, or is false | `accepts_email_marketing_eq: false` | `q[accepts_email_marketing_eq]=false` |
47
+
48
+ ### Which filters an endpoint accepts
49
+
50
+ Each list endpoint accepts the attributes, associations and scopes its resource allows, and only the predicates that fit each attribute's kind of value:
51
+
52
+ | Kind of value | Predicates |
53
+ |---|---|
54
+ | Text | `eq` `not_eq` `in` `not_in` `cont` `i_cont` `not_cont` `start` `end` `null` `not_null` `present` `blank` |
55
+ | Amounts, counts, dates and times | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
56
+ | Statuses, prefixed IDs and types | `eq` `not_eq` `in` `not_in` `null` `not_null` |
57
+ | True or false | `eq` `not_eq` `in` `not_in` `true` `false` `null` |
58
+
59
+ Filters reach associated records at most two levels deep (`line_items_variant_sku_eq`). The API reference lists each documented endpoint's filters and sortable fields in its `x-spree-filters` entry, and the SDK types that endpoint's `list()` call from it, so a misspelled filter or sort field is a compile error rather than an unfiltered response. Filters your own app adds need [a one-time declaration](../../developer/core-concepts/search-filtering.md#using-your-own-filters-from-typescript) before TypeScript accepts them. List methods of endpoints the reference does not document yet accept any filter.
47
60
 
48
61
  ### Prefixed IDs in filters
49
62
 
@@ -100,9 +113,9 @@ const customers = await client.customers.list({
100
113
  tags_name_eq: 'wholesale',
101
114
  })
102
115
 
103
- // Products in a specific category
104
- const products = await client.products.list({
105
- taxons_id_eq: 'ctg_xxx',
116
+ // Orders containing a specific variant
117
+ const orders = await client.orders.list({
118
+ line_items_variant_id_eq: 'variant_xxx',
106
119
  })
107
120
  ```
108
121
 
@@ -37,20 +37,32 @@ curl -G 'http://localhost:3000/api/v3/store/products' \
37
37
  | `cont` | Contains (case-insensitive) | `name_cont: 'shirt'` | `q[name_cont]=shirt` |
38
38
  | `start` | Starts with | `name_start: 'Spree'` | `q[name_start]=Spree` |
39
39
  | `end` | Ends with | `slug_end: 'tote'` | `q[slug_end]=tote` |
40
- | `lt` | Less than | `price_lt: 50` | `q[price_lt]=50` |
41
- | `lteq` | Less than or equal | `price_lteq: 50` | `q[price_lteq]=50` |
42
- | `gt` | Greater than | `price_gt: 10` | `q[price_gt]=10` |
43
- | `gteq` | Greater than or equal | `price_gteq: 10` | `q[price_gteq]=10` |
40
+ | `lt` | Less than | `available_on_lt: '2026-01-01'` | `q[available_on_lt]=2026-01-01` |
41
+ | `lteq` | Less than or equal | `depth_lteq: 1` | `q[depth_lteq]=1` |
42
+ | `gt` | Greater than | `products_count_gt: 0` | `q[products_count_gt]=0` |
43
+ | `gteq` | Greater than or equal | `available_on_gteq: '2026-01-01'` | `q[available_on_gteq]=2026-01-01` |
44
44
  | `in` | In a list | `status_in: ['active', 'draft']` | `q[status_in][]=active&q[status_in][]=draft` |
45
45
  | `null` | Is null | `deleted_at_null: true` | `q[deleted_at_null]=true` |
46
46
  | `not_null` | Is not null | `completed_at_not_null: true` | `q[completed_at_not_null]=true` |
47
47
  | `present` | Is present (not empty) | `description_present: true` | `q[description_present]=true` |
48
48
  | `blank` | Is blank (null or empty) | `description_blank: true` | `q[description_blank]=true` |
49
- | `true` | Is true (boolean) | `purchasable_true: 1` | `q[purchasable_true]=1` |
50
- | `false` | Is false (boolean) | `purchasable_false: 1` | `q[purchasable_false]=1` |
49
+ | `eq` on a true/false field | Is true, or is false | `automatic_eq: true` | `q[automatic_eq]=true` |
51
50
 
52
51
  > **NOTE:** The SDK automatically wraps filter keys in `q[...]` and appends `[]` for array values — just pass flat params.
53
52
 
53
+ ### Which filters an endpoint accepts
54
+
55
+ Each list endpoint accepts the attributes, associations and scopes its resource allows, and only the predicates that fit each attribute's kind of value:
56
+
57
+ | Kind of value | Predicates |
58
+ |---|---|
59
+ | Text | `eq` `not_eq` `in` `not_in` `cont` `i_cont` `not_cont` `start` `end` `null` `not_null` `present` `blank` |
60
+ | Amounts, counts, dates and times | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
61
+ | Statuses, prefixed IDs and types | `eq` `not_eq` `in` `not_in` `null` `not_null` |
62
+ | True or false | `eq` `not_eq` `in` `not_in` `true` `false` `null` |
63
+
64
+ Filters reach associated records at most two levels deep (`categories_name_eq`). The API reference lists each documented endpoint's filters and sortable fields in its `x-spree-filters` entry, and the SDK types that endpoint's `list()` call from it, so a misspelled filter or sort field is a compile error rather than an unfiltered response. Filters your own app adds need [a one-time declaration](../../developer/core-concepts/search-filtering.md#using-your-own-filters-from-typescript) before TypeScript accepts them. List methods of endpoints the reference does not document yet accept any filter.
65
+
54
66
  ### Combining Filters
55
67
 
56
68
  Multiple filters are combined with AND logic:
@@ -60,8 +72,8 @@ Multiple filters are combined with AND logic:
60
72
  // Products that contain "shirt" AND cost between $20-$100
61
73
  const products = await client.products.list({
62
74
  name_cont: 'shirt',
63
- price_gteq: 20,
64
- price_lteq: 100,
75
+ price_gte: 20,
76
+ price_lte: 100,
65
77
  })
66
78
  ```
67
79
 
@@ -69,8 +81,8 @@ const products = await client.products.list({
69
81
  curl -G 'http://localhost:3000/api/v3/store/products' \
70
82
  -H 'X-Spree-Api-Key: pk_xxx' \
71
83
  --data-urlencode 'q[name_cont]=shirt' \
72
- --data-urlencode 'q[price_gteq]=20' \
73
- --data-urlencode 'q[price_lteq]=100'
84
+ --data-urlencode 'q[price_gte]=20' \
85
+ --data-urlencode 'q[price_lte]=100'
74
86
  ```
75
87
 
76
88