oneentry 1.0.122 → 1.0.124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/admins/adminsApi.d.ts +16 -8
  2. package/dist/admins/adminsApi.js +18 -10
  3. package/dist/admins/adminsInterfaces.d.ts +49 -25
  4. package/dist/attribute-sets/attributeSetsApi.d.ts +43 -21
  5. package/dist/attribute-sets/attributeSetsApi.js +49 -25
  6. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +70 -24
  7. package/dist/auth-provider/authProviderApi.d.ts +94 -83
  8. package/dist/auth-provider/authProviderApi.js +96 -83
  9. package/dist/auth-provider/authProvidersInterfaces.d.ts +188 -10
  10. package/dist/base/asyncModules.d.ts +32 -28
  11. package/dist/base/asyncModules.js +62 -38
  12. package/dist/base/syncModules.d.ts +44 -44
  13. package/dist/base/syncModules.js +65 -63
  14. package/dist/blocks/blocksApi.d.ts +56 -25
  15. package/dist/blocks/blocksApi.js +56 -25
  16. package/dist/blocks/blocksInterfaces.d.ts +71 -22
  17. package/dist/events/eventsApi.d.ts +45 -11
  18. package/dist/events/eventsApi.js +47 -17
  19. package/dist/events/eventsInterfaces.d.ts +44 -2
  20. package/dist/file-uploading/fileUploadingApi.d.ts +44 -24
  21. package/dist/file-uploading/fileUploadingApi.js +46 -27
  22. package/dist/file-uploading/fileUploadingInterfaces.d.ts +63 -14
  23. package/dist/forms/formsApi.d.ts +23 -8
  24. package/dist/forms/formsApi.js +23 -8
  25. package/dist/forms/formsInterfaces.d.ts +62 -15
  26. package/dist/formsData/formsDataApi.d.ts +33 -33
  27. package/dist/formsData/formsDataApi.js +33 -33
  28. package/dist/formsData/formsDataInterfaces.d.ts +123 -35
  29. package/dist/general-types/generalTypesApi.d.ts +12 -1
  30. package/dist/general-types/generalTypesApi.js +12 -1
  31. package/dist/general-types/generalTypesInterfaces.d.ts +18 -5
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.js +1 -1
  34. package/dist/integration-collections/integrationCollectionsApi.d.ts +96 -70
  35. package/dist/integration-collections/integrationCollectionsApi.js +114 -81
  36. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +152 -30
  37. package/dist/locales/localesApi.d.ts +6 -1
  38. package/dist/locales/localesApi.js +6 -1
  39. package/dist/locales/localesInterfaces.d.ts +20 -11
  40. package/dist/menus/menusApi.d.ts +8 -3
  41. package/dist/menus/menusApi.js +8 -3
  42. package/dist/menus/menusInterfaces.d.ts +30 -17
  43. package/dist/orders/ordersApi.d.ts +64 -64
  44. package/dist/orders/ordersApi.js +67 -65
  45. package/dist/orders/ordersInterfaces.d.ts +174 -60
  46. package/dist/pages/pagesApi.d.ts +89 -30
  47. package/dist/pages/pagesApi.js +181 -57
  48. package/dist/pages/pagesInterfaces.d.ts +117 -23
  49. package/dist/payments/paymentsApi.d.ts +56 -22
  50. package/dist/payments/paymentsApi.js +56 -22
  51. package/dist/payments/paymentsInterfaces.d.ts +119 -36
  52. package/dist/product-statuses/productStatusesApi.d.ts +21 -15
  53. package/dist/product-statuses/productStatusesApi.js +21 -18
  54. package/dist/product-statuses/productStatusesInterfaces.d.ts +37 -9
  55. package/dist/products/productsApi.d.ts +137 -157
  56. package/dist/products/productsApi.js +137 -157
  57. package/dist/products/productsInterfaces.d.ts +240 -57
  58. package/dist/system/systemApi.d.ts +29 -10
  59. package/dist/system/systemApi.js +29 -10
  60. package/dist/system/systemInterfaces.d.ts +8 -0
  61. package/dist/templates/templatesApi.d.ts +26 -16
  62. package/dist/templates/templatesApi.js +26 -19
  63. package/dist/templates/templatesInterfaces.d.ts +40 -14
  64. package/dist/templates-preview/templatesPreviewApi.d.ts +18 -14
  65. package/dist/templates-preview/templatesPreviewApi.js +18 -17
  66. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +57 -29
  67. package/dist/users/usersApi.d.ts +37 -33
  68. package/dist/users/usersApi.js +37 -33
  69. package/dist/users/usersInterfaces.d.ts +80 -9
  70. package/dist/web-socket/wsApi.d.ts +6 -3
  71. package/dist/web-socket/wsApi.js +6 -3
  72. package/dist/web-socket/wsInterfaces.d.ts +3 -1
  73. package/package.json +11 -11
