oneentry 1.0.159 → 1.0.161
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 +2 -0
- package/changelog.md +56 -1
- package/dist/admins/adminsApi.d.ts +15 -1
- package/dist/admins/adminsApi.js +29 -0
- package/dist/admins/adminsInterfaces.d.ts +37 -1
- package/dist/base/lazySchema.d.ts +15 -0
- package/dist/base/lazySchema.js +20 -0
- package/dist/discounts/discountsApi.d.ts +14 -1
- package/dist/discounts/discountsApi.js +21 -0
- package/dist/discounts/discountsInterfaces.d.ts +27 -1
- package/dist/filters/filtersInterfaces.d.ts +2 -2
- package/dist/filters/filtersSchemas.d.ts +1 -1
- package/dist/filters/filtersSchemas.js +4 -1
- package/dist/forms-data/formsDataApi.d.ts +14 -1
- package/dist/forms-data/formsDataApi.js +21 -0
- package/dist/forms-data/formsDataInterfaces.d.ts +74 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/orders/ordersApi.d.ts +15 -1
- package/dist/orders/ordersApi.js +22 -0
- package/dist/orders/ordersInterfaces.d.ts +27 -1
- package/dist/pages/pagesApi.d.ts +14 -1
- package/dist/pages/pagesApi.js +21 -0
- package/dist/pages/pagesInterfaces.d.ts +38 -1
- package/dist/payments/paymentsInterfaces.d.ts +2 -2
- package/dist/products/productsInterfaces.d.ts +1 -1
- package/dist/search/searchApi.d.ts +35 -0
- package/dist/search/searchApi.js +86 -0
- package/dist/search/searchInterfaces.d.ts +94 -0
- package/dist/search/searchInterfaces.js +2 -0
- package/dist/search/searchSchemas.d.ts +73 -0
- package/dist/search/searchSchemas.js +44 -0
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +0 -2
- package/dist/templates-preview/templatesPreviewSchemas.d.ts +0 -2
- package/dist/templates-preview/templatesPreviewSchemas.js +0 -1
- package/dist/types.d.ts +35 -0
- package/dist/types.js +2 -0
- package/dist/users/usersApi.d.ts +15 -1
- package/dist/users/usersApi.js +22 -0
- package/dist/users/usersInterfaces.d.ts +39 -1
- package/dist/web-socket/lazySocket.d.ts +18 -0
- package/dist/web-socket/lazySocket.js +70 -0
- package/esm/admins/adminsApi.d.ts +66 -0
- package/esm/admins/adminsApi.js +90 -0
- package/esm/admins/adminsInterfaces.d.ts +137 -0
- package/esm/admins/adminsInterfaces.js +1 -0
- package/esm/admins/adminsSchemas.d.ts +48 -0
- package/esm/admins/adminsSchemas.js +31 -0
- package/esm/attribute-sets/attributeSetsApi.d.ts +67 -0
- package/esm/attribute-sets/attributeSetsApi.js +97 -0
- package/esm/attribute-sets/attributeSetsInterfaces.d.ts +285 -0
- package/esm/attribute-sets/attributeSetsInterfaces.js +1 -0
- package/esm/attribute-sets/attributeSetsSchemas.d.ts +84 -0
- package/esm/attribute-sets/attributeSetsSchemas.js +66 -0
- package/esm/auth-provider/authProviderApi.d.ts +262 -0
- package/esm/auth-provider/authProviderApi.js +362 -0
- package/esm/auth-provider/authProviderSchemas.d.ts +124 -0
- package/esm/auth-provider/authProviderSchemas.js +92 -0
- package/esm/auth-provider/authProvidersInterfaces.d.ts +430 -0
- package/esm/auth-provider/authProvidersInterfaces.js +1 -0
- package/esm/base/asyncModules.d.ts +123 -0
- package/esm/base/asyncModules.js +382 -0
- package/esm/base/lazySchema.d.ts +15 -0
- package/esm/base/lazySchema.js +17 -0
- package/esm/base/stateModule.d.ts +35 -0
- package/esm/base/stateModule.js +51 -0
- package/esm/base/syncModules.d.ts +245 -0
- package/esm/base/syncModules.js +555 -0
- package/esm/base/timeIntervals.d.ts +95 -0
- package/esm/base/timeIntervals.js +317 -0
- package/esm/base/utils.d.ts +354 -0
- package/esm/base/utils.js +1 -0
- package/esm/base/validation.d.ts +98 -0
- package/esm/base/validation.js +118 -0
- package/esm/blocks/blocksApi.d.ts +252 -0
- package/esm/blocks/blocksApi.js +394 -0
- package/esm/blocks/blocksInterfaces.d.ts +361 -0
- package/esm/blocks/blocksInterfaces.js +1 -0
- package/esm/blocks/blocksSchemas.d.ts +213 -0
- package/esm/blocks/blocksSchemas.js +40 -0
- package/esm/discounts/discountsApi.d.ts +94 -0
- package/esm/discounts/discountsApi.js +136 -0
- package/esm/discounts/discountsInterfaces.d.ts +293 -0
- package/esm/discounts/discountsInterfaces.js +1 -0
- package/esm/events/eventsApi.d.ts +108 -0
- package/esm/events/eventsApi.js +141 -0
- package/esm/events/eventsInterfaces.d.ts +176 -0
- package/esm/events/eventsInterfaces.js +1 -0
- package/esm/file-uploading/fileUploadingApi.d.ts +91 -0
- package/esm/file-uploading/fileUploadingApi.js +127 -0
- package/esm/file-uploading/fileUploadingInterfaces.d.ts +116 -0
- package/esm/file-uploading/fileUploadingInterfaces.js +1 -0
- package/esm/file-uploading/fileUploadingSchemas.d.ts +24 -0
- package/esm/file-uploading/fileUploadingSchemas.js +19 -0
- package/esm/filters/filtersApi.d.ts +32 -0
- package/esm/filters/filtersApi.js +36 -0
- package/esm/filters/filtersInterfaces.d.ts +56 -0
- package/esm/filters/filtersInterfaces.js +1 -0
- package/esm/filters/filtersSchemas.d.ts +32 -0
- package/esm/filters/filtersSchemas.js +29 -0
- package/esm/forms/formsApi.d.ts +44 -0
- package/esm/forms/formsApi.js +54 -0
- package/esm/forms/formsInterfaces.d.ts +237 -0
- package/esm/forms/formsInterfaces.js +1 -0
- package/esm/forms/formsSchemas.d.ts +56 -0
- package/esm/forms/formsSchemas.js +32 -0
- package/esm/forms-data/formsDataApi.d.ts +124 -0
- package/esm/forms-data/formsDataApi.js +210 -0
- package/esm/forms-data/formsDataInterfaces.d.ts +670 -0
- package/esm/forms-data/formsDataInterfaces.js +1 -0
- package/esm/forms-data/formsDataSchemas.d.ts +107 -0
- package/esm/forms-data/formsDataSchemas.js +83 -0
- package/esm/general-types/generalTypesApi.d.ts +29 -0
- package/esm/general-types/generalTypesApi.js +34 -0
- package/esm/general-types/generalTypesInterfaces.d.ts +29 -0
- package/esm/general-types/generalTypesInterfaces.js +1 -0
- package/esm/general-types/generalTypesSchemas.d.ts +68 -0
- package/esm/general-types/generalTypesSchemas.js +42 -0
- package/esm/index.d.ts +143 -0
- package/esm/index.js +124 -0
- package/esm/integration-collections/integrationCollectionsApi.d.ts +172 -0
- package/esm/integration-collections/integrationCollectionsApi.js +224 -0
- package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +317 -0
- package/esm/integration-collections/integrationCollectionsInterfaces.js +1 -0
- package/esm/integration-collections/integrationCollectionsSchemas.d.ts +84 -0
- package/esm/integration-collections/integrationCollectionsSchemas.js +60 -0
- package/esm/locales/localesApi.d.ts +28 -0
- package/esm/locales/localesApi.js +33 -0
- package/esm/locales/localesInterfaces.d.ts +40 -0
- package/esm/locales/localesInterfaces.js +1 -0
- package/esm/locales/localesSchemas.d.ts +32 -0
- package/esm/locales/localesSchemas.js +23 -0
- package/esm/menus/menusApi.d.ts +30 -0
- package/esm/menus/menusApi.js +35 -0
- package/esm/menus/menusInterfaces.d.ts +87 -0
- package/esm/menus/menusInterfaces.js +2 -0
- package/esm/menus/menusSchemas.d.ts +16 -0
- package/esm/menus/menusSchemas.js +25 -0
- package/esm/orders/ordersApi.d.ts +213 -0
- package/esm/orders/ordersApi.js +288 -0
- package/esm/orders/ordersInterfaces.d.ts +763 -0
- package/esm/orders/ordersInterfaces.js +1 -0
- package/esm/orders/ordersSchemas.d.ts +312 -0
- package/esm/orders/ordersSchemas.js +171 -0
- package/esm/package.json +4 -0
- package/esm/pages/pagesApi.d.ts +173 -0
- package/esm/pages/pagesApi.js +414 -0
- package/esm/pages/pagesInterfaces.d.ts +344 -0
- package/esm/pages/pagesInterfaces.js +1 -0
- package/esm/pages/pagesSchemas.d.ts +121 -0
- package/esm/pages/pagesSchemas.js +60 -0
- package/esm/payments/paymentsApi.d.ts +88 -0
- package/esm/payments/paymentsApi.js +122 -0
- package/esm/payments/paymentsInterfaces.d.ts +189 -0
- package/esm/payments/paymentsInterfaces.js +1 -0
- package/esm/payments/paymentsSchemas.d.ts +94 -0
- package/esm/payments/paymentsSchemas.js +53 -0
- package/esm/product-statuses/productStatusesApi.d.ts +50 -0
- package/esm/product-statuses/productStatusesApi.js +68 -0
- package/esm/product-statuses/productStatusesInterfaces.d.ts +62 -0
- package/esm/product-statuses/productStatusesInterfaces.js +1 -0
- package/esm/product-statuses/productStatusesSchemas.d.ts +34 -0
- package/esm/product-statuses/productStatusesSchemas.js +27 -0
- package/esm/products/productsApi.d.ts +366 -0
- package/esm/products/productsApi.js +468 -0
- package/esm/products/productsInterfaces.d.ts +723 -0
- package/esm/products/productsInterfaces.js +1 -0
- package/esm/products/productsSchemas.d.ts +234 -0
- package/esm/products/productsSchemas.js +121 -0
- package/esm/search/searchApi.d.ts +35 -0
- package/esm/search/searchApi.js +47 -0
- package/esm/search/searchInterfaces.d.ts +94 -0
- package/esm/search/searchInterfaces.js +1 -0
- package/esm/search/searchSchemas.d.ts +73 -0
- package/esm/search/searchSchemas.js +41 -0
- package/esm/sitemap/sitemapApi.d.ts +37 -0
- package/esm/sitemap/sitemapApi.js +41 -0
- package/esm/sitemap/sitemapInterfaces.d.ts +51 -0
- package/esm/sitemap/sitemapInterfaces.js +1 -0
- package/esm/subscriptions/subscriptionsApi.d.ts +74 -0
- package/esm/subscriptions/subscriptionsApi.js +90 -0
- package/esm/subscriptions/subscriptionsInterfaces.d.ts +111 -0
- package/esm/subscriptions/subscriptionsInterfaces.js +1 -0
- package/esm/subscriptions/subscriptionsSchemas.d.ts +46 -0
- package/esm/subscriptions/subscriptionsSchemas.js +38 -0
- package/esm/system/systemApi.d.ts +46 -0
- package/esm/system/systemApi.js +53 -0
- package/esm/system/systemInterfaces.d.ts +29 -0
- package/esm/system/systemInterfaces.js +1 -0
- package/esm/templates/templatesApi.d.ts +53 -0
- package/esm/templates/templatesApi.js +78 -0
- package/esm/templates/templatesInterfaces.d.ts +68 -0
- package/esm/templates/templatesInterfaces.js +1 -0
- package/esm/templates/templatesSchemas.d.ts +48 -0
- package/esm/templates/templatesSchemas.js +28 -0
- package/esm/templates-preview/templatesPreviewApi.d.ts +40 -0
- package/esm/templates-preview/templatesPreviewApi.js +50 -0
- package/esm/templates-preview/templatesPreviewInterfaces.d.ts +129 -0
- package/esm/templates-preview/templatesPreviewInterfaces.js +1 -0
- package/esm/templates-preview/templatesPreviewSchemas.d.ts +79 -0
- package/esm/templates-preview/templatesPreviewSchemas.js +43 -0
- package/esm/types.d.ts +35 -0
- package/esm/types.js +1 -0
- package/esm/user-activity/userActivityApi.d.ts +31 -0
- package/esm/user-activity/userActivityApi.js +37 -0
- package/esm/user-activity/userActivityInterfaces.d.ts +42 -0
- package/esm/user-activity/userActivityInterfaces.js +1 -0
- package/esm/users/usersApi.d.ts +249 -0
- package/esm/users/usersApi.js +312 -0
- package/esm/users/usersInterfaces.d.ts +419 -0
- package/esm/users/usersInterfaces.js +1 -0
- package/esm/users/usersSchemas.d.ts +72 -0
- package/esm/users/usersSchemas.js +55 -0
- package/esm/web-socket/lazySocket.d.ts +18 -0
- package/esm/web-socket/lazySocket.js +67 -0
- package/esm/web-socket/wsApi.d.ts +27 -0
- package/esm/web-socket/wsApi.js +43 -0
- package/esm/web-socket/wsInterfaces.d.ts +16 -0
- package/esm/web-socket/wsInterfaces.js +1 -0
- package/package.json +47 -2
- package/types.d.ts +1 -0
- package/types.js +1 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules.js';
|
|
2
|
+
import type StateModule from '../base/stateModule.js';
|
|
3
|
+
import type { IError } from '../base/utils.js';
|
|
4
|
+
import type { ICollectionEntity, ICollectionFormObject, ICollectionIsValid, ICollectionQuery, ICollectionRow, ICollectionRowsResponce, ICollectionsApi } from './integrationCollectionsInterfaces.js';
|
|
5
|
+
/**
|
|
6
|
+
* Controllers for working with attributes.
|
|
7
|
+
* @handle /api/content/integration-collections
|
|
8
|
+
* @class IntegrationCollectionsApi
|
|
9
|
+
* @augments AsyncModules
|
|
10
|
+
* @implements {ICollectionsApi}
|
|
11
|
+
* @description This class provides methods to interact with integration collections, including retrieving all collections, getting a single collection by ID, and managing collection rows.
|
|
12
|
+
*/
|
|
13
|
+
export default class IntegrationCollectionsApi extends AsyncModules implements ICollectionsApi {
|
|
14
|
+
protected state: StateModule;
|
|
15
|
+
protected _url: string;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
constructor(state: StateModule);
|
|
20
|
+
private _defaultQuery;
|
|
21
|
+
/**
|
|
22
|
+
* Get all collections.
|
|
23
|
+
* @handleName getICollections
|
|
24
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
25
|
+
* @param {object} [userQuery] - Optional set query parameters.
|
|
26
|
+
* @example
|
|
27
|
+
{
|
|
28
|
+
"limit": 0,
|
|
29
|
+
"offset": 30,
|
|
30
|
+
"entityType": "orders",
|
|
31
|
+
"entityId": 1
|
|
32
|
+
}
|
|
33
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 0.
|
|
34
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 30.
|
|
35
|
+
* @param {string} [userQuery.entityType] - Entity type. Example: "orders".
|
|
36
|
+
* @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
|
|
37
|
+
* @returns {Promise<ICollectionEntity[] | IError>} Returns an array of ICollection objects or an error object if there was an issue.
|
|
38
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollections getICollections} documentation.
|
|
39
|
+
*/
|
|
40
|
+
getICollections(langCode?: string, userQuery?: ICollectionQuery): Promise<ICollectionEntity[] | IError>;
|
|
41
|
+
/**
|
|
42
|
+
* Get a single collection object by id.
|
|
43
|
+
* @handleName getICollectionById
|
|
44
|
+
* @param {number} id - Collection id. Example: 1.
|
|
45
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
46
|
+
* @returns {Promise<ICollectionEntity | IError>} Returns an ICollection object or an error object if there was an issue.
|
|
47
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
48
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionById getICollectionById} documentation.
|
|
49
|
+
*/
|
|
50
|
+
getICollectionById(id: number, langCode?: string): Promise<ICollectionEntity | IError>;
|
|
51
|
+
/**
|
|
52
|
+
* Get all records belonging to the collection by collection id.
|
|
53
|
+
* @handleName getICollectionRowsById
|
|
54
|
+
* @param {number} id - Collection id. Example: 1.
|
|
55
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
56
|
+
* @param {any} [userQuery] - Optional set query parameters.
|
|
57
|
+
* @example
|
|
58
|
+
{
|
|
59
|
+
"limit": 0,
|
|
60
|
+
"offset": 30,
|
|
61
|
+
"entityType": "orders",
|
|
62
|
+
"entityId": 1
|
|
63
|
+
}
|
|
64
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 0.
|
|
65
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 30.
|
|
66
|
+
* @param {string} [userQuery.entityType] - Entity type. Example: "orders".
|
|
67
|
+
* @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
|
|
68
|
+
* @returns {Promise<ICollectionRowsResponce | IError>} Returns object ItemsWithTotal, where items is an array of requested objects.
|
|
69
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
70
|
+
* @description Get all records belonging to the collection by collection id.
|
|
71
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsById getICollectionRowsById} documentation.
|
|
72
|
+
*/
|
|
73
|
+
getICollectionRowsById(id: number, langCode?: string, userQuery?: ICollectionQuery): Promise<ICollectionRowsResponce | IError>;
|
|
74
|
+
/**
|
|
75
|
+
* Check for the existence of a text identifier (marker).
|
|
76
|
+
* @handleName validateICollectionMarker
|
|
77
|
+
* @param {string} marker - Collection marker. Example: "collection1".
|
|
78
|
+
* @returns {Promise<ICollectionIsValid | IError>} Returns an object with a boolean property `valid` indicating whether the marker is valid or not.
|
|
79
|
+
* @example
|
|
80
|
+
{
|
|
81
|
+
"valid": true
|
|
82
|
+
}
|
|
83
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
84
|
+
* @description Check for the existence of a text identifier (marker).
|
|
85
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/validateICollectionMarker validateICollectionMarker} documentation.
|
|
86
|
+
*/
|
|
87
|
+
validateICollectionMarker(marker: string): Promise<ICollectionIsValid | IError>;
|
|
88
|
+
/**
|
|
89
|
+
* Getting all records from the collection.
|
|
90
|
+
* @handleName getICollectionRowsByMarker
|
|
91
|
+
* @param {string} marker - Collection text identifier. Example: "collection1".
|
|
92
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
93
|
+
* @returns {Promise<ICollectionRowsResponce | IError>} Returns CollectionRowEntity object.
|
|
94
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
95
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsByMarker getICollectionRowsByMarker} documentation.
|
|
96
|
+
*/
|
|
97
|
+
getICollectionRowsByMarker(marker: string, langCode?: string): Promise<ICollectionRowsResponce | IError>;
|
|
98
|
+
/**
|
|
99
|
+
* Getting one record from the collection.
|
|
100
|
+
* @handleName getICollectionRowByMarkerAndId
|
|
101
|
+
* @param {string} marker - Collection text identifier. Example: "collection1".
|
|
102
|
+
* @param {number} id - Collection record identifier. Example: 1.
|
|
103
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
104
|
+
* @returns {Promise<ICollectionRow | IError>} Returns CollectionRowEntity object.
|
|
105
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
106
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowByMarkerAndId getICollectionRowByMarkerAndId} documentation.
|
|
107
|
+
*/
|
|
108
|
+
getICollectionRowByMarkerAndId(marker: string, id: number, langCode?: string): Promise<ICollectionRow | IError>;
|
|
109
|
+
/**
|
|
110
|
+
* Create a record in the collection.
|
|
111
|
+
* @handleName createICollectionRow
|
|
112
|
+
* @param {string} marker - Collection text identifier. Example: "collection1".
|
|
113
|
+
* @param {ICollectionFormObject} body - Object for creating a record.
|
|
114
|
+
* @example
|
|
115
|
+
{
|
|
116
|
+
"formIdentifier": "collection-form",
|
|
117
|
+
"formData": [
|
|
118
|
+
{
|
|
119
|
+
"marker": "collection_marker",
|
|
120
|
+
"type": "string",
|
|
121
|
+
"value": "Collection marker"
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
126
|
+
* @returns {Promise<ICollectionRow | IError>} Returns object of type ICollectionRow.
|
|
127
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
128
|
+
* @description Create a record in the collection.
|
|
129
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/createICollectionRow createICollectionRow} documentation.
|
|
130
|
+
*/
|
|
131
|
+
createICollectionRow(marker: string, body: ICollectionFormObject, langCode?: string): Promise<ICollectionRow | IError>;
|
|
132
|
+
/**
|
|
133
|
+
* Edit a record in the collection.
|
|
134
|
+
* @handleName updateICollectionRow
|
|
135
|
+
* @param {string} marker - Text identifier of the collection. Example: "collection1".
|
|
136
|
+
* @param {number} id - Row identifier in the collection. Example: 12.
|
|
137
|
+
* @param {object} body - Object for updating a record in the collection.
|
|
138
|
+
* @example
|
|
139
|
+
{
|
|
140
|
+
"formIdentifier": "collection-form",
|
|
141
|
+
"formData": [
|
|
142
|
+
{
|
|
143
|
+
"marker": "collection_marker",
|
|
144
|
+
"type": "string",
|
|
145
|
+
"value": "Collection marker"
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
* @param {string} body.formIdentifier - Textual identifier of the form. Example: "collection-form".
|
|
150
|
+
* @param {any} body.formData - Object with the form data.
|
|
151
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
152
|
+
* @returns {Promise<ICollectionRow | IError>} Returns object of type ICollectionRow.
|
|
153
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
154
|
+
* @description Edit a record in the collection.
|
|
155
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/updateICollectionRow updateICollectionRow} documentation.
|
|
156
|
+
*/
|
|
157
|
+
updateICollectionRow(marker: string, id: number, body: {
|
|
158
|
+
formIdentifier: string;
|
|
159
|
+
formData: any;
|
|
160
|
+
}, langCode?: string): Promise<ICollectionRow | IError>;
|
|
161
|
+
/**
|
|
162
|
+
* Deletion of collection record object
|
|
163
|
+
* @handleName deleteICollectionRowByMarkerAndId
|
|
164
|
+
* @param {string} marker - text identifier of the collection Example: "collection1".
|
|
165
|
+
* @param {number} id - record identifier in the collection Example: 12.
|
|
166
|
+
* @returns {Promise<boolean | IError>} Returns true (in case of successful deletion) or false (in case of unsuccessful deletion) (permission "collections.row.delete" required for access)
|
|
167
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
168
|
+
* @description Deletion of collection record object
|
|
169
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/deleteICollectionRowByMarkerAndId deleteICollectionRowByMarkerAndId} documentation.
|
|
170
|
+
*/
|
|
171
|
+
deleteICollectionRowByMarkerAndId(marker: string, id: number): Promise<boolean | IError>;
|
|
172
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/* eslint-disable jsdoc/reject-any-type */
|
|
2
|
+
import AsyncModules from '../base/asyncModules.js';
|
|
3
|
+
import createSchemaLoader from '../base/lazySchema.js';
|
|
4
|
+
const schema = createSchemaLoader(() => import('./integrationCollectionsSchemas.js'));
|
|
5
|
+
/**
|
|
6
|
+
* Controllers for working with attributes.
|
|
7
|
+
* @handle /api/content/integration-collections
|
|
8
|
+
* @class IntegrationCollectionsApi
|
|
9
|
+
* @augments AsyncModules
|
|
10
|
+
* @implements {ICollectionsApi}
|
|
11
|
+
* @description This class provides methods to interact with integration collections, including retrieving all collections, getting a single collection by ID, and managing collection rows.
|
|
12
|
+
*/
|
|
13
|
+
export default class IntegrationCollectionsApi extends AsyncModules {
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
constructor(state) {
|
|
18
|
+
super(state);
|
|
19
|
+
this._defaultQuery = {
|
|
20
|
+
langCode: 'en_US',
|
|
21
|
+
offset: 0,
|
|
22
|
+
limit: 30,
|
|
23
|
+
};
|
|
24
|
+
this._url = state.url + '/api/content/integration-collections';
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get all collections.
|
|
28
|
+
* @handleName getICollections
|
|
29
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
30
|
+
* @param {object} [userQuery] - Optional set query parameters.
|
|
31
|
+
* @example
|
|
32
|
+
{
|
|
33
|
+
"limit": 0,
|
|
34
|
+
"offset": 30,
|
|
35
|
+
"entityType": "orders",
|
|
36
|
+
"entityId": 1
|
|
37
|
+
}
|
|
38
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 0.
|
|
39
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 30.
|
|
40
|
+
* @param {string} [userQuery.entityType] - Entity type. Example: "orders".
|
|
41
|
+
* @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
|
|
42
|
+
* @returns {Promise<ICollectionEntity[] | IError>} Returns an array of ICollection objects or an error object if there was an issue.
|
|
43
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollections getICollections} documentation.
|
|
44
|
+
*/
|
|
45
|
+
async getICollections(langCode = this.state.lang, userQuery) {
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
const query = { ...this._defaultQuery, ...userQuery, langCode };
|
|
48
|
+
const result = await this._fetchGet(`?` + this._queryParamsToString(query));
|
|
49
|
+
// Validate response if validation is enabled
|
|
50
|
+
const validated = await this._validateResponse(result, schema('CollectionsResponseSchema'));
|
|
51
|
+
return this._normalizeData(validated, langCode);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get a single collection object by id.
|
|
55
|
+
* @handleName getICollectionById
|
|
56
|
+
* @param {number} id - Collection id. Example: 1.
|
|
57
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
58
|
+
* @returns {Promise<ICollectionEntity | IError>} Returns an ICollection object or an error object if there was an issue.
|
|
59
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
60
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionById getICollectionById} documentation.
|
|
61
|
+
*/
|
|
62
|
+
async getICollectionById(id, langCode = this.state.lang) {
|
|
63
|
+
const result = await this._fetchGet(`/${id}?` + this._queryParamsToString({ langCode }));
|
|
64
|
+
// Validate response if validation is enabled
|
|
65
|
+
const validated = await this._validateResponse(result, schema('CollectionEntitySchema'));
|
|
66
|
+
return this._normalizeData(validated, langCode);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get all records belonging to the collection by collection id.
|
|
70
|
+
* @handleName getICollectionRowsById
|
|
71
|
+
* @param {number} id - Collection id. Example: 1.
|
|
72
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
73
|
+
* @param {any} [userQuery] - Optional set query parameters.
|
|
74
|
+
* @example
|
|
75
|
+
{
|
|
76
|
+
"limit": 0,
|
|
77
|
+
"offset": 30,
|
|
78
|
+
"entityType": "orders",
|
|
79
|
+
"entityId": 1
|
|
80
|
+
}
|
|
81
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 0.
|
|
82
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 30.
|
|
83
|
+
* @param {string} [userQuery.entityType] - Entity type. Example: "orders".
|
|
84
|
+
* @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
|
|
85
|
+
* @returns {Promise<ICollectionRowsResponce | IError>} Returns object ItemsWithTotal, where items is an array of requested objects.
|
|
86
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
87
|
+
* @description Get all records belonging to the collection by collection id.
|
|
88
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsById getICollectionRowsById} documentation.
|
|
89
|
+
*/
|
|
90
|
+
async getICollectionRowsById(id, langCode = this.state.lang, userQuery) {
|
|
91
|
+
const result = await this._fetchGet(`/${id}/rows?` +
|
|
92
|
+
this._queryParamsToString({
|
|
93
|
+
...this._defaultQuery,
|
|
94
|
+
...userQuery,
|
|
95
|
+
langCode,
|
|
96
|
+
}));
|
|
97
|
+
// Validate response if validation is enabled
|
|
98
|
+
const validated = await this._validateResponse(result, schema('CollectionRowsResponseSchema'));
|
|
99
|
+
return this._normalizeData(validated, langCode);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Check for the existence of a text identifier (marker).
|
|
103
|
+
* @handleName validateICollectionMarker
|
|
104
|
+
* @param {string} marker - Collection marker. Example: "collection1".
|
|
105
|
+
* @returns {Promise<ICollectionIsValid | IError>} Returns an object with a boolean property `valid` indicating whether the marker is valid or not.
|
|
106
|
+
* @example
|
|
107
|
+
{
|
|
108
|
+
"valid": true
|
|
109
|
+
}
|
|
110
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
111
|
+
* @description Check for the existence of a text identifier (marker).
|
|
112
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/validateICollectionMarker validateICollectionMarker} documentation.
|
|
113
|
+
*/
|
|
114
|
+
async validateICollectionMarker(marker) {
|
|
115
|
+
const result = await this._fetchGet(`/marker-validation/${marker}`);
|
|
116
|
+
// Validate response if validation is enabled
|
|
117
|
+
const validated = await this._validateResponse(result, schema('CollectionIsValidSchema'));
|
|
118
|
+
return this._normalizeData(validated);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Getting all records from the collection.
|
|
122
|
+
* @handleName getICollectionRowsByMarker
|
|
123
|
+
* @param {string} marker - Collection text identifier. Example: "collection1".
|
|
124
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
125
|
+
* @returns {Promise<ICollectionRowsResponce | IError>} Returns CollectionRowEntity object.
|
|
126
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
127
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsByMarker getICollectionRowsByMarker} documentation.
|
|
128
|
+
*/
|
|
129
|
+
async getICollectionRowsByMarker(marker, langCode = this.state.lang) {
|
|
130
|
+
const result = await this._fetchGet(`/marker/${marker}/rows?langCode=${langCode}`);
|
|
131
|
+
// Validate response if validation is enabled
|
|
132
|
+
const validated = await this._validateResponse(result, schema('CollectionRowsResponseSchema'));
|
|
133
|
+
return this._normalizeData(validated, langCode);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Getting one record from the collection.
|
|
137
|
+
* @handleName getICollectionRowByMarkerAndId
|
|
138
|
+
* @param {string} marker - Collection text identifier. Example: "collection1".
|
|
139
|
+
* @param {number} id - Collection record identifier. Example: 1.
|
|
140
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
141
|
+
* @returns {Promise<ICollectionRow | IError>} Returns CollectionRowEntity object.
|
|
142
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
143
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowByMarkerAndId getICollectionRowByMarkerAndId} documentation.
|
|
144
|
+
*/
|
|
145
|
+
async getICollectionRowByMarkerAndId(marker, id, langCode = this.state.lang) {
|
|
146
|
+
const result = await this._fetchGet(`/marker/${marker}/rows/${id}?langCode=${langCode}`);
|
|
147
|
+
// Validate response if validation is enabled
|
|
148
|
+
const validated = await this._validateResponse(result, schema('CollectionRowSchema'));
|
|
149
|
+
return this._normalizeData(validated, langCode);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Create a record in the collection.
|
|
153
|
+
* @handleName createICollectionRow
|
|
154
|
+
* @param {string} marker - Collection text identifier. Example: "collection1".
|
|
155
|
+
* @param {ICollectionFormObject} body - Object for creating a record.
|
|
156
|
+
* @example
|
|
157
|
+
{
|
|
158
|
+
"formIdentifier": "collection-form",
|
|
159
|
+
"formData": [
|
|
160
|
+
{
|
|
161
|
+
"marker": "collection_marker",
|
|
162
|
+
"type": "string",
|
|
163
|
+
"value": "Collection marker"
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
168
|
+
* @returns {Promise<ICollectionRow | IError>} Returns object of type ICollectionRow.
|
|
169
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
170
|
+
* @description Create a record in the collection.
|
|
171
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/createICollectionRow createICollectionRow} documentation.
|
|
172
|
+
*/
|
|
173
|
+
async createICollectionRow(marker, body, langCode = this.state.lang) {
|
|
174
|
+
const response = await this._fetchPost(`/marker/${marker}/rows?langCode=${langCode}`, body);
|
|
175
|
+
// Validate response if validation is enabled
|
|
176
|
+
const validated = await this._validateResponse(response, schema('CollectionRowSchema'));
|
|
177
|
+
return this._normalizeData(validated, langCode);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Edit a record in the collection.
|
|
181
|
+
* @handleName updateICollectionRow
|
|
182
|
+
* @param {string} marker - Text identifier of the collection. Example: "collection1".
|
|
183
|
+
* @param {number} id - Row identifier in the collection. Example: 12.
|
|
184
|
+
* @param {object} body - Object for updating a record in the collection.
|
|
185
|
+
* @example
|
|
186
|
+
{
|
|
187
|
+
"formIdentifier": "collection-form",
|
|
188
|
+
"formData": [
|
|
189
|
+
{
|
|
190
|
+
"marker": "collection_marker",
|
|
191
|
+
"type": "string",
|
|
192
|
+
"value": "Collection marker"
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
* @param {string} body.formIdentifier - Textual identifier of the form. Example: "collection-form".
|
|
197
|
+
* @param {any} body.formData - Object with the form data.
|
|
198
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
199
|
+
* @returns {Promise<ICollectionRow | IError>} Returns object of type ICollectionRow.
|
|
200
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
201
|
+
* @description Edit a record in the collection.
|
|
202
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/updateICollectionRow updateICollectionRow} documentation.
|
|
203
|
+
*/
|
|
204
|
+
async updateICollectionRow(marker, id, body, langCode = this.state.lang) {
|
|
205
|
+
const response = await this._fetchPut(`/marker/${marker}/rows/${id}?` + `langCode=${langCode}`, body);
|
|
206
|
+
// Validate response if validation is enabled
|
|
207
|
+
const validated = await this._validateResponse(response, schema('CollectionRowSchema'));
|
|
208
|
+
return this._normalizeData(validated, langCode);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Deletion of collection record object
|
|
212
|
+
* @handleName deleteICollectionRowByMarkerAndId
|
|
213
|
+
* @param {string} marker - text identifier of the collection Example: "collection1".
|
|
214
|
+
* @param {number} id - record identifier in the collection Example: 12.
|
|
215
|
+
* @returns {Promise<boolean | IError>} Returns true (in case of successful deletion) or false (in case of unsuccessful deletion) (permission "collections.row.delete" required for access)
|
|
216
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
217
|
+
* @description Deletion of collection record object
|
|
218
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/deleteICollectionRowByMarkerAndId deleteICollectionRowByMarkerAndId} documentation.
|
|
219
|
+
*/
|
|
220
|
+
async deleteICollectionRowByMarkerAndId(marker, id) {
|
|
221
|
+
const result = await this._fetchDelete(`/marker/${marker}/rows/${id}`);
|
|
222
|
+
return result;
|
|
223
|
+
}
|
|
224
|
+
}
|