oneentry 1.0.0

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.
Files changed (80) hide show
  1. package/README.md +324 -0
  2. package/dist/admins/adminsApi.d.ts +14 -0
  3. package/dist/admins/adminsApi.js +34 -0
  4. package/dist/admins/adminsApi.js.map +1 -0
  5. package/dist/admins/adminsInterfaces.d.ts +4 -0
  6. package/dist/admins/adminsInterfaces.js +3 -0
  7. package/dist/admins/adminsInterfaces.js.map +1 -0
  8. package/dist/attribute-set/AttributeSetApi.d.ts +24 -0
  9. package/dist/attribute-set/AttributeSetApi.js +49 -0
  10. package/dist/attribute-set/AttributeSetApi.js.map +1 -0
  11. package/dist/attribute-set/attributeSetInterfaces.d.ts +5 -0
  12. package/dist/attribute-set/attributeSetInterfaces.js +3 -0
  13. package/dist/attribute-set/attributeSetInterfaces.js.map +1 -0
  14. package/dist/base/oneEntry.d.ts +9 -0
  15. package/dist/base/oneEntry.js +55 -0
  16. package/dist/base/oneEntry.js.map +1 -0
  17. package/dist/general-types/GeneralTypesApi.d.ts +14 -0
  18. package/dist/general-types/GeneralTypesApi.js +34 -0
  19. package/dist/general-types/GeneralTypesApi.js.map +1 -0
  20. package/dist/general-types/generalTypesInterfaces.d.ts +4 -0
  21. package/dist/general-types/generalTypesInterfaces.js +3 -0
  22. package/dist/general-types/generalTypesInterfaces.js.map +1 -0
  23. package/dist/index.d.ts +33 -0
  24. package/dist/index.js +50 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/locales/localesApi.d.ts +14 -0
  27. package/dist/locales/localesApi.js +34 -0
  28. package/dist/locales/localesApi.js.map +1 -0
  29. package/dist/locales/localesInterfaces.d.ts +4 -0
  30. package/dist/locales/localesInterfaces.js +3 -0
  31. package/dist/locales/localesInterfaces.js.map +1 -0
  32. package/dist/markers/markersApi.d.ts +35 -0
  33. package/dist/markers/markersApi.js +65 -0
  34. package/dist/markers/markersApi.js.map +1 -0
  35. package/dist/markers/markersInterfaces.d.ts +6 -0
  36. package/dist/markers/markersInterfaces.js +3 -0
  37. package/dist/markers/markersInterfaces.js.map +1 -0
  38. package/dist/menus/menusApi.d.ts +16 -0
  39. package/dist/menus/menusApi.js +36 -0
  40. package/dist/menus/menusApi.js.map +1 -0
  41. package/dist/menus/menusInterfaces.d.ts +4 -0
  42. package/dist/menus/menusInterfaces.js +3 -0
  43. package/dist/menus/menusInterfaces.js.map +1 -0
  44. package/dist/modules/modulesApi.d.ts +14 -0
  45. package/dist/modules/modulesApi.js +34 -0
  46. package/dist/modules/modulesApi.js.map +1 -0
  47. package/dist/modules/modulesInterfaces.d.ts +4 -0
  48. package/dist/modules/modulesInterfaces.js +3 -0
  49. package/dist/modules/modulesInterfaces.js.map +1 -0
  50. package/dist/pages/pagesApi.d.ts +72 -0
  51. package/dist/pages/pagesApi.js +128 -0
  52. package/dist/pages/pagesApi.js.map +1 -0
  53. package/dist/pages/pagesInterfaces.d.ts +15 -0
  54. package/dist/pages/pagesInterfaces.js +3 -0
  55. package/dist/pages/pagesInterfaces.js.map +1 -0
  56. package/dist/product-statuses/productStatusesApi.d.ts +38 -0
  57. package/dist/product-statuses/productStatusesApi.js +73 -0
  58. package/dist/product-statuses/productStatusesApi.js.map +1 -0
  59. package/dist/product-statuses/productStatusesInterfaces.d.ts +7 -0
  60. package/dist/product-statuses/productStatusesInterfaces.js +3 -0
  61. package/dist/product-statuses/productStatusesInterfaces.js.map +1 -0
  62. package/dist/products/productsApi.d.ts +181 -0
  63. package/dist/products/productsApi.js +262 -0
  64. package/dist/products/productsApi.js.map +1 -0
  65. package/dist/products/productsInterfaces.d.ts +43 -0
  66. package/dist/products/productsInterfaces.js +3 -0
  67. package/dist/products/productsInterfaces.js.map +1 -0
  68. package/dist/templates/templatesApi.d.ts +38 -0
  69. package/dist/templates/templatesApi.js +74 -0
  70. package/dist/templates/templatesApi.js.map +1 -0
  71. package/dist/templates/templatesInterfaces.d.ts +7 -0
  72. package/dist/templates/templatesInterfaces.js +3 -0
  73. package/dist/templates/templatesInterfaces.js.map +1 -0
  74. package/dist/templates-preview/templatesPreviewApi.d.ts +30 -0
  75. package/dist/templates-preview/templatesPreviewApi.js +60 -0
  76. package/dist/templates-preview/templatesPreviewApi.js.map +1 -0
  77. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +6 -0
  78. package/dist/templates-preview/templatesPreviewInterfaces.js +3 -0
  79. package/dist/templates-preview/templatesPreviewInterfaces.js.map +1 -0
  80. package/package.json +19 -0