@@ -5,8 +5,14 @@ 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 blocks
8
+ * Controllers for working with blocks.
9
+ *
9
10
  * @handle /api/content/blocks
11
+ * @class BlocksApi
12
+ * @extends AsyncModules
13
+ * @implements {IBlocks}
14
+ *
15
+ * @description This class provides methods to interact with blocks.
10
16
  */
11
17
  class BlocksApi extends asyncModules_1.default {
12
18
  constructor(state) {
@@ -16,12 +22,17 @@ class BlocksApi extends asyncModules_1.default {
16
22
  /**
17
23
  * Get blocks by parameters.
18
24
  *
19
- * @param {BlockType} [type] - Available values : product | error_page | catalog_page | product_preview | similar_products_block | product_block | form | common_page | common_block | order | none
20
- * @param {string} [langCode] - Language code. Default "en_US"
21
- * @param {number} [offset] - Parameter for pagination. Default 0
22
- * @param {number} [limit] - Parameter for pagination. Default 30
25
+ * @handleName getBlocks
23
26
  *
24
- * @returns Return array of BlocksEntity object.
27
+ * @param {BlockType} type - Available values : product | error_page | catalog_page | product_preview | similar_products_block | product_block | form | common_page | common_block | order | none. Example: 'product'.
28
+ * @param {string} [langCode] - Language code. Default: "en_US".
29
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
30
+ * @param {number} [limit] - Parameter for pagination. Default: 30.
31
+ *
32
+ * @return {IBlocksResponse} Returns BlocksEntity object.
33
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
34
+ *
35
+ * @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.
25
36
  */
26
37
  async getBlocks(type, langCode = this.state.lang, offset = 0, limit = 30) {
27
38
  const response = await this._fetchGet(`?langCode=${langCode}&type=${type}&offset=${offset}&limit=${limit}`);
@@ -71,12 +82,17 @@ class BlocksApi extends asyncModules_1.default {
71
82
  /**
72
83
  * Get block by marker.
73
84
  *
74
- * @param {string} [marker] - Marker of Block.
75
- * @param {string} [langCode] - Language code. Default "en_US"
76
- * @param {number} [offset] - Parameter for pagination. Default 0
77
- * @param {number} [limit] - Parameter for pagination. Default 30
85
+ * @handleName getBlockByMarker
86
+ *
87
+ * @param {string} marker - Marker of Block. Example: 'product_block'.
88
+ * @param {string} [langCode] - Language code. Default: "en_US".
89
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
90
+ * @param {number} [limit] - Parameter for pagination. Default: 30.
78
91
  *
79
- * @returns Return BlocksEntity object.
92
+ * @return {IBlockEntity} - Returns a BlockEntity object.
93
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
94
+ *
95
+ * @description This method retrieves a block by its marker and includes additional information such as similar products or products associated with the block.
80
96
  */
81
97
  async getBlockByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
82
98
  const response = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
@@ -120,12 +136,17 @@ class BlocksApi extends asyncModules_1.default {
120
136
  /**
121
137
  * Get similar products by block marker.
122
138
  *
123
- * @param {string} [marker] - Block identifier
124
- * @param {string} [langCode] - Language code. Default "en_US"
125
- * @param {number} [offset] - Parameter for pagination. Default 0
126
- * @param {number} [limit] - Parameter for pagination. Default 30
139
+ * @handleName getSimilarProducts
140
+ *
141
+ * @param {string} marker - Block identifier. Example: 'similar_products_block'.
142
+ * @param {string} [langCode] - Language code. Default: "en_US".
143
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
144
+ * @param {number} [limit] - Parameter for pagination. Default: 30.
127
145
  *
128
- * @returns Return IProductsResponse with total and items array of BlocksEntity object.
146
+ * @return {IProductsResponse} - Returns the total count and an array of product items in object by specified block marker.
147
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
148
+ *
149
+ * @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.
129
150
  */
130
151
  async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30) {
131
152
  const query = {
@@ -139,12 +160,17 @@ class BlocksApi extends asyncModules_1.default {
139
160
  /**
140
161
  * Get products by block marker.
141
162
  *
142
- * @param {string} [marker] - Block identifier
143
- * @param {string} [langCode] - Language code. Default "en_US"
144
- * @param {number} [offset] - Parameter for pagination. Default 0
145
- * @param {number} [limit] - Parameter for pagination. Default 30
163
+ * @handleName getProductsByBlockMarker
164
+ *
165
+ * @param {string} marker - Block identifier. Example: 'product_block'.
166
+ * @param {string} [langCode] - Language code. Default: "en_US".
167
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
168
+ * @param {number} [limit] - Parameter for pagination. Default: 30.
169
+ *
170
+ * @return {IProductsEntity[]} Return array of BlocksEntity object.
171
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
146
172
  *
147
- * @returns Return array of BlocksEntity object.
173
+ * @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.
148
174
  */
149
175
  async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
150
176
  const query = {
@@ -156,12 +182,17 @@ class BlocksApi extends asyncModules_1.default {
156
182
  return this._normalizeData(result.items);
157
183
  }
158
184
  /**
159
- * Quick search for block objects with limited output
185
+ * Quick search for block objects with limited output.
186
+ *
187
+ * @handleName searchBlock
188
+ *
189
+ * @param {string} name - Search string. Example: 'product_block'.
190
+ * @param {string} [langCode] - Language code. Default: "en_US".
160
191
  *
161
- * @param {string} [name] - Search string
162
- * @param {string} [langCode] - Language code. Default "en_US"
192
+ * @return {ISearchBlock[]} Returns an array of ISearchBlock objects.
193
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
163
194
  *
164
- * @returns Return array of BlocksEntity object.
195
+ * @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.
165
196
  */
166
197
  async searchBlock(name, langCode = this.state.lang) {
167
198
  const result = await this._fetchGet(`/quick/search?langCode=${langCode}&name=${name}`);
@@ -1,45 +1,88 @@
1
1
  import type { AttributeType, IError, ILocalizeInfo } from '../base/utils';
2
2
  import type { IProductsEntity, IProductsResponse } from '../products/productsInterfaces';
3
3
  /**
4
- * Represents a interface object of Blocks Api.
4
+ * Interface for managing and retrieving blocks in the system.
5
+ *
6
+ * @interface IBlocks
5
7
  *
6
8
  * @property {function} getBlocks - Get all Blocks objects.
7
9
  * @property {function} getBlockByMarker - Get Block object by marker.
8
10
  * @property {function} getSimilarProducts - Get Array of similar products from product-similar block.
9
11
  * @property {function} getProductsByBlockMarker - Get Array of products from product block.
10
12
  * @property {function} searchBlock - Quick search for block objects with limited output.
13
+ *
14
+ * @description This interface defines methods for retrieving and managing blocks in the system.
11
15
  */
12
16
  interface IBlocks {
17
+ /**
18
+ * Retrieves all block objects of a specific type.
19
+ *
20
+ * @param {BlockType} type - The type of blocks to retrieve. Example: 'product'.
21
+ * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
22
+ * @param {number} [offset] - Optional offset for pagination. Default: 0.
23
+ * @param {number} [limit] - Optional limit for pagination. Default: 30.
24
+ *
25
+ * @return {IBlocksResponse} A promise that resolves to a blocks response or an error.
26
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
27
+ */
13
28
  getBlocks(type: BlockType, langCode?: string, offset?: number, limit?: number): Promise<IBlocksResponse | IError>;
29
+ /**
30
+ * Retrieves a block object by its marker.
31
+ *
32
+ * @param {string} marker - The marker identifying the block. Example: 'product_block'.
33
+ * @param {string} langCode - Language code for localization. Default: "en_US".
34
+ * @param {number} [offset] - Optional offset for pagination. Default: 0.
35
+ * @param {number} [limit] - Optional limit for pagination. Default: 30.
36
+ *
37
+ * @return {IBlockEntity} A promise that resolves to a block entity or an error.
38
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
39
+ */
14
40
  getBlockByMarker(marker: string, langCode: string, offset?: number, limit?: number): Promise<IBlockEntity | IError>;
41
+ /**
42
+ * Performs a quick search for block objects with limited output.
43
+ *
44
+ * @param {string} name - The name to search for. Example: 'product_block'.
45
+ * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
46
+ *
47
+ * @return {ISearchBlock[]} A promise that resolves to an array of search blocks or an error.
48
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
49
+ */
15
50
  searchBlock(name: string, langCode?: string): Promise<Array<ISearchBlock> | IError>;
16
51
  }
17
52
  /**
18
- * IBlocksResponse
53
+ * Represents a response from the blocks API.
54
+ *
55
+ * @interface IBlocksResponse
56
+ *
57
+ * @property {number} total - Total number of found records. Example: 100.
58
+ * @property {Array<IBlockEntity>} items - Array of block entities. Example: .
19
59
  *
20
- * @property {number} total -
21
- * @property {Array<IBlockEntity>} items -
60
+ * @description Represents a response from the blocks API containing a total count and an array of block entities.
22
61
  */
23
62
  interface IBlocksResponse {
24
63
  total: number;
25
64
  items: Array<IBlockEntity>;
26
65
  }
27
66
  /**
28
- * IBlockEntity
67
+ * Represents a block entity with various attributes and properties.
29
68
  *
30
- * @property {AttributeType} attributeValues -
31
- * @property {number} id -
32
- * @property {string} identifier -
33
- * @property {boolean} isVisible -
34
- * @property {ILocalizeInfo} localizeInfos -
35
- * @property {number} position -
36
- * @property {string | null} templateIdentifier -
37
- * @property {string} type -
38
- * @property {number} version -
39
- * @property {number} countElementsPerRow -
40
- * @property {number} quantity -
41
- * @property {IProductsResponse} similarProducts -
42
- * @property {Array<IProductsEntity>} products -
69
+ * @interface IBlockEntity
70
+ *
71
+ * @property {AttributeType} attributeValues - Type of attributes used in the block.
72
+ * @property {number} id - Unique identifier of the block. Example: 1234.
73
+ * @property {string} identifier - Unique string identifier for the block. Example: 'block1'.
74
+ * @property {boolean} isVisible - Indicates whether the block is visible. Example: true.
75
+ * @property {ILocalizeInfo} localizeInfos - Localization information for the block. Example: .
76
+ * @property {number} position - Position of the block in a list or layout. Example: 1.
77
+ * @property {string | null} templateIdentifier - Identifier for the template used by the block, or null if not applicable. Example: 'template1' or null.
78
+ * @property {string} type - Type of the block, such as 'product', 'error_page', etc. Example: 'product'.
79
+ * @property {number} version - Version of the block entity. Example: 1.
80
+ * @property {number} [countElementsPerRow] - Number of elements displayed per row in the block, if applicable. Example: 3.
81
+ * @property {number} [quantity] - Quantity of items in the block, if applicable. Example: 5.
82
+ * @property {IProductsResponse} [similarProducts] - Response containing similar products associated with the block. Example: { total: 10, items: [...] }.
83
+ * @property {Array<IProductsEntity>} [products] - Array of product entities associated with the block. Example: [{ id: 1, name: 'Product 1', ... }, { id: 2, name: 'Product 2', ... }].
84
+ *
85
+ * @description Represents a block entity with various attributes and properties.
43
86
  */
44
87
  interface IBlockEntity {
45
88
  attributeValues: AttributeType;
@@ -57,11 +100,15 @@ interface IBlockEntity {
57
100
  products?: Array<IProductsEntity>;
58
101
  }
59
102
  /**
60
- * ISearchBlock
103
+ * Represents a search block entity with an identifier, name, and ID.
104
+ *
105
+ * @interface ISearchBlock
106
+ *
107
+ * @property {number} id - Unique identifier of the search block. Example: 1.
108
+ * @property {string} name - Name of the search block. Example: 'Search Block 1'.
109
+ * @property {string} identifier - Unique string identifier for the search block. Example: 'search_block_1'.
61
110
  *
62
- * @property {number} id -
63
- * @property {string} name -
64
- * @property {string} identifier -
111
+ * @description Represents a search block entity with an identifier, name, and ID.
65
112
  */
66
113
  interface ISearchBlock {
67
114
  id: number;
@@ -70,6 +117,8 @@ interface ISearchBlock {
70
117
  }
71
118
  /**
72
119
  * BlockType
120
+ * @type {BlockType}
121
+ * @description This type defines the possible values for block types used in the system.
73
122
  */
74
123
  type BlockType = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'similar_products_block' | 'product_block' | 'form' | 'common_page' | 'common_block' | 'order' | 'service' | 'none';
75
124
  export type { BlockType, IBlockEntity, IBlocks, IBlocksResponse, ISearchBlock };
@@ -5,37 +5,71 @@ import type { IEvents } from './eventsInterfaces';
5
5
  import type { ISubscriptions } from './eventsInterfaces';
6
6
  /**
7
7
  * Controllers for working with events
8
+ *
8
9
  * @handle /api/content/events
10
+ * @class EventsApi
11
+ * @extends AsyncModules
12
+ * @implements {IEvents}
13
+ *
14
+ * @description This class provides methods to interact with events, including subscribing and unsubscribing to product events, and retrieving all subscriptions.
9
15
  */
10
16
  export default class EventsApi extends AsyncModules implements IEvents {
11
17
  protected state: StateModule;
12
18
  protected _url: string;
19
+ /**
20
+ * Initializes the EventsApi with the provided state module.
21
+ *
22
+ * @constructor
23
+ * @class - EventsApi
24
+ * @extends - AsyncModules
25
+ * @implements {IEvents}
26
+ *
27
+ * @param {StateModule} state - The state module containing the base URL and other configurations.
28
+ *
29
+ * @description Initializes the EventsApi with the provided state module.
30
+ */
13
31
  constructor(state: StateModule);
14
32
  /**
15
33
  * Return all subscriptions to product.
16
34
  *
17
- * @param {number} [offset] - Pagination parameter, default is 0
18
- * @param {number} [limit] - Pagination parameter, default is 30
35
+ * @handleName getAllSubscriptions
36
+ *
37
+ * @return {ISubscriptions} Returns an object containing all subscriptions or an error object if there was an issue.
38
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
39
+ *
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.
19
41
  */
20
- getAllSubscriptions(offset?: number, limit?: number): Promise<ISubscriptions | IError>;
42
+ getAllSubscriptions(): Promise<ISubscriptions | IError>;
21
43
  /**
22
44
  * Subscribing to an event on a product.
23
45
  *
46
+ * @handleName subscribeByMarker
47
+ *
48
+ * @param {string} marker - Event marker. Example: 'product_price_change'.
49
+ * @param {string} productId - Product id. Example: 12345.
50
+ * @param {string} [langCode] - Language code. Default: "en_US".
51
+ * @param {number} [threshold] - Threshold value for comparing numerical value. Default is 0.
52
+ *
53
+ * @return {any} Returns a promise that resolves to the result of the subscription operation or an error object if there was an issue.
54
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
55
+ *
24
56
  * @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.
25
- * @param {string} [marker] - Event marker.
26
- * @param {string} [productId] - Product id.
27
- * @param {string} [langCode] - Language code.
28
- * @param {number} [threshold] - Threshold value for comparing numerical value.
29
57
  */
30
58
  subscribeByMarker(marker: string, productId: number, langCode?: string, threshold?: number): Promise<any | IError>;
31
59
  /**
32
60
  * Unsubscribing to an event on a product.
33
61
  *
62
+ * @handleName unsubscribeByMarker
63
+ *
64
+ * @param {string} marker - The marker of the event to unsubscribe from. Example: 'product_price_change'.
65
+ * @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
66
+ * @param {string} [langCode] - Language code. Default: "en_US".
67
+ * @param {number} [threshold] - The threshold value for comparing numerical values. Default: 0.
68
+ *
69
+ * @return {any} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
70
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
71
+ *
34
72
  * @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.
35
- * @param {string} [marker] - Event marker.
36
- * @param {string} [productId] - Product id.
37
- * @param {number} [langCode] - Language code.
38
- * @param {number} [threshold] - Threshold value for comparing numerical value.
39
73
  */
40
74
  unsubscribeByMarker(marker: string, productId: number, langCode?: string, threshold?: number): Promise<any | IError>;
41
75
  }
@@ -3,14 +3,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- /* eslint-disable @typescript-eslint/no-unused-vars */
7
- /* eslint-disable @typescript-eslint/no-explicit-any */
8
6
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
9
7
  /**
10
8
  * Controllers for working with events
9
+ *
11
10
  * @handle /api/content/events
11
+ * @class EventsApi
12
+ * @extends AsyncModules
13
+ * @implements {IEvents}
14
+ *
15
+ * @description This class provides methods to interact with events, including subscribing and unsubscribing to product events, and retrieving all subscriptions.
12
16
  */
13
17
  class EventsApi extends asyncModules_1.default {
18
+ /**
19
+ * Initializes the EventsApi with the provided state module.
20
+ *
21
+ * @constructor
22
+ * @class - EventsApi
23
+ * @extends - AsyncModules
24
+ * @implements {IEvents}
25
+ *
26
+ * @param {StateModule} state - The state module containing the base URL and other configurations.
27
+ *
28
+ * @description Initializes the EventsApi with the provided state module.
29
+ */
14
30
  constructor(state) {
15
31
  super(state);
16
32
  this._url = state.url + '/api/content/events';
@@ -18,27 +34,34 @@ class EventsApi extends asyncModules_1.default {
18
34
  /**
19
35
  * Return all subscriptions to product.
20
36
  *
21
- * @param {number} [offset] - Pagination parameter, default is 0
22
- * @param {number} [limit] - Pagination parameter, default is 30
37
+ * @handleName getAllSubscriptions
38
+ *
39
+ * @return {ISubscriptions} Returns an object containing all subscriptions or an error object if there was an issue.
40
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
41
+ *
42
+ * @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.
23
43
  */
24
- async getAllSubscriptions(offset = 0, limit = 30) {
25
- const query = {
26
- offset,
27
- limit,
28
- };
44
+ async getAllSubscriptions() {
29
45
  const result = await this._fetchGet(`/subscriptions`);
30
46
  return result;
31
47
  }
32
48
  /**
33
49
  * Subscribing to an event on a product.
34
50
  *
51
+ * @handleName subscribeByMarker
52
+ *
53
+ * @param {string} marker - Event marker. Example: 'product_price_change'.
54
+ * @param {string} productId - Product id. Example: 12345.
55
+ * @param {string} [langCode] - Language code. Default: "en_US".
56
+ * @param {number} [threshold] - Threshold value for comparing numerical value. Default is 0.
57
+ *
58
+ * @return {any} Returns a promise that resolves to the result of the subscription operation or an error object if there was an issue.
59
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
60
+ *
35
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.
36
- * @param {string} [marker] - Event marker.
37
- * @param {string} [productId] - Product id.
38
- * @param {string} [langCode] - Language code.
39
- * @param {number} [threshold] - Threshold value for comparing numerical value.
40
62
  */
41
63
  async subscribeByMarker(marker, productId, langCode = this.state.lang, threshold = 0) {
64
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
65
  const data = {
43
66
  locale: langCode,
44
67
  productId,
@@ -52,13 +75,20 @@ class EventsApi extends asyncModules_1.default {
52
75
  /**
53
76
  * Unsubscribing to an event on a product.
54
77
  *
78
+ * @handleName unsubscribeByMarker
79
+ *
80
+ * @param {string} marker - The marker of the event to unsubscribe from. Example: 'product_price_change'.
81
+ * @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
82
+ * @param {string} [langCode] - Language code. Default: "en_US".
83
+ * @param {number} [threshold] - The threshold value for comparing numerical values. Default: 0.
84
+ *
85
+ * @return {any} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
86
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
87
+ *
55
88
  * @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.
56
- * @param {string} [marker] - Event marker.
57
- * @param {string} [productId] - Product id.
58
- * @param {number} [langCode] - Language code.
59
- * @param {number} [threshold] - Threshold value for comparing numerical value.
60
89
  */
61
90
  async unsubscribeByMarker(marker, productId, langCode = this.state.lang, threshold = 0) {
91
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
92
  const data = {
63
93
  locale: langCode,
64
94
  productId: productId,
@@ -1,18 +1,60 @@
1
1
  import type { IError } from '../base/utils';
2
2
  /**
3
- * Represents a interface object of Events Api.
3
+ * Interface for managing event subscriptions related to products.
4
+ *
5
+ * @interface IEvents
4
6
  *
5
7
  * @property {function} getAllSubscriptions - Return all subscriptions to product.
6
8
  * @property {function} subscribeByMarker - Subscribing to an event on a product.
7
9
  * @property {function} unsubscribeByMarker - Unsubscribing to an event on a product.
10
+ *
11
+ * @description This interface defines methods for managing event subscriptions related to products.
8
12
  */
9
13
  interface IEvents {
14
+ /**
15
+ * Retrieves all subscriptions to products.
16
+ *
17
+ * @param {number} [limit] - Optional limit for pagination. Default is 30.
18
+ * @param {number} [offset] - Optional offset for pagination. Default is 0.
19
+ *
20
+ * @return {ISubscriptions} A promise that resolves to a subscriptions object or an error.
21
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
22
+ */
10
23
  getAllSubscriptions(limit?: number, offset?: number): Promise<ISubscriptions | IError>;
24
+ /**
25
+ * Subscribes to an event on a product by its marker.
26
+ *
27
+ * @param {string} marker - The marker identifying the event. Example: 'product_price_change'.
28
+ * @param {number} productId - The ID of the product to subscribe to. Example: 12345.
29
+ * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
30
+ * @param {number} [threshold] - Optional threshold value for the subscription. Default: 0.
31
+ *
32
+ * @return {any} A promise that resolves to any type or an error.
33
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
34
+ */
11
35
  subscribeByMarker(marker: string, productId: number, langCode?: string, threshold?: number): Promise<any | IError>;
36
+ /**
37
+ * Unsubscribes from an event on a product by its marker.
38
+ *
39
+ * @param {string} marker - The marker identifying the event. Example: 'product_price_change'.
40
+ * @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
41
+ * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
42
+ * @param {number} [threshold] - Optional threshold value for the unsubscription. Default: 0.
43
+ *
44
+ * @returns {any} A promise that resolves to any type or an error.
45
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
46
+ */
12
47
  unsubscribeByMarker(marker: string, productId: number, langCode?: string, threshold?: number): Promise<any | IError>;
13
48
  }
14
49
  /**
15
- * ISubscriptions
50
+ * Represents a response from the events API containing a total count and an array of subscription items.
51
+ *
52
+ * @interface ISubscriptions
53
+ *
54
+ * @property {number} total - Total number of found records. Example: 100.
55
+ * @property {Array<{ eventMarker: string; productId: number }>} items - Array of subscription items, each containing an event marker and a product ID. Example: [{ eventMarker: 'product_price_change', productId: 12345 }, { eventMarker: 'product_stock_update', productId: 67890 }].
56
+ *
57
+ * @description Represents a response from the events API containing a total count and an array of subscription items.
16
58
  */
17
59
  interface ISubscriptions {
18
60
  total: number;
@@ -4,6 +4,13 @@ import type { IError } from '../base/utils';
4
4
  import type { IFileUploading, IUploadingQuery, IUploadingReturns } from './fileUploadingInterfaces';
5
5
  /**
6
6
  * Controllers for working with file uploading
7
+ *
8
+ * @handle /api/content/files
9
+ * @class FileUploadingApi
10
+ * @extends AsyncModules
11
+ * @implements {IFileUploading}
12
+ *
13
+ * @description This class provides methods to upload and delete files in a cloud file storage, as well as retrieve files by parameters.
7
14
  */
8
15
  export default class FileUploadingApi extends AsyncModules implements IFileUploading {
9
16
  protected state: StateModule;
@@ -13,45 +20,58 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
13
20
  /**
14
21
  * Upload file function.
15
22
  *
16
- * @param {File} [data] File objects. Get data as File from your unput as e.target.files[0]
23
+ * @handleName upload
17
24
  *
18
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
19
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page"
20
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor"
21
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787
22
- * @param {number} [fileQuery.width] - Optional width parameter. Example: 0
23
- * @param {number} [fileQuery.height] - Optional height parameter. Example: 0
24
- * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true
25
- * @param {boolean} [fileQuery.template] - preview template identifier. Example: 1
25
+ * @param {File | Blob} file - File to upload. Example: new File(["content"], "file.png", { type: "image/png" }).
26
+ * @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example: { type: 'page', entity: 'editor', id: 3787, width: 0, height: 0, compress: true, template: 1 }.
26
27
  *
27
- * @returns Uploads a file to an Amazon S3-compatible cloud file storage
28
+ * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
29
+ * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
30
+ * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
31
+ * @param {number} [fileQuery.width] - Optional width parameter. Example: 0.
32
+ * @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
33
+ * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
34
+ * @param {boolean} [fileQuery.template] - preview template identifier. Example: 1.
35
+ *
36
+ * @return {IUploadingReturns} Uploads a file to an Amazon S3-compatible cloud file storage.
37
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
38
+ *
39
+ * @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.
28
40
  */
29
41
  upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturns | IError>;
30
42
  /**
31
43
  * Deletes a file from the cloud file storage.
32
44
  *
33
- * @param {string} [filename] File name. Example "file.png"
45
+ * @handleName delete
34
46
  *
35
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
36
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page"
37
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor"
38
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787
39
- * @param {number} [fileQuery.template] - preview template identifier. Example: 1
47
+ * @param {string} [filename] - File name. Example: "file.png".
48
+ * @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example: { type: 'page', entity: 'editor', id: 3787, template: 1 }.
49
+ * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
50
+ * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
51
+ * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
52
+ * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
40
53
  *
41
- * @returns Deletes a file from the cloud file storage
54
+ * @return {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
55
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
56
+ *
57
+ * @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.
42
58
  */
43
59
  delete(filename: string, fileQuery?: IUploadingQuery): Promise<any | IError>;
44
60
  /**
45
61
  * Get file by parameters.
46
62
  *
47
- * @param {number} [id] - Object identifier, from which the file is uploaded, determines the folder name in the storage
63
+ * @handleName getFile
64
+ *
65
+ * @param {number} [id] - Object identifier, from which the file is uploaded, determines the folder name in the storage. Example: 3787.
66
+ * @param {string} [type] - Type, determines the folder name in the storage. Example: "page".
67
+ * @param {string} [entity] - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
68
+ * @param {string} [filename] - Filename. Example: "file.png".
69
+ * @param {string} [template] - Preview template identifier. Example: 1.
48
70
  *
49
- * @param {string} [type] - Type, determines the folder name in the storage
50
- * @param {string} [entity] - entity name, from which the file is uploaded, determines the folder name in the storage
51
- * @param {string} [filename] - Filename. Example "file.png"
52
- * @param {string} [template] - preview template identifier. Example 1
71
+ * @return {any} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
72
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
53
73
  *
54
- * @returns Return file as File object
74
+ * @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.
55
75
  */
56
- getFile(id: number, type: string, entity: string, filename?: string, template?: string): Promise<Blob | IError>;
76
+ getFile(id: number, type: string, entity: string, filename: string, template?: string): Promise<any | IError>;
57
77
  }