idosell 0.4.25 → 0.4.27
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/changelog.md +4 -0
- package/dist/gateways.d.ts +33 -33
- package/dist/methods/postPromotions.js +1 -0
- package/dist/reqparams.d.ts +163 -0
- package/dist/request.js +3 -0
- package/dist/responses.d.ts +111 -0
- package/package.json +1 -1
- package/tests/postPromotions.test.js +7 -0
package/changelog.md
CHANGED
|
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.4.27] - 2025-04-06
|
|
9
|
+
- Addded missing promotions types
|
|
10
|
+
- Fixed paging for promotions
|
|
11
|
+
|
|
8
12
|
## [0.4.25] - 2025-04-04
|
|
9
13
|
- Updated to v7.19
|
|
10
14
|
- Added promotion routes
|
package/dist/gateways.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
2
2
|
import type { PagableGateway, AppendableGateway, Gateway, DateLike, JSObject, IdosellErrorFaultStructure } from "./app.d.ts"
|
|
3
|
-
import type { GetClientsBalanceResponse, BooleanStatusResponse, GetClientsResponse, PostClientsResponse, PutClientsResponse, SearchClientsCrmResponse, GetClientsDeliveryAddressResponse, PostClientsDeliveryAddressResponse, PutClientsDeliveryAddressResponse, VouchersResponse, PutVouchersResponse, SearchClientsGiftcardsResponse, GetClientsGiftcardsTypesResponse, GetClientsMembershipCardsResponse, PutClientsMembershipCardsResponse, SearchClientsNewsletterEmailResponse, SearchClientsNewsletterSmsResponse, GetClientsPayerAddressResponse, PostClientsPayerAddressResponse, PutClientsPayerAddressResponse, GetClientsPricelistsClientsResponse, PutClientsPricelistsClientsResponse, GetClientsPricelistsResponse, PostClientsPricelistsResponse, GetClientsPricelistsProductsResponse, PutClientsPricelistsProductsResponse, GetClientsPricesActiveCardResponse, GetClientsPricesDiscountGroupsResponse, GetClientsPricesDiscountsResponse, PutClientsPricesDiscountsResponse, GetClientsProfitPointsResponse, GetClientsProvinceListResponse, GetClientsTagsResponse, PostClientsTagsResponse, PutClientsTagsResponse, GetConfigVariablesResponse, PutConfigVariablesResponse, GetCouriersAssignedToShippingProfilesResponse, GetCouriersResponse, GetCouriersPickupPointsResponse, PutCouriersPickupPointsResponse, GetCpaCampaignResponse, CmsCampaignResponse, CmsResponse, GetCpaResponse, GetDeliveriesProfilesResponse, GetDeliveriesRegionsResponse, PostDeliveriesRegionsResponse, GetDiscountsGroupsClientsResponse, GetDiscountsGroupsResponse, PostDiscountsGroupsResponse, GetEntriesResponse, PostEntriesResponse, GetEntriesPagesToDisplayResponse, GetEntriesSourcesResponse, GetMenuResponse, PostMenuResponse, PutMenuResponse, PutMenuSortResponse, GetOrdersAnalyticsResponse, GetOrdersAuctionDetailsResponse, PutOrdersCourierResponse, PostOrdersDocumentsCreateResponse, GetOrdersDocumentsResponse, PostOrdersDocumentsResponse, GetOrdersHandlerResponse, GetOrdersHistoryResponse, GetOrdersImagesResponse, PostOrdersImagesResponse, GetOrdersLabelsResponse, SearchOrdersOpinionsResponse, GetOrdersOpinionsRateResponse, SearchOrdersResponse, PostOrdersResponse, PutOrdersResponse, GetOrdersPackagesResponse, PutOrdersPackagesResponse, PutOrdersProductsSerialNumbersResponse, PutOrdersProfitMarginResponse, GetOrdersProfitabilityResponse, GetOrdersStatusesResponse, GetOrdersWarehouseResponse, PostPackagesLabelsResponse, PutPackagesResponse, SearchPackagesResponse, GetPaymentsFormsResponse, GetPaymentsResponse, PostPaymentsResponse, GetPaymentsProfilesResponse, PostPaymentsRepaymentResponse, GetProductsSKUbyBarcodeResponse, PutProductsAttachmentsResponse, GetProductsAuctionsResponse, GetProductsBrandsResponse, PutProductsBrandsResponse, GetProductsCategoriesResponse, PutProductsCategoriesResponse, SearchProductsCategoriesIdosellResponse, GetProductsCodeExistenceResponse, SearchProductsDeliveryTimeResponse, GetProductsDescriptionsResponse, ProductIdentResponse, PutProductsGroupsSettingsResponse, GetProductsIdBySizecodeResponse, PutProductsImagesResponse, GetProductsMarketingPromotionResponse, PostProductsMarketingPromotionResponse, PutProductsMarketingPromotionResponse, GetProductsMarketingZonesResponse, PutProductsMarketingZonesResponse, GetProductsOmnibusPricesResponse, GetProductsOpinionsResponse, PostProductsOpinionsResponse, GetProductsOpinionsRateResponse, PutProductsParametersResponse, SearchProductsParametersResponse, SearchProductsResponse, PostProductsResponse, PutProductsResponse, GetProductsQuestionsResponse, GetProductsReservationsResponse, GetProductsSeriesResponse, PutProductsSeriesResponse, GetProductsSizesResponse, PutProductsSizesResponse, PutProductsStockQuantityResponse, GetProductsStocksResponse, PutProductsStocksResponse, GetProductsStrikethroughPricesResponse, PutProductsSupplierCodeResponse, PutProductsSupplierProductDataResponse, GetResponsibilityEntitiesResponse, PutResponsibilityEntitiesResponse, GetReturnsResponse, PostReturnsResponse, PutReturnsResponse, PutReturnsSerialNumberResponse, GetRmaResponse, PutRmaResponse, GetRmaStatusesResponse, GetShopsCurrenciesResponse, GetShopsLanguagesResponse, GetSizechartsResponse, PutSizechartsResponse, GetSizesResponse, PutSizesResponse, GetSnippetsCampaignResponse, GetSnippetsCookiesResponse, GetSnippetsResponse, GetSystemConfigResponse, GetSystemCurrenciesResponse, PutSystemCurrenciesResponse, GetSystemProcessesAutomationResponse, GetSystemServerLoadResponse, GetSystemServerTimeResponse, GetSystemShopsDataResponse, GetSystemUnitsResponse, PutSystemUnitsResponse, GetSystemUsersResponse, GetVouchersTypesResponse, GetVouchersResponse, GetWarrantiesCountTotalResponse, PutWarrantiesLanguageDataResponse, GetWarrantiesResponse, PutWarrantiesResponse, GetWmsLocationsResponse, GetWmsStocksdocumentsDocumentsResponse, PostWmsStocksdocumentsDocumentsResponse, PutWmsStocksdocumentsDocumentsResponse, GetWmsStocksdocumentsOpenedDocumentsResponse, GetWmsStocksdocumentsProductsResponse, PutWmsStocksdocumentsProductsResponse, GetWmsSuppliersResponse, PutWmsSuppliersResponse } from "./responses.d.ts"
|
|
3
|
+
import type { GetClientsBalanceResponse, BooleanStatusResponse, GetClientsResponse, PostClientsResponse, PutClientsResponse, SearchClientsCrmResponse, GetClientsDeliveryAddressResponse, PostClientsDeliveryAddressResponse, PutClientsDeliveryAddressResponse, VouchersResponse, PutVouchersResponse, SearchClientsGiftcardsResponse, GetClientsGiftcardsTypesResponse, GetClientsMembershipCardsResponse, PutClientsMembershipCardsResponse, SearchClientsNewsletterEmailResponse, SearchClientsNewsletterSmsResponse, GetClientsPayerAddressResponse, PostClientsPayerAddressResponse, PutClientsPayerAddressResponse, GetClientsPricelistsClientsResponse, PutClientsPricelistsClientsResponse, GetClientsPricelistsResponse, PostClientsPricelistsResponse, GetClientsPricelistsProductsResponse, PutClientsPricelistsProductsResponse, GetClientsPricesActiveCardResponse, GetClientsPricesDiscountGroupsResponse, GetClientsPricesDiscountsResponse, PutClientsPricesDiscountsResponse, GetClientsProfitPointsResponse, GetClientsProvinceListResponse, GetClientsTagsResponse, PostClientsTagsResponse, PutClientsTagsResponse, GetConfigVariablesResponse, PutConfigVariablesResponse, GetCouriersAssignedToShippingProfilesResponse, GetCouriersResponse, GetCouriersPickupPointsResponse, PutCouriersPickupPointsResponse, GetCpaCampaignResponse, CmsCampaignResponse, CmsResponse, GetCpaResponse, GetDeliveriesProfilesResponse, GetDeliveriesRegionsResponse, PostDeliveriesRegionsResponse, GetDiscountsGroupsClientsResponse, GetDiscountsGroupsResponse, PostDiscountsGroupsResponse, GetEntriesResponse, PostEntriesResponse, GetEntriesPagesToDisplayResponse, GetEntriesSourcesResponse, GetMenuResponse, PostMenuResponse, PutMenuResponse, PutMenuSortResponse, GetOrdersAnalyticsResponse, GetOrdersAuctionDetailsResponse, PutOrdersCourierResponse, PostOrdersDocumentsCreateResponse, GetOrdersDocumentsResponse, PostOrdersDocumentsResponse, GetOrdersHandlerResponse, GetOrdersHistoryResponse, GetOrdersImagesResponse, PostOrdersImagesResponse, GetOrdersLabelsResponse, SearchOrdersOpinionsResponse, GetOrdersOpinionsRateResponse, SearchOrdersResponse, PostOrdersResponse, PutOrdersResponse, GetOrdersPackagesResponse, PutOrdersPackagesResponse, PutOrdersProductsSerialNumbersResponse, PutOrdersProfitMarginResponse, GetOrdersProfitabilityResponse, GetOrdersStatusesResponse, GetOrdersWarehouseResponse, PostPackagesLabelsResponse, PutPackagesResponse, SearchPackagesResponse, GetPaymentsFormsResponse, GetPaymentsResponse, PostPaymentsResponse, GetPaymentsProfilesResponse, PostPaymentsRepaymentResponse, GetProductsSKUbyBarcodeResponse, PutProductsAttachmentsResponse, GetProductsAuctionsResponse, GetProductsBrandsResponse, PutProductsBrandsResponse, GetProductsCategoriesResponse, PutProductsCategoriesResponse, SearchProductsCategoriesIdosellResponse, GetProductsCodeExistenceResponse, SearchProductsDeliveryTimeResponse, GetProductsDescriptionsResponse, ProductIdentResponse, PutProductsGroupsSettingsResponse, GetProductsIdBySizecodeResponse, PutProductsImagesResponse, GetProductsMarketingPromotionResponse, PostProductsMarketingPromotionResponse, PutProductsMarketingPromotionResponse, GetProductsMarketingZonesResponse, PutProductsMarketingZonesResponse, GetProductsOmnibusPricesResponse, GetProductsOpinionsResponse, PostProductsOpinionsResponse, GetProductsOpinionsRateResponse, PutProductsParametersResponse, SearchProductsParametersResponse, SearchProductsResponse, PostProductsResponse, PutProductsResponse, GetProductsQuestionsResponse, GetProductsReservationsResponse, GetProductsSeriesResponse, PutProductsSeriesResponse, GetProductsSizesResponse, PutProductsSizesResponse, PutProductsStockQuantityResponse, GetProductsStocksResponse, PutProductsStocksResponse, GetProductsStrikethroughPricesResponse, PutProductsSupplierCodeResponse, PutProductsSupplierProductDataResponse, PromotionBoolResponse, SearchPromotionsElementsResponse, SearchPromotionsHistoryResponse, PromotionIdResponse, GetPromotionsResponse, SearchPromotionsListViewResponse, GetPromotionsArchiveResponse, SearchPromotionsArchiveResponse, GetPromotionsSettingsResponse, GetResponsibilityEntitiesResponse, PutResponsibilityEntitiesResponse, GetReturnsResponse, PostReturnsResponse, PutReturnsResponse, PutReturnsSerialNumberResponse, GetRmaResponse, PutRmaResponse, GetRmaStatusesResponse, GetShopsCurrenciesResponse, GetShopsLanguagesResponse, GetSizechartsResponse, PutSizechartsResponse, GetSizesResponse, PutSizesResponse, GetSnippetsCampaignResponse, GetSnippetsCookiesResponse, GetSnippetsResponse, GetSystemConfigResponse, GetSystemCurrenciesResponse, PutSystemCurrenciesResponse, GetSystemProcessesAutomationResponse, GetSystemServerLoadResponse, GetSystemServerTimeResponse, GetSystemShopsDataResponse, GetSystemUnitsResponse, PutSystemUnitsResponse, GetSystemUsersResponse, GetVouchersTypesResponse, GetVouchersResponse, GetWarrantiesCountTotalResponse, PutWarrantiesLanguageDataResponse, GetWarrantiesResponse, PutWarrantiesResponse, GetWmsLocationsResponse, GetWmsStocksdocumentsDocumentsResponse, PostWmsStocksdocumentsDocumentsResponse, PutWmsStocksdocumentsDocumentsResponse, GetWmsStocksdocumentsOpenedDocumentsResponse, GetWmsStocksdocumentsProductsResponse, PutWmsStocksdocumentsProductsResponse, GetWmsSuppliersResponse, PutWmsSuppliersResponse } from "./responses.d.ts"
|
|
4
4
|
import type * as RequestParams from "./reqparams.d.ts";
|
|
5
5
|
import * as ENUMS from "./enums";
|
|
6
6
|
import utils from "./utils";
|
|
@@ -3719,9 +3719,9 @@ export interface PutProductsSynchronizationFinishUploadRequest extends Gateway {
|
|
|
3719
3719
|
verifyFiles: (value: boolean) => this;
|
|
3720
3720
|
}
|
|
3721
3721
|
|
|
3722
|
-
export interface PostPromotionsElementsRequest extends AppendableGateway<PostPromotionsElementsRequest> {
|
|
3722
|
+
export interface PostPromotionsElementsRequest extends AppendableGateway<PostPromotionsElementsRequest, PromotionBoolResponse, RequestParams.PostPromotionsElementsParams> {
|
|
3723
3723
|
/** Array of PromotionElement objects */
|
|
3724
|
-
elements: (value:
|
|
3724
|
+
elements: (value: RequestParams.PostPromotionsElementsParams["elements"]) => this;
|
|
3725
3725
|
/** ID */
|
|
3726
3726
|
id: (id: string) => this
|
|
3727
3727
|
/** Promotion element type */
|
|
@@ -3734,12 +3734,12 @@ export interface PostPromotionsElementsRequest extends AppendableGateway<PostPro
|
|
|
3734
3734
|
correlatedElementsId: (correlatedElementsId: number|string|number[]|string[]) => this
|
|
3735
3735
|
}
|
|
3736
3736
|
|
|
3737
|
-
export interface SearchPromotionsElementsRequest extends PagableGateway<SearchPromotionsElementsRequest> {
|
|
3738
|
-
filter: (value:
|
|
3737
|
+
export interface SearchPromotionsElementsRequest extends PagableGateway<SearchPromotionsElementsRequest, SearchPromotionsElementsResponse, RequestParams.SearchPromotionsElementsParams> {
|
|
3738
|
+
filter: (value: RequestParams.SearchPromotionsElementsParams["filter"]) => this;
|
|
3739
3739
|
/** Pagination settings. */
|
|
3740
|
-
pagination: (value:
|
|
3740
|
+
pagination: (value: RequestParams.SearchPromotionsElementsParams["pagination"]) => this;
|
|
3741
3741
|
/** Order by settings. */
|
|
3742
|
-
orderBy: (value:
|
|
3742
|
+
orderBy: (value: RequestParams.SearchPromotionsElementsParams["orderBy"]) => this;
|
|
3743
3743
|
/** Elements IDs */
|
|
3744
3744
|
ids: (value: string|string[]) => this;
|
|
3745
3745
|
/** Element types */
|
|
@@ -3750,9 +3750,9 @@ export interface SearchPromotionsElementsRequest extends PagableGateway<SearchPr
|
|
|
3750
3750
|
orderByProperty: (elementName: "promotion_id"|"type"|"element_id", descending?: boolean) => this;
|
|
3751
3751
|
}
|
|
3752
3752
|
|
|
3753
|
-
export interface DeletePromotionsElementsRequest extends AppendableGateway<DeletePromotionsElementsRequest> {
|
|
3753
|
+
export interface DeletePromotionsElementsRequest extends AppendableGateway<DeletePromotionsElementsRequest, PromotionBoolResponse, RequestParams.DeletePromotionsElementsParams> {
|
|
3754
3754
|
/** Array of PromotionElement objects */
|
|
3755
|
-
elements: (value:
|
|
3755
|
+
elements: (value: RequestParams.DeletePromotionsElementsParams["elements"]) => this;
|
|
3756
3756
|
/** ID */
|
|
3757
3757
|
id: (id: string) => this
|
|
3758
3758
|
/** Promotion element type */
|
|
@@ -3765,16 +3765,16 @@ export interface DeletePromotionsElementsRequest extends AppendableGateway<Delet
|
|
|
3765
3765
|
correlatedElementsId: (correlatedElementsId: number|string|number[]|string[]) => this
|
|
3766
3766
|
}
|
|
3767
3767
|
|
|
3768
|
-
export interface SearchPromotionsHistoryRequest extends PagableGateway<SearchPromotionsHistoryRequest> {
|
|
3768
|
+
export interface SearchPromotionsHistoryRequest extends PagableGateway<SearchPromotionsHistoryRequest, SearchPromotionsHistoryResponse, RequestParams.SearchPromotionsHistoryParams> {
|
|
3769
3769
|
/** Filters that limit the result of a customer query. */
|
|
3770
|
-
filter: (value:
|
|
3770
|
+
filter: (value: RequestParams.SearchPromotionsHistoryParams["filter"]) => this;
|
|
3771
3771
|
/** Pagination settings. */
|
|
3772
|
-
pagination: (value:
|
|
3772
|
+
pagination: (value: RequestParams.SearchPromotionsHistoryParams["pagination"]) => this;
|
|
3773
3773
|
/** Promotion ID */
|
|
3774
3774
|
promotionId: (value: number|string) => this;
|
|
3775
3775
|
}
|
|
3776
3776
|
|
|
3777
|
-
export interface PostPromotionsRequest extends Gateway {
|
|
3777
|
+
export interface PostPromotionsRequest extends Gateway<PromotionIdResponse, RequestParams.PostPromotionsParams> {
|
|
3778
3778
|
/** Promotion name */
|
|
3779
3779
|
name: (value: string) => this;
|
|
3780
3780
|
/** Array of shop ids */
|
|
@@ -3794,7 +3794,7 @@ export interface PostPromotionsRequest extends Gateway {
|
|
|
3794
3794
|
/** Price type */
|
|
3795
3795
|
priceType: (value: 'retail'|'wholesale'|'pos') => this;
|
|
3796
3796
|
/** A representation of a floating-point number with precise accuracy. */
|
|
3797
|
-
newPriceValue: (value:
|
|
3797
|
+
newPriceValue: (value: RequestParams.PostPromotionsParams["newPriceValue"]) => this;
|
|
3798
3798
|
/** Currency */
|
|
3799
3799
|
currency: (value: string) => this;
|
|
3800
3800
|
/** Discount type */
|
|
@@ -3813,11 +3813,11 @@ export interface PostPromotionsRequest extends Gateway {
|
|
|
3813
3813
|
status: (value: 'waiting'|'active'|'closed') => this;
|
|
3814
3814
|
}
|
|
3815
3815
|
|
|
3816
|
-
export interface DeletePromotionsRequest extends Gateway {
|
|
3816
|
+
export interface DeletePromotionsRequest extends Gateway<PromotionBoolResponse, RequestParams.PromotionIdParams> {
|
|
3817
3817
|
promotionId: (value: number|string) => this;
|
|
3818
3818
|
}
|
|
3819
3819
|
|
|
3820
|
-
export interface PutPromotionsRequest extends Gateway {
|
|
3820
|
+
export interface PutPromotionsRequest extends Gateway<PromotionIdResponse, RequestParams.PutPromotionsParams> {
|
|
3821
3821
|
/** Promotion name */
|
|
3822
3822
|
name: (value: string) => this;
|
|
3823
3823
|
/** Array of shop ids */
|
|
@@ -3837,7 +3837,7 @@ export interface PutPromotionsRequest extends Gateway {
|
|
|
3837
3837
|
/** Price type */
|
|
3838
3838
|
priceType: (value: 'retail'|'wholesale'|'pos') => this;
|
|
3839
3839
|
/** A representation of a floating-point number with precise accuracy. */
|
|
3840
|
-
newPriceValue: (value:
|
|
3840
|
+
newPriceValue: (value: RequestParams.PutPromotionsParams["newPriceValue"]) => this;
|
|
3841
3841
|
/** Currency */
|
|
3842
3842
|
currency: (value: string) => this;
|
|
3843
3843
|
/** Discount type */
|
|
@@ -3858,22 +3858,22 @@ export interface PutPromotionsRequest extends Gateway {
|
|
|
3858
3858
|
promotionId: (promotionId: number) => this;
|
|
3859
3859
|
}
|
|
3860
3860
|
|
|
3861
|
-
export interface PostPromotionsEndRequest extends Gateway {
|
|
3861
|
+
export interface PostPromotionsEndRequest extends Gateway<PromotionIdResponse, RequestParams.PromotionIdParams> {
|
|
3862
3862
|
/** ID of promotion */
|
|
3863
3863
|
promotionId: (value: number|string) => this;
|
|
3864
3864
|
}
|
|
3865
3865
|
|
|
3866
|
-
export interface GetPromotionsRequest extends Gateway {
|
|
3866
|
+
export interface GetPromotionsRequest extends Gateway<GetPromotionsResponse, RequestParams.PromotionIdParams> {
|
|
3867
3867
|
promotionId: (value: number|string) => this;
|
|
3868
3868
|
}
|
|
3869
3869
|
|
|
3870
|
-
export interface SearchPromotionsListViewRequest extends PagableGateway<SearchPromotionsListViewRequest> {
|
|
3870
|
+
export interface SearchPromotionsListViewRequest extends PagableGateway<SearchPromotionsListViewRequest, SearchPromotionsListViewResponse, RequestParams.SearchPromotionsListViewParams> {
|
|
3871
3871
|
/** Filters that limit the result of a customer query. */
|
|
3872
|
-
filter: (value:
|
|
3872
|
+
filter: (value: RequestParams.SearchPromotionsListViewParams["filter"]) => this;
|
|
3873
3873
|
/** Pagination settings. */
|
|
3874
|
-
pagination: (value:
|
|
3874
|
+
pagination: (value: RequestParams.SearchPromotionsListViewParams["pagination"]) => this;
|
|
3875
3875
|
/** Order by settings. */
|
|
3876
|
-
orderBy: (value:
|
|
3876
|
+
orderBy: (value: RequestParams.SearchPromotionsListViewParams["orderBy"]) => this;
|
|
3877
3877
|
/** Promotion ID */
|
|
3878
3878
|
ids: (value: number|string|number[]|string[]) => this;
|
|
3879
3879
|
/** Promotion name */
|
|
@@ -3889,14 +3889,14 @@ export interface SearchPromotionsListViewRequest extends PagableGateway<SearchPr
|
|
|
3889
3889
|
/** Promotion statuses */
|
|
3890
3890
|
statuses: (value: 'waiting'|'active'|'closed'|Array<'waiting'|'active'|'closed'>) => this;
|
|
3891
3891
|
/** Date range */
|
|
3892
|
-
dateRange: (value:
|
|
3892
|
+
dateRange: (value: RequestParams.SearchPromotionsListViewParams["dateRange"]) => this;
|
|
3893
3893
|
/** Array of products in promotion */
|
|
3894
3894
|
productsNotInPromotion: (value: number|string|number[]|string[]) => this;
|
|
3895
3895
|
/** Define ordering of records */
|
|
3896
3896
|
orderByProperty: (elementName: "id"|"name"|"start_time"|"end_time"|"new_price_value"|"new_price_end"|"elements_modification_date", descending?: boolean) => this;
|
|
3897
3897
|
}
|
|
3898
3898
|
|
|
3899
|
-
export interface PostPromotionsStartRequest extends Gateway {
|
|
3899
|
+
export interface PostPromotionsStartRequest extends Gateway<PromotionIdResponse, RequestParams.PromotionIdParams> {
|
|
3900
3900
|
/** ID of promotion */
|
|
3901
3901
|
promotionId: (value: number|string) => this;
|
|
3902
3902
|
}
|
|
@@ -3905,27 +3905,27 @@ export interface DeletePromotionsArchiveRequest extends Gateway {
|
|
|
3905
3905
|
promotionId: (value: number|string) => this;
|
|
3906
3906
|
}
|
|
3907
3907
|
|
|
3908
|
-
export interface GetPromotionsArchiveRequest extends Gateway {
|
|
3908
|
+
export interface GetPromotionsArchiveRequest extends Gateway<GetPromotionsArchiveResponse, RequestParams.PromotionIdParams> {
|
|
3909
3909
|
promotionId: (value: number|string) => this;
|
|
3910
3910
|
}
|
|
3911
3911
|
|
|
3912
|
-
export interface SearchPromotionsArchiveRequest extends PagableGateway<SearchPromotionsArchiveRequest> {
|
|
3912
|
+
export interface SearchPromotionsArchiveRequest extends PagableGateway<SearchPromotionsArchiveRequest, SearchPromotionsArchiveResponse, RequestParams.SearchPromotionsArchiveParams> {
|
|
3913
3913
|
/** Filters that limit the result of a customer query. */
|
|
3914
|
-
filter: (value:
|
|
3914
|
+
filter: (value: RequestParams.SearchPromotionsArchiveParams["filter"]) => this;
|
|
3915
3915
|
/** Pagination settings. */
|
|
3916
|
-
pagination: (value:
|
|
3916
|
+
pagination: (value: RequestParams.SearchPromotionsArchiveParams["pagination"]) => this;
|
|
3917
3917
|
/** Order by settings. */
|
|
3918
|
-
orderBy: (value:
|
|
3918
|
+
orderBy: (value: RequestParams.SearchPromotionsArchiveParams["orderBy"]) => this;
|
|
3919
3919
|
/** Shops IDs */
|
|
3920
3920
|
shops: (value: number|string|number[]|string[]) => this;
|
|
3921
|
-
archivedDate: (value:
|
|
3921
|
+
archivedDate: (value: RequestParams.SearchPromotionsArchiveParams["archivedDate"]) => this;
|
|
3922
3922
|
/** Define ordering of records */
|
|
3923
3923
|
orderByProperty: (elementName: "id"|"shop_mask"|"archived_date", descending?: boolean) => this;
|
|
3924
3924
|
}
|
|
3925
3925
|
|
|
3926
|
-
export interface GetPromotionsSettingsRequest extends Gateway {}
|
|
3926
|
+
export interface GetPromotionsSettingsRequest extends Gateway<GetPromotionsSettingsResponse> {}
|
|
3927
3927
|
|
|
3928
|
-
export interface PutPromotionsSettingsRequest extends Gateway {
|
|
3928
|
+
export interface PutPromotionsSettingsRequest extends Gateway<PromotionBoolResponse, RequestParams.PutPromotionsSettingsParams> {
|
|
3929
3929
|
/** Days to archive */
|
|
3930
3930
|
daysLeftToArchive: (value: number|string) => this;
|
|
3931
3931
|
/** Days to remove from archive */
|
|
@@ -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
|
};
|
package/dist/reqparams.d.ts
CHANGED
|
@@ -7154,4 +7154,167 @@ export type PutWmsStocksdocumentsAcceptMMParams = {
|
|
|
7154
7154
|
id: number;
|
|
7155
7155
|
};
|
|
7156
7156
|
|
|
7157
|
+
export type PromotionIdParams = {
|
|
7158
|
+
/** @description ID of promotion */
|
|
7159
|
+
promotionId: number;
|
|
7160
|
+
};
|
|
7161
|
+
|
|
7162
|
+
type PaginationParam = {
|
|
7163
|
+
/** @description Page index (starting from 0)
|
|
7164
|
+
* @default 0 */
|
|
7165
|
+
page?: number;
|
|
7166
|
+
/** @description Number of records per page.
|
|
7167
|
+
* @default 100 */
|
|
7168
|
+
perPage?: number;
|
|
7169
|
+
};
|
|
7170
|
+
|
|
7171
|
+
type DateRangeParam = {
|
|
7172
|
+
/** Format: date
|
|
7173
|
+
* @description Date "from" (RFC) */
|
|
7174
|
+
from?: string | null;
|
|
7175
|
+
/** Format: date
|
|
7176
|
+
* @description Date "to" (RFC) */
|
|
7177
|
+
to?: string | null;
|
|
7178
|
+
} | null;
|
|
7179
|
+
|
|
7180
|
+
type PromotionBody = {
|
|
7181
|
+
/** @description Promotion name */
|
|
7182
|
+
name?: string;
|
|
7183
|
+
/** @description Promotion zones */
|
|
7184
|
+
types?: ("promotion" | "special" | "discount" | "distinguished" | "bestseller" | "new")[];
|
|
7185
|
+
/** @description Promotion start datetime */
|
|
7186
|
+
startTime?: string;
|
|
7187
|
+
/** @description Promotion end datetime */
|
|
7188
|
+
endTime?: string;
|
|
7189
|
+
/** @description Change visibility */
|
|
7190
|
+
changeVisibility?: boolean;
|
|
7191
|
+
/** @description Auto unpin */
|
|
7192
|
+
autoUnpin?: boolean;
|
|
7193
|
+
/** @description Auto unpin own stocks */
|
|
7194
|
+
autoUnpinOwnStocks?: boolean;
|
|
7195
|
+
/** @description Price type */
|
|
7196
|
+
priceType?: "retail" | "wholesale" | "pos";
|
|
7197
|
+
/** @description Currency */
|
|
7198
|
+
currency?: string;
|
|
7199
|
+
/** @description Discount type */
|
|
7200
|
+
newPriceDiscountType?: "percent" | "minus" | "set";
|
|
7201
|
+
/** @description New price round */
|
|
7202
|
+
newPriceRound?: "whole" | "first" | "second";
|
|
7203
|
+
/** @description New price end */
|
|
7204
|
+
newPriceEnd?: number;
|
|
7205
|
+
/** @description Net or gross */
|
|
7206
|
+
netGross?: "gross" | "net";
|
|
7207
|
+
/** @description Charge type */
|
|
7208
|
+
chargeType?: "lowest" | "sum";
|
|
7209
|
+
/** @description Enable in marketplaces */
|
|
7210
|
+
enableInMarketplaces?: "y" | "n" | "yes_for_dynamic_pricing_products";
|
|
7211
|
+
/** @description Status */
|
|
7212
|
+
status?: "waiting" | "active" | "closed";
|
|
7213
|
+
};
|
|
7214
|
+
|
|
7215
|
+
export type PostPromotionsParams = PromotionBody & {
|
|
7216
|
+
/** @description Array of shop ids */
|
|
7217
|
+
activeInShops: number[];
|
|
7218
|
+
/** @description A representation of a floating-point number with precise accuracy. */
|
|
7219
|
+
newPriceValue: { value: string };
|
|
7220
|
+
};
|
|
7221
|
+
|
|
7222
|
+
export type PutPromotionsParams = PromotionBody & PromotionIdParams & {
|
|
7223
|
+
/** @description Array of shop ids */
|
|
7224
|
+
activeInShops?: number[];
|
|
7225
|
+
/** @description A representation of a floating-point number with precise accuracy. */
|
|
7226
|
+
newPriceValue?: { value: string };
|
|
7227
|
+
};
|
|
7228
|
+
|
|
7229
|
+
type PromotionElementsBody = {
|
|
7230
|
+
/** @description Array of PromotionElement objects */
|
|
7231
|
+
elements: {
|
|
7232
|
+
/** @description ID */
|
|
7233
|
+
id: string;
|
|
7234
|
+
/** @description Promotion element type */
|
|
7235
|
+
type: "product" | "series" | "producer" | "category" | "menu";
|
|
7236
|
+
/** @description Promotion ID */
|
|
7237
|
+
promotionId: number;
|
|
7238
|
+
}[];
|
|
7239
|
+
};
|
|
7240
|
+
|
|
7241
|
+
export type PostPromotionsElementsParams = PromotionElementsBody;
|
|
7242
|
+
export type DeletePromotionsElementsParams = PromotionElementsBody;
|
|
7243
|
+
|
|
7244
|
+
export type SearchPromotionsHistoryParams = {
|
|
7245
|
+
filter: {
|
|
7246
|
+
/** @description Promotion ID */
|
|
7247
|
+
promotionId: number;
|
|
7248
|
+
};
|
|
7249
|
+
pagination?: PaginationParam;
|
|
7250
|
+
};
|
|
7251
|
+
|
|
7252
|
+
export type SearchPromotionsElementsParams = {
|
|
7253
|
+
/** @example {"types": ["category", "series"], "ids": ["213"], "promotionIds": [534]} */
|
|
7254
|
+
filter?: {
|
|
7255
|
+
/** @description Elements IDs */
|
|
7256
|
+
ids?: string[];
|
|
7257
|
+
/** @description Element types */
|
|
7258
|
+
types?: ("product" | "series" | "producer" | "category" | "menu")[];
|
|
7259
|
+
/** @description Promotion IDs */
|
|
7260
|
+
promotionIds?: number[];
|
|
7261
|
+
};
|
|
7262
|
+
pagination?: PaginationParam;
|
|
7263
|
+
orderBy?: {
|
|
7264
|
+
/** @default promotion_id */
|
|
7265
|
+
property?: "promotion_id" | "type" | "element_id";
|
|
7266
|
+
/** @default desc */
|
|
7267
|
+
orderByDirection?: "asc" | "desc";
|
|
7268
|
+
};
|
|
7269
|
+
};
|
|
7270
|
+
|
|
7271
|
+
export type SearchPromotionsListViewParams = {
|
|
7272
|
+
filter?: {
|
|
7273
|
+
ids?: number[] | null;
|
|
7274
|
+
name?: string;
|
|
7275
|
+
changeVisibility?: boolean;
|
|
7276
|
+
/** @description Array of shop ids */
|
|
7277
|
+
activeInShops?: number[];
|
|
7278
|
+
types?: ("promotion" | "special" | "discount" | "distinguished" | "bestseller" | "new")[];
|
|
7279
|
+
priceTypes?: ("retail" | "wholesale" | "pos")[];
|
|
7280
|
+
statuses?: ("waiting" | "active" | "closed")[];
|
|
7281
|
+
dateRange?: DateRangeParam;
|
|
7282
|
+
productsNotInPromotion?: number[] | null;
|
|
7283
|
+
};
|
|
7284
|
+
pagination?: PaginationParam;
|
|
7285
|
+
orderBy?: {
|
|
7286
|
+
/** @default id */
|
|
7287
|
+
property?: "id" | "name" | "start_time" | "end_time" | "new_price_value" | "new_price_end" | "elements_modification_date";
|
|
7288
|
+
/** @default desc */
|
|
7289
|
+
orderByDirection?: "asc" | "desc";
|
|
7290
|
+
};
|
|
7291
|
+
};
|
|
7292
|
+
|
|
7293
|
+
export type SearchPromotionsArchiveParams = {
|
|
7294
|
+
filter?: {
|
|
7295
|
+
shops?: number[];
|
|
7296
|
+
archivedDate?: DateRangeParam;
|
|
7297
|
+
};
|
|
7298
|
+
pagination?: PaginationParam;
|
|
7299
|
+
orderBy?: {
|
|
7300
|
+
/** @default id */
|
|
7301
|
+
property?: "id" | "shop_mask" | "archived_date";
|
|
7302
|
+
/** @default desc */
|
|
7303
|
+
orderByDirection?: "asc" | "desc";
|
|
7304
|
+
};
|
|
7305
|
+
};
|
|
7306
|
+
|
|
7307
|
+
export type PutPromotionsSettingsParams = {
|
|
7308
|
+
daysLeftToArchive?: number;
|
|
7309
|
+
daysLeftToRemove?: number;
|
|
7310
|
+
showPriceOnProductsList?: number;
|
|
7311
|
+
automaticallySuggestDefaultStartDate?: "on" | "off";
|
|
7312
|
+
automaticallySuggestDefaultEndDate?: "on" | "off";
|
|
7313
|
+
defaultStartDate?: number;
|
|
7314
|
+
defaultEndDate?: number;
|
|
7315
|
+
defaultStartTime?: number;
|
|
7316
|
+
defaultEndTime?: number;
|
|
7317
|
+
daysLeftToClose?: number;
|
|
7318
|
+
};
|
|
7319
|
+
|
|
7157
7320
|
export { };
|
package/dist/request.js
CHANGED
|
@@ -67,10 +67,13 @@ const checkNext = (request, response, logPage) => {
|
|
|
67
67
|
handlePagination(response.results_page, response.results_number_page, request, { results_page: response.results_page + 1 });
|
|
68
68
|
}
|
|
69
69
|
else if (response.pagination) {
|
|
70
|
+
console.log({ rp: request.params, qp: response.pagination });
|
|
70
71
|
request.params.pagination.page = response.pagination.resultsPage + 1;
|
|
71
72
|
handlePagination(response.pagination.resultsPage, response.pagination.resultsNumberPage, request);
|
|
72
73
|
}
|
|
73
74
|
else if (response.data?.pagination) {
|
|
75
|
+
if (!request.params.pagination)
|
|
76
|
+
request.params.pagination = {};
|
|
74
77
|
request.params.pagination.page = response.data.pagination.resultsPage + 1;
|
|
75
78
|
handlePagination(response.data.pagination.resultsPage, response.data.pagination.resultsNumberPage, request);
|
|
76
79
|
}
|
package/dist/responses.d.ts
CHANGED
|
@@ -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;
|
|
@@ -9146,4 +9149,112 @@ export type GetOrdersResponse = {
|
|
|
9146
9149
|
}[];
|
|
9147
9150
|
};
|
|
9148
9151
|
|
|
9152
|
+
type PromotionErrorEntry = {
|
|
9153
|
+
/** @description Error code. */
|
|
9154
|
+
code: string;
|
|
9155
|
+
/** @description Field associated with the error. */
|
|
9156
|
+
field: string | null;
|
|
9157
|
+
/** @description Error description. */
|
|
9158
|
+
message: string | null;
|
|
9159
|
+
/** @description Value associated with the error. */
|
|
9160
|
+
value: string | null;
|
|
9161
|
+
/** @description Unique identifier of the error (for support). */
|
|
9162
|
+
uid: string | null;
|
|
9163
|
+
};
|
|
9164
|
+
|
|
9165
|
+
type PromotionApiResponse<T> = {
|
|
9166
|
+
data: T;
|
|
9167
|
+
isError: boolean;
|
|
9168
|
+
errors: PromotionErrorEntry[];
|
|
9169
|
+
};
|
|
9170
|
+
|
|
9171
|
+
type PromotionData = {
|
|
9172
|
+
/** @description ID of promotion */
|
|
9173
|
+
promotionId: number;
|
|
9174
|
+
name: string;
|
|
9175
|
+
/** @description Array of shop ids */
|
|
9176
|
+
activeInShops: number[];
|
|
9177
|
+
types: ("promotion" | "special" | "discount" | "distinguished" | "bestseller" | "new")[];
|
|
9178
|
+
startTime: string;
|
|
9179
|
+
endTime: string;
|
|
9180
|
+
changeVisibility: boolean;
|
|
9181
|
+
autoUnpin: boolean;
|
|
9182
|
+
autoUnpinOwnStocks: boolean;
|
|
9183
|
+
priceType: "retail" | "wholesale" | "pos";
|
|
9184
|
+
/** @description A representation of a floating-point number with precise accuracy. */
|
|
9185
|
+
newPriceValue: { value: string };
|
|
9186
|
+
currency: string;
|
|
9187
|
+
newPriceDiscountType: "percent" | "minus" | "set";
|
|
9188
|
+
newPriceRound: "whole" | "first" | "second";
|
|
9189
|
+
newPriceEnd: number;
|
|
9190
|
+
netGross: "gross" | "net";
|
|
9191
|
+
chargeType: "lowest" | "sum";
|
|
9192
|
+
enableInMarketplaces: "y" | "n" | "yes_for_dynamic_pricing_products";
|
|
9193
|
+
status: "waiting" | "active" | "closed";
|
|
9194
|
+
elementsModificationDate: string | null;
|
|
9195
|
+
/** @description Promotion archive datetime — optional in list/get, required in archive */
|
|
9196
|
+
archivedDate?: string | null;
|
|
9197
|
+
/** @description Promotion elements count e.g. { "products": 1 } */
|
|
9198
|
+
elementsCount: Record<string, number>;
|
|
9199
|
+
elements?: unknown[];
|
|
9200
|
+
};
|
|
9201
|
+
|
|
9202
|
+
type PromotionArchiveData = Omit<PromotionData, "archivedDate" | "elementsCount" | "elements"> & {
|
|
9203
|
+
archivedDate: string | null;
|
|
9204
|
+
elementsCount: Record<string, never>;
|
|
9205
|
+
elements: unknown[];
|
|
9206
|
+
};
|
|
9207
|
+
|
|
9208
|
+
export type SearchPromotionsHistoryResponse = PromotionApiResponse<{
|
|
9209
|
+
list: {
|
|
9210
|
+
readonly id: number;
|
|
9211
|
+
readonly date: string;
|
|
9212
|
+
readonly login: string;
|
|
9213
|
+
readonly description: string;
|
|
9214
|
+
}[];
|
|
9215
|
+
pagination: PagedResponse;
|
|
9216
|
+
}>;
|
|
9217
|
+
|
|
9218
|
+
export type SearchPromotionsElementsResponse = PromotionApiResponse<{
|
|
9219
|
+
list: {
|
|
9220
|
+
id: string;
|
|
9221
|
+
type: "product" | "series" | "producer" | "category" | "menu";
|
|
9222
|
+
name: string;
|
|
9223
|
+
promotionId: number;
|
|
9224
|
+
/** @description Correlated elements id */
|
|
9225
|
+
correlatedElementsId?: number[];
|
|
9226
|
+
}[];
|
|
9227
|
+
pagination: PagedResponse;
|
|
9228
|
+
}>;
|
|
9229
|
+
|
|
9230
|
+
export type SearchPromotionsListViewResponse = PromotionApiResponse<{
|
|
9231
|
+
list: PromotionData[];
|
|
9232
|
+
pagination: PagedResponse;
|
|
9233
|
+
}>;
|
|
9234
|
+
|
|
9235
|
+
export type SearchPromotionsArchiveResponse = PromotionApiResponse<{
|
|
9236
|
+
list: PromotionArchiveData[];
|
|
9237
|
+
pagination: PagedResponse;
|
|
9238
|
+
}>;
|
|
9239
|
+
|
|
9240
|
+
export type GetPromotionsResponse = PromotionApiResponse<PromotionData>;
|
|
9241
|
+
export type GetPromotionsArchiveResponse = PromotionApiResponse<PromotionArchiveData>;
|
|
9242
|
+
|
|
9243
|
+
export type GetPromotionsSettingsResponse = PromotionApiResponse<{
|
|
9244
|
+
daysLeftToArchive: number;
|
|
9245
|
+
daysLeftToRemove: number;
|
|
9246
|
+
showPriceOnProductsList: number;
|
|
9247
|
+
automaticallySuggestDefaultStartDate: "on" | "off";
|
|
9248
|
+
automaticallySuggestDefaultEndDate: "on" | "off";
|
|
9249
|
+
defaultStartDate: number;
|
|
9250
|
+
defaultEndDate: number;
|
|
9251
|
+
defaultStartTime: number;
|
|
9252
|
+
defaultEndTime: number;
|
|
9253
|
+
daysLeftToClose: number;
|
|
9254
|
+
}>;
|
|
9255
|
+
|
|
9256
|
+
export type PromotionIdResponse = PromotionApiResponse<number>;
|
|
9257
|
+
|
|
9258
|
+
export type PromotionBoolResponse = PromotionApiResponse<boolean | null>;
|
|
9259
|
+
|
|
9149
9260
|
export { };
|
package/package.json
CHANGED
|
@@ -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
|
+
})
|