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
package/README.md ADDED
@@ -0,0 +1,324 @@
1
+ # OneEntry SDK
2
+
3
+ OneEntry Headless CMS SDK is an SDK that provides an easy way to interact with the OneEntry Headless CMS API.
4
+
5
+ ## Installation
6
+
7
+ To install the OneEntry Headless CMS SDK in your project, run the following command:
8
+
9
+ > > npm install oneentry
10
+
11
+ ## Usage
12
+
13
+ To use the OneEntry Headless CMS SDK in your project, import the defineOneEntry function:
14
+
15
+ > > import { defineOneEntry } from 'oneentry';
16
+
17
+ > const {
18
+ > Product,
19
+ > Page,
20
+ > ProductStatus,
21
+ > Templates,
22
+ > TemplatesPreview,
23
+ > Markers,
24
+ > AttributeSet,
25
+ > Admins,
26
+ > GeneralTypes,
27
+ > Locales,
28
+ > Menus,
29
+ > Modules
30
+ > } = defineOneEntry('your-url');
31
+ >
32
+ > Or
33
+ >
34
+ > const api = defineOneEntry('your-url')
35
+
36
+ ## Classes and Methods
37
+
38
+ The OneEntry Headless CMS SDK contains two classes: ProductApi and PageApi.
39
+
40
+ ### AdminsApi
41
+
42
+ const { Admins } = defineOneEntry('your-url');
43
+
44
+ #### getAdminsInfo
45
+
46
+ > > const value = await getAdminsInfo()
47
+ >
48
+ > This method retrieves all user objects of type admin from the API. It returns a Promise that resolves to an array of AdminEntity objects.
49
+
50
+ ### AttributeSetApi
51
+
52
+ const { AttributeSet } = defineOneEntry('your-url');
53
+
54
+ #### getAttributeSetById
55
+
56
+ > > const value = await getAttributeSetById(1)
57
+ >
58
+ > This method retrieves a single attribute set object based on its identifier (id) from the API. It returns a Promise that resolves to the attribute set object.
59
+
60
+ #### getAttributeSetByMarker
61
+
62
+ > > const value = await getAttributeSetByMarker('marker')
63
+ >
64
+ > This method retrieves a single attribute set object based on its marker (marker) from the API. It returns a Promise that resolves to the attribute set object.
65
+
66
+ ### GeneralTypesApi
67
+
68
+ const { GeneralTypes } = defineOneEntry('your-url');
69
+
70
+ #### getAllTypes
71
+
72
+ > > const value = await getAllTypes()
73
+ >
74
+ > This method retrieves all objects of type GeneralTypeEntity from the API. It returns a Promise that resolves to an array of GeneralTypeEntity objects.
75
+
76
+ ### LocalesApi
77
+
78
+ const { Locales } = defineOneEntry('your-url');
79
+
80
+ #### getLocales
81
+
82
+ > > const value = await getLocales()
83
+ >
84
+ > This method retrieves all active language localization objects from the API. It returns a Promise that resolves to an array of LocaleEntity objects.
85
+
86
+ ### MarkersApi
87
+
88
+ const { Markers } = defineOneEntry('your-url');
89
+
90
+ #### getMarker
91
+
92
+ > > const value = await getMarker('marker')
93
+ >
94
+ > This method retrieves a single marker object based on its marker identifier (marker) from the API. It returns a Promise that resolves to the marker object of type MarkerEntity.
95
+
96
+ #### getMarkers
97
+
98
+ > > const value = await getMarkers({limit:20, offset:5})
99
+ >
100
+ > This method retrieves all marker objects from the API. It accepts two optional parameters limit (default 30) and offset (default 0) that allow you to limit the selection of records and offset the records selection, respectively. It returns a Promise that resolves to an object of type ItemsWithTotal, where items is an array of MarkerEntity objects and total is the total number of markers found.
101
+
102
+ #### getMarkersById
103
+
104
+ > > const value = await getMarkersById(1)
105
+ >
106
+ > This method retrieves a single marker object based on its identifier (id) from the API. It returns a Promise that resolves to the marker object of type MarkerEntity.
107
+
108
+ ### MenusApi
109
+
110
+ const { Menus } = defineOneEntry('your-url');
111
+
112
+ #### getMenusByMarker
113
+
114
+ > > const value = await getMenusByMarker('marker')
115
+ >
116
+ > This method retrieves a single menu object based on its marker (marker) from the API. It returns a Promise that resolves to a single menu object as a ContentMenuDto object with included pages.
117
+
118
+ ### ModulesApi
119
+
120
+ const { Modules } = defineOneEntry('your-url');
121
+
122
+ #### getAllModules
123
+
124
+ > > const value = await getAllModules()
125
+ >
126
+ > This method retrieves all modules from the API. It returns a Promise that resolves to an array of BaseModuleDto objects or an empty array [] if there is no data.
127
+
128
+ ### PagesApi
129
+
130
+ const { Pages } = defineOneEntry('your-url');
131
+
132
+ #### getRootPages
133
+
134
+ > > const value = await getRootPages()
135
+ >
136
+ > This method retrieves all top-level page objects from the API. It returns a Promise that resolves to an array of ContentIndexedPageDto objects or an empty array [] if there is no data.
137
+
138
+ #### getCatalogPages
139
+
140
+ > > const value = await getCatalogPages({limit:20, offset:5})
141
+ >
142
+ > This method retrieves all page objects with product information as an array from the API. It accepts two optional parameters limit and offset for pagination. It returns a Promise that resolves to an array of ContentIndexedPageDto objects or an empty array [] if there is no data.
143
+
144
+ #### getPages
145
+
146
+ > > const value = await getPages()
147
+ >
148
+ > This method retrieves all created pages as an array from the API. It returns a Promise that resolves to an array of ContentIndexedPageDto objects or an empty array [] if there is no data.
149
+
150
+ #### getPageById
151
+
152
+ > > const value = await getPageById(1)
153
+ >
154
+ > This method retrieves a single page object based on its identifier (id) from the API. It returns a Promise that resolves to the page object, with the specific DTO depending on the type of page being returned.
155
+
156
+ #### getPageByUrl
157
+
158
+ > > const value = await getPageById('shop')
159
+ >
160
+ > This method retrieves a single page object based on its URL (url) from the API. It returns a Promise that resolves to the page object, with the specific DTO depending on the type of page being returned.
161
+
162
+ #### getChildPagesByParentUrl
163
+
164
+ > > const value = await getChildPagesByParentUrl('shop')
165
+ >
166
+ > This method retrieves child pages object with information as an array based on the parent page's URL (url). It returns a Promise that resolves to an array of ContentIndexedPageDto objects or an empty array [] if there is no data for the selected parent.
167
+
168
+ #### getConfigPageByUrl
169
+
170
+ > > const value = await getConfigPageByUrl('shop')
171
+ >
172
+ > This method retrieves the settings for a specific page based on its URL (url). It returns a Promise that resolves to a ConfigPageDto object with page display settings.
173
+
174
+ #### searchPage
175
+
176
+ > > const value = await searchPage('cup')
177
+ >
178
+ > This method performs a quick search for page objects based on a text query (name). It returns a Promise that resolves to a ContentIndexedPageDto objects or an empty array [].
179
+
180
+ ### ProductsApi
181
+
182
+ const { Products } = defineOneEntry('your-url');
183
+ This module accepts a set of user parameters called userQuery. If the parameters are not passed to the method, the default value will be applied.
184
+
185
+ > {offset: 0,
186
+ > limit: 30,
187
+ > statusMarker: null,
188
+ > conditionValue: null,
189
+ > conditionMarker: null,
190
+ > attributeMarker: null,
191
+ > sortOrder: 'DESC',
192
+ > sortKey: 'id'}
193
+
194
+ #### getProducts
195
+
196
+ > > const value = await getProducts()
197
+ >
198
+ > This method searches for product page objects with pagination and filtering based on the provided query parameters (userQuery). It returns a Promise that resolves to a list of products (IProduct[]).
199
+
200
+ #### getProductsEmptyPage
201
+
202
+ > > const value = await getProductsEmptyPage()
203
+ >
204
+ > This method searches for product page objects with pagination that do not have a category, based on the provided query parameters (userQuery). It returns a Promise that resolves to an array of items, where each item is a ContentIndexedProductDto object.
205
+
206
+ #### getProductsPageById
207
+
208
+ > > const value = await getProductsPageById(1)
209
+ >
210
+ > This method searches for all product page objects with pagination for the selected category based on the page identifier (id). It accepts an optional userQuery parameter to set query parameters for the search. The query parameters include limit, offset, statusMarker, conditionValue, conditionMarker, attributeMarker, sortOrder, and sortKey. It returns a Promise that resolves to an array of ContentIndexedProductDto objects.
211
+
212
+ #### getProductsPageByUrl
213
+
214
+ > > const value = await getProductsPageByUrl('cup')
215
+ >
216
+ > This method searches for all product page objects with pagination for the selected category based on the page URL (url). It accepts an optional userQuery parameter to set query parameters for the search. The query parameters include limit, offset, statusMarker, conditionValue, conditionMarker, attributeMarker, sortOrder, and sortKey. It returns a Promise that resolves to an array of ContentIndexedProductDto objects.
217
+
218
+ #### getRelatedProductsById
219
+
220
+ > > const value = await getRelatedProductsById(1)
221
+ >
222
+ > This method retrieves all related product page objects for a specific product based on its identifier (id) from the API. It accepts an optional userQuery parameter for additional query parameters such as limit, offset, sortOrder, and sortKey. It returns a Promise that resolves to an array of ContentIndexedProductDto objects.
223
+
224
+ #### getProductById
225
+
226
+ > > const value = await getProductById(1)
227
+ >
228
+ > This method retrieves a single product object based on its identifier (id) from the API. It returns a Promise that resolves to a ContentIndexedProductDto object for the product.
229
+
230
+ #### filterProduct
231
+
232
+ > > const value = await filterProduct({conditionValue:1})
233
+ >
234
+ > This method filters product page objects with pagination and multiple filtering based on the provided data request body. The data parameter should be an array of {attributeMarker:string,conditionMarker:string,conditionValue:number,pageId:number}.
235
+
236
+ #### searchProduct
237
+
238
+ > > const value = await searchProduct('cup')
239
+ >
240
+ > This method performs a quick search for product page objects based on a text query name. The search is performed on the title field of the localizeInfos object, taking the specified lang language code into consideration. It returns a Promise that resolves to an array of ContentIndexedProductDto objects.
241
+
242
+ #### getAttributesByProductId
243
+
244
+ > > const value = await getAttributesByProductId(1)
245
+ >
246
+ > This method retrieves all attributes of a product based on its identifier (id) from the API. It returns a Promise that resolves to an array of set attributes for the product.
247
+
248
+ ### ProductStatusApi
249
+
250
+ const { ProductStatus } = defineOneEntry('your-url');
251
+
252
+ #### getProductStatuses
253
+
254
+ > > const value = await getProductStatuses()
255
+ >
256
+ > This method searches for all product status objects from the API. It returns a Promise that resolves to an array of product status objects.
257
+
258
+ #### getProductStatusesById
259
+
260
+ > > const value = await getProductStatusesById(1)
261
+ >
262
+ > This method searches for a product status object based on its identifier (id) from the API. It returns a Promise that resolves to a product status object.
263
+
264
+ #### getProductsByStatusMarker
265
+
266
+ > > const value = await getProductsByStatusMarker('marker')
267
+ >
268
+ > This method searches for a product status object based on its textual identifier (marker) from the API. It returns a Promise that resolves to a product status object.
269
+
270
+ #### validateMarker
271
+
272
+ > > const value = await validateMarker('marker')
273
+ >
274
+ > This method checks the existence of a textual identifier (marker). It takes a marker parameter as input, representing the product marker to validate. It returns a Promise that resolves to true if the textual identifier (marker) exists or false if it doesn't.
275
+
276
+ ### TemplatesApi
277
+
278
+ const { Templates } = defineOneEntry('your-url');
279
+
280
+ #### getTemplates
281
+
282
+ > > const value = await getTemplates()
283
+ >
284
+ > This method retrieves all template objects of a specific type from the API. It returns a Promise that resolves to an array of template objects.
285
+
286
+ #### getAllTemplates
287
+
288
+ > > const value = await getAllTemplates()
289
+ >
290
+ > This method retrieves all template objects grouped by types from the API. It returns a Promise that resolves to an object GroupedTemplatesObject, which contains an array of template objects.
291
+
292
+ #### getTemplateById
293
+
294
+ > > const value = await getTemplateById(1)
295
+ >
296
+ > This method retrieves a single template object based on its identifier (id) from the API. It returns a Promise that resolves to a template object.
297
+
298
+ #### getTemplateByMarker
299
+
300
+ > > const value = await getTemplateByMarker(1)
301
+ >
302
+ > This method retrieves a single template object based on its textual identifier (marker) from the API. It returns a Promise that resolves to a template object.
303
+
304
+ ### TemplatesPreviewApi
305
+
306
+ const { TemplatesPreview } = defineOneEntry('your-url');
307
+
308
+ #### getTemplatesPreview
309
+
310
+ > > const value = await getTemplatesPreview()
311
+ >
312
+ > This method retrieves all template objects from the API. It returns a Promise that resolves to an array of TemplatePreviewsEntity template objects.
313
+
314
+ #### getTemplatesPreviewById
315
+
316
+ > > const value = await getTemplatesPreviewById(1)
317
+ >
318
+ > This method retrieves a single template object based on its identifier (id) from the API. It returns a Promise that resolves to a TemplatePreviewsEntity object.
319
+
320
+ #### getTemplatesPreviewByMarker
321
+
322
+ > > const value = await getTemplatesPreviewByMarker('marker')
323
+ >
324
+ > This method retrieves a single template object based on its textual identifier (marker) from the API. It returns a Promise that resolves to a TemplatePreviewsEntity object.
@@ -0,0 +1,14 @@
1
+ import OneEntry from "../base/oneEntry";
2
+ import { IAdmins } from "./adminsInterfaces";
3
+ /**
4
+ * Controllers for working with users - admins
5
+ */
6
+ export default class AdminsApi extends OneEntry implements IAdmins {
7
+ constructor(url: string);
8
+ /**
9
+ * Get all user objects - admins.
10
+ *
11
+ * @returns Returns all AdminEntity user objects
12
+ */
13
+ getAdminsInfo(): Promise<any>;
14
+ }
@@ -0,0 +1,34 @@
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 users - admins
15
+ */
16
+ class AdminsApi extends oneEntry_1.default {
17
+ constructor(url) {
18
+ super(url);
19
+ this._url += '/api/content/admins';
20
+ }
21
+ /**
22
+ * Get all user objects - admins.
23
+ *
24
+ * @returns Returns all AdminEntity user objects
25
+ */
26
+ getAdminsInfo() {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ const result = yield this._fetchGet('');
29
+ return result;
30
+ });
31
+ }
32
+ }
33
+ exports.default = AdminsApi;
34
+ //# sourceMappingURL=adminsApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adminsApi.js","sourceRoot":"","sources":["../../src/admins/adminsApi.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+CAAwC;AAGxC;;GAEG;AACH,MAAqB,SAAU,SAAQ,kBAAQ;IAC3C,YAAY,GAAW;QACnB,KAAK,CAAC,GAAG,CAAC,CAAA;QACV,IAAI,CAAC,IAAI,IAAI,qBAAqB,CAAA;IACtC,CAAC;IAED;;;;OAIG;IACU,aAAa;;YACtB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;YACvC,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;CAEJ;AAhBD,4BAgBC"}
@@ -0,0 +1,4 @@
1
+ interface IAdmins {
2
+ getAdminsInfo(): Promise<any>;
3
+ }
4
+ export { IAdmins };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=adminsInterfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adminsInterfaces.js","sourceRoot":"","sources":["../../src/admins/adminsInterfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ import OneEntry from "../base/oneEntry";
2
+ import { IAttributeSet } from "./attributeSetInterfaces";
3
+ /**
4
+ * Controllers for working with attribute sets
5
+ */
6
+ export default class AttributeSetApi extends OneEntry implements IAttributeSet {
7
+ constructor(url: string);
8
+ /**
9
+ * Get one attributes set object.
10
+ *
11
+ * @param {number} [id] - Identifier of the attributes set object
12
+ *
13
+ * @returns Returns one attributes set object
14
+ */
15
+ getAttributeSetById(id: number): Promise<any>;
16
+ /**
17
+ * Get one attributes set object by marker.
18
+ *
19
+ * @param {string} [marker] - Marker of the attributes set object
20
+ *
21
+ * @returns Returns one attributes set object
22
+ */
23
+ getAttributeSetByMarker(marker: string): Promise<any>;
24
+ }
@@ -0,0 +1,49 @@
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 attribute sets
15
+ */
16
+ class AttributeSetApi extends oneEntry_1.default {
17
+ constructor(url) {
18
+ super(url);
19
+ this._url += '/api/content/attributes-sets';
20
+ }
21
+ /**
22
+ * Get one attributes set object.
23
+ *
24
+ * @param {number} [id] - Identifier of the attributes set object
25
+ *
26
+ * @returns Returns one attributes set object
27
+ */
28
+ getAttributeSetById(id) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ const result = yield this._fetchGet(`/${id}`);
31
+ return result;
32
+ });
33
+ }
34
+ /**
35
+ * Get one attributes set object by marker.
36
+ *
37
+ * @param {string} [marker] - Marker of the attributes set object
38
+ *
39
+ * @returns Returns one attributes set object
40
+ */
41
+ getAttributeSetByMarker(marker) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const result = yield this._fetchGet(`marker/${marker}`);
44
+ return result;
45
+ });
46
+ }
47
+ }
48
+ exports.default = AttributeSetApi;
49
+ //# sourceMappingURL=attributeSetApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attributeSetApi.js","sourceRoot":"","sources":["../../src/attribute-set/attributeSetApi.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+CAAwC;AAGxC;;GAEG;AACH,MAAqB,eAAgB,SAAQ,kBAAQ;IACjD,YAAY,GAAW;QACnB,KAAK,CAAC,GAAG,CAAC,CAAA;QACV,IAAI,CAAC,IAAI,IAAI,8BAA8B,CAAA;IAC/C,CAAC;IAED;;;;;;OAMG;IACU,mBAAmB,CAAC,EAAS;;YACtC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;YAC7C,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAED;;;;;;OAMG;IACU,uBAAuB,CAAC,MAAa;;YAC9C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,MAAM,EAAE,CAAC,CAAA;YACvD,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;CACJ;AA7BD,kCA6BC"}
@@ -0,0 +1,5 @@
1
+ interface IAttributeSet {
2
+ getAttributeSetById(id: number): Promise<any>;
3
+ getAttributeSetByMarker(url: string): Promise<any>;
4
+ }
5
+ export { IAttributeSet };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=attributeSetInterfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attributeSetInterfaces.js","sourceRoot":"","sources":["../../src/attribute-set/attributeSetInterfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { IProductsQuery } from '../products/productsInterfaces';
2
+ export default abstract class OneEntry {
3
+ protected _url: string;
4
+ constructor(url: string);
5
+ protected _getFullPath(path: string): string;
6
+ protected _fetchGet(path: string): Promise<any>;
7
+ protected _fetchPost(path: string, data: object): Promise<any>;
8
+ protected _queryParamsToString(query: IProductsQuery): string;
9
+ }
@@ -0,0 +1,55 @@
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
+ class OneEntry {
13
+ constructor(url) {
14
+ this._url = url;
15
+ }
16
+ _getFullPath(path) {
17
+ return (this._url + path);
18
+ }
19
+ _fetchGet(path) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const response = yield fetch(this._getFullPath(path), {
22
+ method: 'GET',
23
+ headers: {
24
+ 'Content-Type': 'application/json'
25
+ }
26
+ });
27
+ const result = yield response.json();
28
+ return result;
29
+ });
30
+ }
31
+ _fetchPost(path, data) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ const response = yield fetch(this._getFullPath(path), {
34
+ method: 'POST',
35
+ headers: {
36
+ 'Content-Type': 'application/json'
37
+ },
38
+ body: JSON.stringify(data)
39
+ });
40
+ const result = yield response.json();
41
+ return result;
42
+ });
43
+ }
44
+ _queryParamsToString(query) {
45
+ let result = '';
46
+ for (let key in query) {
47
+ if (query[key] !== null) {
48
+ result += `${key}=${query[key]}&`;
49
+ }
50
+ }
51
+ return result.slice(0, (result.length - 1));
52
+ }
53
+ }
54
+ exports.default = OneEntry;
55
+ //# sourceMappingURL=oneEntry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oneEntry.js","sourceRoot":"","sources":["../../src/base/oneEntry.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,MAA8B,QAAQ;IAGlC,YAAY,GAAU;QAClB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAA;IACnB,CAAC;IAES,YAAY,CAAC,IAAW;QAC9B,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;IAC7B,CAAC;IAEe,SAAS,CAAC,IAAW;;YACjC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;gBAClD,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACL,cAAc,EAAE,kBAAkB;iBACrC;aACJ,CAAC,CAAA;YAEF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YACpC,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAEe,UAAU,CAAC,IAAW,EAAE,IAAW;;YAC/C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;gBAClD,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACL,cAAc,EAAE,kBAAkB;iBACrC;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;aAC7B,CAAC,CAAA;YACF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YACpC,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAES,oBAAoB,CAAC,KAAoB;QAC/C,IAAI,MAAM,GAAU,EAAE,CAAA;QACtB,KAAK,IAAI,GAAG,IAAI,KAAK,EAAE;YACnB,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE;gBACrB,MAAM,IAAI,GAAG,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAA;aACpC;SACJ;QACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAA;IAC/C,CAAC;CACJ;AA5CD,2BA4CC"}
@@ -0,0 +1,14 @@
1
+ import OneEntry from "../base/oneEntry";
2
+ import { IGeneralTypes } from "./generalTypesInterfaces";
3
+ /**
4
+ * Controllers for working with types
5
+ */
6
+ export default class GeneralTypesApi extends OneEntry implements IGeneralTypes {
7
+ constructor(url: string);
8
+ /**
9
+ * Get all types.
10
+ *
11
+ * @returns Returns all objects of type GeneralTypeEntity
12
+ */
13
+ getAllTypes(): Promise<any>;
14
+ }
@@ -0,0 +1,34 @@
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 types
15
+ */
16
+ class GeneralTypesApi extends oneEntry_1.default {
17
+ constructor(url) {
18
+ super(url);
19
+ this._url += '/api/content/general-types';
20
+ }
21
+ /**
22
+ * Get all types.
23
+ *
24
+ * @returns Returns all objects of type GeneralTypeEntity
25
+ */
26
+ getAllTypes() {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ const result = yield this._fetchGet('');
29
+ return result;
30
+ });
31
+ }
32
+ }
33
+ exports.default = GeneralTypesApi;
34
+ //# sourceMappingURL=generalTypesApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generalTypesApi.js","sourceRoot":"","sources":["../../src/general-types/generalTypesApi.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+CAAwC;AAGxC;;GAEG;AACH,MAAqB,eAAgB,SAAQ,kBAAQ;IACjD,YAAY,GAAW;QACnB,KAAK,CAAC,GAAG,CAAC,CAAA;QACV,IAAI,CAAC,IAAI,IAAI,4BAA4B,CAAA;IAC7C,CAAC;IAED;;;;OAIG;IACU,WAAW;;YACpB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;YACvC,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;CAEJ;AAhBD,kCAgBC"}
@@ -0,0 +1,4 @@
1
+ interface IGeneralTypes {
2
+ getAllTypes(): Promise<any>;
3
+ }
4
+ export { IGeneralTypes };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generalTypesInterfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generalTypesInterfaces.js","sourceRoot":"","sources":["../../src/general-types/generalTypesInterfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ import ProductApi from './products/productsApi';
2
+ import PageApi from "./pages/pagesApi";
3
+ import ProductStatusesApi from "./product-statuses/productStatusesApi";
4
+ import TemplatesApi from "./templates/templatesApi";
5
+ import TemplatesPreviewApi from "./templates-preview/templatesPreviewApi";
6
+ import MarkersApi from "./markers/markersApi";
7
+ import AttributeSetApi from "./attribute-set/attributeSetApi";
8
+ import AdminsApi from "./admins/adminsApi";
9
+ import GeneralTypesApi from "./general-types/generalTypesApi";
10
+ import LocalesApi from "./locales/localesApi";
11
+ import MenusApi from "./menus/menusApi";
12
+ import ModulesApi from "./modules/modulesApi";
13
+ interface IDefineApi {
14
+ Product: ProductApi;
15
+ Page: PageApi;
16
+ ProductStatus: ProductStatusesApi;
17
+ Templates: TemplatesApi;
18
+ TemplatesPreview: TemplatesPreviewApi;
19
+ Markers: MarkersApi;
20
+ AttributeSet: AttributeSetApi;
21
+ Admins: AdminsApi;
22
+ GeneralTypes: GeneralTypesApi;
23
+ Locales: LocalesApi;
24
+ Menus: MenusApi;
25
+ Modules: ModulesApi;
26
+ }
27
+ /**
28
+ * Define API.
29
+ * @param {string} url - URl of your project.
30
+ * @returns {IDefineApi} - List of methods set.
31
+ */
32
+ export declare function defineOneEntry(url: string): IDefineApi;
33
+ export {};