oneentry 1.0.126 → 1.0.128
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 +0 -2
- package/configure.js +25 -18
- package/dist/admins/adminsApi.d.ts +18 -13
- package/dist/admins/adminsApi.js +18 -13
- package/dist/admins/adminsInterfaces.d.ts +16 -25
- package/dist/attribute-sets/attributeSetsApi.d.ts +14 -15
- package/dist/attribute-sets/attributeSetsApi.js +14 -15
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +78 -84
- package/dist/auth-provider/authProviderApi.d.ts +53 -79
- package/dist/auth-provider/authProviderApi.js +52 -78
- package/dist/auth-provider/authProvidersInterfaces.d.ts +98 -94
- package/dist/base/asyncModules.d.ts +23 -21
- package/dist/base/asyncModules.js +39 -29
- package/dist/base/result.d.ts +31 -0
- package/dist/base/result.js +32 -5
- package/dist/base/stateModule.d.ts +10 -0
- package/dist/base/stateModule.js +50 -2
- package/dist/base/syncModules.d.ts +42 -50
- package/dist/base/syncModules.js +106 -58
- package/dist/base/utils.d.ts +33 -2
- package/dist/blocks/blocksApi.d.ts +9 -18
- package/dist/blocks/blocksApi.js +9 -18
- package/dist/blocks/blocksInterfaces.d.ts +41 -46
- package/dist/config.d.ts +13 -0
- package/dist/config.js +30 -0
- package/dist/events/eventsApi.d.ts +10 -27
- package/dist/events/eventsApi.js +26 -40
- package/dist/events/eventsInterfaces.d.ts +33 -28
- package/dist/file-uploading/fileUploadingApi.d.ts +12 -17
- package/dist/file-uploading/fileUploadingApi.js +14 -17
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +8 -19
- package/dist/forms/formsApi.d.ts +10 -9
- package/dist/forms/formsApi.js +10 -9
- package/dist/forms/formsInterfaces.d.ts +20 -12
- package/dist/forms-data/formsDataApi.d.ts +24 -28
- package/dist/forms-data/formsDataApi.js +25 -28
- package/dist/forms-data/formsDataInterfaces.d.ts +71 -71
- package/dist/general-types/generalTypesApi.d.ts +5 -5
- package/dist/general-types/generalTypesApi.js +5 -5
- package/dist/general-types/generalTypesInterfaces.d.ts +5 -8
- package/dist/index.d.ts +3 -4
- package/dist/index.js +3 -4
- package/dist/integration-collections/integrationCollectionsApi.d.ts +29 -47
- package/dist/integration-collections/integrationCollectionsApi.js +31 -51
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +62 -58
- package/dist/locales/localesApi.d.ts +7 -3
- package/dist/locales/localesApi.js +7 -3
- package/dist/locales/localesInterfaces.d.ts +6 -5
- package/dist/menus/menusApi.d.ts +7 -3
- package/dist/menus/menusApi.js +7 -3
- package/dist/menus/menusInterfaces.d.ts +5 -10
- package/dist/menus/menusInterfaces.js +1 -0
- package/dist/orders/ordersApi.d.ts +17 -25
- package/dist/orders/ordersApi.js +17 -26
- package/dist/orders/ordersInterfaces.d.ts +94 -53
- package/dist/pages/pagesApi.d.ts +47 -60
- package/dist/pages/pagesApi.js +51 -61
- package/dist/pages/pagesInterfaces.d.ts +44 -48
- package/dist/payments/paymentsApi.d.ts +17 -27
- package/dist/payments/paymentsApi.js +17 -31
- package/dist/payments/paymentsInterfaces.d.ts +35 -29
- package/dist/product-statuses/productStatusesApi.d.ts +9 -9
- package/dist/product-statuses/productStatusesApi.js +9 -9
- package/dist/product-statuses/productStatusesInterfaces.d.ts +14 -12
- package/dist/products/productsApi.d.ts +23 -44
- package/dist/products/productsApi.js +24 -44
- package/dist/products/productsInterfaces.d.ts +51 -57
- package/dist/system/systemApi.d.ts +11 -13
- package/dist/system/systemApi.js +12 -13
- package/dist/system/systemInterfaces.d.ts +14 -3
- package/dist/templates/templatesApi.d.ts +8 -11
- package/dist/templates/templatesApi.js +8 -11
- package/dist/templates/templatesInterfaces.d.ts +13 -12
- package/dist/templates-preview/templatesPreviewApi.d.ts +7 -8
- package/dist/templates-preview/templatesPreviewApi.js +7 -8
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +15 -18
- package/dist/users/usersApi.d.ts +13 -20
- package/dist/users/usersApi.js +13 -20
- package/dist/users/usersInterfaces.d.ts +26 -30
- package/dist/web-socket/wsApi.d.ts +5 -3
- package/dist/web-socket/wsApi.js +6 -3
- package/dist/web-socket/wsInterfaces.d.ts +7 -2
- package/package.json +16 -12
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import type { IAttributeValues, IError, ILocalizeInfo } from '../base/utils';
|
|
2
2
|
/**
|
|
3
3
|
* @interface IMenus
|
|
4
|
-
*
|
|
5
|
-
* @property {function} getMenusByMarker - Get pages includes in menu by marker.
|
|
4
|
+
* @property {Function} getMenusByMarker - Get pages includes in menu by marker.
|
|
6
5
|
* @description This interface defines a method for retrieving menu pages by a specific marker and language code.
|
|
7
6
|
*/
|
|
8
7
|
interface IMenus {
|
|
9
8
|
/**
|
|
10
9
|
* Get pages includes in menu by marker.
|
|
11
|
-
*
|
|
10
|
+
* @handleName getMenusByMarker
|
|
12
11
|
* @param {string} marker - Menu marker. Example: "main_menu".
|
|
13
12
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
14
|
-
* @
|
|
13
|
+
* @returns {IMenusEntity} Returns a single menu object as a ContentMenu object with included pages.
|
|
15
14
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
15
|
+
* @description This method gets pages includes in menu by marker.
|
|
16
16
|
*/
|
|
17
17
|
getMenusByMarker(marker: string, langCode: string): Promise<IMenusEntity | IError>;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* @interface IMenusPages
|
|
21
|
-
*
|
|
22
21
|
* @property {IMenusPages[]} children - Contains array with child page objects. Example:
|
|
23
22
|
[
|
|
24
23
|
{
|
|
@@ -56,13 +55,9 @@ interface IMenusPages {
|
|
|
56
55
|
}
|
|
57
56
|
/**
|
|
58
57
|
* @interface IMenusEntity
|
|
59
|
-
*
|
|
60
58
|
* @property {number} id - The unique identifier of the menu. Example: 1.
|
|
61
59
|
* @property {string} identifier - The menu identifier. Example: "main_menu".
|
|
62
|
-
* @property {ILocalizeInfo} localizeInfos -
|
|
63
|
-
{
|
|
64
|
-
"title": "menu"
|
|
65
|
-
}
|
|
60
|
+
* @property {ILocalizeInfo} localizeInfos - Contains localization information. Example: {"title": "menu"}.
|
|
66
61
|
* @property {IMenusPages[]} pages - Array of menu pages. Example:
|
|
67
62
|
[
|
|
68
63
|
{
|
|
@@ -4,7 +4,6 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IBaseOrdersEntity, IOrderByMarkerEntity, IOrderData, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity } from './ordersInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with orders.
|
|
7
|
-
*
|
|
8
7
|
* @handle /api/content/orders-storage
|
|
9
8
|
* @module OrdersApi
|
|
10
9
|
* @description This module provides methods for working with orders, including retrieving, creating, and updating orders in the order storage.
|
|
@@ -12,64 +11,59 @@ import type { IBaseOrdersEntity, IOrderByMarkerEntity, IOrderData, IOrdersApi, I
|
|
|
12
11
|
export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
13
12
|
protected state: StateModule;
|
|
14
13
|
protected _url: string;
|
|
14
|
+
/**
|
|
15
|
+
* Constructs an instance of the OrdersApi class.
|
|
16
|
+
* @param {StateModule} state - The state module containing the necessary information for making API calls.
|
|
17
|
+
* @description Constructor initializes the OrdersApi with a given state.
|
|
18
|
+
*/
|
|
15
19
|
constructor(state: StateModule);
|
|
16
20
|
/**
|
|
17
21
|
* Getting all the order storage objects.
|
|
18
|
-
*
|
|
19
22
|
* @handleName getAllOrdersStorage
|
|
20
|
-
*
|
|
21
23
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
22
24
|
* @param {number} [offset] - Optional parameter for pagination. Default: 0.
|
|
23
25
|
* @param {number} [limit] - Optional parameter for pagination. Default: 30.
|
|
24
|
-
* @
|
|
26
|
+
* @returns {IOrdersEntity[]} Returns an array of order storage objects.
|
|
25
27
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
26
28
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
27
|
-
|
|
29
|
+
*/
|
|
28
30
|
getAllOrdersStorage(langCode?: string, offset?: number, limit?: number): Promise<IOrdersEntity[] | IError>;
|
|
29
31
|
/**
|
|
30
32
|
* Getting all orders from the orders storage object created by the user.
|
|
31
|
-
*
|
|
32
33
|
* @handleName getAllOrdersByMarker
|
|
33
|
-
*
|
|
34
34
|
* @param {string} marker - Textual identifier of the order storage object. Example: "order_storage_1".
|
|
35
35
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
36
36
|
* @param {number} [offset] - Offset parameter. Default: 0.
|
|
37
37
|
* @param {number} [limit] - Limit parameter. Default: 30.
|
|
38
|
-
* @
|
|
38
|
+
* @returns {IOrdersByMarkerEntity} Returns an object with the orders.
|
|
39
39
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
40
40
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
41
41
|
*/
|
|
42
42
|
getAllOrdersByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IOrdersByMarkerEntity | IError>;
|
|
43
43
|
/**
|
|
44
44
|
* Retrieve one order storage object by marker.
|
|
45
|
-
*
|
|
46
45
|
* @handleName getOrderByMarker
|
|
47
|
-
*
|
|
48
46
|
* @param {string} marker - Marker of the order object. Example: "order_storage_1".
|
|
49
47
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
50
|
-
* @
|
|
48
|
+
* @returns {IOrdersEntity} Return object of order information.
|
|
51
49
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
52
50
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
53
51
|
*/
|
|
54
52
|
getOrderByMarker(marker: string, langCode?: string): Promise<IOrdersEntity | IError>;
|
|
55
53
|
/**
|
|
56
54
|
* Getting a single order from the order storage object created by the user.
|
|
57
|
-
*
|
|
58
55
|
* @handleName getOrderByMarkerAndId
|
|
59
|
-
*
|
|
60
56
|
* @param {string} marker - The text identifier of the order storage object. Example: "order_storage_1".
|
|
61
57
|
* @param {number} id - ID of the order object. Example: 12345.
|
|
62
58
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
63
|
-
* @
|
|
59
|
+
* @returns {IOrderByMarkerEntity} Returns an object with the order.
|
|
64
60
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
65
61
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
66
62
|
*/
|
|
67
63
|
getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<IOrderByMarkerEntity | IError>;
|
|
68
64
|
/**
|
|
69
65
|
* Creation of an order in the order storage.
|
|
70
|
-
*
|
|
71
66
|
* @handleName createOrder
|
|
72
|
-
*
|
|
73
67
|
* @param {string} marker - Textual identifier of the order storage object. Example: "order_storage_1".
|
|
74
68
|
* @param {IOrderData} body - Object for creating an order. Example:
|
|
75
69
|
{
|
|
@@ -82,22 +76,20 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
82
76
|
},
|
|
83
77
|
"products": [
|
|
84
78
|
{
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
"productId": 1,
|
|
80
|
+
"quantity": 2
|
|
87
81
|
}
|
|
88
82
|
]
|
|
89
83
|
}
|
|
90
|
-
* @param {
|
|
91
|
-
* @
|
|
84
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
85
|
+
* @returns {IBaseOrdersEntity} Returns an object with the created order.
|
|
92
86
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
93
87
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
94
88
|
*/
|
|
95
89
|
createOrder(marker: string, body: IOrderData, langCode?: string): Promise<IBaseOrdersEntity | IError>;
|
|
96
90
|
/**
|
|
97
91
|
* Changing an order in the orders storage
|
|
98
|
-
*
|
|
99
92
|
* @handleName updateOrderByMarkerAndId
|
|
100
|
-
*
|
|
101
93
|
* @param {string} marker - The text identifier of the order storage object. Example: "order_storage_1".
|
|
102
94
|
* @param {number} id - ID of the order object. Example: 12345.
|
|
103
95
|
* @param {IOrderData} body - Object for updating an order. Example:
|
|
@@ -111,14 +103,14 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
111
103
|
},
|
|
112
104
|
"products": [
|
|
113
105
|
{
|
|
114
|
-
|
|
115
|
-
|
|
106
|
+
"productId": 1,
|
|
107
|
+
"quantity": 2
|
|
116
108
|
}
|
|
117
109
|
],
|
|
118
110
|
"currency": "USD"
|
|
119
111
|
}
|
|
120
112
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
121
|
-
* @
|
|
113
|
+
* @returns {IBaseOrdersEntity} Returns an object with the updated order.
|
|
122
114
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
123
115
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
124
116
|
*/
|
package/dist/orders/ordersApi.js
CHANGED
|
@@ -6,58 +6,55 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for working with orders.
|
|
9
|
-
*
|
|
10
9
|
* @handle /api/content/orders-storage
|
|
11
10
|
* @module OrdersApi
|
|
12
11
|
* @description This module provides methods for working with orders, including retrieving, creating, and updating orders in the order storage.
|
|
13
12
|
*/
|
|
14
13
|
class OrdersApi extends asyncModules_1.default {
|
|
14
|
+
/**
|
|
15
|
+
* Constructs an instance of the OrdersApi class.
|
|
16
|
+
* @param {StateModule} state - The state module containing the necessary information for making API calls.
|
|
17
|
+
* @description Constructor initializes the OrdersApi with a given state.
|
|
18
|
+
*/
|
|
15
19
|
constructor(state) {
|
|
16
20
|
super(state);
|
|
17
21
|
this._url = state.url + '/api/content/orders-storage';
|
|
18
22
|
}
|
|
19
23
|
/**
|
|
20
24
|
* Getting all the order storage objects.
|
|
21
|
-
*
|
|
22
25
|
* @handleName getAllOrdersStorage
|
|
23
|
-
*
|
|
24
26
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
25
27
|
* @param {number} [offset] - Optional parameter for pagination. Default: 0.
|
|
26
28
|
* @param {number} [limit] - Optional parameter for pagination. Default: 30.
|
|
27
|
-
* @
|
|
29
|
+
* @returns {IOrdersEntity[]} Returns an array of order storage objects.
|
|
28
30
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
29
31
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
30
|
-
|
|
32
|
+
*/
|
|
31
33
|
async getAllOrdersStorage(langCode = this.state.lang, offset = 0, limit = 30) {
|
|
32
34
|
const result = await this._fetchGet(`?langCode=${langCode}&limit=${limit}&offset=${offset}`);
|
|
33
35
|
return this._normalizeData(result);
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* Getting all orders from the orders storage object created by the user.
|
|
37
|
-
*
|
|
38
39
|
* @handleName getAllOrdersByMarker
|
|
39
|
-
*
|
|
40
40
|
* @param {string} marker - Textual identifier of the order storage object. Example: "order_storage_1".
|
|
41
41
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
42
42
|
* @param {number} [offset] - Offset parameter. Default: 0.
|
|
43
43
|
* @param {number} [limit] - Limit parameter. Default: 30.
|
|
44
|
-
* @
|
|
44
|
+
* @returns {IOrdersByMarkerEntity} Returns an object with the orders.
|
|
45
45
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
46
46
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
47
47
|
*/
|
|
48
48
|
async getAllOrdersByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
49
|
const result = await this._fetchGet(`/marker/${marker}/orders?langCode=${langCode}&limit=${limit}&offset=${offset}`);
|
|
51
50
|
return this._normalizeData(result);
|
|
52
51
|
}
|
|
53
52
|
/**
|
|
54
53
|
* Retrieve one order storage object by marker.
|
|
55
|
-
*
|
|
56
54
|
* @handleName getOrderByMarker
|
|
57
|
-
*
|
|
58
55
|
* @param {string} marker - Marker of the order object. Example: "order_storage_1".
|
|
59
56
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
60
|
-
* @
|
|
57
|
+
* @returns {IOrdersEntity} Return object of order information.
|
|
61
58
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
62
59
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
63
60
|
*/
|
|
@@ -67,13 +64,11 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
67
64
|
}
|
|
68
65
|
/**
|
|
69
66
|
* Getting a single order from the order storage object created by the user.
|
|
70
|
-
*
|
|
71
67
|
* @handleName getOrderByMarkerAndId
|
|
72
|
-
*
|
|
73
68
|
* @param {string} marker - The text identifier of the order storage object. Example: "order_storage_1".
|
|
74
69
|
* @param {number} id - ID of the order object. Example: 12345.
|
|
75
70
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
76
|
-
* @
|
|
71
|
+
* @returns {IOrderByMarkerEntity} Returns an object with the order.
|
|
77
72
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
78
73
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
79
74
|
*/
|
|
@@ -83,9 +78,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
83
78
|
}
|
|
84
79
|
/**
|
|
85
80
|
* Creation of an order in the order storage.
|
|
86
|
-
*
|
|
87
81
|
* @handleName createOrder
|
|
88
|
-
*
|
|
89
82
|
* @param {string} marker - Textual identifier of the order storage object. Example: "order_storage_1".
|
|
90
83
|
* @param {IOrderData} body - Object for creating an order. Example:
|
|
91
84
|
{
|
|
@@ -98,13 +91,13 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
98
91
|
},
|
|
99
92
|
"products": [
|
|
100
93
|
{
|
|
101
|
-
|
|
102
|
-
|
|
94
|
+
"productId": 1,
|
|
95
|
+
"quantity": 2
|
|
103
96
|
}
|
|
104
97
|
]
|
|
105
98
|
}
|
|
106
|
-
* @param {
|
|
107
|
-
* @
|
|
99
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
100
|
+
* @returns {IBaseOrdersEntity} Returns an object with the created order.
|
|
108
101
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
109
102
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
110
103
|
*/
|
|
@@ -120,9 +113,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
120
113
|
}
|
|
121
114
|
/**
|
|
122
115
|
* Changing an order in the orders storage
|
|
123
|
-
*
|
|
124
116
|
* @handleName updateOrderByMarkerAndId
|
|
125
|
-
*
|
|
126
117
|
* @param {string} marker - The text identifier of the order storage object. Example: "order_storage_1".
|
|
127
118
|
* @param {number} id - ID of the order object. Example: 12345.
|
|
128
119
|
* @param {IOrderData} body - Object for updating an order. Example:
|
|
@@ -136,14 +127,14 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
136
127
|
},
|
|
137
128
|
"products": [
|
|
138
129
|
{
|
|
139
|
-
|
|
140
|
-
|
|
130
|
+
"productId": 1,
|
|
131
|
+
"quantity": 2
|
|
141
132
|
}
|
|
142
133
|
],
|
|
143
134
|
"currency": "USD"
|
|
144
135
|
}
|
|
145
136
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
146
|
-
* @
|
|
137
|
+
* @returns {IBaseOrdersEntity} Returns an object with the updated order.
|
|
147
138
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
148
139
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
149
140
|
*/
|
|
@@ -1,60 +1,63 @@
|
|
|
1
1
|
import type { IError, ILocalizeInfo } from '../base/utils';
|
|
2
2
|
/**
|
|
3
3
|
* @interface IOrdersApi
|
|
4
|
-
*
|
|
5
|
-
* @property {
|
|
6
|
-
* @property {
|
|
7
|
-
* @property {
|
|
8
|
-
* @property {
|
|
9
|
-
* @property {
|
|
10
|
-
* @property {
|
|
11
|
-
* @property {function} setAccessToken - Only for custom authorization. An intermediate method for setting up an access token.
|
|
4
|
+
* @property {Function} getOrderByMarker - Retrieve one order storage object by marker.
|
|
5
|
+
* @property {Function} createOrder - Creation of an order in the order storage.
|
|
6
|
+
* @property {Function} updateOrderByMarkerAndId - Changing an order in the order store.
|
|
7
|
+
* @property {Function} getOrderByMarkerAndId - Getting a single order from the order storage object created by the user.
|
|
8
|
+
* @property {Function} getAllOrders - Getting all the order storage objects.
|
|
9
|
+
* @property {Function} getAllOrdersByMarker - Getting one order storage object by marker.
|
|
10
|
+
* @property {Function} setAccessToken - Only for custom authorization. An intermediate method for setting up an access token.
|
|
12
11
|
* @description Represents the API for managing orders in the order storage.
|
|
13
12
|
*/
|
|
14
13
|
interface IOrdersApi {
|
|
15
14
|
/**
|
|
16
15
|
* Getting all the order storage objects.
|
|
17
|
-
*
|
|
18
|
-
* @param {
|
|
16
|
+
* @handleName getAllOrdersStorage
|
|
17
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
19
18
|
* @param {number} [offset] - Optional parameter for pagination. Default: 0.
|
|
20
19
|
* @param {number} [limit] - Optional parameter for pagination. Default: 30.
|
|
21
|
-
* @
|
|
20
|
+
* @returns {Promise<IOrdersEntity[] | IError>} Returns an array of order storage objects.
|
|
22
21
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
22
|
+
* @description This method gets all the order storage objects.
|
|
23
23
|
*/
|
|
24
24
|
getAllOrdersStorage(langCode?: string, offset?: number, limit?: number): Promise<IOrdersEntity[] | IError>;
|
|
25
25
|
/**
|
|
26
26
|
* Getting all orders from the orders storage object created by the user.
|
|
27
|
-
*
|
|
27
|
+
* @handleName getAllOrdersByMarker
|
|
28
28
|
* @param {string} marker - Textual identifier of the order storage object. Example: "order_storage_1".
|
|
29
29
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
30
30
|
* @param {number} [offset] - Offset parameter. Default: 0.
|
|
31
31
|
* @param {number} [limit] - Limit parameter. Default: 30.
|
|
32
|
-
* @
|
|
32
|
+
* @returns {Promise<IOrdersByMarkerEntity | IError>} Returns an object with the orders.
|
|
33
33
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
34
|
+
* @description This method gets all orders from the orders storage object created by the user.
|
|
34
35
|
*/
|
|
35
36
|
getAllOrdersByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IOrdersByMarkerEntity | IError>;
|
|
36
37
|
/**
|
|
37
38
|
* Retrieve one order storage object by marker.
|
|
38
|
-
*
|
|
39
|
+
* @handleName getOrderByMarker
|
|
39
40
|
* @param {string} marker - Marker of the order object. Example: "order_storage_1".
|
|
40
41
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
41
|
-
* @
|
|
42
|
+
* @returns {Promise<IOrdersEntity | IError>} Return object of order information.
|
|
42
43
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
44
|
+
* @description This method retrieves one order storage object by marker.
|
|
43
45
|
*/
|
|
44
46
|
getOrderByMarker(marker: string, langCode?: string): Promise<IOrdersEntity | IError>;
|
|
45
47
|
/**
|
|
46
48
|
* Getting a single order from the order storage object created by the user.
|
|
47
|
-
*
|
|
49
|
+
* @handleName getOrderByMarkerAndId
|
|
48
50
|
* @param {string} marker - The text identifier of the order storage object. Example: "order_storage_1".
|
|
49
51
|
* @param {number} id - ID of the order object. Example: 12345.
|
|
50
52
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
51
|
-
* @
|
|
53
|
+
* @returns {Promise<IOrderByMarkerEntity | IError>} Returns an object with the order.
|
|
52
54
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
55
|
+
* @description This method gets a single order from the order storage object created by the user.
|
|
53
56
|
*/
|
|
54
57
|
getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<IOrderByMarkerEntity | IError>;
|
|
55
58
|
/**
|
|
56
59
|
* Creation of an order in the order storage.
|
|
57
|
-
*
|
|
60
|
+
* @handleName createOrder
|
|
58
61
|
* @param {string} marker - Textual identifier of the order storage object. Example: "order_storage_1".
|
|
59
62
|
* @param {IOrderData} body - Object for creating an order. Example:
|
|
60
63
|
{
|
|
@@ -67,20 +70,20 @@ interface IOrdersApi {
|
|
|
67
70
|
},
|
|
68
71
|
"products": [
|
|
69
72
|
{
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
"productId": 1,
|
|
74
|
+
"quantity": 2
|
|
72
75
|
}
|
|
73
76
|
]
|
|
74
77
|
}
|
|
75
|
-
* @param {
|
|
76
|
-
* @
|
|
78
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
79
|
+
* @returns {Promise<IBaseOrdersEntity | IError>} Returns an object with the created order.
|
|
77
80
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
78
81
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
79
82
|
*/
|
|
80
83
|
createOrder(marker: string, body: IOrderData, langCode: string): Promise<IBaseOrdersEntity | IError>;
|
|
81
84
|
/**
|
|
82
85
|
* Changing an order in the orders storage
|
|
83
|
-
*
|
|
86
|
+
* @handleName updateOrderByMarkerAndId
|
|
84
87
|
* @param {string} marker - The text identifier of the order storage object. Example: "order_storage_1".
|
|
85
88
|
* @param {number} id - ID of the order object. Example: 12345.
|
|
86
89
|
* @param {IOrderData} body - Object for updating an order. Example:
|
|
@@ -94,22 +97,22 @@ interface IOrdersApi {
|
|
|
94
97
|
},
|
|
95
98
|
"products": [
|
|
96
99
|
{
|
|
97
|
-
|
|
98
|
-
|
|
100
|
+
"productId": 1,
|
|
101
|
+
"quantity": 2
|
|
99
102
|
}
|
|
100
103
|
],
|
|
101
104
|
"currency": "USD"
|
|
102
105
|
}
|
|
103
106
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
104
|
-
* @
|
|
107
|
+
* @returns {Promise<IBaseOrdersEntity | IError>} Returns an object with the updated order.
|
|
105
108
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
106
109
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
107
110
|
*/
|
|
108
111
|
updateOrderByMarkerAndId(marker: string, id: number, body: IOrderData, langCode?: string): Promise<IBaseOrdersEntity | IError>;
|
|
109
112
|
}
|
|
110
113
|
/**
|
|
114
|
+
* Interface for the orders storage object.
|
|
111
115
|
* @interface IOrdersByMarkerEntity
|
|
112
|
-
*
|
|
113
116
|
* @property {IOrderByMarkerEntity[]} items - Array of order storage objects. Example:
|
|
114
117
|
[
|
|
115
118
|
{
|
|
@@ -120,9 +123,9 @@ interface IOrdersApi {
|
|
|
120
123
|
"formIdentifier": "orderForm",
|
|
121
124
|
"formData": [
|
|
122
125
|
{
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
"marker": "order_name",
|
|
127
|
+
"value": "Ivan",
|
|
128
|
+
"type": "string"
|
|
126
129
|
}
|
|
127
130
|
],
|
|
128
131
|
"attributeSetIdentifier": "order_form",
|
|
@@ -134,12 +137,12 @@ interface IOrdersApi {
|
|
|
134
137
|
},
|
|
135
138
|
"products": [
|
|
136
139
|
{
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
"id": 2957,
|
|
141
|
+
"title": "Cosmo",
|
|
142
|
+
"sku": null,
|
|
143
|
+
"previewImage": null,
|
|
144
|
+
"price": 150,
|
|
145
|
+
"quantity": 2
|
|
143
146
|
}
|
|
144
147
|
],
|
|
145
148
|
"isCompleted": false
|
|
@@ -154,9 +157,7 @@ interface IOrdersByMarkerEntity {
|
|
|
154
157
|
}
|
|
155
158
|
/**
|
|
156
159
|
* Interface representing a picture entity.
|
|
157
|
-
*
|
|
158
160
|
* @interface IPicture
|
|
159
|
-
*
|
|
160
161
|
* @property {string} filename - The name of the file. Example: "image.jpg".
|
|
161
162
|
* @property {string} downloadLink - The URL link to download the picture. Example: "https://example.com/image.jpg".
|
|
162
163
|
* @property {number} size - The size of the picture in bytes. Example: 102400.
|
|
@@ -170,19 +171,33 @@ interface IPicture {
|
|
|
170
171
|
previewLink: string;
|
|
171
172
|
}
|
|
172
173
|
/**
|
|
174
|
+
* Interface representing a product in an order.
|
|
173
175
|
* @interface IOrderProducts
|
|
174
|
-
*
|
|
175
|
-
* @property {number} productId - Product title. Example: 2957.
|
|
176
|
+
* @property {number} id - Product id. Example: 2957.
|
|
176
177
|
* @property {number} quantity - Product quantity. Example: 1.
|
|
178
|
+
* @property {string} title - Product title. Example: "Cosmo".
|
|
179
|
+
* @property {string | null} sku - Product sku. Example: "SKU".
|
|
180
|
+
* @property {any} previewImage - Product previewImage. Example:
|
|
181
|
+
{
|
|
182
|
+
"filename": "image.jpg",
|
|
183
|
+
"downloadLink": "https://example.com/image.jpg",
|
|
184
|
+
"size": 102400,
|
|
185
|
+
"previewLink": "https://example.com/image-preview.jpg"
|
|
186
|
+
}
|
|
187
|
+
* @property {number} price - Product price. Example: 150.
|
|
177
188
|
* @description Represents a product in an order.
|
|
178
189
|
*/
|
|
179
190
|
interface IOrderProducts {
|
|
180
|
-
|
|
191
|
+
id: number;
|
|
181
192
|
quantity: number;
|
|
193
|
+
title: string;
|
|
194
|
+
sku: string | null;
|
|
195
|
+
previewImage: any;
|
|
196
|
+
price: number;
|
|
182
197
|
}
|
|
183
198
|
/**
|
|
199
|
+
* Interface representing form data for orders.
|
|
184
200
|
* @interface IOrdersFormData
|
|
185
|
-
*
|
|
186
201
|
* @property {string} marker - Marker of form field. Example: "name_1".
|
|
187
202
|
* @property {string} type - Type of value. Example: "string".
|
|
188
203
|
* @property {string} value - Value. Example: "Name".
|
|
@@ -194,8 +209,8 @@ interface IOrdersFormData {
|
|
|
194
209
|
value: any;
|
|
195
210
|
}
|
|
196
211
|
/**
|
|
212
|
+
* Interface representing product data in an order.
|
|
197
213
|
* @interface IOrderProductData
|
|
198
|
-
*
|
|
199
214
|
* @property {number} productId - Product identifier. Example: 1.
|
|
200
215
|
* @property {number} quantity - Quantity of the product. Example: 2.
|
|
201
216
|
* @description Represents a product data in an order.
|
|
@@ -205,8 +220,27 @@ interface IOrderProductData {
|
|
|
205
220
|
quantity: number;
|
|
206
221
|
}
|
|
207
222
|
/**
|
|
223
|
+
* Interface representing product data in an order.
|
|
224
|
+
* @interface IOrderProductsData
|
|
225
|
+
* @property {number} id - Product identifier. Example: 1.
|
|
226
|
+
* @property {any} previewImage - Product preview image.
|
|
227
|
+
* @property {number} price - Product price. Example: 10.
|
|
228
|
+
* @property {number} quantity - Quantity of the product. Example: 2.
|
|
229
|
+
* @property {string} sku - Product SKU. Example: "sku_1".
|
|
230
|
+
* @property {string} title - Product title. Example: "Product 1".
|
|
231
|
+
* @description Represents a product data in an order.
|
|
232
|
+
*/
|
|
233
|
+
interface IOrderProductsData {
|
|
234
|
+
id: number;
|
|
235
|
+
previewImage: any;
|
|
236
|
+
price: number;
|
|
237
|
+
quantity: number;
|
|
238
|
+
sku: string;
|
|
239
|
+
title: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Interface representing an order storage object.
|
|
208
243
|
* @interface IBaseOrdersEntity
|
|
209
|
-
*
|
|
210
244
|
* @property {number} id - Object identifier. Example: 1.
|
|
211
245
|
* @property {string} formIdentifier - Text identifier of the form. Example: "bar-orders-form".
|
|
212
246
|
* @property {string} paymentAccountIdentifier - Text identifier of the order payment. Example: "payment-1".
|
|
@@ -218,7 +252,7 @@ interface IOrderProductData {
|
|
|
218
252
|
"type": "string"
|
|
219
253
|
}
|
|
220
254
|
]
|
|
221
|
-
* @property {
|
|
255
|
+
* @property {IOrderProductsData[]} products - Array of products added to order. Example:
|
|
222
256
|
[
|
|
223
257
|
{
|
|
224
258
|
"id": 2957,
|
|
@@ -230,7 +264,7 @@ interface IOrderProductData {
|
|
|
230
264
|
}
|
|
231
265
|
]
|
|
232
266
|
* @property {string} currency - Currency used to pay for the order. Example: "USD".
|
|
233
|
-
* @property {number} totalSum - Total order amount. Example: "
|
|
267
|
+
* @property {number} totalSum - Total order amount. Example: "150".
|
|
234
268
|
* @property {string} [createdDate] - Order creation date. Example: "2023-10-01T12:00:00Z".
|
|
235
269
|
* @property {string} [statusIdentifier] - Text identifier of order status object (if not set, default status will be assigned). Example: "status-1".
|
|
236
270
|
*/
|
|
@@ -239,15 +273,15 @@ interface IBaseOrdersEntity {
|
|
|
239
273
|
formIdentifier: string;
|
|
240
274
|
paymentAccountIdentifier: string;
|
|
241
275
|
formData: IOrdersFormData[];
|
|
242
|
-
products:
|
|
276
|
+
products: IOrderProductsData[];
|
|
243
277
|
currency: string;
|
|
244
278
|
totalSum: number;
|
|
245
279
|
createdDate?: string;
|
|
246
280
|
statusIdentifier?: string;
|
|
247
281
|
}
|
|
248
282
|
/**
|
|
283
|
+
* Interface representing a response from the order storage.
|
|
249
284
|
* @interface IBaseOrdersEntityResponse
|
|
250
|
-
*
|
|
251
285
|
* @property {IBaseOrdersEntity[]} items - Array of order storage objects. Example:
|
|
252
286
|
[
|
|
253
287
|
{
|
|
@@ -267,8 +301,8 @@ interface IBaseOrdersEntityResponse {
|
|
|
267
301
|
total: string | number;
|
|
268
302
|
}
|
|
269
303
|
/**
|
|
304
|
+
* Interface representing an order storage object.
|
|
270
305
|
* @interface IOrdersEntity
|
|
271
|
-
*
|
|
272
306
|
* @property {number} id - Object identifier. Example: 1.
|
|
273
307
|
* @property {ILocalizeInfo} localizeInfos - Name considering localization. Example:
|
|
274
308
|
{
|
|
@@ -291,8 +325,8 @@ interface IOrdersEntity {
|
|
|
291
325
|
paymentAccountIdentifiers: IPaymentAccountIdentifiers[];
|
|
292
326
|
}
|
|
293
327
|
/**
|
|
328
|
+
* Interface representing an identifier for a payment account used in an order.
|
|
294
329
|
* @interface IPaymentAccountIdentifiers
|
|
295
|
-
*
|
|
296
330
|
* @property {string} identifier - Textual identifier of the payment account. Example: "payment-1".
|
|
297
331
|
* @description Represents an identifier for a payment account used in an order.
|
|
298
332
|
*/
|
|
@@ -300,8 +334,8 @@ interface IPaymentAccountIdentifiers {
|
|
|
300
334
|
identifier: string;
|
|
301
335
|
}
|
|
302
336
|
/**
|
|
337
|
+
* Interface representing the data required to create or update an order in the order storage.
|
|
303
338
|
* @interface IOrderData
|
|
304
|
-
*
|
|
305
339
|
* @property {string} formIdentifier - Text identifier of the form object linked to the order repository. Example: "bar-orders-form".
|
|
306
340
|
* @property {string} paymentAccountIdentifier - Text identifier of the payment object linked to the order repository. Example: "payment-1".
|
|
307
341
|
* @property {IOrdersFormData | IOrdersFormData[]} formData - Form data linked to the order repository. Example:
|
|
@@ -322,8 +356,8 @@ interface IOrderData {
|
|
|
322
356
|
products: IOrderProductData[];
|
|
323
357
|
}
|
|
324
358
|
/**
|
|
359
|
+
* Interface representing an order product data.
|
|
325
360
|
* @interface IOrderByMarkerEntity
|
|
326
|
-
*
|
|
327
361
|
* @property {number} id - Object identifier. Example: 125.
|
|
328
362
|
* @property {number} storageId - Identifier of the order storage object. Example: 1.
|
|
329
363
|
* @property {string} createdDate - Date when the order was created. Example: "2023-10-01T12:00:00Z".
|
|
@@ -342,7 +376,14 @@ interface IOrderData {
|
|
|
342
376
|
* @property {string} currency - Currency used to pay for the order. Example: "USD".
|
|
343
377
|
* @property {string | null} [paymentAccountIdentifier] - Textual identifier for the order payment. Example: "payment-1".
|
|
344
378
|
* @property {Record<string, any>} paymentAccountLocalizeInfos - Payment account name considering localization. Example: { "en_US": "USD Payment", "ru_RU": "Оплата в долларах США" }.
|
|
345
|
-
* @property {IOrderProducts[]} products - Array of products added to order. Example:
|
|
379
|
+
* @property {IOrderProducts[]} products - Array of products added to order. Example:
|
|
380
|
+
[
|
|
381
|
+
{
|
|
382
|
+
"id": 1,
|
|
383
|
+
"name": "Product 1",
|
|
384
|
+
"quantity": 2
|
|
385
|
+
}
|
|
386
|
+
]
|
|
346
387
|
* @property {boolean} isCompleted - Indicates that the order has been completed. Example: true.
|
|
347
388
|
* @description Represents an order storage object created by the user.
|
|
348
389
|
*/
|