@sokol111/ecommerce-catalog-service-api 1.0.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/dist/api.d.ts +30 -0
- package/dist/api.js +95 -0
- package/dist/api.schemas.d.ts +546 -0
- package/dist/api.schemas.js +92 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +26 -0
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
import type { AttributeListResponse, AttributeResponse, CategoryListResponse, CategoryResponse, CreateAttributeRequest, CreateCategoryRequest, CreateProductRequest, GetAttributeListParams, GetCategoryListParams, GetProductListParams, ProductListResponse, ProductResponse, UpdateAttributeRequest, UpdateCategoryRequest, UpdateProductRequest } from './api.schemas';
|
|
3
|
+
export declare const getCatalogAPI: () => {
|
|
4
|
+
createAttribute: <TData = AxiosResponse<AttributeResponse, any, {}>>(createAttributeRequest: CreateAttributeRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
5
|
+
updateAttribute: <TData = AxiosResponse<AttributeResponse, any, {}>>(updateAttributeRequest: UpdateAttributeRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
6
|
+
getAttributeById: <TData = AxiosResponse<AttributeResponse, any, {}>>(id: string, options?: AxiosRequestConfig) => Promise<TData>;
|
|
7
|
+
getAttributeList: <TData = AxiosResponse<AttributeListResponse, any, {}>>(params: GetAttributeListParams, options?: AxiosRequestConfig) => Promise<TData>;
|
|
8
|
+
deleteAttribute: <TData = AxiosResponse<void, any, {}>>(id: string, options?: AxiosRequestConfig) => Promise<TData>;
|
|
9
|
+
createCategory: <TData = AxiosResponse<CategoryResponse, any, {}>>(createCategoryRequest: CreateCategoryRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
10
|
+
updateCategory: <TData = AxiosResponse<CategoryResponse, any, {}>>(updateCategoryRequest: UpdateCategoryRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
11
|
+
getCategoryById: <TData = AxiosResponse<CategoryResponse, any, {}>>(id: string, options?: AxiosRequestConfig) => Promise<TData>;
|
|
12
|
+
getCategoryList: <TData = AxiosResponse<CategoryListResponse, any, {}>>(params: GetCategoryListParams, options?: AxiosRequestConfig) => Promise<TData>;
|
|
13
|
+
createProduct: <TData = AxiosResponse<ProductResponse, any, {}>>(createProductRequest: CreateProductRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
14
|
+
updateProduct: <TData = AxiosResponse<ProductResponse, any, {}>>(updateProductRequest: UpdateProductRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
15
|
+
getProductById: <TData = AxiosResponse<ProductResponse, any, {}>>(id: string, options?: AxiosRequestConfig) => Promise<TData>;
|
|
16
|
+
getProductList: <TData = AxiosResponse<ProductListResponse, any, {}>>(params: GetProductListParams, options?: AxiosRequestConfig) => Promise<TData>;
|
|
17
|
+
};
|
|
18
|
+
export type CreateAttributeResult = AxiosResponse<AttributeResponse>;
|
|
19
|
+
export type UpdateAttributeResult = AxiosResponse<AttributeResponse>;
|
|
20
|
+
export type GetAttributeByIdResult = AxiosResponse<AttributeResponse>;
|
|
21
|
+
export type GetAttributeListResult = AxiosResponse<AttributeListResponse>;
|
|
22
|
+
export type DeleteAttributeResult = AxiosResponse<void>;
|
|
23
|
+
export type CreateCategoryResult = AxiosResponse<CategoryResponse>;
|
|
24
|
+
export type UpdateCategoryResult = AxiosResponse<CategoryResponse>;
|
|
25
|
+
export type GetCategoryByIdResult = AxiosResponse<CategoryResponse>;
|
|
26
|
+
export type GetCategoryListResult = AxiosResponse<CategoryListResponse>;
|
|
27
|
+
export type CreateProductResult = AxiosResponse<ProductResponse>;
|
|
28
|
+
export type UpdateProductResult = AxiosResponse<ProductResponse>;
|
|
29
|
+
export type GetProductByIdResult = AxiosResponse<ProductResponse>;
|
|
30
|
+
export type GetProductListResult = AxiosResponse<ProductListResponse>;
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.13.2 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Catalog API
|
|
5
|
+
* API for managing product catalog.
|
|
6
|
+
|
|
7
|
+
This service combines:
|
|
8
|
+
- **Attributes** - Product attribute definitions (color, size, RAM, etc.)
|
|
9
|
+
- **Categories** - Product categories with attribute assignments
|
|
10
|
+
- **Products** - Products with attribute values
|
|
11
|
+
|
|
12
|
+
* OpenAPI spec version: 1.0.1
|
|
13
|
+
*/
|
|
14
|
+
import axios from 'axios';
|
|
15
|
+
export const getCatalogAPI = () => {
|
|
16
|
+
/**
|
|
17
|
+
* @summary Create a new attribute
|
|
18
|
+
*/
|
|
19
|
+
const createAttribute = (createAttributeRequest, options) => {
|
|
20
|
+
return axios.post(`/v1/attribute/create`, createAttributeRequest, options);
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @summary Update an existing attribute
|
|
24
|
+
*/
|
|
25
|
+
const updateAttribute = (updateAttributeRequest, options) => {
|
|
26
|
+
return axios.put(`/v1/attribute/update`, updateAttributeRequest, options);
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* @summary Get an attribute by ID
|
|
30
|
+
*/
|
|
31
|
+
const getAttributeById = (id, options) => {
|
|
32
|
+
return axios.get(`/v1/attribute/get/${id}`, options);
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* @summary Get a paginated list of attributes
|
|
36
|
+
*/
|
|
37
|
+
const getAttributeList = (params, options) => {
|
|
38
|
+
return axios.get(`/v1/attribute/list`, Object.assign(Object.assign({}, options), { params: Object.assign(Object.assign({}, params), options === null || options === void 0 ? void 0 : options.params) }));
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* @summary Delete an attribute by ID
|
|
42
|
+
*/
|
|
43
|
+
const deleteAttribute = (id, options) => {
|
|
44
|
+
return axios.delete(`/v1/attribute/delete/${id}`, options);
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* @summary Create a new category
|
|
48
|
+
*/
|
|
49
|
+
const createCategory = (createCategoryRequest, options) => {
|
|
50
|
+
return axios.post(`/v1/category/create`, createCategoryRequest, options);
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* @summary Update an existing category
|
|
54
|
+
*/
|
|
55
|
+
const updateCategory = (updateCategoryRequest, options) => {
|
|
56
|
+
return axios.put(`/v1/category/update`, updateCategoryRequest, options);
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* @summary Get a category by ID
|
|
60
|
+
*/
|
|
61
|
+
const getCategoryById = (id, options) => {
|
|
62
|
+
return axios.get(`/v1/category/get/${id}`, options);
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* @summary Get a paginated list of categories
|
|
66
|
+
*/
|
|
67
|
+
const getCategoryList = (params, options) => {
|
|
68
|
+
return axios.get(`/v1/category/list`, Object.assign(Object.assign({}, options), { params: Object.assign(Object.assign({}, params), options === null || options === void 0 ? void 0 : options.params) }));
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* @summary Create a new product
|
|
72
|
+
*/
|
|
73
|
+
const createProduct = (createProductRequest, options) => {
|
|
74
|
+
return axios.post(`/v1/product/create`, createProductRequest, options);
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* @summary Update an existing product
|
|
78
|
+
*/
|
|
79
|
+
const updateProduct = (updateProductRequest, options) => {
|
|
80
|
+
return axios.put(`/v1/product/update`, updateProductRequest, options);
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* @summary Get a product by ID
|
|
84
|
+
*/
|
|
85
|
+
const getProductById = (id, options) => {
|
|
86
|
+
return axios.get(`/v1/product/get/${id}`, options);
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* @summary Get a paginated list of products
|
|
90
|
+
*/
|
|
91
|
+
const getProductList = (params, options) => {
|
|
92
|
+
return axios.get(`/v1/product/list`, Object.assign(Object.assign({}, options), { params: Object.assign(Object.assign({}, params), options === null || options === void 0 ? void 0 : options.params) }));
|
|
93
|
+
};
|
|
94
|
+
return { createAttribute, updateAttribute, getAttributeById, getAttributeList, deleteAttribute, createCategory, updateCategory, getCategoryById, getCategoryList, createProduct, updateProduct, getProductById, getProductList };
|
|
95
|
+
};
|
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.13.2 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Catalog API
|
|
5
|
+
* API for managing product catalog.
|
|
6
|
+
|
|
7
|
+
This service combines:
|
|
8
|
+
- **Attributes** - Product attribute definitions (color, size, RAM, etc.)
|
|
9
|
+
- **Categories** - Product categories with attribute assignments
|
|
10
|
+
- **Products** - Products with attribute values
|
|
11
|
+
|
|
12
|
+
* OpenAPI spec version: 1.0.1
|
|
13
|
+
*/
|
|
14
|
+
export type GetAttributeListParams = {
|
|
15
|
+
/**
|
|
16
|
+
* Page number (1-based)
|
|
17
|
+
* @minimum 1
|
|
18
|
+
*/
|
|
19
|
+
page: number;
|
|
20
|
+
/**
|
|
21
|
+
* Number of items per page (max 100)
|
|
22
|
+
* @minimum 1
|
|
23
|
+
* @maximum 100
|
|
24
|
+
*/
|
|
25
|
+
size: number;
|
|
26
|
+
/**
|
|
27
|
+
* Filter by enabled status
|
|
28
|
+
*/
|
|
29
|
+
enabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Filter by attribute type
|
|
32
|
+
*/
|
|
33
|
+
type?: GetAttributeListType;
|
|
34
|
+
/**
|
|
35
|
+
* Field to sort by
|
|
36
|
+
*/
|
|
37
|
+
sort?: GetAttributeListSort;
|
|
38
|
+
/**
|
|
39
|
+
* Sort order
|
|
40
|
+
*/
|
|
41
|
+
order?: GetAttributeListOrder;
|
|
42
|
+
};
|
|
43
|
+
export type GetAttributeListType = typeof GetAttributeListType[keyof typeof GetAttributeListType];
|
|
44
|
+
export declare const GetAttributeListType: {
|
|
45
|
+
readonly single: "single";
|
|
46
|
+
readonly multiple: "multiple";
|
|
47
|
+
readonly range: "range";
|
|
48
|
+
readonly boolean: "boolean";
|
|
49
|
+
readonly text: "text";
|
|
50
|
+
};
|
|
51
|
+
export type GetAttributeListSort = typeof GetAttributeListSort[keyof typeof GetAttributeListSort];
|
|
52
|
+
export declare const GetAttributeListSort: {
|
|
53
|
+
readonly name: "name";
|
|
54
|
+
readonly slug: "slug";
|
|
55
|
+
readonly createdAt: "createdAt";
|
|
56
|
+
readonly modifiedAt: "modifiedAt";
|
|
57
|
+
};
|
|
58
|
+
export type GetAttributeListOrder = typeof GetAttributeListOrder[keyof typeof GetAttributeListOrder];
|
|
59
|
+
export declare const GetAttributeListOrder: {
|
|
60
|
+
readonly asc: "asc";
|
|
61
|
+
readonly desc: "desc";
|
|
62
|
+
};
|
|
63
|
+
export type GetCategoryListParams = {
|
|
64
|
+
/**
|
|
65
|
+
* Page number (1-based)
|
|
66
|
+
* @minimum 1
|
|
67
|
+
*/
|
|
68
|
+
page: number;
|
|
69
|
+
/**
|
|
70
|
+
* Number of items per page (max 100)
|
|
71
|
+
* @minimum 1
|
|
72
|
+
* @maximum 100
|
|
73
|
+
*/
|
|
74
|
+
size: number;
|
|
75
|
+
/**
|
|
76
|
+
* Filter by enabled status
|
|
77
|
+
*/
|
|
78
|
+
enabled?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Field to sort by
|
|
81
|
+
*/
|
|
82
|
+
sort?: GetCategoryListSort;
|
|
83
|
+
/**
|
|
84
|
+
* Sort order
|
|
85
|
+
*/
|
|
86
|
+
order?: GetCategoryListOrder;
|
|
87
|
+
};
|
|
88
|
+
export type GetCategoryListSort = typeof GetCategoryListSort[keyof typeof GetCategoryListSort];
|
|
89
|
+
export declare const GetCategoryListSort: {
|
|
90
|
+
readonly name: "name";
|
|
91
|
+
readonly createdAt: "createdAt";
|
|
92
|
+
readonly modifiedAt: "modifiedAt";
|
|
93
|
+
};
|
|
94
|
+
export type GetCategoryListOrder = typeof GetCategoryListOrder[keyof typeof GetCategoryListOrder];
|
|
95
|
+
export declare const GetCategoryListOrder: {
|
|
96
|
+
readonly asc: "asc";
|
|
97
|
+
readonly desc: "desc";
|
|
98
|
+
};
|
|
99
|
+
export type GetProductListParams = {
|
|
100
|
+
/**
|
|
101
|
+
* Page number (1-based)
|
|
102
|
+
* @minimum 1
|
|
103
|
+
*/
|
|
104
|
+
page: number;
|
|
105
|
+
/**
|
|
106
|
+
* Number of items per page (max 100)
|
|
107
|
+
* @minimum 1
|
|
108
|
+
* @maximum 100
|
|
109
|
+
*/
|
|
110
|
+
size: number;
|
|
111
|
+
/**
|
|
112
|
+
* Filter by enabled status
|
|
113
|
+
*/
|
|
114
|
+
enabled?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Filter by category ID
|
|
117
|
+
*/
|
|
118
|
+
categoryId?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Field to sort by
|
|
121
|
+
*/
|
|
122
|
+
sort?: GetProductListSort;
|
|
123
|
+
/**
|
|
124
|
+
* Sort order
|
|
125
|
+
*/
|
|
126
|
+
order?: GetProductListOrder;
|
|
127
|
+
};
|
|
128
|
+
export type GetProductListSort = typeof GetProductListSort[keyof typeof GetProductListSort];
|
|
129
|
+
export declare const GetProductListSort: {
|
|
130
|
+
readonly name: "name";
|
|
131
|
+
readonly price: "price";
|
|
132
|
+
readonly quantity: "quantity";
|
|
133
|
+
readonly createdAt: "createdAt";
|
|
134
|
+
readonly modifiedAt: "modifiedAt";
|
|
135
|
+
readonly categoryId: "categoryId";
|
|
136
|
+
};
|
|
137
|
+
export type GetProductListOrder = typeof GetProductListOrder[keyof typeof GetProductListOrder];
|
|
138
|
+
export declare const GetProductListOrder: {
|
|
139
|
+
readonly asc: "asc";
|
|
140
|
+
readonly desc: "desc";
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Attribute type:
|
|
144
|
+
- single: One option from list (e.g., color)
|
|
145
|
+
- multiple: Multiple options (e.g., connectivity: WiFi, Bluetooth)
|
|
146
|
+
- range: Numeric value with optional unit (e.g., RAM: 8 GB)
|
|
147
|
+
- boolean: Yes/No value (e.g., waterproof)
|
|
148
|
+
- text: Free text (e.g., custom engraving)
|
|
149
|
+
|
|
150
|
+
*/
|
|
151
|
+
export type CreateAttributeRequestType = typeof CreateAttributeRequestType[keyof typeof CreateAttributeRequestType];
|
|
152
|
+
export declare const CreateAttributeRequestType: {
|
|
153
|
+
readonly single: "single";
|
|
154
|
+
readonly multiple: "multiple";
|
|
155
|
+
readonly range: "range";
|
|
156
|
+
readonly boolean: "boolean";
|
|
157
|
+
readonly text: "text";
|
|
158
|
+
};
|
|
159
|
+
export interface CreateAttributeRequest {
|
|
160
|
+
/**
|
|
161
|
+
* Optional client-generated UUID
|
|
162
|
+
* @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
|
|
163
|
+
*/
|
|
164
|
+
id?: string;
|
|
165
|
+
/**
|
|
166
|
+
* @minLength 2
|
|
167
|
+
* @maxLength 100
|
|
168
|
+
*/
|
|
169
|
+
name: string;
|
|
170
|
+
/**
|
|
171
|
+
* URL-friendly identifier
|
|
172
|
+
* @minLength 2
|
|
173
|
+
* @maxLength 50
|
|
174
|
+
* @pattern ^[a-z0-9]+(?:-[a-z0-9]+)*$
|
|
175
|
+
*/
|
|
176
|
+
slug: string;
|
|
177
|
+
/** Attribute type:
|
|
178
|
+
- single: One option from list (e.g., color)
|
|
179
|
+
- multiple: Multiple options (e.g., connectivity: WiFi, Bluetooth)
|
|
180
|
+
- range: Numeric value with optional unit (e.g., RAM: 8 GB)
|
|
181
|
+
- boolean: Yes/No value (e.g., waterproof)
|
|
182
|
+
- text: Free text (e.g., custom engraving)
|
|
183
|
+
*/
|
|
184
|
+
type: CreateAttributeRequestType;
|
|
185
|
+
/**
|
|
186
|
+
* Unit for range type (GB, kg, mm, etc.)
|
|
187
|
+
* @maxLength 20
|
|
188
|
+
*/
|
|
189
|
+
unit?: string;
|
|
190
|
+
enabled: boolean;
|
|
191
|
+
/** Options for single/multiple types */
|
|
192
|
+
options?: AttributeOptionInput[];
|
|
193
|
+
}
|
|
194
|
+
export type UpdateAttributeRequestType = typeof UpdateAttributeRequestType[keyof typeof UpdateAttributeRequestType];
|
|
195
|
+
export declare const UpdateAttributeRequestType: {
|
|
196
|
+
readonly single: "single";
|
|
197
|
+
readonly multiple: "multiple";
|
|
198
|
+
readonly range: "range";
|
|
199
|
+
readonly boolean: "boolean";
|
|
200
|
+
readonly text: "text";
|
|
201
|
+
};
|
|
202
|
+
export interface UpdateAttributeRequest {
|
|
203
|
+
/** @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$ */
|
|
204
|
+
id: string;
|
|
205
|
+
/**
|
|
206
|
+
* @minLength 2
|
|
207
|
+
* @maxLength 100
|
|
208
|
+
*/
|
|
209
|
+
name: string;
|
|
210
|
+
/**
|
|
211
|
+
* @minLength 2
|
|
212
|
+
* @maxLength 50
|
|
213
|
+
* @pattern ^[a-z0-9]+(?:-[a-z0-9]+)*$
|
|
214
|
+
*/
|
|
215
|
+
slug: string;
|
|
216
|
+
type: UpdateAttributeRequestType;
|
|
217
|
+
/** @maxLength 20 */
|
|
218
|
+
unit?: string;
|
|
219
|
+
enabled: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Optimistic locking version
|
|
222
|
+
* @minimum 1
|
|
223
|
+
*/
|
|
224
|
+
version: number;
|
|
225
|
+
options?: AttributeOptionInput[];
|
|
226
|
+
}
|
|
227
|
+
export type AttributeResponseType = typeof AttributeResponseType[keyof typeof AttributeResponseType];
|
|
228
|
+
export declare const AttributeResponseType: {
|
|
229
|
+
readonly single: "single";
|
|
230
|
+
readonly multiple: "multiple";
|
|
231
|
+
readonly range: "range";
|
|
232
|
+
readonly boolean: "boolean";
|
|
233
|
+
readonly text: "text";
|
|
234
|
+
};
|
|
235
|
+
export interface AttributeResponse {
|
|
236
|
+
id: string;
|
|
237
|
+
version: number;
|
|
238
|
+
name: string;
|
|
239
|
+
slug: string;
|
|
240
|
+
type: AttributeResponseType;
|
|
241
|
+
unit?: string;
|
|
242
|
+
enabled: boolean;
|
|
243
|
+
options?: AttributeOption[];
|
|
244
|
+
createdAt: string;
|
|
245
|
+
modifiedAt: string;
|
|
246
|
+
}
|
|
247
|
+
export interface AttributeListResponse {
|
|
248
|
+
items: AttributeResponse[];
|
|
249
|
+
/** Current page number */
|
|
250
|
+
page: number;
|
|
251
|
+
/** Number of items per page */
|
|
252
|
+
size: number;
|
|
253
|
+
/** Total number of items */
|
|
254
|
+
total: number;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Input for creating/updating an attribute option
|
|
258
|
+
*/
|
|
259
|
+
export interface AttributeOptionInput {
|
|
260
|
+
/**
|
|
261
|
+
* @minLength 1
|
|
262
|
+
* @maxLength 100
|
|
263
|
+
*/
|
|
264
|
+
name: string;
|
|
265
|
+
/**
|
|
266
|
+
* @minLength 1
|
|
267
|
+
* @maxLength 50
|
|
268
|
+
* @pattern ^[a-z0-9]+(?:-[a-z0-9]+)*$
|
|
269
|
+
*/
|
|
270
|
+
slug: string;
|
|
271
|
+
/**
|
|
272
|
+
* Hex color code for color attributes
|
|
273
|
+
* @pattern ^#[0-9A-Fa-f]{6}$
|
|
274
|
+
*/
|
|
275
|
+
colorCode?: string;
|
|
276
|
+
/**
|
|
277
|
+
* @minimum 0
|
|
278
|
+
* @maximum 10000
|
|
279
|
+
*/
|
|
280
|
+
sortOrder?: number;
|
|
281
|
+
enabled: boolean;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Embedded attribute option
|
|
285
|
+
*/
|
|
286
|
+
export interface AttributeOption {
|
|
287
|
+
name: string;
|
|
288
|
+
slug: string;
|
|
289
|
+
colorCode?: string;
|
|
290
|
+
sortOrder: number;
|
|
291
|
+
enabled: boolean;
|
|
292
|
+
}
|
|
293
|
+
export interface CreateCategoryRequest {
|
|
294
|
+
/**
|
|
295
|
+
* Optional client-generated UUID
|
|
296
|
+
* @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
|
|
297
|
+
*/
|
|
298
|
+
id?: string;
|
|
299
|
+
/**
|
|
300
|
+
* @minLength 2
|
|
301
|
+
* @maxLength 100
|
|
302
|
+
*/
|
|
303
|
+
name: string;
|
|
304
|
+
enabled: boolean;
|
|
305
|
+
/** List of attributes to assign to this category */
|
|
306
|
+
attributes?: CategoryAttributeInput[];
|
|
307
|
+
}
|
|
308
|
+
export interface UpdateCategoryRequest {
|
|
309
|
+
/** @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$ */
|
|
310
|
+
id: string;
|
|
311
|
+
/**
|
|
312
|
+
* @minLength 2
|
|
313
|
+
* @maxLength 100
|
|
314
|
+
*/
|
|
315
|
+
name: string;
|
|
316
|
+
enabled: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Optimistic locking version
|
|
319
|
+
* @minimum 1
|
|
320
|
+
*/
|
|
321
|
+
version: number;
|
|
322
|
+
/** List of attributes assigned to this category */
|
|
323
|
+
attributes?: CategoryAttributeInput[];
|
|
324
|
+
}
|
|
325
|
+
export interface CategoryResponse {
|
|
326
|
+
id: string;
|
|
327
|
+
version: number;
|
|
328
|
+
name: string;
|
|
329
|
+
enabled: boolean;
|
|
330
|
+
createdAt: string;
|
|
331
|
+
modifiedAt: string;
|
|
332
|
+
/** List of attributes assigned to this category */
|
|
333
|
+
attributes?: CategoryAttribute[];
|
|
334
|
+
}
|
|
335
|
+
export interface CategoryListResponse {
|
|
336
|
+
items: CategoryResponse[];
|
|
337
|
+
/** Current page number */
|
|
338
|
+
page: number;
|
|
339
|
+
/** Number of items per page */
|
|
340
|
+
size: number;
|
|
341
|
+
/** Total number of items */
|
|
342
|
+
total: number;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* How this attribute is used in this category:
|
|
346
|
+
- variant: Creates product variants (color, size) - buyer can choose
|
|
347
|
+
- specification: Describes the product (processor, screen) - shown in specs
|
|
348
|
+
|
|
349
|
+
*/
|
|
350
|
+
export type CategoryAttributeInputRole = typeof CategoryAttributeInputRole[keyof typeof CategoryAttributeInputRole];
|
|
351
|
+
export declare const CategoryAttributeInputRole: {
|
|
352
|
+
readonly variant: "variant";
|
|
353
|
+
readonly specification: "specification";
|
|
354
|
+
};
|
|
355
|
+
/**
|
|
356
|
+
* Input for assigning an attribute to a category
|
|
357
|
+
*/
|
|
358
|
+
export interface CategoryAttributeInput {
|
|
359
|
+
/** @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$ */
|
|
360
|
+
attributeId: string;
|
|
361
|
+
/** How this attribute is used in this category:
|
|
362
|
+
- variant: Creates product variants (color, size) - buyer can choose
|
|
363
|
+
- specification: Describes the product (processor, screen) - shown in specs
|
|
364
|
+
*/
|
|
365
|
+
role: CategoryAttributeInputRole;
|
|
366
|
+
/** Whether products must have this attribute */
|
|
367
|
+
required?: boolean;
|
|
368
|
+
/**
|
|
369
|
+
* @minimum 0
|
|
370
|
+
* @maximum 10000
|
|
371
|
+
*/
|
|
372
|
+
sortOrder?: number;
|
|
373
|
+
/** Whether this attribute can be used as a filter */
|
|
374
|
+
filterable: boolean;
|
|
375
|
+
/** Whether this attribute value is included in search */
|
|
376
|
+
searchable: boolean;
|
|
377
|
+
}
|
|
378
|
+
export type CategoryAttributeRole = typeof CategoryAttributeRole[keyof typeof CategoryAttributeRole];
|
|
379
|
+
export declare const CategoryAttributeRole: {
|
|
380
|
+
readonly variant: "variant";
|
|
381
|
+
readonly specification: "specification";
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* Embedded category attribute
|
|
385
|
+
*/
|
|
386
|
+
export interface CategoryAttribute {
|
|
387
|
+
attributeId: string;
|
|
388
|
+
role: CategoryAttributeRole;
|
|
389
|
+
required: boolean;
|
|
390
|
+
sortOrder: number;
|
|
391
|
+
filterable: boolean;
|
|
392
|
+
searchable: boolean;
|
|
393
|
+
}
|
|
394
|
+
export type ProblemErrorsItem = {
|
|
395
|
+
field?: string;
|
|
396
|
+
message?: string;
|
|
397
|
+
};
|
|
398
|
+
/**
|
|
399
|
+
* RFC7807 Problem Details
|
|
400
|
+
*/
|
|
401
|
+
export interface Problem {
|
|
402
|
+
type: string;
|
|
403
|
+
title: string;
|
|
404
|
+
status: number;
|
|
405
|
+
detail?: string;
|
|
406
|
+
instance?: string;
|
|
407
|
+
traceId?: string;
|
|
408
|
+
errors?: ProblemErrorsItem[];
|
|
409
|
+
}
|
|
410
|
+
export interface CreateProductRequest {
|
|
411
|
+
/**
|
|
412
|
+
* Optional client-generated UUID
|
|
413
|
+
* @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
|
|
414
|
+
*/
|
|
415
|
+
id?: string;
|
|
416
|
+
/**
|
|
417
|
+
* @minLength 2
|
|
418
|
+
* @maxLength 100
|
|
419
|
+
*/
|
|
420
|
+
name: string;
|
|
421
|
+
/** @maxLength 2000 */
|
|
422
|
+
description?: string;
|
|
423
|
+
/**
|
|
424
|
+
* @minimum 0
|
|
425
|
+
* @maximum 100000000
|
|
426
|
+
*/
|
|
427
|
+
price: number;
|
|
428
|
+
/**
|
|
429
|
+
* @minimum 0
|
|
430
|
+
* @maximum 100000000
|
|
431
|
+
*/
|
|
432
|
+
quantity: number;
|
|
433
|
+
/**
|
|
434
|
+
* Reference to image in Image Service
|
|
435
|
+
* @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
|
|
436
|
+
*/
|
|
437
|
+
imageId?: string;
|
|
438
|
+
/**
|
|
439
|
+
* Category this product belongs to
|
|
440
|
+
* @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
|
|
441
|
+
*/
|
|
442
|
+
categoryId?: string;
|
|
443
|
+
enabled: boolean;
|
|
444
|
+
/** List of attribute values for this product */
|
|
445
|
+
attributes?: ProductAttributeInput[];
|
|
446
|
+
}
|
|
447
|
+
export interface UpdateProductRequest {
|
|
448
|
+
/** @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$ */
|
|
449
|
+
id: string;
|
|
450
|
+
/**
|
|
451
|
+
* @minLength 2
|
|
452
|
+
* @maxLength 100
|
|
453
|
+
*/
|
|
454
|
+
name: string;
|
|
455
|
+
/** @maxLength 2000 */
|
|
456
|
+
description?: string;
|
|
457
|
+
/**
|
|
458
|
+
* @minimum 0
|
|
459
|
+
* @maximum 100000000
|
|
460
|
+
*/
|
|
461
|
+
price: number;
|
|
462
|
+
/**
|
|
463
|
+
* @minimum 0
|
|
464
|
+
* @maximum 100000000
|
|
465
|
+
*/
|
|
466
|
+
quantity: number;
|
|
467
|
+
/** @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$ */
|
|
468
|
+
imageId?: string;
|
|
469
|
+
/** @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$ */
|
|
470
|
+
categoryId?: string;
|
|
471
|
+
enabled: boolean;
|
|
472
|
+
/**
|
|
473
|
+
* Optimistic locking version
|
|
474
|
+
* @minimum 1
|
|
475
|
+
*/
|
|
476
|
+
version: number;
|
|
477
|
+
/** List of attribute values for this product */
|
|
478
|
+
attributes?: ProductAttributeInput[];
|
|
479
|
+
}
|
|
480
|
+
export interface ProductResponse {
|
|
481
|
+
id: string;
|
|
482
|
+
version: number;
|
|
483
|
+
name: string;
|
|
484
|
+
description?: string;
|
|
485
|
+
price: number;
|
|
486
|
+
quantity: number;
|
|
487
|
+
imageId?: string;
|
|
488
|
+
categoryId?: string;
|
|
489
|
+
enabled: boolean;
|
|
490
|
+
createdAt: string;
|
|
491
|
+
modifiedAt: string;
|
|
492
|
+
/** List of attribute values for this product */
|
|
493
|
+
attributes?: ProductAttribute[];
|
|
494
|
+
}
|
|
495
|
+
export interface ProductListResponse {
|
|
496
|
+
items: ProductResponse[];
|
|
497
|
+
/** Current page number */
|
|
498
|
+
page: number;
|
|
499
|
+
/** Number of items per page */
|
|
500
|
+
size: number;
|
|
501
|
+
/** Total number of items */
|
|
502
|
+
total: number;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Input for assigning an attribute value to a product
|
|
506
|
+
*/
|
|
507
|
+
export interface ProductAttributeInput {
|
|
508
|
+
/**
|
|
509
|
+
* Reference to the attribute definition
|
|
510
|
+
* @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
|
|
511
|
+
*/
|
|
512
|
+
attributeId: string;
|
|
513
|
+
/**
|
|
514
|
+
* Slug of the selected option (for single type)
|
|
515
|
+
* @maxLength 50
|
|
516
|
+
*/
|
|
517
|
+
optionSlugValue?: string;
|
|
518
|
+
/** Slugs of selected options (for multiple type) */
|
|
519
|
+
optionSlugValues?: string[];
|
|
520
|
+
/** Numeric value (for range type - e.g., RAM, storage) */
|
|
521
|
+
numericValue?: number;
|
|
522
|
+
/**
|
|
523
|
+
* Free text value (for text type)
|
|
524
|
+
* @maxLength 2000
|
|
525
|
+
*/
|
|
526
|
+
textValue?: string;
|
|
527
|
+
/** Boolean value (for boolean type) */
|
|
528
|
+
booleanValue?: boolean;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Embedded product attribute with value
|
|
532
|
+
*/
|
|
533
|
+
export interface ProductAttribute {
|
|
534
|
+
/** Reference to the attribute definition */
|
|
535
|
+
attributeId: string;
|
|
536
|
+
/** Slug of the selected option (for single type) */
|
|
537
|
+
optionSlugValue?: string;
|
|
538
|
+
/** Slugs of selected options (for multiple type) */
|
|
539
|
+
optionSlugValues?: string[];
|
|
540
|
+
/** Numeric value (for range type) */
|
|
541
|
+
numericValue?: number;
|
|
542
|
+
/** Free text value (for text type) */
|
|
543
|
+
textValue?: string;
|
|
544
|
+
/** Boolean value (for boolean type) */
|
|
545
|
+
booleanValue?: boolean;
|
|
546
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.13.2 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Catalog API
|
|
5
|
+
* API for managing product catalog.
|
|
6
|
+
|
|
7
|
+
This service combines:
|
|
8
|
+
- **Attributes** - Product attribute definitions (color, size, RAM, etc.)
|
|
9
|
+
- **Categories** - Product categories with attribute assignments
|
|
10
|
+
- **Products** - Products with attribute values
|
|
11
|
+
|
|
12
|
+
* OpenAPI spec version: 1.0.1
|
|
13
|
+
*/
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
15
|
+
export const GetAttributeListType = {
|
|
16
|
+
single: 'single',
|
|
17
|
+
multiple: 'multiple',
|
|
18
|
+
range: 'range',
|
|
19
|
+
boolean: 'boolean',
|
|
20
|
+
text: 'text',
|
|
21
|
+
};
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
23
|
+
export const GetAttributeListSort = {
|
|
24
|
+
name: 'name',
|
|
25
|
+
slug: 'slug',
|
|
26
|
+
createdAt: 'createdAt',
|
|
27
|
+
modifiedAt: 'modifiedAt',
|
|
28
|
+
};
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
30
|
+
export const GetAttributeListOrder = {
|
|
31
|
+
asc: 'asc',
|
|
32
|
+
desc: 'desc',
|
|
33
|
+
};
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
35
|
+
export const GetCategoryListSort = {
|
|
36
|
+
name: 'name',
|
|
37
|
+
createdAt: 'createdAt',
|
|
38
|
+
modifiedAt: 'modifiedAt',
|
|
39
|
+
};
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
41
|
+
export const GetCategoryListOrder = {
|
|
42
|
+
asc: 'asc',
|
|
43
|
+
desc: 'desc',
|
|
44
|
+
};
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
46
|
+
export const GetProductListSort = {
|
|
47
|
+
name: 'name',
|
|
48
|
+
price: 'price',
|
|
49
|
+
quantity: 'quantity',
|
|
50
|
+
createdAt: 'createdAt',
|
|
51
|
+
modifiedAt: 'modifiedAt',
|
|
52
|
+
categoryId: 'categoryId',
|
|
53
|
+
};
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
55
|
+
export const GetProductListOrder = {
|
|
56
|
+
asc: 'asc',
|
|
57
|
+
desc: 'desc',
|
|
58
|
+
};
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
60
|
+
export const CreateAttributeRequestType = {
|
|
61
|
+
single: 'single',
|
|
62
|
+
multiple: 'multiple',
|
|
63
|
+
range: 'range',
|
|
64
|
+
boolean: 'boolean',
|
|
65
|
+
text: 'text',
|
|
66
|
+
};
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
68
|
+
export const UpdateAttributeRequestType = {
|
|
69
|
+
single: 'single',
|
|
70
|
+
multiple: 'multiple',
|
|
71
|
+
range: 'range',
|
|
72
|
+
boolean: 'boolean',
|
|
73
|
+
text: 'text',
|
|
74
|
+
};
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
76
|
+
export const AttributeResponseType = {
|
|
77
|
+
single: 'single',
|
|
78
|
+
multiple: 'multiple',
|
|
79
|
+
range: 'range',
|
|
80
|
+
boolean: 'boolean',
|
|
81
|
+
text: 'text',
|
|
82
|
+
};
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
84
|
+
export const CategoryAttributeInputRole = {
|
|
85
|
+
variant: 'variant',
|
|
86
|
+
specification: 'specification',
|
|
87
|
+
};
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
89
|
+
export const CategoryAttributeRole = {
|
|
90
|
+
variant: 'variant',
|
|
91
|
+
specification: 'specification',
|
|
92
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sokol111/ecommerce-catalog-service-api",
|
|
3
|
+
"description": "Generated TypeScript Axios client from OpenAPI for ecommerce-catalog-service-api",
|
|
4
|
+
"version": "1.0.1",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"prepare": "npm run build"
|
|
11
|
+
},
|
|
12
|
+
"keywords": ["openapi", "typescript", "axios", "sdk"],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"axios": "^1.10.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5"
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
]
|
|
26
|
+
}
|