oneentry 1.0.32 → 1.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,12 +21,13 @@ npm install oneentry
21
21
  # Usage
22
22
 
23
23
  To use the OneEntry Headless CMS SDK in your project, import the defineOneEntry function:
24
- ```
24
+ ```js
25
25
  import { defineOneEntry } from 'oneentry'
26
26
 
27
27
  const {
28
28
  Admins,
29
- Blocks
29
+ AttributesSets,
30
+ Blocks,
30
31
  Forms,
31
32
  FormData,
32
33
  FileUploading,
@@ -44,25 +45,25 @@ const {
44
45
 
45
46
  Or
46
47
 
47
- ```
48
+ ```js
48
49
  const api = defineOneEntry('your-url')
49
50
  ```
50
51
 
51
52
  >If you chose token protection to ensure connection security, just pass your token to the function as an optional parameter.
52
53
 
53
- ```
54
+ ```js
54
55
  const api = defineOneEntry('your-url', 'your-token')
55
56
  ```
56
57
 
57
58
  ## Admins
58
59
 
59
- ```
60
+ ```js
60
61
  const { Admins } = defineOneEntry('your-url')
61
62
  ```
62
63
 
63
64
  ### Admins.getAdminsInfo(langCode, offset, limit)
64
65
 
65
- ```
66
+ ```js
66
67
  const value = await Admins.getAdminsInfo('en_US', 0, 30)
67
68
  ```
68
69
 
@@ -71,7 +72,7 @@ const value = await Admins.getAdminsInfo('en_US', 0, 30)
71
72
 
72
73
  Example return:
73
74
 
74
- ```
75
+ ```json
75
76
  [
76
77
  {
77
78
  "id": 1764,
@@ -91,20 +92,122 @@ Example return:
91
92
  ]
92
93
  ```
93
94
 
95
+ ## AttributesSets
96
+
97
+ ```js
98
+ const { AttributesSets } = defineOneEntry('your-url');
99
+ ```
100
+
101
+ ### AttributesSets.getAttributesByMarker(marker, langCode)
102
+
103
+ ```js
104
+ const value = await AttributesSets.getAttributesByMarker('my-marker', 'en_US')
105
+ ```
106
+
107
+ > This method return all attributes with data from the attribute sets.
108
+
109
+ Example return:
110
+
111
+ ```json
112
+ [
113
+ {
114
+ "type": "list",
115
+ "marker": "list1",
116
+ "position": 192,
117
+ "validators": {
118
+ "requiredValidator": {
119
+ "strict": true
120
+ },
121
+ "defaultValueValidator": {
122
+ "fieldDefaultValue": 11
123
+ }
124
+ },
125
+ "localizeInfos": {
126
+ "title": "My attribute"
127
+ },
128
+ "listTitles": [
129
+ {
130
+ "title": "red",
131
+ "value": 1,
132
+ "position": 1,
133
+ "extendedValue": null,
134
+ "extendedValueType": null
135
+ },
136
+ {
137
+ "title": "yellow",
138
+ "value": 2,
139
+ "position": 2,
140
+ "extendedValue": null,
141
+ "extendedValueType": null
142
+ }
143
+ ]
144
+ }
145
+ ]
146
+ ```
147
+
148
+ ### AttributesSets.getSingleAttributeByMarkerSet(attributeMarker, setMarker, langCode)
149
+
150
+ ```js
151
+ const value = await AttributesSets.getSingleAttributeByMarkerSet('list1', 'list1', 'en_US')
152
+ ```
153
+
154
+ > This method return a single attribute with data from the attribute sets.
155
+
156
+ Example return:
157
+
158
+ ```json
159
+ {
160
+ "type": "list",
161
+ "marker": "list1",
162
+ "position": 192,
163
+ "validators": {
164
+ "requiredValidator": {
165
+ "strict": true
166
+ },
167
+ "defaultValueValidator": {
168
+ "fieldDefaultValue": 11
169
+ }
170
+ },
171
+ "localizeInfos": {
172
+ "title": "My attribute"
173
+ },
174
+ "listTitles": [
175
+ {
176
+ "title": "red",
177
+ "value": 1,
178
+ "position": 1,
179
+ "extendedValue": null,
180
+ "extendedValueType": null
181
+ },
182
+ {
183
+ "title": "yellow",
184
+ "value": 2,
185
+ "position": 2,
186
+ "extendedValue": null,
187
+ "extendedValueType": null
188
+ }
189
+ ]
190
+ }
191
+ ```
192
+
193
+
94
194
  ## Blocks
95
195
 
196
+ ```js
96
197
  const { Blocks } = defineOneEntry('your-url');
198
+ ```
97
199
 
98
200
  ### Blocks.getBlocks(langCode, offset, limit)
99
201
 
100
- ```
202
+ ```js
101
203
  const value = await Blocks.getBlocks('en_US', 0, 30)
102
204
  ```
103
205
 
104
206
  > This method return all blocks objects.
105
207
 
106
208
  Example return:
107
- ```
209
+
210
+ ```json
108
211
  [
109
212
  {
110
213
  "id": 1764,
@@ -149,14 +252,15 @@ Example return:
149
252
 
150
253
  ### Blocks.getBlockByMarker(marker, langCode)
151
254
 
152
- ```
255
+ ```js
153
256
  const value = await Blocks.getBlockByMarker('my-marker', 'en_US')
154
257
  ```
155
258
 
156
259
  > This method return one blocks object by marker.
157
260
 
158
261
  Example return:
159
- ```
262
+
263
+ ```json
160
264
  {
161
265
  "id": 1764,
162
266
  "attributeSetId": 7,
@@ -203,7 +307,7 @@ const { FileUploading } = defineOneEntry('your-url');
203
307
 
204
308
  ### FileUploading.upload(data, fileQuery)
205
309
 
206
- ```
310
+ ```js
207
311
  const query = {
208
312
  type:"page",
209
313
  entity:"editor",
@@ -221,7 +325,7 @@ const value = await FileUploading.upload(data, query)
221
325
 
222
326
  Example return:
223
327
 
224
- ```
328
+ ```json
225
329
  [
226
330
  {
227
331
  "filename": "string",
@@ -233,7 +337,7 @@ Example return:
233
337
 
234
338
  ### FileUploading.delete(filename, fileQuery)
235
339
 
236
- ```
340
+ ```js
237
341
  const query = {
238
342
  type:"page",
239
343
  entity:"editor",
@@ -247,7 +351,8 @@ const value = await FileUploading.delete("file.png", query)
247
351
  > This void method delete a file from the cloud file storage.
248
352
 
249
353
  ### FileUploading.getFile(id, type, entity, filename)
250
- ```
354
+
355
+ ```js
251
356
  const value = await FileUploading.getFile(123, 'page', 'editor', 'file.png')
252
357
  ```
253
358
 
@@ -255,9 +360,9 @@ const value = await FileUploading.getFile(123, 'page', 'editor', 'file.png')
255
360
 
256
361
  Example return:
257
362
 
258
- ```
363
+ ```json
259
364
  {
260
- "file": File,
365
+ "file": "string"
261
366
  }
262
367
  ```
263
368
 
@@ -267,7 +372,7 @@ const { Forms } = defineOneEntry('your-url');
267
372
 
268
373
  ### Forms.getAllForms(langCode, offset, limit)
269
374
 
270
- ```
375
+ ```js
271
376
  const value = await Forms.getAllForms('en_US', 0, 30)
272
377
  ```
273
378
 
@@ -275,7 +380,7 @@ const value = await Forms.getAllForms('en_US', 0, 30)
275
380
 
276
381
  Example return:
277
382
 
278
- ```
383
+ ```json
279
384
  [
280
385
  {
281
386
  "id": 1764,
@@ -329,7 +434,7 @@ Example return:
329
434
 
330
435
  ### Forms.getFormByMarker(marker, langCode)
331
436
 
332
- ```
437
+ ```js
333
438
  const value = await Forms.getFormByMarker('My form', 'en_US')
334
439
  ```
335
440
 
@@ -337,7 +442,7 @@ const value = await Forms.getFormByMarker('My form', 'en_US')
337
442
 
338
443
  Example return:
339
444
 
340
- ```
445
+ ```json
341
446
  {
342
447
  "id": 1764,
343
448
  "attributeSetId": 0,
@@ -393,7 +498,7 @@ const { FormData } = defineOneEntry('your-url');
393
498
 
394
499
  ### FormData.postFormsData(data)
395
500
 
396
- ```
501
+ ```js
397
502
  const value = await FormData.postFormsData(data)
398
503
  ```
399
504
 
@@ -401,7 +506,7 @@ const value = await FormData.postFormsData(data)
401
506
 
402
507
  Example return:
403
508
 
404
- ```
509
+ ```json
405
510
  {
406
511
  "id": 1764,
407
512
  "formIdentifier": "my-form",
@@ -419,7 +524,7 @@ Example return:
419
524
 
420
525
  ### FormData.getFormsData(langCode, offset, limit)
421
526
 
422
- ```
527
+ ```js
423
528
  const value = await FormData.getFormsData('en_US', 0, 30)
424
529
  ```
425
530
 
@@ -427,7 +532,7 @@ const value = await FormData.getFormsData('en_US', 0, 30)
427
532
 
428
533
  Example return:
429
534
 
430
- ```
535
+ ```json
431
536
  {
432
537
  "id": 1764,
433
538
  "formIdentifier": "my-form",
@@ -446,7 +551,7 @@ Example return:
446
551
 
447
552
  ### FormData.getFormsDataByMarker(marker, langCode, offset, limit)
448
553
 
449
- ```
554
+ ```js
450
555
  const value = await FormData.getFormsDataByMarker('my-marker', 'en_US', 0, 30)
451
556
  ```
452
557
 
@@ -454,7 +559,7 @@ const value = await FormData.getFormsDataByMarker('my-marker', 'en_US', 0, 30)
454
559
 
455
560
  Example return:
456
561
 
457
- ```
562
+ ```json
458
563
  {
459
564
  "id": 1764,
460
565
  "formIdentifier": "my-form",
@@ -477,7 +582,7 @@ const { GeneralTypes } = defineOneEntry('your-url');
477
582
 
478
583
  ### GeneralTypes.getAllTypes()
479
584
 
480
- ```
585
+ ```js
481
586
  const value = await GeneralTypes.getAllTypes()
482
587
  ```
483
588
 
@@ -485,7 +590,7 @@ const value = await GeneralTypes.getAllTypes()
485
590
 
486
591
  Example return:
487
592
 
488
- ```
593
+ ```json
489
594
  [
490
595
  {
491
596
  "id": 1,
@@ -496,13 +601,13 @@ Example return:
496
601
 
497
602
  ## Locales
498
603
 
499
- ```
604
+ ```js
500
605
  const { Locales } = defineOneEntry('your-url')
501
606
  ```
502
607
 
503
608
  ### Locales.getLocales()
504
609
 
505
- ```
610
+ ```js
506
611
  const value = await Locales.getLocales()
507
612
  ```
508
613
 
@@ -510,7 +615,7 @@ const value = await Locales.getLocales()
510
615
 
511
616
  Example return:
512
617
 
513
- ```
618
+ ```json
514
619
  [
515
620
  {
516
621
  "id": 1764,
@@ -527,13 +632,13 @@ Example return:
527
632
 
528
633
  ## Menus
529
634
 
530
- ```
635
+ ```js
531
636
  const { Menus } = defineOneEntry('your-url')
532
637
  ```
533
638
 
534
639
  ### Menus.getMenusByMarker(marker)
535
640
 
536
- ```
641
+ ```js
537
642
  const value = await Menus.getMenusByMarker('my-marker')
538
643
  ```
539
644
 
@@ -541,7 +646,7 @@ const value = await Menus.getMenusByMarker('my-marker')
541
646
 
542
647
  Example return:
543
648
 
544
- ```
649
+ ```json
545
650
  {
546
651
  "id": 1764,
547
652
  "identifier": "catalog",
@@ -570,7 +675,7 @@ Example return:
570
675
 
571
676
  ## Pages
572
677
 
573
- ```
678
+ ```js
574
679
  const { Pages } = defineOneEntry('your-url')
575
680
  ```
576
681
 
@@ -633,7 +738,7 @@ const value = await Pages.getRootPages([ 'en_US', 'it_IT' ])
633
738
 
634
739
  ### Pages.getRootPages(langCode)
635
740
 
636
- ```
741
+ ```js
637
742
  const value = await Pages.getRootPages('en_US')
638
743
  ```
639
744
 
@@ -641,7 +746,7 @@ const value = await Pages.getRootPages('en_US')
641
746
 
642
747
  Example return:
643
748
 
644
- ```
749
+ ```json
645
750
  [
646
751
  {
647
752
  "id": 1764,
@@ -681,7 +786,7 @@ Example return:
681
786
 
682
787
  ### Pages.getCatalogPages(langCode, limit, offset)
683
788
 
684
- ```
789
+ ```js
685
790
  const value = await Pages.getCatalogPages('en_US', 0, 30)
686
791
  ```
687
792
 
@@ -689,7 +794,7 @@ const value = await Pages.getCatalogPages('en_US', 0, 30)
689
794
 
690
795
  Example return:
691
796
 
692
- ```
797
+ ```json
693
798
  [
694
799
  {
695
800
  "id": 1764,
@@ -729,7 +834,7 @@ Example return:
729
834
 
730
835
  ### Pages.getPages(langCode)
731
836
 
732
- ```
837
+ ```js
733
838
  const value = await Pages.getPages('en_US')
734
839
  ```
735
840
 
@@ -737,7 +842,7 @@ const value = await Pages.getPages('en_US')
737
842
 
738
843
  Example return:
739
844
 
740
- ```
845
+ ```json
741
846
  [
742
847
  {
743
848
  "id": 1764,
@@ -777,7 +882,7 @@ Example return:
777
882
 
778
883
  ### Pages.getPageById(id, langCode)
779
884
 
780
- ```
885
+ ```js
781
886
  const value = await Pages.getPageById(1, 'en_US')
782
887
  ```
783
888
 
@@ -785,7 +890,7 @@ const value = await Pages.getPageById(1, 'en_US')
785
890
 
786
891
  Example return:
787
892
 
788
- ```
893
+ ```json
789
894
  {
790
895
  "id": 1764,
791
896
  "parentId": null,
@@ -817,7 +922,7 @@ Example return:
817
922
 
818
923
  ### Pages.getPageByUrl(url, langCode)
819
924
 
820
- ```
925
+ ```js
821
926
  const value = await Pages.getPageByUrl('shop', 'en_US')
822
927
  ```
823
928
 
@@ -825,7 +930,7 @@ const value = await Pages.getPageByUrl('shop', 'en_US')
825
930
 
826
931
  Example return:
827
932
 
828
- ```
933
+ ```json
829
934
  {
830
935
  "id": 1764,
831
936
  "parentId": null,
@@ -857,7 +962,7 @@ Example return:
857
962
 
858
963
  ### Pages.getChildPagesByParentUrl(url, langCode)
859
964
 
860
- ```
965
+ ```js
861
966
  const value = await Pages.getChildPagesByParentUrl('shop', 'en_US')
862
967
  ```
863
968
 
@@ -865,7 +970,7 @@ const value = await Pages.getChildPagesByParentUrl('shop', 'en_US')
865
970
 
866
971
  Example return:
867
972
 
868
- ```
973
+ ```json
869
974
  [
870
975
  {
871
976
  "id": 1764,
@@ -897,17 +1002,71 @@ Example return:
897
1002
  ]
898
1003
  ```
899
1004
 
900
- ### Pages.getFormsByPageUrl(url, langCode)
1005
+ ### Pages.getBlocksByPageUrl(url, langCode)
901
1006
 
902
- ```
1007
+ ```js
903
1008
  const value = await Pages.getFormsByPageUrl('shop', 'en_US')
904
1009
  ```
905
1010
 
906
- > Get PositionFormDto objects for a related form by url. Returns an array of PositionFormDto objects.
1011
+ > Get PositionBlock objects for a related form by url. Returns an array of PositionBlock objects.
907
1012
 
908
1013
  Example return:
909
1014
 
1015
+ ```json
1016
+ [
1017
+ {
1018
+ "id": 1764,
1019
+ "version": 10,
1020
+ "identifier": "catalog",
1021
+ "attributeSetId": 0,
1022
+ "localizeInfos": {
1023
+ "en_US": {
1024
+ "title": "My block"
1025
+ }
1026
+ },
1027
+ "customSettings": {
1028
+ "sliderDelay": 0,
1029
+ "sliderDelayType": "",
1030
+ "productQuantity": 4,
1031
+ "productSortType": "By_ID",
1032
+ "productSortOrder": "Descending",
1033
+ "productCountElementsPerRow": 10,
1034
+ "similarProductRules": [
1035
+ {
1036
+ "property": "Descending",
1037
+ "includes": "",
1038
+ "keywords": "",
1039
+ "strict": ""
1040
+ }
1041
+ ]
1042
+ },
1043
+ "position": 0,
1044
+ "isSync": false,
1045
+ "attributeValues": {
1046
+ "en_US": {
1047
+ "marker": {
1048
+ "value": "",
1049
+ "type": "string"
1050
+ }
1051
+ }
1052
+ },
1053
+ "type": "forNewsPage",
1054
+ "templateIdentifier": null
1055
+ }
1056
+ ]
1057
+ ```
1058
+
1059
+ ### Pages.getFormsByPageUrl(url, langCode)
1060
+
1061
+ ```js
1062
+ const value = await Pages.getFormsByPageUrl('shop', 'en_US')
910
1063
  ```
1064
+
1065
+ > Get PositionForm objects for a related form by url. Returns an array of PositionForm objects.
1066
+
1067
+ Example return:
1068
+
1069
+ ```json
911
1070
  [
912
1071
  {
913
1072
  "id": 1764,
@@ -961,7 +1120,7 @@ Example return:
961
1120
 
962
1121
  ### Pages.getConfigPageByUrl(url)
963
1122
 
964
- ```
1123
+ ```js
965
1124
  const value = await Pages.getConfigPageByUrl('shop')
966
1125
  ```
967
1126
 
@@ -969,7 +1128,7 @@ const value = await Pages.getConfigPageByUrl('shop')
969
1128
 
970
1129
  Example return:
971
1130
 
972
- ```
1131
+ ```json
973
1132
  {
974
1133
  "rowsPerPage": 10,
975
1134
  "productsPerRow": 10
@@ -978,7 +1137,7 @@ Example return:
978
1137
 
979
1138
  ### Pages.searchPage(name, langCode)
980
1139
 
981
- ```
1140
+ ```js
982
1141
  const value = await Pages.searchPage('cup', 'en_US')
983
1142
  ```
984
1143
 
@@ -986,7 +1145,7 @@ const value = await Pages.searchPage('cup', 'en_US')
986
1145
 
987
1146
  Example return:
988
1147
 
989
- ```
1148
+ ```json
990
1149
  [
991
1150
  {
992
1151
  "id": 1764,
@@ -1020,7 +1179,7 @@ Example return:
1020
1179
 
1021
1180
  ## Products
1022
1181
 
1023
- ```
1182
+ ```js
1024
1183
  const { Products } = defineOneEntry('your-url')
1025
1184
  ```
1026
1185
 
@@ -1028,7 +1187,7 @@ const { Products } = defineOneEntry('your-url')
1028
1187
 
1029
1188
  Parameters:
1030
1189
 
1031
- ```
1190
+ ```js
1032
1191
  const userQuery = {
1033
1192
  offset: 0,
1034
1193
  limit: 30,
@@ -1117,7 +1276,7 @@ const value = await Products.getProducts([ 'en_US', 'it_IT' ])
1117
1276
 
1118
1277
  ### Products.getProducts(langCode, userQuery)
1119
1278
 
1120
- ```
1279
+ ```js
1121
1280
  const value = await Products.getProducts('en_US', userQuery)
1122
1281
  ```
1123
1282
 
@@ -1125,7 +1284,7 @@ const value = await Products.getProducts('en_US', userQuery)
1125
1284
 
1126
1285
  Example return:
1127
1286
 
1128
- ```
1287
+ ```json
1129
1288
  [
1130
1289
  {
1131
1290
  "id": 1764,
@@ -1161,7 +1320,7 @@ Example return:
1161
1320
 
1162
1321
  ### Products.getProductsEmptyPage(langCode, userQuery)
1163
1322
 
1164
- ```
1323
+ ```js
1165
1324
  const value = await Products.getProductsEmptyPage('en_US', userQuery)
1166
1325
  ```
1167
1326
 
@@ -1169,7 +1328,7 @@ const value = await Products.getProductsEmptyPage('en_US', userQuery)
1169
1328
 
1170
1329
  Example return:
1171
1330
 
1172
- ```
1331
+ ```json
1173
1332
  [
1174
1333
  {
1175
1334
  "id": 1764,
@@ -1205,7 +1364,7 @@ Example return:
1205
1364
 
1206
1365
  ### Products.getProductsPageById(id, langCode, userQuery)
1207
1366
 
1208
- ```
1367
+ ```js
1209
1368
  const value = await Products.getProductsPageById(1, 'en_US', userQuery)
1210
1369
  ```
1211
1370
 
@@ -1213,13 +1372,11 @@ const value = await Products.getProductsPageById(1, 'en_US', userQuery)
1213
1372
 
1214
1373
  Example return:
1215
1374
 
1216
- ```
1375
+ ```json
1217
1376
  {
1218
1377
  "id": 1764,
1219
1378
  "localizeInfos": {
1220
- {
1221
- "title": "Product"
1222
- }
1379
+ "title": "Product"
1223
1380
  },
1224
1381
  "isVisible": true,
1225
1382
  "statusId": 1,
@@ -1242,11 +1399,9 @@ Example return:
1242
1399
  "templateIdentifier": "my-template",
1243
1400
  "shortDescTemplateIdentifier": "my-template-short",
1244
1401
  "attributeValues": {
1245
- {
1246
- "marker": {
1247
- "value": "",
1248
- "type": "string"
1249
- }
1402
+ "marker": {
1403
+ "value": "",
1404
+ "type": "string"
1250
1405
  }
1251
1406
  },
1252
1407
  "position": 1
@@ -1255,7 +1410,7 @@ Example return:
1255
1410
 
1256
1411
  ### Products.getProductsPageByUrl(url, langCode, userQuery)
1257
1412
 
1258
- ```
1413
+ ```js
1259
1414
  const value = await Products.getProductsPageByUrl('cup', 'en_US', userQuery)
1260
1415
  ```
1261
1416
 
@@ -1263,13 +1418,10 @@ const value = await Products.getProductsPageByUrl('cup', 'en_US', userQuery)
1263
1418
 
1264
1419
  Example return:
1265
1420
 
1266
- ```
1421
+ ```json
1267
1422
  {
1268
1423
  "id": 1764,
1269
- "localizeInfos": {
1270
- {
1271
- "title": "Product"
1272
- }
1424
+ "localizeInfos": {"title": "Product"
1273
1425
  },
1274
1426
  "isVisible": true,
1275
1427
  "statusId": 1,
@@ -1292,11 +1444,9 @@ Example return:
1292
1444
  "templateIdentifier": "my-template",
1293
1445
  "shortDescTemplateIdentifier": "my-template-short",
1294
1446
  "attributeValues": {
1295
- {
1296
- "marker": {
1297
- "value": "",
1298
- "type": "string"
1299
- }
1447
+ "marker": {
1448
+ "value": "",
1449
+ "type": "string"
1300
1450
  }
1301
1451
  },
1302
1452
  "position": 1
@@ -1305,7 +1455,7 @@ Example return:
1305
1455
 
1306
1456
  ### Products.getRelatedProductsById(id, langCode, userQuery)
1307
1457
 
1308
- ```
1458
+ ```js
1309
1459
  const value = await Products.getRelatedProductsById(1, 'en_US', {limit:20, offset:1})
1310
1460
  ```
1311
1461
 
@@ -1313,7 +1463,7 @@ const value = await Products.getRelatedProductsById(1, 'en_US', {limit:20, offse
1313
1463
 
1314
1464
  Example return:
1315
1465
 
1316
- ```
1466
+ ```json
1317
1467
  {
1318
1468
  "id": 1764,
1319
1469
  "localizeInfos": {
@@ -1347,7 +1497,7 @@ Example return:
1347
1497
 
1348
1498
  ### Products.getProductById(id, langCode)
1349
1499
 
1350
- ```
1500
+ ```js
1351
1501
  const value = await Products.getProductById(1, 'en_US')
1352
1502
  ```
1353
1503
 
@@ -1355,7 +1505,7 @@ const value = await Products.getProductById(1, 'en_US')
1355
1505
 
1356
1506
  Example return:
1357
1507
 
1358
- ```
1508
+ ```json
1359
1509
  {
1360
1510
  "id": 1764,
1361
1511
  "localizeInfos": {
@@ -1390,7 +1540,7 @@ Example return:
1390
1540
 
1391
1541
  ### Products.filterProduct(data, langCode, userQuery)
1392
1542
 
1393
- ```
1543
+ ```js
1394
1544
  const data = {
1395
1545
  attributeMarker: "price",
1396
1546
  conditionMarker: "lth",
@@ -1402,7 +1552,7 @@ const value = await Products.filterProduct(data, 'en_US', userQuery)
1402
1552
 
1403
1553
  Example body:
1404
1554
 
1405
- ```
1555
+ ```js
1406
1556
  [
1407
1557
  {
1408
1558
  "attributeMarker": "price",
@@ -1423,13 +1573,11 @@ Example body:
1423
1573
 
1424
1574
  Example return:
1425
1575
 
1426
- ```
1576
+ ```json
1427
1577
  {
1428
1578
  "id": 1764,
1429
1579
  "localizeInfos": {
1430
- {
1431
- "title": "Product"
1432
- }
1580
+ "title": "Product"
1433
1581
  },
1434
1582
  "isVisible": true,
1435
1583
  "statusId": 1,
@@ -1452,11 +1600,9 @@ Example return:
1452
1600
  "templateIdentifier": "my-template",
1453
1601
  "shortDescTemplateIdentifier": "my-template-short",
1454
1602
  "attributeValues": {
1455
- {
1456
- "marker": {
1457
- "value": "",
1458
- "type": "string"
1459
- }
1603
+ "marker": {
1604
+ "value": "",
1605
+ "type": "string"
1460
1606
  }
1461
1607
  },
1462
1608
  "position": 1
@@ -1465,7 +1611,7 @@ Example return:
1465
1611
 
1466
1612
  ### Products.searchProduct(name, langCode)
1467
1613
 
1468
- ```
1614
+ ```js
1469
1615
  const value = await Products.searchProduct('cup', 'en_US')
1470
1616
  ```
1471
1617
 
@@ -1473,14 +1619,12 @@ const value = await Products.searchProduct('cup', 'en_US')
1473
1619
 
1474
1620
  Example return:
1475
1621
 
1476
- ```
1622
+ ```json
1477
1623
  [
1478
1624
  {
1479
1625
  "id": 1764,
1480
1626
  "localizeInfos": {
1481
- {
1482
- "title": "Product"
1483
- }
1627
+ "title": "Product"
1484
1628
  },
1485
1629
  "isVisible": true,
1486
1630
  "statusId": 1,
@@ -1503,11 +1647,9 @@ Example return:
1503
1647
  "templateIdentifier": "my-template",
1504
1648
  "shortDescTemplateIdentifier": "my-template-short",
1505
1649
  "attributeValues": {
1506
- {
1507
- "marker": {
1508
- "value": "",
1509
- "type": "string"
1510
- }
1650
+ "marker": {
1651
+ "value": "",
1652
+ "type": "string"
1511
1653
  }
1512
1654
  },
1513
1655
  "position": 1
@@ -1517,13 +1659,13 @@ Example return:
1517
1659
 
1518
1660
  ## ProductStatuses
1519
1661
 
1520
- ```
1662
+ ```js
1521
1663
  const { ProductStatuses } = defineOneEntry('your-url');
1522
1664
  ```
1523
1665
 
1524
1666
  ### ProductStatuses.getProductStatuses()
1525
1667
 
1526
- ```
1668
+ ```js
1527
1669
  const value = await ProductStatuses.getProductStatuses()
1528
1670
  ```
1529
1671
 
@@ -1531,7 +1673,7 @@ const value = await ProductStatuses.getProductStatuses()
1531
1673
 
1532
1674
  Example return:
1533
1675
 
1534
- ```
1676
+ ```json
1535
1677
  [
1536
1678
  {
1537
1679
  "id": 1764,
@@ -1549,7 +1691,7 @@ Example return:
1549
1691
 
1550
1692
  ### ProductStatuses.getProductStatusesById(id)
1551
1693
 
1552
- ```
1694
+ ```js
1553
1695
  const value = await ProductStatuses.getProductStatusesById(1)
1554
1696
  ```
1555
1697
 
@@ -1557,7 +1699,7 @@ const value = await ProductStatuses.getProductStatusesById(1)
1557
1699
 
1558
1700
  Example return:
1559
1701
 
1560
- ```
1702
+ ```json
1561
1703
  {
1562
1704
  "id": 1764,
1563
1705
  "updatedDate": "2023-09-25T13:36:05.907Z",
@@ -1573,7 +1715,7 @@ Example return:
1573
1715
 
1574
1716
  ### ProductStatuses.getProductsByStatusMarker(marker)
1575
1717
 
1576
- ```
1718
+ ```js
1577
1719
  const value = await ProductStatuses.getProductsByStatusMarker('my-marker')
1578
1720
  ```
1579
1721
 
@@ -1581,7 +1723,7 @@ const value = await ProductStatuses.getProductsByStatusMarker('my-marker')
1581
1723
 
1582
1724
  Example return:
1583
1725
 
1584
- ```
1726
+ ```json
1585
1727
  {
1586
1728
  "id": 1764,
1587
1729
  "updatedDate": "2023-09-25T13:39:19.384Z",
@@ -1597,7 +1739,7 @@ Example return:
1597
1739
 
1598
1740
  ### ProductStatuses.validateMarker(marker)
1599
1741
 
1600
- ```
1742
+ ```js
1601
1743
  const value = await ProductStatuses.validateMarker('marker')
1602
1744
  ```
1603
1745
 
@@ -1605,19 +1747,19 @@ const value = await ProductStatuses.validateMarker('marker')
1605
1747
 
1606
1748
  Example return:
1607
1749
 
1608
- ```
1750
+ ```json
1609
1751
  true
1610
1752
  ```
1611
1753
 
1612
1754
  ## System
1613
1755
 
1614
- ```
1756
+ ```js
1615
1757
  const { System } = defineOneEntry('your-url')
1616
1758
  ```
1617
1759
 
1618
1760
  ### System.test404()
1619
1761
 
1620
- ```
1762
+ ```js
1621
1763
  const value = await System.test404()
1622
1764
  ```
1623
1765
 
@@ -1625,7 +1767,7 @@ const value = await System.test404()
1625
1767
 
1626
1768
  ### System.test500()
1627
1769
 
1628
- ```
1770
+ ```js
1629
1771
  const value = await System.test500()
1630
1772
  ```
1631
1773
 
@@ -1634,13 +1776,13 @@ const value = await System.test500()
1634
1776
 
1635
1777
  ## Templates
1636
1778
 
1637
- ```
1779
+ ```js
1638
1780
  const { Templates } = defineOneEntry('your-url')
1639
1781
  ```
1640
1782
 
1641
1783
  ### Templates.getAllTemplates()
1642
1784
 
1643
- ```
1785
+ ```js
1644
1786
  const value = await Templates.getAllTemplates()
1645
1787
  ```
1646
1788
 
@@ -1648,7 +1790,7 @@ const value = await Templates.getAllTemplates()
1648
1790
 
1649
1791
  Example return:
1650
1792
 
1651
- ```
1793
+ ```json
1652
1794
  [
1653
1795
  {
1654
1796
  "id": 1764,
@@ -1674,7 +1816,7 @@ Example return:
1674
1816
 
1675
1817
  ### Templates.getTemplateByType(type)
1676
1818
 
1677
- ```
1819
+ ```js
1678
1820
  const value = await Templates.getTemplateByType('forCatalogProducts')
1679
1821
  ```
1680
1822
 
@@ -1682,7 +1824,7 @@ const value = await Templates.getTemplateByType('forCatalogProducts')
1682
1824
 
1683
1825
  Example return:
1684
1826
 
1685
- ```
1827
+ ```json
1686
1828
  [
1687
1829
  {
1688
1830
  "id": 1764,
@@ -1708,21 +1850,21 @@ Example return:
1708
1850
 
1709
1851
  ## TemplatePreviews
1710
1852
 
1711
- ```
1853
+ ```js
1712
1854
  const { TemplatePreviews } = defineOneEntry('your-url')
1713
1855
  ```
1714
1856
 
1715
- ### getTemplatesPreview
1857
+ ### TemplatePreviews.getTemplatePreviews()
1716
1858
 
1717
- ```
1718
- const value = await TemplatePreviews.getTemplatesPreview()
1859
+ ```js
1860
+ const value = await TemplatePreviews.getTemplatePreviews()
1719
1861
  ```
1720
1862
 
1721
1863
  > This method retrieves all template objects from the API. It returns a Promise that resolves to an array of TemplatePreviewsEntity template objects.
1722
1864
 
1723
1865
  Example return:
1724
1866
 
1725
- ```
1867
+ ```json
1726
1868
  [
1727
1869
  {
1728
1870
  "id": 1764,
@@ -1763,15 +1905,15 @@ Example return:
1763
1905
 
1764
1906
  ### TemplatePreviews.getTemplatesPreviewById(id)
1765
1907
 
1766
- ```
1767
- const value = await TemplatePreviews.getTemplatesPreviewById(1)
1908
+ ```js
1909
+ const value = await TemplatePreviews.getTemplatePreviewById(1)
1768
1910
  ```
1769
1911
 
1770
1912
  > 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.
1771
1913
 
1772
1914
  Example return:
1773
1915
 
1774
- ```
1916
+ ```json
1775
1917
  {
1776
1918
  "id": 1764,
1777
1919
  "updatedDate": "2023-12-05T12:44:37.348Z",
@@ -1810,15 +1952,15 @@ Example return:
1810
1952
 
1811
1953
  ### TemplatePreviews.getTemplatesPreviewByMarker(marker)
1812
1954
 
1813
- ```
1814
- const value = await TemplatePreviews.getTemplatesPreviewByMarker('my-marker')
1955
+ ```js
1956
+ const value = await TemplatePreviews.getTemplatePreviewByMarker('my-marker')
1815
1957
  ```
1816
1958
 
1817
1959
  > 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.
1818
1960
 
1819
1961
  Example return:
1820
1962
 
1821
- ```
1963
+ ```json
1822
1964
  {
1823
1965
  "id": 1764,
1824
1966
  "updatedDate": "2023-12-05T12:44:20.008Z",
@@ -0,0 +1,27 @@
1
+ import OneEntry from "../base/oneEntry";
2
+ import { IAttributesSets, IAttributesSetsEntity } from "./attributeSetsInterfaces";
3
+ /**
4
+ * Controllers for working with attributes.
5
+ */
6
+ export default class AttributesSetsApi extends OneEntry implements IAttributesSets {
7
+ constructor(url: string, token: string);
8
+ /**
9
+ * Get all attributes with data from the attribute sets.
10
+ *
11
+ * @param {string} marker - Attribute marker.
12
+ * @param {string} langCode - Language code.
13
+ *
14
+ * @returns Returns an array of AttributeInSet objects.
15
+ */
16
+ getAttributesByMarker(marker: string, langCode: string): Promise<Array<IAttributesSetsEntity>>;
17
+ /**
18
+ * Get a single attribute with data from the attribute sets.
19
+ *
20
+ * @param {string} attributeMarker - Text identifier (marker) of the attribute in the set.
21
+ * @param {string} setMarker - Text identifier (marker) of the attribute set.
22
+ * @param {string} langCode - Language code.
23
+ *
24
+ * @returns Returns a AttributeInSet object.
25
+ */
26
+ getSingleAttributeByMarkerSet(attributeMarker: string, setMarker: string, langCode: string): Promise<IAttributesSetsEntity>;
27
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const oneEntry_1 = require("../base/oneEntry");
4
+ /**
5
+ * Controllers for working with attributes.
6
+ */
7
+ class AttributesSetsApi extends oneEntry_1.default {
8
+ constructor(url, token) {
9
+ super(url, token);
10
+ this._url += '/api/content/attributes-sets';
11
+ }
12
+ /**
13
+ * Get all attributes with data from the attribute sets.
14
+ *
15
+ * @param {string} marker - Attribute marker.
16
+ * @param {string} langCode - Language code.
17
+ *
18
+ * @returns Returns an array of AttributeInSet objects.
19
+ */
20
+ async getAttributesByMarker(marker, langCode) {
21
+ const result = await this._fetchGet(`/${marker}/attributes?langCode=${langCode}`);
22
+ return result;
23
+ }
24
+ /**
25
+ * Get a single attribute with data from the attribute sets.
26
+ *
27
+ * @param {string} attributeMarker - Text identifier (marker) of the attribute in the set.
28
+ * @param {string} setMarker - Text identifier (marker) of the attribute set.
29
+ * @param {string} langCode - Language code.
30
+ *
31
+ * @returns Returns a AttributeInSet object.
32
+ */
33
+ async getSingleAttributeByMarkerSet(attributeMarker, setMarker, langCode) {
34
+ const result = await this._fetchGet(`/${setMarker}/attributes/${attributeMarker}?langCode=${langCode}`);
35
+ return result;
36
+ }
37
+ }
38
+ exports.default = AttributesSetsApi;
@@ -0,0 +1,46 @@
1
+ import { ILocalizeInfos, Types } from "../base/utils";
2
+ /**
3
+ * Represents an interface object of AttributesSets Api.
4
+ *
5
+ * @property {function} getAttributesByMarker - Get all attributes with data from the attribute sets.
6
+ *
7
+ * @property {function} getSingleAttributeByMarkerSet - Get a single attribute with data from the attribute sets.
8
+ */
9
+ interface IAttributesSets {
10
+ getAttributesByMarker(marker: string, langCode: string): Promise<Array<IAttributesSetsEntity>>;
11
+ getSingleAttributeByMarkerSet(attributeMarker: string, setMarker: string, langCode: string): Promise<IAttributesSetsEntity>;
12
+ }
13
+ /**
14
+ * Represents a template entity object.
15
+ *
16
+ * @interface
17
+ * @property {Types} type - Attribute type.
18
+ * @property {string} marker - Textual identifier of the attribute (marker).
19
+ * @property {number} position - Position number for sorting.
20
+ * @property {Record<string, any>} validators - Set of validators for validation.
21
+ * @property {ILocalizeInfos} localizeInfos - The name of the template, taking into account localization.
22
+ * @property {Array<Record<string, any>>} listTitles - Array of values (with extended data) for list and radioButton attributes.
23
+ *
24
+ */
25
+ interface IAttributesSetsEntity {
26
+ type: Types;
27
+ marker: string;
28
+ position: number;
29
+ validators: {
30
+ requiredValidator: {
31
+ strict: boolean;
32
+ };
33
+ defaultValueValidator: {
34
+ fieldDefaultValue: number;
35
+ };
36
+ };
37
+ localizeInfos: ILocalizeInfos;
38
+ listTitles: Array<{
39
+ title: string;
40
+ value: number | string;
41
+ position: string | number | null;
42
+ extendedValue: string | number | null;
43
+ extendedValueType: string | number | null;
44
+ }>;
45
+ }
46
+ export { IAttributesSets, IAttributesSetsEntity };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import ProductApi from './products/productsApi';
2
2
  import PageApi from "./pages/pagesApi";
3
3
  import ProductStatusesApi from "./product-statuses/productStatusesApi";
4
4
  import TemplatesApi from "./templates/templatesApi";
5
- import TemplatesPreviewApi from "./templates-preview/templatesPreviewApi";
5
+ import TemplatePreviewsApi from "./templates-preview/templatesPreviewApi";
6
6
  import AdminsApi from "./admins/adminsApi";
7
7
  import GeneralTypesApi from "./general-types/GeneralTypesApi";
8
8
  import LocalesApi from "./locales/localesApi";
@@ -12,8 +12,10 @@ import FormsDataApi from "./formsData/formsDataApi";
12
12
  import FileUploadingApi from "./file-uploding/fileUploadingApi";
13
13
  import SystemApi from "./system/systemApi";
14
14
  import BlocksApi from "./blocks/blocksApi";
15
+ import AttributesSetsApi from "./attribute-sets/attributeSetsApi";
15
16
  interface IDefineApi {
16
17
  Admins: AdminsApi;
18
+ AttributesSets: AttributesSetsApi;
17
19
  Blocks: BlocksApi;
18
20
  FileUploading: FileUploadingApi;
19
21
  Forms: FormsApi;
@@ -26,7 +28,7 @@ interface IDefineApi {
26
28
  ProductStatuses: ProductStatusesApi;
27
29
  System: SystemApi;
28
30
  Templates: TemplatesApi;
29
- TemplatePreviews: TemplatesPreviewApi;
31
+ TemplatePreviews: TemplatePreviewsApi;
30
32
  }
31
33
  /**
32
34
  * Define API.
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ const formsDataApi_1 = require("./formsData/formsDataApi");
15
15
  const fileUploadingApi_1 = require("./file-uploding/fileUploadingApi");
16
16
  const systemApi_1 = require("./system/systemApi");
17
17
  const blocksApi_1 = require("./blocks/blocksApi");
18
+ const attributeSetsApi_1 = require("./attribute-sets/attributeSetsApi");
18
19
  /**
19
20
  * Define API.
20
21
  * @param {string} url - URl of your project.
@@ -22,6 +23,7 @@ const blocksApi_1 = require("./blocks/blocksApi");
22
23
  */
23
24
  function defineOneEntry(url, token) {
24
25
  const Admins = new adminsApi_1.default(url, token);
26
+ const AttributesSets = new attributeSetsApi_1.default(url, token);
25
27
  const Blocks = new blocksApi_1.default(url, token);
26
28
  const FileUploading = new fileUploadingApi_1.default(url, token);
27
29
  const Forms = new formsApi_1.default(url, token);
@@ -37,6 +39,7 @@ function defineOneEntry(url, token) {
37
39
  const TemplatePreviews = new templatesPreviewApi_1.default(url, token);
38
40
  return {
39
41
  Admins,
42
+ AttributesSets,
40
43
  Blocks,
41
44
  FileUploading,
42
45
  Forms,
@@ -3,14 +3,14 @@ import { ITemplatesPreview, ITemplatesPreviewEntity } from "./templatesPreviewIn
3
3
  /**
4
4
  * Controllers for working with template objects for preview
5
5
  */
6
- export default class PageApi extends OneEntry implements ITemplatesPreview {
6
+ export default class TemplatePreviewsApi extends OneEntry implements ITemplatesPreview {
7
7
  constructor(url: string, token: string);
8
8
  /**
9
9
  * Get all template objects.
10
10
  *
11
11
  * @returns Returns all TemplatePreviewsEntity template objects
12
12
  */
13
- getTemplatesPreview(): Promise<Array<ITemplatesPreviewEntity>>;
13
+ getTemplatePreviews(): Promise<Array<ITemplatesPreviewEntity>>;
14
14
  /**
15
15
  * Get one template object by id.
16
16
  *
@@ -18,7 +18,7 @@ export default class PageApi extends OneEntry implements ITemplatesPreview {
18
18
  *
19
19
  * @returns Returns a TemplatePreviewsEntity object
20
20
  */
21
- getTemplatesPreviewById(id: number): Promise<ITemplatesPreviewEntity>;
21
+ getTemplatePreviewById(id: number): Promise<ITemplatesPreviewEntity>;
22
22
  /**
23
23
  * Get one template object by marker.
24
24
  *
@@ -26,5 +26,5 @@ export default class PageApi extends OneEntry implements ITemplatesPreview {
26
26
  *
27
27
  * @returns Returns a TemplatePreviewsEntity object
28
28
  */
29
- getTemplatesPreviewByMarker(marker: string): Promise<ITemplatesPreviewEntity>;
29
+ getTemplatePreviewByMarker(marker: string): Promise<ITemplatesPreviewEntity>;
30
30
  }
@@ -4,7 +4,7 @@ const oneEntry_1 = require("../base/oneEntry");
4
4
  /**
5
5
  * Controllers for working with template objects for preview
6
6
  */
7
- class PageApi extends oneEntry_1.default {
7
+ class TemplatePreviewsApi extends oneEntry_1.default {
8
8
  constructor(url, token) {
9
9
  super(url, token);
10
10
  this._url += '/api/content/template-previews';
@@ -14,7 +14,7 @@ class PageApi extends oneEntry_1.default {
14
14
  *
15
15
  * @returns Returns all TemplatePreviewsEntity template objects
16
16
  */
17
- async getTemplatesPreview() {
17
+ async getTemplatePreviews() {
18
18
  const result = await this._fetchGet('');
19
19
  return result;
20
20
  }
@@ -25,7 +25,7 @@ class PageApi extends oneEntry_1.default {
25
25
  *
26
26
  * @returns Returns a TemplatePreviewsEntity object
27
27
  */
28
- async getTemplatesPreviewById(id) {
28
+ async getTemplatePreviewById(id) {
29
29
  const result = await this._fetchGet(`/${id}`);
30
30
  return result;
31
31
  }
@@ -36,9 +36,9 @@ class PageApi extends oneEntry_1.default {
36
36
  *
37
37
  * @returns Returns a TemplatePreviewsEntity object
38
38
  */
39
- async getTemplatesPreviewByMarker(marker) {
39
+ async getTemplatePreviewByMarker(marker) {
40
40
  const result = await this._fetchGet(`/marker/${marker}`);
41
41
  return result;
42
42
  }
43
43
  }
44
- exports.default = PageApi;
44
+ exports.default = TemplatePreviewsApi;
@@ -9,9 +9,9 @@ import { ILocalizeInfos } from "../base/utils";
9
9
  * @property {function} getTemplatesPreviewByMarker - Get one template object by marker.
10
10
  */
11
11
  interface ITemplatesPreview {
12
- getTemplatesPreview(): Promise<Array<ITemplatesPreviewEntity>>;
13
- getTemplatesPreviewById(id: number): Promise<ITemplatesPreviewEntity>;
14
- getTemplatesPreviewByMarker(marker: string): Promise<ITemplatesPreviewEntity>;
12
+ getTemplatePreviews(): Promise<Array<ITemplatesPreviewEntity>>;
13
+ getTemplatePreviewById(id: number): Promise<ITemplatesPreviewEntity>;
14
+ getTemplatePreviewByMarker(marker: string): Promise<ITemplatesPreviewEntity>;
15
15
  }
16
16
  /**
17
17
  * Represents a template preview entity object.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",