idosell 0.4.25 → 0.4.30

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/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import ENUMS from "./enums.js";
2
2
  import utils from "./utils.js";
3
3
  import { gateProxy } from "./gates.js";
4
4
  import { IdosellFaultStringError, catchEmptyList } from "./errors.js";
5
- export const DEFAULT_VERSION = 7;
5
+ export const DEFAULT_VERSION = 8;
6
6
  function normalizeUrl(input = "") {
7
7
  if (!input.length)
8
8
  return "";
@@ -0,0 +1,5 @@
1
+ import { paramsProxy } from "../params.js";
2
+ export default (object) => {
3
+ object.gate = { method: 'get', node: '/products/attachments/getContent' };
4
+ return new Proxy(object, paramsProxy);
5
+ };
@@ -1,5 +1,6 @@
1
1
  import { paramsProxy } from "../params.js";
2
2
  export default (object) => {
3
3
  object.gate = { method: 'get', node: '/products/marketing/promotion' };
4
+ object.auth.version = 7;
4
5
  return new Proxy(object, paramsProxy);
5
6
  };
@@ -0,0 +1,5 @@
1
+ import { paramsProxy } from "../params.js";
2
+ export default (object) => {
3
+ object.gate = { method: 'get', node: '/regulations/history' };
4
+ return new Proxy(object, paramsProxy);
5
+ };
@@ -1,6 +1,7 @@
1
1
  import { paramsProxy } from "../params.js";
2
2
  export default (object) => {
3
3
  object.gate = { method: 'post', node: '/products/marketing/promotion' };
4
+ object.auth.version = 7;
4
5
  object.appendable = {
5
6
  except: ["promotionName", "shopsIds", "marketingZones", "newPriceSettings", "startDate", "endDate", "changeProductsToVisibleWhileStarting", "removeProductsAfterStockLevelRunsDown", "reduceBasingPrice", "calculationMethod"],
6
7
  arrayNode: "promotionElements",
@@ -2,6 +2,7 @@ import { paramsProxy } from "../params.js";
2
2
  export default (object) => {
3
3
  object.gate = { method: 'post', node: '/promotions/promotions/add' };
4
4
  object.rootparams = "request";
5
+ object.req = ["activeInShops", "newPriceValue", "name"];
5
6
  object.arrays = ["activeInShops", "types"];
6
7
  return new Proxy(object, paramsProxy);
7
8
  };
@@ -1,6 +1,12 @@
1
1
  import { paramsProxy } from "../params.js";
2
2
  export default (object) => {
3
3
  object.gate = { method: 'put', node: '/clients/externalCode' };
4
+ object.appendable = {
5
+ except: [],
6
+ arrayNode: "clients",
7
+ index: 0
8
+ };
4
9
  object.req = [{ "any": ["client_id", "client_login"] }];
10
+ object.arrays = ["clients"];
5
11
  return new Proxy(object, paramsProxy);
6
12
  };
@@ -1,6 +1,7 @@
1
1
  import { paramsProxy } from "../params.js";
2
2
  export default (object) => {
3
3
  object.gate = { method: 'put', node: '/products/marketing/promotion' };
4
+ object.auth.version = 7;
4
5
  object.appendable = {
5
6
  except: ["promotionId", "promotionName", "shopsIds", "marketingZones", "newPriceSettings", "startDate", "endDate", "changeProductsToVisibleWhileStarting", "removeProductsAfterStockLevelRunsDown", "reduceBasingPrice", "calculationMethod", "removeAllPromotionElements"],
6
7
  arrayNode: "promotionElements",
@@ -325,50 +325,6 @@ export type PostProductsParams = {
325
325
  productPictures?: string[];
326
326
  /** @description List of photos descriptions */
327
327
  productDescriptionPictures?: string[];
328
- /** @description Reduced price */
329
- productPromotion?: {
330
- /** @description Object determines if the promotion should be active.. Allowed values "y" - active promotion, "n" - inactive promotion. */
331
- promoteInEnabled?: string;
332
- /** @description Strikethrough price */
333
- promoteItemNormalPrice?: number;
334
- /** @description Strikethrough wholesale price */
335
- promoteItemWholesaleNormalPrice?: number;
336
- /** @description Switching off date */
337
- promoteItemEndingDate?: string;
338
- };
339
- /** @description Discount for shop. */
340
- productDiscount?: {
341
- /** @description Object determines if the promotion should be active.. Allowed values "y" - active promotion, "n" - inactive promotion. */
342
- promoteInEnabled?: string;
343
- /** @description Strikethrough price */
344
- promoteItemNormalPrice?: number;
345
- /** @description Strikethrough wholesale price */
346
- promoteItemWholesaleNormalPrice?: number;
347
- /** @description Switching off date */
348
- promoteItemEndingDate?: string;
349
- };
350
- /** @description Distinguished product in store. */
351
- productDistinguished?: {
352
- /** @description Object determines if the promotion should be active.. Allowed values "y" - active promotion, "n" - inactive promotion. */
353
- promoteInEnabled?: string;
354
- /** @description Strikethrough price */
355
- promoteItemNormalPrice?: number;
356
- /** @description Strikethrough wholesale price */
357
- promoteItemWholesaleNormalPrice?: number;
358
- /** @description Switching off date */
359
- promoteItemEndingDate?: string;
360
- };
361
- /** @description Special product in store. */
362
- productSpecial?: {
363
- /** @description Object determines if the promotion should be active.. Allowed values "y" - active promotion, "n" - inactive promotion. */
364
- promoteInEnabled?: string;
365
- /** @description Strikethrough price */
366
- promoteItemNormalPrice?: number;
367
- /** @description Strikethrough wholesale price */
368
- promoteItemWholesaleNormalPrice?: number;
369
- /** @description Switching off date */
370
- promoteItemEndingDate?: string;
371
- };
372
328
  /** @description Parameters (distinguished). */
373
329
  productParametersDistinction?: {
374
330
  /** @description Parameter ID */
@@ -1094,66 +1050,6 @@ export type PutProductsParams = {
1094
1050
  /** @description A picture in url or base64 (depends on pictures_input_type). */
1095
1051
  productPictureSource?: string;
1096
1052
  }[];
1097
- /** @description Reduced price */
1098
- productPromotion?: {
1099
- /** @description Is attribute set */
1100
- promoteIsEnabled?: string;
1101
- /** @description Strikethrough price */
1102
- promoteItemNormalPrice?: number;
1103
- /** @description Net strikethrough price. */
1104
- promoteItemNormalPriceNet?: number;
1105
- /** @description Strikethrough wholesale price */
1106
- promoteItemWholesaleNormalPrice?: number;
1107
- /** @description Net wholesale strikethrough price. */
1108
- promoteItemWholesaleNormalPriceNet?: number;
1109
- /** @description Switching off date */
1110
- promoteItemEndingDate?: string;
1111
- };
1112
- /** @description Discount for shop. */
1113
- productDiscount?: {
1114
- /** @description Is attribute set */
1115
- promoteIsEnabled?: string;
1116
- /** @description Strikethrough price */
1117
- promoteItemNormalPrice?: number;
1118
- /** @description Net strikethrough price. */
1119
- promoteItemNormalPriceNet?: number;
1120
- /** @description Strikethrough wholesale price */
1121
- promoteItemWholesaleNormalPrice?: number;
1122
- /** @description Net wholesale strikethrough price. */
1123
- promoteItemWholesaleNormalPriceNet?: number;
1124
- /** @description Switching off date */
1125
- promoteItemEndingDate?: string;
1126
- };
1127
- /** @description Distinguished product in store. */
1128
- productDistinguished?: {
1129
- /** @description Is attribute set */
1130
- promoteIsEnabled?: string;
1131
- /** @description Strikethrough price */
1132
- promoteItemNormalPrice?: number;
1133
- /** @description Net strikethrough price. */
1134
- promoteItemNormalPriceNet?: number;
1135
- /** @description Strikethrough wholesale price */
1136
- promoteItemWholesaleNormalPrice?: number;
1137
- /** @description Switching off date */
1138
- promoteItemEndingDate?: string;
1139
- /** @description Net wholesale strikethrough price. */
1140
- promoteItemWholesaleNormalPriceNet?: number;
1141
- };
1142
- /** @description Special product in store. */
1143
- productSpecial?: {
1144
- /** @description Is attribute set */
1145
- promoteIsEnabled?: string;
1146
- /** @description Strikethrough price */
1147
- promoteItemNormalPrice?: number;
1148
- /** @description Net strikethrough price. */
1149
- promoteItemNormalPriceNet?: number;
1150
- /** @description Strikethrough wholesale price */
1151
- promoteItemWholesaleNormalPrice?: number;
1152
- /** @description Net wholesale strikethrough price. */
1153
- promoteItemWholesaleNormalPriceNet?: number;
1154
- /** @description Switching off date */
1155
- promoteItemEndingDate?: string;
1156
- };
1157
1053
  /** @description Parameters (distinguished). */
1158
1054
  productParametersDistinction?: {
1159
1055
  /** @description Parameter ID */
@@ -6512,12 +6408,15 @@ export type PostDiscountsRebatesCodeParams = {
6512
6408
  };
6513
6409
 
6514
6410
  export type PutClientsExternalCodeParams = {
6515
- /** @example 1 */
6516
- client_id?: number;
6517
- /** @description Customer's login. */
6518
- client_login?: string;
6519
- /** @description External system code. */
6520
- code_extern?: string;
6411
+ /** @description Customer data. */
6412
+ clients: {
6413
+ /** @example 1 */
6414
+ client_id?: number;
6415
+ /** @description Customer's login. */
6416
+ client_login?: string;
6417
+ /** @description External system code. */
6418
+ code_extern?: string;
6419
+ }[];
6521
6420
  };
6522
6421
 
6523
6422
  export type PutClientsGiftcardsParams = {
@@ -7154,4 +7053,176 @@ export type PutWmsStocksdocumentsAcceptMMParams = {
7154
7053
  id: number;
7155
7054
  };
7156
7055
 
7056
+ export type PromotionIdParams = {
7057
+ /** @description ID of promotion */
7058
+ promotionId: number;
7059
+ };
7060
+
7061
+ type PaginationParam = {
7062
+ /** @description Page index (starting from 0)
7063
+ * @default 0 */
7064
+ page?: number;
7065
+ /** @description Number of records per page.
7066
+ * @default 100 */
7067
+ perPage?: number;
7068
+ };
7069
+
7070
+ type DateRangeParam = {
7071
+ /** Format: date
7072
+ * @description Date "from" (RFC) */
7073
+ from?: string | null;
7074
+ /** Format: date
7075
+ * @description Date "to" (RFC) */
7076
+ to?: string | null;
7077
+ } | null;
7078
+
7079
+ type PromotionBody = {
7080
+ /** @description Promotion name */
7081
+ name?: string;
7082
+ /** @description Promotion zones */
7083
+ types?: ("promotion" | "special" | "discount" | "distinguished" | "bestseller" | "new")[];
7084
+ /** @description Promotion start datetime */
7085
+ startTime?: string;
7086
+ /** @description Promotion end datetime */
7087
+ endTime?: string;
7088
+ /** @description Change visibility */
7089
+ changeVisibility?: boolean;
7090
+ /** @description Auto unpin */
7091
+ autoUnpin?: boolean;
7092
+ /** @description Auto unpin own stocks */
7093
+ autoUnpinOwnStocks?: boolean;
7094
+ /** @description Price type */
7095
+ priceType?: "retail" | "wholesale" | "pos";
7096
+ /** @description Currency */
7097
+ currency?: string;
7098
+ /** @description Discount type */
7099
+ newPriceDiscountType?: "percent" | "minus" | "set";
7100
+ /** @description New price round */
7101
+ newPriceRound?: "whole" | "first" | "second";
7102
+ /** @description New price end */
7103
+ newPriceEnd?: number;
7104
+ /** @description Net or gross */
7105
+ netGross?: "gross" | "net";
7106
+ /** @description Charge type */
7107
+ chargeType?: "lowest" | "sum";
7108
+ /** @description Enable in marketplaces */
7109
+ enableInMarketplaces?: "y" | "n" | "yes_for_dynamic_pricing_products";
7110
+ /** @description Status */
7111
+ status?: "waiting" | "active" | "closed";
7112
+ };
7113
+
7114
+ export type PostPromotionsParams = PromotionBody & {
7115
+ /** @description Array of shop ids */
7116
+ activeInShops: number[];
7117
+ /** @description A representation of a floating-point number with precise accuracy. */
7118
+ newPriceValue: { value: string };
7119
+ };
7120
+
7121
+ export type PutPromotionsParams = PromotionBody & PromotionIdParams & {
7122
+ /** @description Array of shop ids */
7123
+ activeInShops?: number[];
7124
+ /** @description A representation of a floating-point number with precise accuracy. */
7125
+ newPriceValue?: { value: string };
7126
+ };
7127
+
7128
+ type PromotionElementsBody = {
7129
+ /** @description Array of PromotionElement objects */
7130
+ elements: {
7131
+ /** @description ID */
7132
+ id: string;
7133
+ /** @description Promotion element type */
7134
+ type: "product" | "series" | "producer" | "category" | "menu";
7135
+ /** @description Promotion ID */
7136
+ promotionId: number;
7137
+ }[];
7138
+ };
7139
+
7140
+ export type PostPromotionsElementsParams = PromotionElementsBody;
7141
+ export type DeletePromotionsElementsParams = PromotionElementsBody;
7142
+
7143
+ export type SearchPromotionsHistoryParams = {
7144
+ filter: {
7145
+ /** @description Promotion ID */
7146
+ promotionId: number;
7147
+ };
7148
+ pagination?: PaginationParam;
7149
+ };
7150
+
7151
+ export type SearchPromotionsElementsParams = {
7152
+ /** @example {"types": ["category", "series"], "ids": ["213"], "promotionIds": [534]} */
7153
+ filter?: {
7154
+ /** @description Elements IDs */
7155
+ ids?: string[];
7156
+ /** @description Element types */
7157
+ types?: ("product" | "series" | "producer" | "category" | "menu")[];
7158
+ /** @description Promotion IDs */
7159
+ promotionIds?: number[];
7160
+ };
7161
+ pagination?: PaginationParam;
7162
+ orderBy?: {
7163
+ /** @default promotion_id */
7164
+ property?: "promotion_id" | "type" | "element_id";
7165
+ /** @default desc */
7166
+ orderByDirection?: "asc" | "desc";
7167
+ };
7168
+ };
7169
+
7170
+ export type SearchPromotionsListViewParams = {
7171
+ filter?: {
7172
+ ids?: number[] | null;
7173
+ name?: string;
7174
+ changeVisibility?: boolean;
7175
+ /** @description Array of shop ids */
7176
+ activeInShops?: number[];
7177
+ types?: ("promotion" | "special" | "discount" | "distinguished" | "bestseller" | "new")[];
7178
+ priceTypes?: ("retail" | "wholesale" | "pos")[];
7179
+ statuses?: ("waiting" | "active" | "closed")[];
7180
+ dateRange?: DateRangeParam;
7181
+ productsNotInPromotion?: number[] | null;
7182
+ };
7183
+ pagination?: PaginationParam;
7184
+ orderBy?: {
7185
+ /** @default id */
7186
+ property?: "id" | "name" | "start_time" | "end_time" | "new_price_value" | "new_price_end" | "elements_modification_date";
7187
+ /** @default desc */
7188
+ orderByDirection?: "asc" | "desc";
7189
+ };
7190
+ };
7191
+
7192
+ export type SearchPromotionsArchiveParams = {
7193
+ filter?: {
7194
+ shops?: number[];
7195
+ archivedDate?: DateRangeParam;
7196
+ };
7197
+ pagination?: PaginationParam;
7198
+ orderBy?: {
7199
+ /** @default id */
7200
+ property?: "id" | "shop_mask" | "archived_date";
7201
+ /** @default desc */
7202
+ orderByDirection?: "asc" | "desc";
7203
+ };
7204
+ };
7205
+
7206
+ export type PutPromotionsSettingsParams = {
7207
+ daysLeftToArchive?: number;
7208
+ daysLeftToRemove?: number;
7209
+ showPriceOnProductsList?: number;
7210
+ automaticallySuggestDefaultStartDate?: "on" | "off";
7211
+ automaticallySuggestDefaultEndDate?: "on" | "off";
7212
+ defaultStartDate?: number;
7213
+ defaultEndDate?: number;
7214
+ defaultStartTime?: number;
7215
+ defaultEndTime?: number;
7216
+ daysLeftToClose?: number;
7217
+ };
7218
+
7219
+ export type GetProductsAttachmentsGetContentParams = {
7220
+ /** @description - product identifier value */
7221
+ productIdentValue: string;
7222
+ /** @description - product identifier type */
7223
+ productIdentType: "codeExtern" | "codeProducer" | "index" | "id";
7224
+ /** @description - product attachment ID */
7225
+ attachmentId: number;
7226
+ };
7227
+
7157
7228
  export { };
package/dist/request.js CHANGED
@@ -71,6 +71,8 @@ const checkNext = (request, response, logPage) => {
71
71
  handlePagination(response.pagination.resultsPage, response.pagination.resultsNumberPage, request);
72
72
  }
73
73
  else if (response.data?.pagination) {
74
+ if (!request.params.pagination)
75
+ request.params.pagination = {};
74
76
  request.params.pagination.page = response.data.pagination.resultsPage + 1;
75
77
  handlePagination(response.data.pagination.resultsPage, response.data.pagination.resultsNumberPage, request);
76
78
  }
@@ -20,6 +20,9 @@ type PagedSnakecaseResponse = {
20
20
  results_limit: number;
21
21
  };
22
22
 
23
+ type PaginatedResponse = {
24
+ pagination: PagedResponse
25
+ }
23
26
  type FaultCodeString = {
24
27
  /** @description Error code. */
25
28
  faultCode: number;
@@ -989,7 +992,7 @@ export type GetConfigVariablesResponse = {
989
992
  /** @description Key of config value. */
990
993
  key: string;
991
994
  /** @description Name of config item. */
992
- readonly name: string;
995
+ name: string;
993
996
  /** @description Value of config item. */
994
997
  value: string;
995
998
  } & {
@@ -1009,7 +1012,7 @@ export type PutConfigVariablesResponse = {
1009
1012
  /** @description Key of config value. */
1010
1013
  key: string;
1011
1014
  /** @description Name of config item. */
1012
- readonly name?: string;
1015
+ name?: string;
1013
1016
  /** @description Value of config item. */
1014
1017
  value: string;
1015
1018
  } & {
@@ -1182,9 +1185,9 @@ export type GetCpaCampaignResponse = {
1182
1185
  /** @description Whether the snippet is active */
1183
1186
  active: "y" | "n";
1184
1187
  /** @description Number of CPA programs associated with the campaign. */
1185
- readonly cpaCount: number | null;
1188
+ cpaCount: number | null;
1186
1189
  /** @description Number of active CPA programs associated with the campaign. */
1187
- readonly activeCpaCount: number | null;
1190
+ activeCpaCount: number | null;
1188
1191
  }[];
1189
1192
  pagination: PagedResponse;
1190
1193
  };
@@ -3490,6 +3493,8 @@ export type PutProductsMarketingZonesResponse = {
3490
3493
  export type GetProductsOmnibusPricesResponse = {
3491
3494
  /** @description Products list. */
3492
3495
  products: never[] | Record<string, {
3496
+ /** @description Product ID */
3497
+ productId: number;
3493
3498
  shops: never[] | Record<string, {
3494
3499
  /** @description Shop Id */
3495
3500
  shop_id: number;
@@ -6248,18 +6253,18 @@ export type GetSnippetsCampaignResponse = {
6248
6253
  /** @description Whether the snippet is active */
6249
6254
  active: "y" | "n";
6250
6255
  /** @description Whether the snippet campaign is deleted */
6251
- readonly deleted: "y" | "n";
6256
+ deleted: "y" | "n";
6252
6257
  /** @description Snippet order. */
6253
6258
  order: number;
6254
6259
  /** @description Number of code snippets associated with the campaign. */
6255
- readonly snippetCount: number | null;
6260
+ snippetCount: number | null;
6256
6261
  /** @description Number of active code snippets associated with the campaign. */
6257
- readonly activeSnippetCount: number | null;
6262
+ activeSnippetCount: number | null;
6258
6263
  configVariables: {
6259
6264
  /** @description Key of config value. */
6260
6265
  key: string;
6261
6266
  /** @description Name of config item. */
6262
- readonly name: string;
6267
+ name: string;
6263
6268
  /** @description Value of config item. */
6264
6269
  value: string;
6265
6270
  }[];
@@ -6428,9 +6433,9 @@ export type GetSnippetsResponse = {
6428
6433
  } | null;
6429
6434
  };
6430
6435
  /** @description Whether the snippet is marked as deleted. */
6431
- readonly deleted: "y" | "n";
6436
+ deleted: "y" | "n";
6432
6437
  /** @description The number of cookies associated with the snippet. */
6433
- readonly cookiesCount: number;
6438
+ cookiesCount: number;
6434
6439
  }[];
6435
6440
  pagination: PagedResponse;
6436
6441
  };
@@ -9146,4 +9151,148 @@ export type GetOrdersResponse = {
9146
9151
  }[];
9147
9152
  };
9148
9153
 
9154
+ type PromotionErrorEntry = {
9155
+ /** @description Error code. */
9156
+ code: string;
9157
+ /** @description Field associated with the error. */
9158
+ field: string | null;
9159
+ /** @description Error description. */
9160
+ message: string | null;
9161
+ /** @description Value associated with the error. */
9162
+ value: string | null;
9163
+ /** @description Unique identifier of the error (for support). */
9164
+ uid: string | null;
9165
+ };
9166
+
9167
+ type PromotionApiResponse<T> = {
9168
+ data: T;
9169
+ isError: boolean;
9170
+ errors: PromotionErrorEntry[];
9171
+ };
9172
+
9173
+ type PromotionData = {
9174
+ /** @description ID of promotion */
9175
+ promotionId: number;
9176
+ name: string;
9177
+ /** @description Array of shop ids */
9178
+ activeInShops: number[];
9179
+ types: ("promotion" | "special" | "discount" | "distinguished" | "bestseller" | "new")[];
9180
+ startTime: string;
9181
+ endTime: string;
9182
+ changeVisibility: boolean;
9183
+ autoUnpin: boolean;
9184
+ autoUnpinOwnStocks: boolean;
9185
+ priceType: "retail" | "wholesale" | "pos";
9186
+ /** @description A representation of a floating-point number with precise accuracy. */
9187
+ newPriceValue: { value: string };
9188
+ currency: string;
9189
+ newPriceDiscountType: "percent" | "minus" | "set";
9190
+ newPriceRound: "whole" | "first" | "second";
9191
+ newPriceEnd: number;
9192
+ netGross: "gross" | "net";
9193
+ chargeType: "lowest" | "sum";
9194
+ enableInMarketplaces: "y" | "n" | "yes_for_dynamic_pricing_products";
9195
+ status: "waiting" | "active" | "closed";
9196
+ elementsModificationDate: string | null;
9197
+ /** @description Promotion archive datetime — optional in list/get, required in archive */
9198
+ archivedDate?: string | null;
9199
+ /** @description Promotion elements count e.g. { "products": 1 } */
9200
+ elementsCount: Record<string, number>;
9201
+ elements?: unknown[];
9202
+ };
9203
+
9204
+ type PromotionArchiveData = Omit<PromotionData, "archivedDate" | "elementsCount" | "elements"> & {
9205
+ archivedDate: string | null;
9206
+ elementsCount: Record<string, never>;
9207
+ elements: unknown[];
9208
+ };
9209
+
9210
+ export type SearchPromotionsHistoryResponse = PromotionApiResponse<{
9211
+ list: {
9212
+ id: number;
9213
+ date: string;
9214
+ login: string;
9215
+ description: string;
9216
+ }[];
9217
+ pagination: PagedResponse;
9218
+ }>;
9219
+
9220
+ export type SearchPromotionsElementsResponse = PromotionApiResponse<{
9221
+ list: {
9222
+ id: string;
9223
+ type: "product" | "series" | "producer" | "category" | "menu";
9224
+ name: string;
9225
+ promotionId: number;
9226
+ /** @description Correlated elements id */
9227
+ correlatedElementsId?: number[];
9228
+ }[];
9229
+ pagination: PagedResponse;
9230
+ }>;
9231
+
9232
+ export type SearchPromotionsListViewResponse = PromotionApiResponse<{
9233
+ list: PromotionData[];
9234
+ pagination: PagedResponse;
9235
+ }>;
9236
+
9237
+ export type SearchPromotionsArchiveResponse = PromotionApiResponse<{
9238
+ list: PromotionArchiveData[];
9239
+ pagination: PagedResponse;
9240
+ }>;
9241
+
9242
+ export type GetPromotionsResponse = PromotionApiResponse<PromotionData>;
9243
+ export type GetPromotionsArchiveResponse = PromotionApiResponse<PromotionArchiveData>;
9244
+
9245
+ export type GetPromotionsSettingsResponse = PromotionApiResponse<{
9246
+ daysLeftToArchive: number;
9247
+ daysLeftToRemove: number;
9248
+ showPriceOnProductsList: number;
9249
+ automaticallySuggestDefaultStartDate: "on" | "off";
9250
+ automaticallySuggestDefaultEndDate: "on" | "off";
9251
+ defaultStartDate: number;
9252
+ defaultEndDate: number;
9253
+ defaultStartTime: number;
9254
+ defaultEndTime: number;
9255
+ daysLeftToClose: number;
9256
+ }>;
9257
+
9258
+ export type PromotionIdResponse = PromotionApiResponse<number>;
9259
+
9260
+ export type PromotionBoolResponse = PromotionApiResponse<boolean | null>;
9261
+
9262
+ export type GetRegulationsHistoryResponse = {
9263
+ results: {
9264
+ /** @description Document's type */
9265
+ type: string;
9266
+ /** @description Language ISO code. */
9267
+ langId: string;
9268
+ /** @description Shop ID. */
9269
+ shopId: number;
9270
+ /** @description Content. */
9271
+ content: string;
9272
+ /** @description Creation time. */
9273
+ creationTime: number;
9274
+ /** @description User. */
9275
+ user: string;
9276
+ /** @description Change type. */
9277
+ changeType: "auto" | "user";
9278
+ /** @description Change source (y - auto, m - markdown editor, n - WYSIWYG/HTML editor). */
9279
+ isDefault: "y" | "m" | "n";
9280
+ /** @description Setting to check if revision was published in shop. */
9281
+ wasPublished: number;
9282
+ /** @description 2-letter ISO country code. */
9283
+ country: string;
9284
+ }[];
9285
+ pagination: {
9286
+ /** @description Pagination settings. */
9287
+ appliedFilter: {
9288
+ /** @description Page index (starting from 0)
9289
+ * @default 0 */
9290
+ page: number;
9291
+ /** @description Number of records per page.
9292
+ * @default 100 */
9293
+ perPage: number;
9294
+ };
9295
+ };
9296
+ };
9297
+
9149
9298
  export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idosell",
3
- "version": "0.4.25",
3
+ "version": "0.4.30",
4
4
  "description": "Idosell 3 REST connector",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/gateways.d.ts",
@@ -0,0 +1,7 @@
1
+ import idosell from "./dist/index.ts"
2
+ import { expect, test } from "vitest"
3
+
4
+ test("getProductsAttachmentsGetContentAttachmentId", () => {
5
+ const params = idosell().getProductsAttachmentsGetContent.productIdentType("id").productIdentValue("294").attachmentId(5).checkParams();
6
+ expect(params).toEqual({"productIdentType":"id","productIdentValue":"294","attachmentId":5});
7
+ })
@@ -0,0 +1,7 @@
1
+ import idosell from "./dist/index.ts"
2
+ import { expect, test } from "vitest"
3
+
4
+ test("postPromotionsName", () => {
5
+ const params = idosell().postPromotions.activeInShops([1]).newPriceValue({ "value": "5" }).name("Promo").checkParams();
6
+ expect(params).toEqual({"activeInShops":[1],"newPriceValue":{"value":"5"},"name":"Promo"});
7
+ })
@@ -1,7 +1,7 @@
1
- import idosell from "./dist/index"
1
+ import idosell from "./dist/index.ts"
2
2
  import { expect, test } from "vitest"
3
3
 
4
4
  test("putClientsExternalCodeCode_extern", () => {
5
- const params = idosell().putClientsExternalCode.client_login("iai_demo").code_extern("abc").checkParams();
6
- expect(params).toEqual({"client_login":"iai_demo","code_extern":"abc"});
5
+ const params = idosell().putClientsExternalCode.client_id(10).code_extern("vip10").checkParams();
6
+ expect(params).toEqual({"clients":[{"client_id":10,"code_extern":"vip10"}]});
7
7
  })