oneentry 1.0.123 → 1.0.125
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 +24 -22
- package/dist/admins/adminsApi.d.ts +30 -9
- package/dist/admins/adminsApi.js +30 -9
- package/dist/admins/adminsInterfaces.d.ts +77 -32
- package/dist/attribute-sets/attributeSetsApi.d.ts +36 -22
- package/dist/attribute-sets/attributeSetsApi.js +41 -25
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +133 -39
- package/dist/auth-provider/authProviderApi.d.ts +209 -88
- package/dist/auth-provider/authProviderApi.js +226 -87
- package/dist/auth-provider/authProvidersInterfaces.d.ts +345 -18
- package/dist/base/asyncModules.d.ts +38 -28
- package/dist/base/asyncModules.js +178 -47
- package/dist/base/result.js +23 -0
- package/dist/base/syncModules.d.ts +48 -44
- package/dist/base/syncModules.js +84 -64
- package/dist/base/utils.d.ts +1 -1
- package/dist/blocks/blocksApi.d.ts +48 -27
- package/dist/blocks/blocksApi.js +48 -27
- package/dist/blocks/blocksInterfaces.d.ts +126 -32
- package/dist/events/eventsApi.d.ts +45 -12
- package/dist/events/eventsApi.js +47 -12
- package/dist/events/eventsInterfaces.d.ts +50 -3
- package/dist/file-uploading/fileUploadingApi.d.ts +57 -29
- package/dist/file-uploading/fileUploadingApi.js +57 -30
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +90 -17
- package/dist/forms/formsApi.d.ts +20 -9
- package/dist/forms/formsApi.js +19 -8
- package/dist/forms/formsInterfaces.d.ts +86 -23
- package/dist/formsData/formsDataApi.d.ts +33 -21
- package/dist/formsData/formsDataApi.js +33 -21
- package/dist/formsData/formsDataInterfaces.d.ts +212 -41
- package/dist/general-types/generalTypesApi.d.ts +11 -2
- package/dist/general-types/generalTypesApi.js +10 -1
- package/dist/general-types/generalTypesInterfaces.d.ts +17 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/integration-collections/integrationCollectionsApi.d.ts +134 -81
- package/dist/integration-collections/integrationCollectionsApi.js +135 -83
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +246 -43
- package/dist/locales/localesApi.d.ts +5 -1
- package/dist/locales/localesApi.js +5 -1
- package/dist/locales/localesInterfaces.d.ts +19 -12
- package/dist/menus/menusApi.d.ts +6 -3
- package/dist/menus/menusApi.js +6 -3
- package/dist/menus/menusInterfaces.d.ts +60 -21
- package/dist/orders/ordersApi.d.ts +84 -66
- package/dist/orders/ordersApi.js +91 -71
- package/dist/orders/ordersInterfaces.d.ts +282 -86
- package/dist/pages/pagesApi.d.ts +101 -42
- package/dist/pages/pagesApi.js +93 -39
- package/dist/pages/pagesInterfaces.d.ts +218 -75
- package/dist/payments/paymentsApi.d.ts +53 -39
- package/dist/payments/paymentsApi.js +55 -40
- package/dist/payments/paymentsInterfaces.d.ts +121 -56
- package/dist/product-statuses/productStatusesApi.d.ts +17 -17
- package/dist/product-statuses/productStatusesApi.js +16 -19
- package/dist/product-statuses/productStatusesInterfaces.d.ts +43 -14
- package/dist/products/productsApi.d.ts +309 -177
- package/dist/products/productsApi.js +313 -167
- package/dist/products/productsInterfaces.d.ts +447 -81
- package/dist/system/systemApi.d.ts +42 -12
- package/dist/system/systemApi.js +43 -10
- package/dist/system/systemInterfaces.d.ts +7 -0
- package/dist/templates/templatesApi.d.ts +24 -20
- package/dist/templates/templatesApi.js +22 -21
- package/dist/templates/templatesInterfaces.d.ts +48 -22
- package/dist/templates-preview/templatesPreviewApi.d.ts +17 -17
- package/dist/templates-preview/templatesPreviewApi.js +16 -19
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +85 -32
- package/dist/users/usersApi.d.ts +59 -35
- package/dist/users/usersApi.js +62 -35
- package/dist/users/usersInterfaces.d.ts +136 -14
- package/dist/web-socket/wsApi.d.ts +4 -5
- package/dist/web-socket/wsApi.js +4 -5
- package/dist/web-socket/wsInterfaces.d.ts +2 -1
- package/package.json +20 -18
|
@@ -11,26 +11,56 @@ export default class SystemApi extends AsyncModules implements ISystem {
|
|
|
11
11
|
protected _url: string;
|
|
12
12
|
constructor(state: StateModule);
|
|
13
13
|
/**
|
|
14
|
-
* test404
|
|
15
|
-
*
|
|
14
|
+
* Sends a GET request to the '/test404' endpoint and returns the result.
|
|
15
|
+
*
|
|
16
|
+
* @handleName test404
|
|
17
|
+
*
|
|
18
|
+
* @return {any} The response from the server after fetching data from the '/test404' endpoint.
|
|
19
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
20
|
+
* @description This method is used to test the 404 error handling by sending a GET request to a specific endpoint.
|
|
16
21
|
*/
|
|
17
|
-
test404(): Promise<any>;
|
|
22
|
+
test404(): Promise<any | IError>;
|
|
18
23
|
/**
|
|
19
|
-
* test500
|
|
20
|
-
*
|
|
24
|
+
* Sends a GET request to the '/test500' endpoint and returns the result.
|
|
25
|
+
*
|
|
26
|
+
* @handleName test500
|
|
27
|
+
*
|
|
28
|
+
* @return {any} The response from the server after fetching data from the '/test500' endpoint.
|
|
29
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
30
|
+
* @description This method is used to test the 500 error handling by sending a GET request to a specific endpoint.
|
|
21
31
|
*/
|
|
22
|
-
test500(): Promise<any>;
|
|
32
|
+
test500(): Promise<any | IError>;
|
|
23
33
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @
|
|
27
|
-
*
|
|
28
|
-
* @param event.
|
|
29
|
-
|
|
34
|
+
* Validates a CAPTCHA token by sending it to the server for verification.
|
|
35
|
+
*
|
|
36
|
+
* @handleName validateCapcha
|
|
37
|
+
*
|
|
38
|
+
* @param {Object} event - The event object containing CAPTCHA data. Example:
|
|
39
|
+
{
|
|
40
|
+
"token": "03AGdBq24...",
|
|
41
|
+
"expectedAction": "login",
|
|
42
|
+
"siteKey": "6Lc_aCMTAAAAAB..."
|
|
43
|
+
}
|
|
44
|
+
* @param {string} event.token - The CAPTCHA token to be validated. Example: "03AGdBq24...".
|
|
45
|
+
* @param {string} event.expectedAction - The expected action associated with the CAPTCHA. Example: "login".
|
|
46
|
+
* @param {string} event.siteKey - The site key used for the CAPTCHA. Example: "6Lc_aCMTAAAAAB...".
|
|
47
|
+
* @return {any} The response from the server after validating the CAPTCHA, or an error object if validation fails.
|
|
48
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
49
|
+
* @description This method sends the CAPTCHA token and related information to the server endpoint '/captcha/validate' to verify its validity.
|
|
30
50
|
*/
|
|
31
51
|
validateCapcha(event: {
|
|
32
52
|
token: string;
|
|
33
53
|
expectedAction: string;
|
|
34
54
|
siteKey: string;
|
|
35
55
|
}): Promise<any | IError>;
|
|
56
|
+
/**
|
|
57
|
+
* Getting the number of requests to API.
|
|
58
|
+
*
|
|
59
|
+
* @handleName getApiStat
|
|
60
|
+
*
|
|
61
|
+
* @return {any} Return object with date and count.
|
|
62
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
63
|
+
* @description Getting the number of requests to API.
|
|
64
|
+
*/
|
|
65
|
+
getApiStat(): Promise<any | IError>;
|
|
36
66
|
}
|
package/dist/system/systemApi.js
CHANGED
|
@@ -15,28 +15,48 @@ class SystemApi extends asyncModules_1.default {
|
|
|
15
15
|
this._url = state.url + '/api/content/system';
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* test404
|
|
19
|
-
*
|
|
18
|
+
* Sends a GET request to the '/test404' endpoint and returns the result.
|
|
19
|
+
*
|
|
20
|
+
* @handleName test404
|
|
21
|
+
*
|
|
22
|
+
* @return {any} The response from the server after fetching data from the '/test404' endpoint.
|
|
23
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
24
|
+
* @description This method is used to test the 404 error handling by sending a GET request to a specific endpoint.
|
|
20
25
|
*/
|
|
21
26
|
async test404() {
|
|
22
27
|
const result = await this._fetchGet('/test404');
|
|
23
28
|
return result;
|
|
24
29
|
}
|
|
25
30
|
/**
|
|
26
|
-
* test500
|
|
27
|
-
*
|
|
31
|
+
* Sends a GET request to the '/test500' endpoint and returns the result.
|
|
32
|
+
*
|
|
33
|
+
* @handleName test500
|
|
34
|
+
*
|
|
35
|
+
* @return {any} The response from the server after fetching data from the '/test500' endpoint.
|
|
36
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
37
|
+
* @description This method is used to test the 500 error handling by sending a GET request to a specific endpoint.
|
|
28
38
|
*/
|
|
29
39
|
async test500() {
|
|
30
40
|
const result = await this._fetchGet('/test500');
|
|
31
41
|
return result;
|
|
32
42
|
}
|
|
33
43
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @
|
|
37
|
-
*
|
|
38
|
-
* @param event.
|
|
39
|
-
|
|
44
|
+
* Validates a CAPTCHA token by sending it to the server for verification.
|
|
45
|
+
*
|
|
46
|
+
* @handleName validateCapcha
|
|
47
|
+
*
|
|
48
|
+
* @param {Object} event - The event object containing CAPTCHA data. Example:
|
|
49
|
+
{
|
|
50
|
+
"token": "03AGdBq24...",
|
|
51
|
+
"expectedAction": "login",
|
|
52
|
+
"siteKey": "6Lc_aCMTAAAAAB..."
|
|
53
|
+
}
|
|
54
|
+
* @param {string} event.token - The CAPTCHA token to be validated. Example: "03AGdBq24...".
|
|
55
|
+
* @param {string} event.expectedAction - The expected action associated with the CAPTCHA. Example: "login".
|
|
56
|
+
* @param {string} event.siteKey - The site key used for the CAPTCHA. Example: "6Lc_aCMTAAAAAB...".
|
|
57
|
+
* @return {any} The response from the server after validating the CAPTCHA, or an error object if validation fails.
|
|
58
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
59
|
+
* @description This method sends the CAPTCHA token and related information to the server endpoint '/captcha/validate' to verify its validity.
|
|
40
60
|
*/
|
|
41
61
|
async validateCapcha(event) {
|
|
42
62
|
const data = {
|
|
@@ -45,5 +65,18 @@ class SystemApi extends asyncModules_1.default {
|
|
|
45
65
|
const result = await this._fetchPost('/captcha/validate', data);
|
|
46
66
|
return result;
|
|
47
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Getting the number of requests to API.
|
|
70
|
+
*
|
|
71
|
+
* @handleName getApiStat
|
|
72
|
+
*
|
|
73
|
+
* @return {any} Return object with date and count.
|
|
74
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
75
|
+
* @description Getting the number of requests to API.
|
|
76
|
+
*/
|
|
77
|
+
async getApiStat() {
|
|
78
|
+
const result = await this._fetchGet('/api-stat');
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
48
81
|
}
|
|
49
82
|
exports.default = SystemApi;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @interface ISystem
|
|
3
|
+
*
|
|
4
|
+
* @property {function} test404 - Test 404 error.
|
|
5
|
+
* @property {function} test500 - Test 500 error.
|
|
6
|
+
* @description Represents a interface object of System Api.
|
|
7
|
+
*/
|
|
1
8
|
interface ISystem {
|
|
2
9
|
test404(): Promise<any>;
|
|
3
10
|
test500(): Promise<any>;
|
|
@@ -4,7 +4,11 @@ import type { IError, Types } from '../base/utils';
|
|
|
4
4
|
import type { ITemplateEntity, ITemplatesApi } from './templatesInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with template objects
|
|
7
|
+
*
|
|
8
|
+
* @module TemplateController
|
|
7
9
|
* @handle /api/content/templates
|
|
10
|
+
*
|
|
11
|
+
* @description This module provides a set of controllers for handling operations related to template objects.
|
|
8
12
|
*/
|
|
9
13
|
export default class TemplatesPreviewApi extends AsyncModules implements ITemplatesApi {
|
|
10
14
|
protected state: StateModule;
|
|
@@ -13,36 +17,36 @@ export default class TemplatesPreviewApi extends AsyncModules implements ITempla
|
|
|
13
17
|
/**
|
|
14
18
|
* Get all template objects grouped by types.
|
|
15
19
|
*
|
|
16
|
-
* @
|
|
20
|
+
* @handleName getAllTemplates
|
|
17
21
|
*
|
|
18
|
-
* @
|
|
22
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
23
|
+
* @return {Record<Types, ITemplateEntity[]>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
|
|
24
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
25
|
+
* @description This function is designed to fetch organized template objects in groups based on their types.
|
|
19
26
|
*/
|
|
20
|
-
getAllTemplates(langCode?: string): Promise<Record<Types, ITemplateEntity> | IError>;
|
|
27
|
+
getAllTemplates(langCode?: string): Promise<Record<Types, ITemplateEntity[]> | IError>;
|
|
21
28
|
/**
|
|
22
29
|
* Get template objects by type.
|
|
23
30
|
*
|
|
24
|
-
* @
|
|
25
|
-
* @param {string} [langCode] - Optional parameter language code
|
|
31
|
+
* @handleName getTemplateByType
|
|
26
32
|
*
|
|
27
|
-
* @
|
|
33
|
+
* @param {Types} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
|
|
34
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
35
|
+
* @return {ITemplateEntity[]} Returns a TemplateEntity object.
|
|
36
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
37
|
+
* @description Fetch template objects that belong to a specific type, with an optional filter by language.
|
|
28
38
|
*/
|
|
29
|
-
getTemplateByType(type: Types, langCode?: string): Promise<
|
|
39
|
+
getTemplateByType(type: Types, langCode?: string): Promise<ITemplateEntity[] | IError>;
|
|
30
40
|
/**
|
|
31
|
-
* Get one template object by
|
|
41
|
+
* Get one template object by marker.
|
|
32
42
|
*
|
|
33
|
-
* @
|
|
34
|
-
* @param {string} [langCode] - Optional parameter language code
|
|
43
|
+
* @handleName getTemplateByMarker
|
|
35
44
|
*
|
|
36
|
-
* @
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @param {number} [marker] - Template marker
|
|
43
|
-
* @param {string} [langCode] - Optional parameter language code
|
|
44
|
-
*
|
|
45
|
-
* @returns Returns a TemplateEntity object
|
|
45
|
+
* @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
|
|
46
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
47
|
+
* @return {ITemplateEntity} Returns a TemplateEntity object
|
|
48
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
49
|
+
* @description Fetch a specific template object based on its unique marker.
|
|
46
50
|
*/
|
|
47
51
|
getTemplateByMarker(marker: string, langCode?: string): Promise<ITemplateEntity | IError>;
|
|
48
52
|
}
|
|
@@ -7,7 +7,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
8
|
/**
|
|
9
9
|
* Controllers for working with template objects
|
|
10
|
+
*
|
|
11
|
+
* @module TemplateController
|
|
10
12
|
* @handle /api/content/templates
|
|
13
|
+
*
|
|
14
|
+
* @description This module provides a set of controllers for handling operations related to template objects.
|
|
11
15
|
*/
|
|
12
16
|
class TemplatesPreviewApi extends asyncModules_1.default {
|
|
13
17
|
constructor(state) {
|
|
@@ -17,9 +21,12 @@ class TemplatesPreviewApi extends asyncModules_1.default {
|
|
|
17
21
|
/**
|
|
18
22
|
* Get all template objects grouped by types.
|
|
19
23
|
*
|
|
20
|
-
* @
|
|
24
|
+
* @handleName getAllTemplates
|
|
21
25
|
*
|
|
22
|
-
* @
|
|
26
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
27
|
+
* @return {Record<Types, ITemplateEntity[]>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
|
|
28
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
29
|
+
* @description This function is designed to fetch organized template objects in groups based on their types.
|
|
23
30
|
*/
|
|
24
31
|
async getAllTemplates(langCode = this.state.lang) {
|
|
25
32
|
const response = await this._fetchGet(`/all?langCode=${langCode}`);
|
|
@@ -33,34 +40,28 @@ class TemplatesPreviewApi extends asyncModules_1.default {
|
|
|
33
40
|
/**
|
|
34
41
|
* Get template objects by type.
|
|
35
42
|
*
|
|
36
|
-
* @
|
|
37
|
-
* @param {string} [langCode] - Optional parameter language code
|
|
43
|
+
* @handleName getTemplateByType
|
|
38
44
|
*
|
|
39
|
-
* @
|
|
45
|
+
* @param {Types} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
|
|
46
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
47
|
+
* @return {ITemplateEntity[]} Returns a TemplateEntity object.
|
|
48
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
49
|
+
* @description Fetch template objects that belong to a specific type, with an optional filter by language.
|
|
40
50
|
*/
|
|
41
51
|
async getTemplateByType(type, langCode = this.state.lang) {
|
|
42
52
|
const result = await this._fetchGet(`?type=${type}&langCode=${langCode}`);
|
|
43
53
|
return this._normalizeData(result);
|
|
44
54
|
}
|
|
45
55
|
/**
|
|
46
|
-
* Get one template object by
|
|
56
|
+
* Get one template object by marker.
|
|
47
57
|
*
|
|
48
|
-
* @
|
|
49
|
-
* @param {string} [langCode] - Optional parameter language code
|
|
58
|
+
* @handleName getTemplateByMarker
|
|
50
59
|
*
|
|
51
|
-
* @
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Get one template object by id.
|
|
59
|
-
*
|
|
60
|
-
* @param {number} [marker] - Template marker
|
|
61
|
-
* @param {string} [langCode] - Optional parameter language code
|
|
62
|
-
*
|
|
63
|
-
* @returns Returns a TemplateEntity object
|
|
60
|
+
* @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
|
|
61
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
62
|
+
* @return {ITemplateEntity} Returns a TemplateEntity object
|
|
63
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
64
|
+
* @description Fetch a specific template object based on its unique marker.
|
|
64
65
|
*/
|
|
65
66
|
async getTemplateByMarker(marker, langCode = this.state.lang) {
|
|
66
67
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
@@ -1,42 +1,68 @@
|
|
|
1
1
|
import type { AttributeType, IError, Types } from '../base/utils';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* @interface ITemplatesApi
|
|
4
4
|
*
|
|
5
5
|
* @property {function} getAllTemplates - Get all template objects grouped by types.
|
|
6
6
|
* @property {function} getTemplateByType - Get template objects by type.
|
|
7
|
-
* @property {function} getTemplateById - Get one template object by id.
|
|
8
7
|
* @property {function} getTemplateByMarker - Getting a single template object.
|
|
8
|
+
*
|
|
9
|
+
* @description This interface defines methods for retrieving templates in the system, including fetching all templates, specific templates by type or ID, and by marker.
|
|
9
10
|
*/
|
|
10
11
|
interface ITemplatesApi {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Get all template objects grouped by types.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
16
|
+
* @return {Record<Types, ITemplateEntity[]>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
|
|
17
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
18
|
+
*/
|
|
19
|
+
getAllTemplates(langCode?: string): Promise<Record<Types, ITemplateEntity[]> | IError>;
|
|
20
|
+
/**
|
|
21
|
+
* Get template objects by type.
|
|
22
|
+
*
|
|
23
|
+
* @param {Types} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
|
|
24
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
25
|
+
* @return {TemplateEntity[]} Returns a TemplateEntity object.
|
|
26
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
27
|
+
*/
|
|
28
|
+
getTemplateByType(type: Types, langCode: string): Promise<ITemplateEntity[] | IError>;
|
|
29
|
+
/**
|
|
30
|
+
* Get one template object by id.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
|
|
33
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
34
|
+
* @return {ITemplateEntity} Returns a TemplateEntity object
|
|
35
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
36
|
+
*/
|
|
14
37
|
getTemplateByMarker(marker: string, langCode?: string): Promise<ITemplateEntity | IError>;
|
|
15
38
|
}
|
|
16
39
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @interface
|
|
20
|
-
* @property {number} id - The unique identifier of the position.
|
|
21
|
-
* @property {number} version - The version number of the object.
|
|
22
|
-
* @property {string} identifier - The textual identifier for the record field.
|
|
23
|
-
* @property {number} generalTypeId - General type Entity id.
|
|
24
|
-
* @property {string} title - The name of the template.
|
|
25
|
-
* @property {number} position - The position of the object.
|
|
26
|
-
* @property {Types} generalTypeName - General type name.
|
|
27
|
-
* @property {string} attributeSetIdentifier - Set of attributes id.
|
|
28
|
-
* @property {AttributeType} attributeValues - Attribute values from the index (represented as a pair of user attribute id: attribute value).
|
|
40
|
+
* @interface ITemplateEntity
|
|
29
41
|
*
|
|
42
|
+
* @property {number} id - The unique identifier of the position. Example: 12345.
|
|
43
|
+
* @property {string | null} attributeSetIdentifier - Set of attributes id. Example: "attribute_set_1".
|
|
44
|
+
* @property {string} title - The name of the template. Example: "Product Template".
|
|
45
|
+
* @property {number} generalTypeId - General type Entity id. Example: 67890.
|
|
46
|
+
* @property {string} identifier - The textual identifier for the record field. Example: "template_12345".
|
|
47
|
+
* @property {number} version - The version number of the object. Example: 1.
|
|
48
|
+
* @property {Types} generalTypeName - General type name. Example: "product".
|
|
49
|
+
* @property {AttributeType} attributeValues - Attribute values from the index (represented as a pair of user attribute id: attribute value). Example:
|
|
50
|
+
* @property {number} position - The position of the object. Example: 1.
|
|
51
|
+
{
|
|
52
|
+
"id": 1,
|
|
53
|
+
"value": "some"
|
|
54
|
+
}
|
|
55
|
+
* @description This interface defines the structure of a template entity, including its identifiers, attributes, and general type information.
|
|
30
56
|
*/
|
|
31
57
|
interface ITemplateEntity {
|
|
32
58
|
id: number;
|
|
33
|
-
|
|
34
|
-
identifier: string;
|
|
35
|
-
generalTypeId: number;
|
|
59
|
+
attributeSetIdentifier: string | null;
|
|
36
60
|
title: string;
|
|
37
|
-
|
|
61
|
+
generalTypeId: number;
|
|
62
|
+
identifier: string;
|
|
63
|
+
version: number;
|
|
38
64
|
generalTypeName: Types;
|
|
39
65
|
attributeValues: AttributeType;
|
|
40
|
-
|
|
66
|
+
position: number;
|
|
41
67
|
}
|
|
42
68
|
export type { ITemplateEntity, ITemplatesApi };
|
|
@@ -3,8 +3,11 @@ import type StateModule from '../base/stateModule';
|
|
|
3
3
|
import type { IError } from '../base/utils';
|
|
4
4
|
import type { ITemplatesPreview, ITemplatesPreviewEntity } from './templatesPreviewInterfaces';
|
|
5
5
|
/**
|
|
6
|
-
* Controllers for working with template objects for preview
|
|
6
|
+
* Controllers for working with template objects for preview.
|
|
7
|
+
*
|
|
7
8
|
* @handle /api/content/template-previews
|
|
9
|
+
*
|
|
10
|
+
* @description This module provides a set of controllers for managing and retrieving template objects designed for preview purposes.
|
|
8
11
|
*/
|
|
9
12
|
export default class TemplatePreviewsApi extends AsyncModules implements ITemplatesPreview {
|
|
10
13
|
protected state: StateModule;
|
|
@@ -13,27 +16,24 @@ export default class TemplatePreviewsApi extends AsyncModules implements ITempla
|
|
|
13
16
|
/**
|
|
14
17
|
* Get all template objects.
|
|
15
18
|
*
|
|
16
|
-
* @
|
|
19
|
+
* @handleName getTemplatePreviews
|
|
17
20
|
*
|
|
18
|
-
* @
|
|
21
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
22
|
+
* @return {ITemplatesPreviewEntity[]} - Returns all TemplatePreviewsEntity template objects.
|
|
23
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
24
|
+
* @description This method is used to fetch all available template objects.
|
|
19
25
|
*/
|
|
20
|
-
getTemplatePreviews(langCode?: string): Promise<
|
|
26
|
+
getTemplatePreviews(langCode?: string): Promise<ITemplatesPreviewEntity[] | IError>;
|
|
21
27
|
/**
|
|
22
|
-
*
|
|
28
|
+
* Retrieves a template object by its marker.
|
|
23
29
|
*
|
|
24
|
-
* @
|
|
25
|
-
* @param {string} [langCode] - Optional parameter language code
|
|
30
|
+
* @handleName getTemplatePreviewByMarker
|
|
26
31
|
*
|
|
27
|
-
* @
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @param {string} [marker] - Product marker
|
|
34
|
-
* @param {string} [langCode] - Optional parameter language code
|
|
35
|
-
*
|
|
36
|
-
* @returns Returns a TemplatePreviewsEntity object
|
|
32
|
+
* @param {string} marker - The unique product marker used to identify the template. If not provided, a default behavior or error may occur. Example: "template_12345".
|
|
33
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
34
|
+
* @return {TemplatePreviewsEntity} - A promise that resolves to a TemplatePreviewsEntity object representing the template.
|
|
35
|
+
* @throws {IError} - Throws an error object if there is an issue during the fetch operation.
|
|
36
|
+
* @description This method is used to fetch a specific template object based on the provided marker.
|
|
37
37
|
*/
|
|
38
38
|
getTemplatePreviewByMarker(marker: string, langCode?: string): Promise<ITemplatesPreviewEntity | IError>;
|
|
39
39
|
}
|
|
@@ -5,8 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
|
-
* Controllers for working with template objects for preview
|
|
8
|
+
* Controllers for working with template objects for preview.
|
|
9
|
+
*
|
|
9
10
|
* @handle /api/content/template-previews
|
|
11
|
+
*
|
|
12
|
+
* @description This module provides a set of controllers for managing and retrieving template objects designed for preview purposes.
|
|
10
13
|
*/
|
|
11
14
|
class TemplatePreviewsApi extends asyncModules_1.default {
|
|
12
15
|
constructor(state) {
|
|
@@ -16,33 +19,27 @@ class TemplatePreviewsApi extends asyncModules_1.default {
|
|
|
16
19
|
/**
|
|
17
20
|
* Get all template objects.
|
|
18
21
|
*
|
|
19
|
-
* @
|
|
22
|
+
* @handleName getTemplatePreviews
|
|
20
23
|
*
|
|
21
|
-
* @
|
|
24
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
25
|
+
* @return {ITemplatesPreviewEntity[]} - Returns all TemplatePreviewsEntity template objects.
|
|
26
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
27
|
+
* @description This method is used to fetch all available template objects.
|
|
22
28
|
*/
|
|
23
29
|
async getTemplatePreviews(langCode = this.state.lang) {
|
|
24
30
|
const result = await this._fetchGet(`?langCode=${langCode}`);
|
|
25
31
|
return this._normalizeData(result, langCode);
|
|
26
32
|
}
|
|
27
33
|
/**
|
|
28
|
-
*
|
|
34
|
+
* Retrieves a template object by its marker.
|
|
29
35
|
*
|
|
30
|
-
* @
|
|
31
|
-
* @param {string} [langCode] - Optional parameter language code
|
|
36
|
+
* @handleName getTemplatePreviewByMarker
|
|
32
37
|
*
|
|
33
|
-
* @
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Get one template object by marker.
|
|
41
|
-
*
|
|
42
|
-
* @param {string} [marker] - Product marker
|
|
43
|
-
* @param {string} [langCode] - Optional parameter language code
|
|
44
|
-
*
|
|
45
|
-
* @returns Returns a TemplatePreviewsEntity object
|
|
38
|
+
* @param {string} marker - The unique product marker used to identify the template. If not provided, a default behavior or error may occur. Example: "template_12345".
|
|
39
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
40
|
+
* @return {TemplatePreviewsEntity} - A promise that resolves to a TemplatePreviewsEntity object representing the template.
|
|
41
|
+
* @throws {IError} - Throws an error object if there is an issue during the fetch operation.
|
|
42
|
+
* @description This method is used to fetch a specific template object based on the provided marker.
|
|
46
43
|
*/
|
|
47
44
|
async getTemplatePreviewByMarker(marker, langCode = this.state.lang) {
|
|
48
45
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|