@congminh1254/shopee-sdk 0.7.0 → 0.8.0
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseManager } from "./base.manager.js";
|
|
2
2
|
import { ShopeeConfig } from "../sdk.js";
|
|
3
|
-
import { GetCommentParams, GetCommentResponse, ReplyCommentParams, ReplyCommentResponse, GetItemListParams, GetItemListResponse, GetItemBaseInfoParams, GetItemBaseInfoResponse } from "../schemas/product.js";
|
|
3
|
+
import { GetCommentParams, GetCommentResponse, ReplyCommentParams, ReplyCommentResponse, GetItemListParams, GetItemListResponse, GetItemBaseInfoParams, GetItemBaseInfoResponse, GetModelListParams, GetModelListResponse } from "../schemas/product.js";
|
|
4
4
|
export declare class ProductManager extends BaseManager {
|
|
5
5
|
constructor(config: ShopeeConfig);
|
|
6
6
|
/**
|
|
@@ -111,4 +111,23 @@ export declare class ProductManager extends BaseManager {
|
|
|
111
111
|
* - error_query_over_itemid_size: Too many item_ids in list
|
|
112
112
|
*/
|
|
113
113
|
getItemBaseInfo(params: GetItemBaseInfoParams): Promise<GetItemBaseInfoResponse>;
|
|
114
|
+
/**
|
|
115
|
+
* Get model list of an item
|
|
116
|
+
*
|
|
117
|
+
* Use this API to get model list of an item.
|
|
118
|
+
*
|
|
119
|
+
* @param params - The parameters for getting the model list
|
|
120
|
+
* @param params.item_id - The ID of the item
|
|
121
|
+
*
|
|
122
|
+
* @returns A promise that resolves to the model list response containing:
|
|
123
|
+
* - tier_variation: Variation config of item with option_list and name
|
|
124
|
+
* - model: List of model information including price_info, model_id, tier_index, model_sku, model_status, etc.
|
|
125
|
+
* - standardise_tier_variation: Standardise variation config of item (if available)
|
|
126
|
+
*
|
|
127
|
+
* @throws {Error} When the API request fails or returns an error:
|
|
128
|
+
* - error_item_not_found: Item_id is not found
|
|
129
|
+
* - error_param_shop_id_not_found: Shop_id is not found
|
|
130
|
+
* - error_item_not_found: Product not found
|
|
131
|
+
*/
|
|
132
|
+
getModelList(params: GetModelListParams): Promise<GetModelListResponse>;
|
|
114
133
|
}
|
|
@@ -143,5 +143,31 @@ export class ProductManager extends BaseManager {
|
|
|
143
143
|
});
|
|
144
144
|
return response;
|
|
145
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Get model list of an item
|
|
148
|
+
*
|
|
149
|
+
* Use this API to get model list of an item.
|
|
150
|
+
*
|
|
151
|
+
* @param params - The parameters for getting the model list
|
|
152
|
+
* @param params.item_id - The ID of the item
|
|
153
|
+
*
|
|
154
|
+
* @returns A promise that resolves to the model list response containing:
|
|
155
|
+
* - tier_variation: Variation config of item with option_list and name
|
|
156
|
+
* - model: List of model information including price_info, model_id, tier_index, model_sku, model_status, etc.
|
|
157
|
+
* - standardise_tier_variation: Standardise variation config of item (if available)
|
|
158
|
+
*
|
|
159
|
+
* @throws {Error} When the API request fails or returns an error:
|
|
160
|
+
* - error_item_not_found: Item_id is not found
|
|
161
|
+
* - error_param_shop_id_not_found: Shop_id is not found
|
|
162
|
+
* - error_item_not_found: Product not found
|
|
163
|
+
*/
|
|
164
|
+
async getModelList(params) {
|
|
165
|
+
const response = await ShopeeFetch.fetch(this.config, "/product/get_model_list", {
|
|
166
|
+
method: "GET",
|
|
167
|
+
auth: true,
|
|
168
|
+
params,
|
|
169
|
+
});
|
|
170
|
+
return response;
|
|
171
|
+
}
|
|
146
172
|
}
|
|
147
173
|
//# sourceMappingURL=product.manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.manager.js","sourceRoot":"","sources":["../../src/managers/product.manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"product.manager.js","sourceRoot":"","sources":["../../src/managers/product.manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,E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IAAI,EAAE,IAAI;YACV,MAAM,EAAE;gBACN,GAAG,MAAM;gBACT,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC;aAC5C;SACF,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,YAAY,CAAC,MAA0B;QAC3C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,yBAAyB,EACzB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,MAAM;SACP,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
package/lib/schemas/product.d.ts
CHANGED
|
@@ -602,3 +602,154 @@ export interface GetItemBaseInfoResponse extends BaseResponse {
|
|
|
602
602
|
tax_info?: TaxInfo;
|
|
603
603
|
};
|
|
604
604
|
}
|
|
605
|
+
/**
|
|
606
|
+
* Parameters for getting model list of an item
|
|
607
|
+
*/
|
|
608
|
+
export type GetModelListParams = {
|
|
609
|
+
/** The ID of the item */
|
|
610
|
+
item_id: number;
|
|
611
|
+
};
|
|
612
|
+
/**
|
|
613
|
+
* Option information in variation
|
|
614
|
+
*/
|
|
615
|
+
export interface VariationOption {
|
|
616
|
+
/** Option name */
|
|
617
|
+
option: string;
|
|
618
|
+
/** Image information for the option */
|
|
619
|
+
image?: {
|
|
620
|
+
/** Id of image */
|
|
621
|
+
image_id?: string;
|
|
622
|
+
/** Url of image */
|
|
623
|
+
image_url?: string;
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Tier variation information
|
|
628
|
+
*/
|
|
629
|
+
export interface TierVariation {
|
|
630
|
+
/** List of options for this variation */
|
|
631
|
+
option_list: VariationOption[];
|
|
632
|
+
/** Variation name */
|
|
633
|
+
name: string;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Model price information
|
|
637
|
+
*/
|
|
638
|
+
export interface ModelPriceInfo {
|
|
639
|
+
/** Currency for the item price */
|
|
640
|
+
currency?: string;
|
|
641
|
+
/** Current price of item */
|
|
642
|
+
current_price: number;
|
|
643
|
+
/** Original price of item */
|
|
644
|
+
original_price: number;
|
|
645
|
+
/** Original price of item after tax */
|
|
646
|
+
inflated_price_of_original_price: number;
|
|
647
|
+
/** Current price of item after tax */
|
|
648
|
+
inflated_price_of_current_price: number;
|
|
649
|
+
/** SIP item price. Only returned for SIP primary shop */
|
|
650
|
+
sip_item_price?: number;
|
|
651
|
+
/** SIP item price source, could be manual or auto. Only returned for SIP primary shop */
|
|
652
|
+
sip_item_price_source?: string;
|
|
653
|
+
/** The currency of sip_item_price. Only returned for SIP primary shop */
|
|
654
|
+
sip_item_price_currency?: string;
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Pre-order information for the model
|
|
658
|
+
*/
|
|
659
|
+
export interface ModelPreOrder {
|
|
660
|
+
/** Whether the model is on pre-order */
|
|
661
|
+
is_pre_order: boolean;
|
|
662
|
+
/** The days to ship for pre-order */
|
|
663
|
+
days_to_ship: number;
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Model stock information
|
|
667
|
+
*/
|
|
668
|
+
export interface ModelStockInfoV2 {
|
|
669
|
+
/** Stock summary info */
|
|
670
|
+
summary_info?: StockSummaryInfo;
|
|
671
|
+
/** Seller stock */
|
|
672
|
+
seller_stock?: SellerStock[];
|
|
673
|
+
/** Shopee stock */
|
|
674
|
+
shopee_stock?: ShopeeStock[];
|
|
675
|
+
/** Advance stock details */
|
|
676
|
+
advance_stock?: AdvanceStock;
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Model dimension information
|
|
680
|
+
*/
|
|
681
|
+
export interface ModelDimension {
|
|
682
|
+
/** The height of package for this model, the unit is CM */
|
|
683
|
+
package_height: number;
|
|
684
|
+
/** The length of package for this model, the unit is CM */
|
|
685
|
+
package_length: number;
|
|
686
|
+
/** The width of package for this model, the unit is CM */
|
|
687
|
+
package_width: number;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Individual model information
|
|
691
|
+
*/
|
|
692
|
+
export interface ModelInfo {
|
|
693
|
+
/** Price information for this model */
|
|
694
|
+
price_info: ModelPriceInfo[];
|
|
695
|
+
/** Model ID */
|
|
696
|
+
model_id?: number;
|
|
697
|
+
/** Tier index of this model */
|
|
698
|
+
tier_index?: number[];
|
|
699
|
+
/** Current promotion ID of this model */
|
|
700
|
+
promotion_id?: number;
|
|
701
|
+
/** SKU of this model */
|
|
702
|
+
model_sku?: string;
|
|
703
|
+
/** The model status, either MODEL_NORMAL or MODEL_UNAVAILABLE */
|
|
704
|
+
model_status?: string;
|
|
705
|
+
/** Pre-order information */
|
|
706
|
+
pre_order?: ModelPreOrder;
|
|
707
|
+
/** Stock information v2 */
|
|
708
|
+
stock_info_v2?: ModelStockInfoV2;
|
|
709
|
+
/** GTIN code (only available for TW seller and BR local seller) */
|
|
710
|
+
gtin_code?: string;
|
|
711
|
+
/** The weight of this model, the unit is KG */
|
|
712
|
+
weight?: string;
|
|
713
|
+
/** The dimension of this model */
|
|
714
|
+
dimension?: ModelDimension;
|
|
715
|
+
/** Whether model is fulfillment by shopee */
|
|
716
|
+
is_fulfillment_by_shopee?: boolean;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Standardized variation option
|
|
720
|
+
*/
|
|
721
|
+
export interface StandardVariationOption {
|
|
722
|
+
/** Standardize Option ID */
|
|
723
|
+
variation_option_id?: number;
|
|
724
|
+
/** Standardize Option Name */
|
|
725
|
+
variation_option_name?: string;
|
|
726
|
+
/** ID of image */
|
|
727
|
+
image_id?: string;
|
|
728
|
+
/** URL of image */
|
|
729
|
+
image_url?: string;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Standardized variation information
|
|
733
|
+
*/
|
|
734
|
+
export interface StandardiseTierVariation {
|
|
735
|
+
/** Standardize Variation ID */
|
|
736
|
+
variation_id?: number;
|
|
737
|
+
/** Standardize Variation Name */
|
|
738
|
+
variation_name?: string;
|
|
739
|
+
/** Standardize Variation Group ID */
|
|
740
|
+
variation_group_id?: number;
|
|
741
|
+
/** Standardize Variation Option List */
|
|
742
|
+
variation_option_list?: StandardVariationOption[];
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Response for getting model list
|
|
746
|
+
*/
|
|
747
|
+
export interface GetModelListResponse extends FetchResponse<{
|
|
748
|
+
/** Variation config of item */
|
|
749
|
+
tier_variation: TierVariation[];
|
|
750
|
+
/** Model list */
|
|
751
|
+
model: ModelInfo[];
|
|
752
|
+
/** Standardise Variation config of item */
|
|
753
|
+
standardise_tier_variation?: StandardiseTierVariation[];
|
|
754
|
+
}> {
|
|
755
|
+
}
|