@@ -0,0 +1,38 @@
1
+ import OneEntry from '../base/oneEntry';
2
+ import { IProductStatuses } from "./productStatusesInterfaces";
3
+ /**
4
+ * Controllers for working with product statuses
5
+ */
6
+ export default class ProductStatusesApi extends OneEntry implements IProductStatuses {
7
+ constructor(url: string);
8
+ /**
9
+ * Search for all product status objects.
10
+ *
11
+ * @returns Returns an array of product status objects
12
+ */
13
+ getProductStatuses(): Promise<any>;
14
+ /**
15
+ * Search for a product status object by identifier.
16
+ *
17
+ * @param {number} [id] - Status id
18
+ *
19
+ * @returns Returns a product status object
20
+ */
21
+ getProductStatusesById(id: number): Promise<any>;
22
+ /**
23
+ * Search for a product status object by its textual identifier (marker).
24
+ *
25
+ * @param {string} [marker] - Product marker
26
+ *
27
+ * @returns Returns a product status object
28
+ */
29
+ getProductsByStatusMarker(marker: string): Promise<any>;
30
+ /**
31
+ * Check the existence of a textual identifier.
32
+ *
33
+ * @param {string} [marker] - Product marker
34
+ *
35
+ * @returns Returns true if the textual identifier (marker) exists or false if it doesn't
36
+ */
37
+ validateMarker(marker: string): Promise<any>;
38
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const oneEntry_1 = require("../base/oneEntry");
13
+ /**
14
+ * Controllers for working with product statuses
15
+ */
16
+ class ProductStatusesApi extends oneEntry_1.default {
17
+ constructor(url) {
18
+ super(url);
19
+ this._url += '/api/content/product-statuses';
20
+ }
21
+ /**
22
+ * Search for all product status objects.
23
+ *
24
+ * @returns Returns an array of product status objects
25
+ */
26
+ getProductStatuses() {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ const result = yield this._fetchGet('');
29
+ return result;
30
+ });
31
+ }
32
+ /**
33
+ * Search for a product status object by identifier.
34
+ *
35
+ * @param {number} [id] - Status id
36
+ *
37
+ * @returns Returns a product status object
38
+ */
39
+ getProductStatusesById(id) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ const result = yield this._fetchGet(`/${id}`);
42
+ return result;
43
+ });
44
+ }
45
+ /**
46
+ * Search for a product status object by its textual identifier (marker).
47
+ *
48
+ * @param {string} [marker] - Product marker
49
+ *
50
+ * @returns Returns a product status object
51
+ */
52
+ getProductsByStatusMarker(marker) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ const result = yield this._fetchGet(`/marker/${marker}`);
55
+ return result;
56
+ });
57
+ }
58
+ /**
59
+ * Check the existence of a textual identifier.
60
+ *
61
+ * @param {string} [marker] - Product marker
62
+ *
63
+ * @returns Returns true if the textual identifier (marker) exists or false if it doesn't
64
+ */
65
+ validateMarker(marker) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const result = yield this._fetchGet(`/marker-validation/${marker}`);
68
+ return result;
69
+ });
70
+ }
71
+ }
72
+ exports.default = ProductStatusesApi;
73
+ //# sourceMappingURL=productStatusesApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"productStatusesApi.js","sourceRoot":"","sources":["../../src/product-statuses/productStatusesApi.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+CAAuC;AAGvC;;GAEG;AACH,MAAqB,kBAAmB,SAAQ,kBAAQ;IACpD,YAAY,GAAW;QACnB,KAAK,CAAC,GAAG,CAAC,CAAA;QACV,IAAI,CAAC,IAAI,IAAI,+BAA+B,CAAA;IAChD,CAAC;IAED;;;;OAIG;IACU,kBAAkB;;YAC3B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;YACvC,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAED;;;;;;OAMG;IACU,sBAAsB,CAAC,EAAS;;YACzC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;YAC7C,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAED;;;;;;OAMG;IACU,yBAAyB,CAAC,MAAa;;YAChD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,MAAM,EAAE,CAAC,CAAA;YACxD,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAED;;;;;;OAMG;IACU,cAAc,CAAC,MAAa;;YACrC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,sBAAsB,MAAM,EAAE,CAAC,CAAA;YACnE,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;CACJ;AAnDD,qCAmDC"}
@@ -0,0 +1,7 @@
1
+ interface IProductStatuses {
2
+ getProductStatuses(): Promise<any>;
3
+ getProductStatusesById(id: number): Promise<any>;
4
+ getProductsByStatusMarker(marker: string): Promise<any>;
5
+ validateMarker(marker: string): Promise<any>;
6
+ }
7
+ export { IProductStatuses };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=productStatusesInterfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"productStatusesInterfaces.js","sourceRoot":"","sources":["../../src/product-statuses/productStatusesInterfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,181 @@
1
+ import { IProductsQuery, IFilterParams, IProduct, IProductApi } from './productsInterfaces';
2
+ import OneEntry from '../base/oneEntry';
3
+ /**
4
+ * Controllers for working with product pages
5
+ */
6
+ export default class ProductApi extends OneEntry implements IProductApi {
7
+ constructor(url: string);
8
+ private _defaultQuery;
9
+ /**
10
+ * Search for all product page objects with pagination and filtering.
11
+ *
12
+ * @param {IProductsQuery} [userQuery] - Optional set query parameters.
13
+ * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
14
+ *
15
+ * @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
16
+ *
17
+ * @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
18
+ *
19
+ * @param {string} [userQuery.conditionValue] - Optional value that is being searched
20
+ *
21
+ * @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
22
+ *
23
+ * @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
24
+ *
25
+ * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
26
+ *
27
+ * @param {string} [userQuery.sortKey] - Optional field to sort by
28
+ *
29
+ * @returns {Promise<IProduct[]>} - List of products.
30
+ */
31
+ getProducts(userQuery?: IProductsQuery): Promise<IProduct[]>;
32
+ /**
33
+ * Search for all product page objects with pagination that do not have a category.
34
+ *
35
+ * @param {IProductsQuery} [userQuery] - Optional set query parameters.
36
+ * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
37
+ *
38
+ * @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
39
+ *
40
+ * @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
41
+ *
42
+ * @param {string} [userQuery.conditionValue] - Optional value that is being searched
43
+ *
44
+ * @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
45
+ *
46
+ * @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
47
+ *
48
+ * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
49
+ *
50
+ * @param {string} [userQuery.sortKey] - Optional field to sort by
51
+ *
52
+ * @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
53
+ */
54
+ getProductsEmptyPage(userQuery?: IProductsQuery): Promise<any>;
55
+ /**
56
+ * Search for all product page objects with pagination for the selected category.
57
+ *
58
+ * @param {number} [id] - Page identifier.
59
+ *
60
+ * @param {IProductsQuery} [userQuery] - Optional set query parameters.
61
+ * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
62
+ *
63
+ * @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
64
+ *
65
+ * @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
66
+ *
67
+ * @param {string} [userQuery.conditionValue] - Optional value that is being searched
68
+ *
69
+ * @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
70
+ *
71
+ * @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
72
+ *
73
+ * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
74
+ *
75
+ * @param {string} [userQuery.sortKey] - Optional field to sort by
76
+ *
77
+ * @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
78
+ */
79
+ getProductsPageById(id: number, userQuery?: IProductsQuery): Promise<any>;
80
+ /**
81
+ * Search for all product page objects with pagination for the selected category (by its URL).
82
+ *
83
+ * @param {string} [url] - URL of the category page.
84
+ *
85
+ * @param {IProductsQuery} [userQuery] - Optional set query parameters.
86
+ * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
87
+ *
88
+ * @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
89
+ *
90
+ * @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
91
+ *
92
+ * @param {string} [userQuery.conditionValue] - Optional value that is being searched
93
+ *
94
+ * @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
95
+ *
96
+ * @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
97
+ *
98
+ * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
99
+ *
100
+ * @param {string} [userQuery.sortKey] - Optional field to sort by
101
+ *
102
+ * @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
103
+ */
104
+ getProductsPageByUrl(url: string, userQuery?: IProductsQuery): Promise<IProduct[]>;
105
+ /**
106
+ * Find all related product page objects.
107
+ *
108
+ * @param {number} [id] - Product page identifier for which to find relationship.
109
+ *
110
+ * @param {IProductsQuery} [userQuery] - Optional set query parameters.
111
+ * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
112
+ *
113
+ * @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
114
+ *
115
+ * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
116
+ *
117
+ * @param {string} [userQuery.sortKey] - Optional field to sort by
118
+ *
119
+ * @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
120
+ */
121
+ getRelatedProductsById(id: number, userQuery?: IProductsQuery): Promise<any>;
122
+ /**
123
+ * Retrieve one product object.
124
+ *
125
+ * @param {number} [id] - Product id.
126
+ *
127
+ * @returns {Promise<IProduct[]>} - Returns ContentIndexedProductDto object for the product.
128
+ */
129
+ getProductById(id: number): Promise<IProduct>;
130
+ /**
131
+ * Find all product page objects with pagination and multiple filtering.
132
+ *
133
+ * @param {array} [data] - Request body.
134
+ * Example Value:
135
+ * [
136
+ * {
137
+ * "attributeMarker": "price",
138
+ * "conditionMarker": "mth",
139
+ * "conditionValue": 1,
140
+ * "pageId": 0
141
+ * },
142
+ * {
143
+ * "attributeMarker": "price",
144
+ * "conditionMarker": "lth",
145
+ * "conditionValue": 3,
146
+ * "pageId": 0
147
+ * }
148
+ * ]
149
+ *
150
+ *
151
+ * @param {IProductsQuery} [userQuery] - Optional set query parameters.
152
+ * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
153
+ *
154
+ * @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
155
+ *
156
+ * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
157
+ *
158
+ * @param {string} [userQuery.sortKey] - Optional field to sort by
159
+ *
160
+ * @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
161
+ */
162
+ filterProduct(data: Array<IFilterParams>, userQuery?: IProductsQuery): Promise<any>;
163
+ /**
164
+ * Quick search for product page objects with limited output.
165
+ *
166
+ * @param {string} [name] - Text to search product page objects (search is based on the title field of the localizeInfos object with language consideration)
167
+ *
168
+ * @param {string} [lang] - Language code
169
+ *
170
+ * @returns {Promise<IProduct[]>} - Returns array of ContentIndexedProductDto object for the product.
171
+ */
172
+ searchProduct(name: string, lang?: string): Promise<any>;
173
+ /**
174
+ * Get all attributes of one Product.
175
+ *
176
+ * @param {number} [id] - Product id.
177
+ *
178
+ * @returns {Promise<IProduct[]>} - Returns array of set attributes.
179
+ */
180
+ getAttributesByProductId(id: number): Promise<any>;
181
+ }
@@ -0,0 +1,262 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const oneEntry_1 = require("../base/oneEntry");
13
+ /**
14
+ * Controllers for working with product pages
15
+ */
16
+ class ProductApi extends oneEntry_1.default {
17
+ constructor(url) {
18
+ super(url);
19
+ this._defaultQuery = {
20
+ offset: 0,
21
+ limit: 30,
22
+ statusMarker: null,
23
+ conditionValue: null,
24
+ conditionMarker: null,
25
+ attributeMarker: null,
26
+ sortOrder: 'DESC',
27
+ sortKey: 'id'
28
+ };
29
+ this._url += '/api/content/products';
30
+ }
31
+ /**
32
+ * Search for all product page objects with pagination and filtering.
33
+ *
34
+ * @param {IProductsQuery} [userQuery] - Optional set query parameters.
35
+ * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
36
+ *
37
+ * @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
38
+ *
39
+ * @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
40
+ *
41
+ * @param {string} [userQuery.conditionValue] - Optional value that is being searched
42
+ *
43
+ * @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
44
+ *
45
+ * @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
46
+ *
47
+ * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
48
+ *
49
+ * @param {string} [userQuery.sortKey] - Optional field to sort by
50
+ *
51
+ * @returns {Promise<IProduct[]>} - List of products.
52
+ */
53
+ getProducts(userQuery) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const query = Object.assign(Object.assign({}, this._defaultQuery), userQuery);
56
+ const result = yield this._fetchGet('/page/url/shop?' + this._queryParamsToString(query));
57
+ return result.items;
58
+ });
59
+ }
60
+ /**
61
+ * Search for all product page objects with pagination that do not have a category.
62
+ *
63
+ * @param {IProductsQuery} [userQuery] - Optional set query parameters.
64
+ * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
65
+ *
66
+ * @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
67
+ *
68
+ * @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
69
+ *
70
+ * @param {string} [userQuery.conditionValue] - Optional value that is being searched
71
+ *
72
+ * @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
73
+ *
74
+ * @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
75
+ *
76
+ * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
77
+ *
78
+ * @param {string} [userQuery.sortKey] - Optional field to sort by
79
+ *
80
+ * @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
81
+ */
82
+ getProductsEmptyPage(userQuery) {
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ const query = Object.assign(Object.assign({}, this._defaultQuery), userQuery);
85
+ const result = yield this._fetchGet('/empty-page?' + this._queryParamsToString(query));
86
+ return result;
87
+ });
88
+ }
89
+ /**
90
+ * Search for all product page objects with pagination for the selected category.
91
+ *
92
+ * @param {number} [id] - Page identifier.
93
+ *
94
+ * @param {IProductsQuery} [userQuery] - Optional set query parameters.
95
+ * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
96
+ *
97
+ * @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
98
+ *
99
+ * @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
100
+ *
101
+ * @param {string} [userQuery.conditionValue] - Optional value that is being searched
102
+ *
103
+ * @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
104
+ *
105
+ * @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
106
+ *
107
+ * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
108
+ *
109
+ * @param {string} [userQuery.sortKey] - Optional field to sort by
110
+ *
111
+ * @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
112
+ */
113
+ getProductsPageById(id, userQuery) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ const query = Object.assign(Object.assign({}, this._defaultQuery), userQuery);
116
+ const result = yield this._fetchGet(`/page/${id}?` + this._queryParamsToString(query));
117
+ return result.items;
118
+ });
119
+ }
120
+ /**
121
+ * Search for all product page objects with pagination for the selected category (by its URL).
122
+ *
123
+ * @param {string} [url] - URL of the category page.
124
+ *
125
+ * @param {IProductsQuery} [userQuery] - Optional set query parameters.
126
+ * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
127
+ *
128
+ * @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
129
+ *
130
+ * @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
131
+ *
132
+ * @param {string} [userQuery.conditionValue] - Optional value that is being searched
133
+ *
134
+ * @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
135
+ *
136
+ * @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
137
+ *
138
+ * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
139
+ *
140
+ * @param {string} [userQuery.sortKey] - Optional field to sort by
141
+ *
142
+ * @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
143
+ */
144
+ getProductsPageByUrl(url, userQuery) {
145
+ return __awaiter(this, void 0, void 0, function* () {
146
+ const query = Object.assign(Object.assign({}, this._defaultQuery), userQuery);
147
+ const result = yield this._fetchGet(`/page/url/${url}?` + this._queryParamsToString(query));
148
+ return result.items;
149
+ });
150
+ }
151
+ /**
152
+ * Find all related product page objects.
153
+ *
154
+ * @param {number} [id] - Product page identifier for which to find relationship.
155
+ *
156
+ * @param {IProductsQuery} [userQuery] - Optional set query parameters.
157
+ * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
158
+ *
159
+ * @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
160
+ *
161
+ * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
162
+ *
163
+ * @param {string} [userQuery.sortKey] - Optional field to sort by
164
+ *
165
+ * @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
166
+ */
167
+ getRelatedProductsById(id, userQuery) {
168
+ return __awaiter(this, void 0, void 0, function* () {
169
+ const query = Object.assign(Object.assign({}, this._defaultQuery), userQuery);
170
+ const result = yield this._fetchGet(`/${id}/related?` + this._queryParamsToString(query));
171
+ return result.items;
172
+ });
173
+ }
174
+ /**
175
+ * Retrieve one product object.
176
+ *
177
+ * @param {number} [id] - Product id.
178
+ *
179
+ * @returns {Promise<IProduct[]>} - Returns ContentIndexedProductDto object for the product.
180
+ */
181
+ getProductById(id) {
182
+ return __awaiter(this, void 0, void 0, function* () {
183
+ const result = yield this._fetchGet(`/${id}`);
184
+ return result;
185
+ });
186
+ }
187
+ /**
188
+ * Find all product page objects with pagination and multiple filtering.
189
+ *
190
+ * @param {array} [data] - Request body.
191
+ * Example Value:
192
+ * [
193
+ * {
194
+ * "attributeMarker": "price",
195
+ * "conditionMarker": "mth",
196
+ * "conditionValue": 1,
197
+ * "pageId": 0
198
+ * },
199
+ * {
200
+ * "attributeMarker": "price",
201
+ * "conditionMarker": "lth",
202
+ * "conditionValue": 3,
203
+ * "pageId": 0
204
+ * }
205
+ * ]
206
+ *
207
+ *
208
+ * @param {IProductsQuery} [userQuery] - Optional set query parameters.
209
+ * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
210
+ *
211
+ * @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
212
+ *
213
+ * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
214
+ *
215
+ * @param {string} [userQuery.sortKey] - Optional field to sort by
216
+ *
217
+ * @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
218
+ */
219
+ filterProduct(data, userQuery) {
220
+ return __awaiter(this, void 0, void 0, function* () {
221
+ const query = Object.assign(Object.assign({}, this._defaultQuery), userQuery);
222
+ const result = yield this._fetchPost(`conditions-filter?` + this._queryParamsToString(query), data);
223
+ return result;
224
+ });
225
+ }
226
+ /**
227
+ * Quick search for product page objects with limited output.
228
+ *
229
+ * @param {string} [name] - Text to search product page objects (search is based on the title field of the localizeInfos object with language consideration)
230
+ *
231
+ * @param {string} [lang] - Language code
232
+ *
233
+ * @returns {Promise<IProduct[]>} - Returns array of ContentIndexedProductDto object for the product.
234
+ */
235
+ searchProduct(name, lang = 'en_US') {
236
+ return __awaiter(this, void 0, void 0, function* () {
237
+ const searchProducts = yield this._fetchGet(`/quick/search?lang=${lang}&name=${name}`);
238
+ const productsList = [];
239
+ yield Promise.all(searchProducts.map((product) => __awaiter(this, void 0, void 0, function* () {
240
+ yield this.getProductById(product.id).then((result) => {
241
+ productsList.push(result);
242
+ });
243
+ })));
244
+ return productsList;
245
+ });
246
+ }
247
+ /**
248
+ * Get all attributes of one Product.
249
+ *
250
+ * @param {number} [id] - Product id.
251
+ *
252
+ * @returns {Promise<IProduct[]>} - Returns array of set attributes.
253
+ */
254
+ getAttributesByProductId(id) {
255
+ return __awaiter(this, void 0, void 0, function* () {
256
+ const product = yield this.getProductById(id);
257
+ return product.attributeValues;
258
+ });
259
+ }
260
+ }
261
+ exports.default = ProductApi;
262
+ //# sourceMappingURL=productsApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"productsApi.js","sourceRoot":"","sources":["../../src/products/productsApi.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,+CAAuC;AAGvC;;GAEG;AACH,MAAqB,UAAW,SAAQ,kBAAQ;IAC5C,YAAY,GAAU;QAClB,KAAK,CAAC,GAAG,CAAC,CAAA;QAIN,kBAAa,GAAkB;YACnC,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,EAAE;YACT,YAAY,EAAE,IAAI;YAClB,cAAc,EAAE,IAAI;YACpB,eAAe,EAAE,IAAI;YACrB,eAAe,EAAE,IAAI;YACrB,SAAS,EAAE,MAAM;YACjB,OAAO,EAAE,IAAI;SAChB,CAAA;QAZG,IAAI,CAAC,IAAI,IAAI,uBAAuB,CAAA;IACxC,CAAC;IAaD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACU,WAAW,CAAC,SAA0B;;YAC/C,MAAM,KAAK,mCAAsB,IAAI,CAAC,aAAa,GAAK,SAAS,CAAC,CAAA;YAElE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,iBAAiB,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,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;YAC7C,OAAO,OAAO,CAAC,eAAe,CAAA;QAClC,CAAC;KAAA;CAEJ;AAvPD,6BAuPC"}
@@ -0,0 +1,43 @@
1
+ interface IProductApi {
2
+ getProducts(userQuery?: IProductsQuery): Promise<IProduct[]>;
3
+ getProductsEmptyPage(userQuery?: IProductsQuery): Promise<any>;
4
+ getProductsPageById(id: number, userQuery?: IProductsQuery): Promise<any>;
5
+ getProductsPageByUrl(url: string, userQuery?: IProductsQuery): Promise<any>;
6
+ getRelatedProductsById(id: number, userQuery?: IProductsQuery): Promise<any>;
7
+ getProductById(id: number): Promise<any>;
8
+ filterProduct(data: Array<IFilterParams>, userQuery?: IProductsQuery): Promise<any>;
9
+ searchProduct(name: string, lang: string): Promise<any>;
10
+ getAttributesByProductId(id: number): Promise<any>;
11
+ }
12
+ interface IProduct {
13
+ attributeSetId: number | null;
14
+ attributeValues: object[] | null;
15
+ id: number;
16
+ isSync: number;
17
+ isVisible: boolean;
18
+ localizeInfos: object;
19
+ position: number;
20
+ price?: number;
21
+ relatedIds: number[];
22
+ shortDescTemplateIdentifier: string | number | null;
23
+ statusId: number | null;
24
+ templateIdentifier: string | number | null;
25
+ }
26
+ interface IProductsQuery {
27
+ offset?: number;
28
+ limit?: number;
29
+ statusMarker?: string | null;
30
+ conditionValue?: string | null;
31
+ conditionMarker?: string | null;
32
+ attributeMarker?: string | null;
33
+ sortOrder?: string;
34
+ sortKey?: string;
35
+ [key: string]: string | number | null;
36
+ }
37
+ interface IFilterParams {
38
+ attributeMarker: string;
39
+ conditionMarker: string;
40
+ conditionValue: number;
41
+ pageId?: number;
42
+ }
43
+ export { IFilterParams, IProductsQuery, IProduct, IProductApi };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=productsInterfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"productsInterfaces.js","sourceRoot":"","sources":["../../src/products/productsInterfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ import OneEntry from '../base/oneEntry';
2
+ import { ITemplatesApi } from './templatesInterfaces';
3
+ /**
4
+ * Controllers for working with template objects
5
+ */
6
+ export default class TemplatesPreviewApi extends OneEntry implements ITemplatesApi {
7
+ constructor(url: string);
8
+ /**
9
+ * Get all template objects of a specific type.
10
+ *
11
+ * @returns Returns an array of product status objects
12
+ */
13
+ getTemplates(): Promise<any>;
14
+ /**
15
+ * Get all template objects grouped by types.
16
+ *
17
+ * @param {number} [id] - Status id
18
+ *
19
+ * @returns Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
20
+ */
21
+ getAllTemplates(): Promise<any>;
22
+ /**
23
+ * Get one template object by id.
24
+ *
25
+ * @param {number} [id] - Product marker
26
+ *
27
+ * @returns Returns a TemplateEntity object
28
+ */
29
+ getTemplateById(id: number): Promise<any>;
30
+ /**
31
+ * Get a single template object by marker.
32
+ *
33
+ * @param {string} [marker] - Product marker
34
+ *
35
+ * @returns Returns a TemplateEntity object
36
+ */
37
+ getTemplateByMarker(marker: string): Promise<any>;
38
+ }