@spree/sdk 0.8.0 → 0.8.1
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.
- package/README.md +14 -27
- package/dist/{index-CM4b4ZtS.d.cts → index-7DYT6LIh.d.cts} +38 -52
- package/dist/{index-CM4b4ZtS.d.ts → index-7DYT6LIh.d.ts} +38 -52
- package/dist/index.cjs +12 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -26
- package/dist/index.d.ts +13 -26
- package/dist/index.js +12 -28
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/zod/index.cjs +36 -47
- package/dist/zod/index.cjs.map +1 -1
- package/dist/zod/index.d.cts +5 -24
- package/dist/zod/index.d.ts +5 -24
- package/dist/zod/index.js +36 -46
- package/dist/zod/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -150,7 +150,7 @@ const products = await client.products.list({
|
|
|
150
150
|
limit: 25,
|
|
151
151
|
name_cont: 'shirt',
|
|
152
152
|
sort: 'price asc',
|
|
153
|
-
expand: ['variants', 'images', '
|
|
153
|
+
expand: ['variants', 'images', 'categories'],
|
|
154
154
|
});
|
|
155
155
|
|
|
156
156
|
// Get single product by ID or slug
|
|
@@ -158,38 +158,27 @@ const product = await client.products.get('spree-tote', {
|
|
|
158
158
|
expand: ['variants', 'images'],
|
|
159
159
|
});
|
|
160
160
|
|
|
161
|
-
// Get available filters (price range, availability, options,
|
|
161
|
+
// Get available filters (price range, availability, options, categories)
|
|
162
162
|
const filters = await client.products.filters({
|
|
163
|
-
|
|
163
|
+
category_id: 'ctg_abc123', // Optional: scope filters to a category
|
|
164
164
|
});
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
### Categories
|
|
167
|
+
### Categories
|
|
168
168
|
|
|
169
169
|
```typescript
|
|
170
|
-
// List
|
|
171
|
-
const
|
|
172
|
-
expand: ['taxons'],
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
// Get taxonomy with taxons
|
|
176
|
-
const categories = await client.taxonomies.get('tax_123', {
|
|
177
|
-
expand: ['root', 'taxons'],
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
// List taxons with filtering
|
|
181
|
-
const taxons = await client.taxons.list({
|
|
170
|
+
// List categories with filtering
|
|
171
|
+
const categories = await client.categories.list({
|
|
182
172
|
depth_eq: 1, // Top-level categories only
|
|
183
|
-
taxonomy_id_eq: '123', // Filter by taxonomy
|
|
184
173
|
});
|
|
185
174
|
|
|
186
|
-
// Get single
|
|
187
|
-
const
|
|
175
|
+
// Get single category by ID or permalink
|
|
176
|
+
const category = await client.categories.get('clothing/shirts', {
|
|
188
177
|
expand: ['ancestors', 'children'], // For breadcrumbs and subcategories
|
|
189
178
|
});
|
|
190
179
|
|
|
191
180
|
// List products in a category
|
|
192
|
-
const categoryProducts = await client.
|
|
181
|
+
const categoryProducts = await client.categories.products.list('clothing/shirts', {
|
|
193
182
|
page: 1,
|
|
194
183
|
limit: 12,
|
|
195
184
|
expand: ['images', 'default_variant'],
|
|
@@ -525,7 +514,7 @@ The SDK uses a resource builder pattern for nested resources:
|
|
|
525
514
|
| `customer` | `creditCards` | `list`, `get`, `delete` |
|
|
526
515
|
| `customer` | `giftCards` | `list`, `get` |
|
|
527
516
|
| `markets` | `countries` | `list`, `get` |
|
|
528
|
-
| `
|
|
517
|
+
| `categories` | `products` | `list` |
|
|
529
518
|
| `wishlists` | `items` | `create`, `update`, `delete` |
|
|
530
519
|
|
|
531
520
|
Example:
|
|
@@ -536,7 +525,7 @@ await client.orders.payments.list(orderId, options);
|
|
|
536
525
|
await client.orders.shipments.update(orderId, shipmentId, params, options);
|
|
537
526
|
await client.customer.addresses.list({}, options);
|
|
538
527
|
await client.markets.countries.list(marketId);
|
|
539
|
-
await client.
|
|
528
|
+
await client.categories.products.list(categoryId, params, options);
|
|
540
529
|
await client.wishlists.items.create(wishlistId, params, options);
|
|
541
530
|
```
|
|
542
531
|
|
|
@@ -605,8 +594,7 @@ import type {
|
|
|
605
594
|
StoreProduct,
|
|
606
595
|
StoreOrder,
|
|
607
596
|
StoreVariant,
|
|
608
|
-
|
|
609
|
-
StoreTaxonomy,
|
|
597
|
+
StoreCategory,
|
|
610
598
|
StoreLineItem,
|
|
611
599
|
StoreAddress,
|
|
612
600
|
StoreCustomer,
|
|
@@ -615,7 +603,7 @@ import type {
|
|
|
615
603
|
|
|
616
604
|
// All responses are fully typed
|
|
617
605
|
const products: PaginatedResponse<StoreProduct> = await client.products.list();
|
|
618
|
-
const
|
|
606
|
+
const category: StoreCategory = await client.categories.get('clothing');
|
|
619
607
|
```
|
|
620
608
|
|
|
621
609
|
## Available Types
|
|
@@ -627,8 +615,7 @@ The SDK exports all Store API types:
|
|
|
627
615
|
- `StoreVariant` - Variant data
|
|
628
616
|
- `StoreOrder` - Order/cart data
|
|
629
617
|
- `StoreLineItem` - Line item in cart
|
|
630
|
-
- `
|
|
631
|
-
- `StoreTaxon` - Individual category
|
|
618
|
+
- `StoreCategory` - Category
|
|
632
619
|
- `StoreCountry` - Country with states
|
|
633
620
|
- `StoreState` - State/province
|
|
634
621
|
- `StoreAddress` - Customer address
|
|
@@ -130,6 +130,32 @@ type Base = {
|
|
|
130
130
|
id: string;
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
+
type Category = {
|
|
134
|
+
id: string;
|
|
135
|
+
name: string;
|
|
136
|
+
permalink: string;
|
|
137
|
+
position: number;
|
|
138
|
+
depth: number;
|
|
139
|
+
meta_title: string | null;
|
|
140
|
+
meta_description: string | null;
|
|
141
|
+
meta_keywords: string | null;
|
|
142
|
+
children_count: number;
|
|
143
|
+
created_at: string;
|
|
144
|
+
updated_at: string;
|
|
145
|
+
parent_id: string | null;
|
|
146
|
+
description: string;
|
|
147
|
+
description_html: string;
|
|
148
|
+
image_url: string | null;
|
|
149
|
+
square_image_url: string | null;
|
|
150
|
+
is_root: boolean;
|
|
151
|
+
is_child: boolean;
|
|
152
|
+
is_leaf: boolean;
|
|
153
|
+
parent?: Category;
|
|
154
|
+
children?: Array<Category>;
|
|
155
|
+
ancestors?: Array<Category>;
|
|
156
|
+
metafields?: Array<Metafield>;
|
|
157
|
+
};
|
|
158
|
+
|
|
133
159
|
type Country = {
|
|
134
160
|
iso: string;
|
|
135
161
|
iso3: string;
|
|
@@ -535,7 +561,7 @@ type Product = {
|
|
|
535
561
|
default_variant?: Variant;
|
|
536
562
|
master_variant?: Variant;
|
|
537
563
|
option_types?: Array<OptionType>;
|
|
538
|
-
|
|
564
|
+
categories?: Array<Category>;
|
|
539
565
|
metafields?: Array<Metafield>;
|
|
540
566
|
};
|
|
541
567
|
|
|
@@ -722,45 +748,6 @@ type TaxCategory = {
|
|
|
722
748
|
name: string;
|
|
723
749
|
};
|
|
724
750
|
|
|
725
|
-
type Taxon = {
|
|
726
|
-
id: string;
|
|
727
|
-
name: string;
|
|
728
|
-
permalink: string;
|
|
729
|
-
position: number;
|
|
730
|
-
depth: number;
|
|
731
|
-
meta_title: string | null;
|
|
732
|
-
meta_description: string | null;
|
|
733
|
-
meta_keywords: string | null;
|
|
734
|
-
children_count: number;
|
|
735
|
-
created_at: string;
|
|
736
|
-
updated_at: string;
|
|
737
|
-
parent_id: string | null;
|
|
738
|
-
taxonomy_id: string;
|
|
739
|
-
description: string;
|
|
740
|
-
description_html: string;
|
|
741
|
-
image_url: string | null;
|
|
742
|
-
square_image_url: string | null;
|
|
743
|
-
is_root: boolean;
|
|
744
|
-
is_child: boolean;
|
|
745
|
-
is_leaf: boolean;
|
|
746
|
-
parent?: Taxon;
|
|
747
|
-
children?: Array<Taxon>;
|
|
748
|
-
ancestors?: Array<Taxon>;
|
|
749
|
-
metafields?: Array<Metafield>;
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
type Taxonomy = {
|
|
753
|
-
id: string;
|
|
754
|
-
name: string;
|
|
755
|
-
position: number;
|
|
756
|
-
created_at: string;
|
|
757
|
-
updated_at: string;
|
|
758
|
-
root_id: string | null;
|
|
759
|
-
root?: Taxon;
|
|
760
|
-
taxons?: Array<Taxon>;
|
|
761
|
-
metafields?: Array<Metafield>;
|
|
762
|
-
};
|
|
763
|
-
|
|
764
751
|
type Variant = {
|
|
765
752
|
id: string;
|
|
766
753
|
product_id: string;
|
|
@@ -848,17 +835,16 @@ interface ProductListParams extends ListParams {
|
|
|
848
835
|
in_stock?: boolean;
|
|
849
836
|
/** Filter: only out-of-stock products */
|
|
850
837
|
out_of_stock?: boolean;
|
|
851
|
-
/** Filter: products in
|
|
852
|
-
|
|
838
|
+
/** Filter: products in category */
|
|
839
|
+
categories_id_eq?: string;
|
|
853
840
|
/** Any additional Ransack predicate */
|
|
854
841
|
[key: string]: string | number | boolean | (string | number)[] | undefined;
|
|
855
842
|
}
|
|
856
|
-
interface
|
|
843
|
+
interface CategoryListParams extends ListParams {
|
|
857
844
|
/** Sort order, e.g. 'name', '-created_at' */
|
|
858
845
|
sort?: string;
|
|
859
846
|
/** Filter: name contains */
|
|
860
847
|
name_cont?: string;
|
|
861
|
-
taxonomy_id_eq?: string | number;
|
|
862
848
|
parent_id_eq?: string | number;
|
|
863
849
|
depth_eq?: number;
|
|
864
850
|
/** Any additional Ransack predicate */
|
|
@@ -947,7 +933,7 @@ interface OptionFilterOption extends FilterOption {
|
|
|
947
933
|
presentation: string;
|
|
948
934
|
position: number;
|
|
949
935
|
}
|
|
950
|
-
interface
|
|
936
|
+
interface CategoryFilterOption {
|
|
951
937
|
id: string;
|
|
952
938
|
name: string;
|
|
953
939
|
permalink: string;
|
|
@@ -972,12 +958,12 @@ interface OptionFilter {
|
|
|
972
958
|
presentation: string;
|
|
973
959
|
options: OptionFilterOption[];
|
|
974
960
|
}
|
|
975
|
-
interface
|
|
976
|
-
id: '
|
|
977
|
-
type: '
|
|
978
|
-
options:
|
|
961
|
+
interface CategoryFilter {
|
|
962
|
+
id: 'categories';
|
|
963
|
+
type: 'category';
|
|
964
|
+
options: CategoryFilterOption[];
|
|
979
965
|
}
|
|
980
|
-
type ProductFilter = PriceRangeFilter | AvailabilityFilter | OptionFilter |
|
|
966
|
+
type ProductFilter = PriceRangeFilter | AvailabilityFilter | OptionFilter | CategoryFilter;
|
|
981
967
|
interface SortOption {
|
|
982
968
|
id: string;
|
|
983
969
|
}
|
|
@@ -988,8 +974,8 @@ interface ProductFiltersResponse {
|
|
|
988
974
|
total_count: number;
|
|
989
975
|
}
|
|
990
976
|
interface ProductFiltersParams {
|
|
991
|
-
|
|
977
|
+
category_id?: string;
|
|
992
978
|
q?: Record<string, unknown>;
|
|
993
979
|
}
|
|
994
980
|
|
|
995
|
-
export { type
|
|
981
|
+
export { type GiftCardBatch as $, type AuthTokens as A, type CreatePaymentSetupSessionParams as B, type CategoryListParams as C, type PaymentSetupSession as D, type CompletePaymentSetupSessionParams as E, type WishedItem as F, type GiftCard as G, type RetryConfig as H, type Asset as I, type AvailabilityFilter as J, type Base as K, type LoginCredentials as L, type Market as M, type CategoryFilter as N, type Order as O, type ProductListParams as P, type CategoryFilterOption as Q, type RequestFn as R, type Shipment as S, type CustomerReturn as T, type UpdateOrderParams as U, type Digital as V, type Wishlist as W, type DigitalLink as X, type ErrorResponse as Y, type Export as Z, type FilterOption as _, type RequestOptions as a, type Image as a0, type Import as a1, type ImportRow as a2, type Invitation as a3, type LineItem as a4, type LineItemInput as a5, type LocaleDefaults as a6, type Metafield as a7, type NewsletterSubscriber as a8, type OptionFilter as a9, type TaxCategory as aA, type Variant as aB, type OptionFilterOption as aa, type OptionType as ab, type OptionValue as ac, type OrderPromotion as ad, type PaginationMeta as ae, type PaymentSource as af, type Price as ag, type PriceRangeFilter as ah, type ProductFilter as ai, type Promotion as aj, type Refund as ak, type Reimbursement as al, type Report as am, type ReturnAuthorization as an, type ReturnItem as ao, type ShippingCategory as ap, type ShippingMethod as aq, type ShippingRate as ar, type SortOption as as, SpreeError as at, type State as au, type StockItem as av, type StockLocation as aw, type StockMovement as ax, type StockTransfer as ay, type StoreCredit as az, type PaginatedResponse as b, type Product as c, type ProductFiltersParams as d, type ProductFiltersResponse as e, type Category as f, type ListResponse as g, type Country as h, type Currency as i, type Locale as j, type CreateCartParams as k, type AddLineItemParams as l, type UpdateLineItemParams as m, type Payment as n, type PaymentMethod as o, type CreatePaymentSessionParams as p, type PaymentSession as q, type UpdatePaymentSessionParams as r, type CompletePaymentSessionParams as s, type RegisterParams as t, type Customer as u, type ListParams as v, type Address as w, type AddressParams as x, type CreditCard as y, type OrderListParams as z };
|
|
@@ -130,6 +130,32 @@ type Base = {
|
|
|
130
130
|
id: string;
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
+
type Category = {
|
|
134
|
+
id: string;
|
|
135
|
+
name: string;
|
|
136
|
+
permalink: string;
|
|
137
|
+
position: number;
|
|
138
|
+
depth: number;
|
|
139
|
+
meta_title: string | null;
|
|
140
|
+
meta_description: string | null;
|
|
141
|
+
meta_keywords: string | null;
|
|
142
|
+
children_count: number;
|
|
143
|
+
created_at: string;
|
|
144
|
+
updated_at: string;
|
|
145
|
+
parent_id: string | null;
|
|
146
|
+
description: string;
|
|
147
|
+
description_html: string;
|
|
148
|
+
image_url: string | null;
|
|
149
|
+
square_image_url: string | null;
|
|
150
|
+
is_root: boolean;
|
|
151
|
+
is_child: boolean;
|
|
152
|
+
is_leaf: boolean;
|
|
153
|
+
parent?: Category;
|
|
154
|
+
children?: Array<Category>;
|
|
155
|
+
ancestors?: Array<Category>;
|
|
156
|
+
metafields?: Array<Metafield>;
|
|
157
|
+
};
|
|
158
|
+
|
|
133
159
|
type Country = {
|
|
134
160
|
iso: string;
|
|
135
161
|
iso3: string;
|
|
@@ -535,7 +561,7 @@ type Product = {
|
|
|
535
561
|
default_variant?: Variant;
|
|
536
562
|
master_variant?: Variant;
|
|
537
563
|
option_types?: Array<OptionType>;
|
|
538
|
-
|
|
564
|
+
categories?: Array<Category>;
|
|
539
565
|
metafields?: Array<Metafield>;
|
|
540
566
|
};
|
|
541
567
|
|
|
@@ -722,45 +748,6 @@ type TaxCategory = {
|
|
|
722
748
|
name: string;
|
|
723
749
|
};
|
|
724
750
|
|
|
725
|
-
type Taxon = {
|
|
726
|
-
id: string;
|
|
727
|
-
name: string;
|
|
728
|
-
permalink: string;
|
|
729
|
-
position: number;
|
|
730
|
-
depth: number;
|
|
731
|
-
meta_title: string | null;
|
|
732
|
-
meta_description: string | null;
|
|
733
|
-
meta_keywords: string | null;
|
|
734
|
-
children_count: number;
|
|
735
|
-
created_at: string;
|
|
736
|
-
updated_at: string;
|
|
737
|
-
parent_id: string | null;
|
|
738
|
-
taxonomy_id: string;
|
|
739
|
-
description: string;
|
|
740
|
-
description_html: string;
|
|
741
|
-
image_url: string | null;
|
|
742
|
-
square_image_url: string | null;
|
|
743
|
-
is_root: boolean;
|
|
744
|
-
is_child: boolean;
|
|
745
|
-
is_leaf: boolean;
|
|
746
|
-
parent?: Taxon;
|
|
747
|
-
children?: Array<Taxon>;
|
|
748
|
-
ancestors?: Array<Taxon>;
|
|
749
|
-
metafields?: Array<Metafield>;
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
type Taxonomy = {
|
|
753
|
-
id: string;
|
|
754
|
-
name: string;
|
|
755
|
-
position: number;
|
|
756
|
-
created_at: string;
|
|
757
|
-
updated_at: string;
|
|
758
|
-
root_id: string | null;
|
|
759
|
-
root?: Taxon;
|
|
760
|
-
taxons?: Array<Taxon>;
|
|
761
|
-
metafields?: Array<Metafield>;
|
|
762
|
-
};
|
|
763
|
-
|
|
764
751
|
type Variant = {
|
|
765
752
|
id: string;
|
|
766
753
|
product_id: string;
|
|
@@ -848,17 +835,16 @@ interface ProductListParams extends ListParams {
|
|
|
848
835
|
in_stock?: boolean;
|
|
849
836
|
/** Filter: only out-of-stock products */
|
|
850
837
|
out_of_stock?: boolean;
|
|
851
|
-
/** Filter: products in
|
|
852
|
-
|
|
838
|
+
/** Filter: products in category */
|
|
839
|
+
categories_id_eq?: string;
|
|
853
840
|
/** Any additional Ransack predicate */
|
|
854
841
|
[key: string]: string | number | boolean | (string | number)[] | undefined;
|
|
855
842
|
}
|
|
856
|
-
interface
|
|
843
|
+
interface CategoryListParams extends ListParams {
|
|
857
844
|
/** Sort order, e.g. 'name', '-created_at' */
|
|
858
845
|
sort?: string;
|
|
859
846
|
/** Filter: name contains */
|
|
860
847
|
name_cont?: string;
|
|
861
|
-
taxonomy_id_eq?: string | number;
|
|
862
848
|
parent_id_eq?: string | number;
|
|
863
849
|
depth_eq?: number;
|
|
864
850
|
/** Any additional Ransack predicate */
|
|
@@ -947,7 +933,7 @@ interface OptionFilterOption extends FilterOption {
|
|
|
947
933
|
presentation: string;
|
|
948
934
|
position: number;
|
|
949
935
|
}
|
|
950
|
-
interface
|
|
936
|
+
interface CategoryFilterOption {
|
|
951
937
|
id: string;
|
|
952
938
|
name: string;
|
|
953
939
|
permalink: string;
|
|
@@ -972,12 +958,12 @@ interface OptionFilter {
|
|
|
972
958
|
presentation: string;
|
|
973
959
|
options: OptionFilterOption[];
|
|
974
960
|
}
|
|
975
|
-
interface
|
|
976
|
-
id: '
|
|
977
|
-
type: '
|
|
978
|
-
options:
|
|
961
|
+
interface CategoryFilter {
|
|
962
|
+
id: 'categories';
|
|
963
|
+
type: 'category';
|
|
964
|
+
options: CategoryFilterOption[];
|
|
979
965
|
}
|
|
980
|
-
type ProductFilter = PriceRangeFilter | AvailabilityFilter | OptionFilter |
|
|
966
|
+
type ProductFilter = PriceRangeFilter | AvailabilityFilter | OptionFilter | CategoryFilter;
|
|
981
967
|
interface SortOption {
|
|
982
968
|
id: string;
|
|
983
969
|
}
|
|
@@ -988,8 +974,8 @@ interface ProductFiltersResponse {
|
|
|
988
974
|
total_count: number;
|
|
989
975
|
}
|
|
990
976
|
interface ProductFiltersParams {
|
|
991
|
-
|
|
977
|
+
category_id?: string;
|
|
992
978
|
q?: Record<string, unknown>;
|
|
993
979
|
}
|
|
994
980
|
|
|
995
|
-
export { type
|
|
981
|
+
export { type GiftCardBatch as $, type AuthTokens as A, type CreatePaymentSetupSessionParams as B, type CategoryListParams as C, type PaymentSetupSession as D, type CompletePaymentSetupSessionParams as E, type WishedItem as F, type GiftCard as G, type RetryConfig as H, type Asset as I, type AvailabilityFilter as J, type Base as K, type LoginCredentials as L, type Market as M, type CategoryFilter as N, type Order as O, type ProductListParams as P, type CategoryFilterOption as Q, type RequestFn as R, type Shipment as S, type CustomerReturn as T, type UpdateOrderParams as U, type Digital as V, type Wishlist as W, type DigitalLink as X, type ErrorResponse as Y, type Export as Z, type FilterOption as _, type RequestOptions as a, type Image as a0, type Import as a1, type ImportRow as a2, type Invitation as a3, type LineItem as a4, type LineItemInput as a5, type LocaleDefaults as a6, type Metafield as a7, type NewsletterSubscriber as a8, type OptionFilter as a9, type TaxCategory as aA, type Variant as aB, type OptionFilterOption as aa, type OptionType as ab, type OptionValue as ac, type OrderPromotion as ad, type PaginationMeta as ae, type PaymentSource as af, type Price as ag, type PriceRangeFilter as ah, type ProductFilter as ai, type Promotion as aj, type Refund as ak, type Reimbursement as al, type Report as am, type ReturnAuthorization as an, type ReturnItem as ao, type ShippingCategory as ap, type ShippingMethod as aq, type ShippingRate as ar, type SortOption as as, SpreeError as at, type State as au, type StockItem as av, type StockLocation as aw, type StockMovement as ax, type StockTransfer as ay, type StoreCredit as az, type PaginatedResponse as b, type Product as c, type ProductFiltersParams as d, type ProductFiltersResponse as e, type Category as f, type ListResponse as g, type Country as h, type Currency as i, type Locale as j, type CreateCartParams as k, type AddLineItemParams as l, type UpdateLineItemParams as m, type Payment as n, type PaymentMethod as o, type CreatePaymentSessionParams as p, type PaymentSession as q, type UpdatePaymentSessionParams as r, type CompletePaymentSessionParams as s, type RegisterParams as t, type Customer as u, type ListParams as v, type Address as w, type AddressParams as x, type CreditCard as y, type OrderListParams as z };
|
package/dist/index.cjs
CHANGED
|
@@ -199,7 +199,7 @@ var StoreClient = class {
|
|
|
199
199
|
}),
|
|
200
200
|
/**
|
|
201
201
|
* Get available filters for products
|
|
202
|
-
* Returns filter options (price range, availability, option types,
|
|
202
|
+
* Returns filter options (price range, availability, option types, categories) with counts
|
|
203
203
|
*/
|
|
204
204
|
filters: (params, options) => this.request("GET", "/products/filters", {
|
|
205
205
|
...options,
|
|
@@ -207,50 +207,34 @@ var StoreClient = class {
|
|
|
207
207
|
})
|
|
208
208
|
};
|
|
209
209
|
// ============================================
|
|
210
|
-
//
|
|
210
|
+
// Categories
|
|
211
211
|
// ============================================
|
|
212
|
-
|
|
212
|
+
categories = {
|
|
213
213
|
/**
|
|
214
|
-
* List
|
|
214
|
+
* List categories
|
|
215
215
|
*/
|
|
216
|
-
list: (params, options) => this.request("GET", "/
|
|
216
|
+
list: (params, options) => this.request("GET", "/categories", {
|
|
217
217
|
...options,
|
|
218
218
|
params: transformListParams({ ...params })
|
|
219
219
|
}),
|
|
220
220
|
/**
|
|
221
|
-
* Get a
|
|
221
|
+
* Get a category by ID or permalink
|
|
222
222
|
*/
|
|
223
|
-
get: (
|
|
224
|
-
...options,
|
|
225
|
-
params: getParams(params)
|
|
226
|
-
})
|
|
227
|
-
};
|
|
228
|
-
taxons = {
|
|
229
|
-
/**
|
|
230
|
-
* List taxons
|
|
231
|
-
*/
|
|
232
|
-
list: (params, options) => this.request("GET", "/taxons", {
|
|
233
|
-
...options,
|
|
234
|
-
params: transformListParams({ ...params })
|
|
235
|
-
}),
|
|
236
|
-
/**
|
|
237
|
-
* Get a taxon by ID or permalink
|
|
238
|
-
*/
|
|
239
|
-
get: (idOrPermalink, params, options) => this.request("GET", `/taxons/${idOrPermalink}`, {
|
|
223
|
+
get: (idOrPermalink, params, options) => this.request("GET", `/categories/${idOrPermalink}`, {
|
|
240
224
|
...options,
|
|
241
225
|
params: getParams(params)
|
|
242
226
|
}),
|
|
243
227
|
/**
|
|
244
|
-
* Nested resource: Products in a
|
|
228
|
+
* Nested resource: Products in a category
|
|
245
229
|
*/
|
|
246
230
|
products: {
|
|
247
231
|
/**
|
|
248
|
-
* List products in a
|
|
249
|
-
* @param
|
|
232
|
+
* List products in a category
|
|
233
|
+
* @param categoryId - Category ID (prefix_id) or permalink
|
|
250
234
|
*/
|
|
251
|
-
list: (
|
|
235
|
+
list: (categoryId, params, options) => this.request(
|
|
252
236
|
"GET",
|
|
253
|
-
`/
|
|
237
|
+
`/categories/${categoryId}/products`,
|
|
254
238
|
{
|
|
255
239
|
...options,
|
|
256
240
|
params: transformListParams({ ...params })
|