import { AxiosRequestConfig, AxiosInstance } from 'axios'; interface ShopeeTokens { access_token: string; refresh_token: string; } interface ShopeeTokensStorage { /** * Provide a function to save tokens. * @param shopId primary reference to save (and retrieve) the token * @param tokens tokens to be saved */ saveTokens(shopId: string, tokens: ShopeeTokens): Promise; /** * Provide a function to fetch the token, return null if the storage cannot find the token. * @param shopId primary reference to load the tokens */ loadTokens(shopId: string): Promise; } declare class InMemoryTokenStorage implements ShopeeTokensStorage { private store; constructor(); saveTokens(shopId: string, tokens: ShopeeTokens): Promise; loadTokens(shopId: string): Promise; } /** * A Class that handle request signing operation */ declare class RequestSigner { storage: ShopeeTokensStorage; readonly partnerId: string; readonly partnerKey: string; readonly shopId: string; constructor(storage: ShopeeTokensStorage, partnerId: string, partnerKey: string, shopId?: string); /** * Create the AxiosRequestConfigInterceptor */ interceptor(): (config: AxiosRequestConfig) => Promise; /** * Create new RequestSigner with specific shopId. * * @param shopId * @returns */ withShopId(shopId: string): RequestSigner; signNoAccessToken(path: string): { timest: string; signature: string; }; sign(path: string): Promise<{ timest: string; signature: string; accessToken?: string; }>; } declare const createSignature: (path: string, partnerId: string, partnerKey: string, accessToken?: string, shopId?: string) => { timest: string; signature: string; accessToken?: string | undefined; }; interface ShopeeBaseResponse { request_id: string; error?: string; message: string; } interface ShopeeAccessTokenResponse extends ShopeeBaseResponse { refresh_token: string; access_token: string; expire_in: number; merchant_id_list?: number[]; shop_id_list?: number[]; } /** * @see https://open.shopee.com/documents/v2/v2.product.get_category?module=89&type=1 * * Example Payload * * ```json * { * "category_id": 100001, * "parent_category_id": 0, * "original_category_name": "Health", * "display_category_name": "Health", * "has_children": true * } * ``` */ interface ShopeeCategoryInfo { category_id: number; parent_category_id: number; original_category_name: string; display_category_name: string; has_children: boolean; } interface ShopeeCategoryResponse extends ShopeeBaseResponse { warning: string; response: { category_list: ShopeeCategoryInfo[]; }; } interface SipAffiliateShopInfo { affi_shop_id: string; region: string; } /** * @see https://open.shopee.com/documents/v2/v2.shop.get_shop_info?module=92&type=1 * * Example * * ```json * { * "shop_name": "auto_gen_90c84fb", * "region": "TH", * "status": "NORMAL", * "is_sip": false, * "is_cb": false, * "is_cnsc": false, * "request_id": "b15066953fc6ddb50b247df0cd35d020", * "auth_time": 1667450081, * "expire_time": 1699027199, * "error": "", * "message": "", * "shop_cbsc": "UNUPGRADED" * } * ``` */ interface ShopeeShopInfoResponse extends ShopeeBaseResponse { shop_name: string; region: string; status: 'BANNED' | 'FROZEN' | 'NORMAL'; sip_affi_shops: SipAffiliateShopInfo[]; is_cb: boolean; is_cnsc: boolean; shop_cbsc: boolean; auth_time: number; expire_time: number; is_sip: boolean; } /** * @see https://open.shopee.com/documents/v2/v2.shop.get_profile?module=92&type=1 * * Example: * * ``` * { * "request_id": "902f5a3356b507cc5fdfc11da3d65c20", * "error": "", * "message": "", * "response": { * "shop_name": "auto_gen_90c84fb", * "shop_logo": "", * "description": "" * } * } * ``` */ interface ShopeeProfileInfoResponse extends ShopeeBaseResponse { response: { shop_logo: string; description: string; shop_name: string; }; } declare type ShopeeProductItemStatus = 'NORMAL' | 'UNLIST' | 'BANNED' | 'DELETED'; /** * @see https://open.shopee.com/documents/v2/v2.product.get_item_list?module=89&type=1 * * Example Payload * * ```json * { * "error": "", * "message": "", * "warning": "", * "request_id": "159ef3b9216fd3e799a4db4453c22720", * "response": { * "item": [ * { * "item_id": 1830497, * "item_status": "NORMAL", * "update_time": 1667488380 * } * ], * "total_count": 1, * "has_next_page": false * } * }, * ``` */ interface ShopeeProductItemId { item_id: number; item_status: ShopeeProductItemStatus; update_time: number; } interface ShopeeProductGetItemListResponse extends ShopeeBaseResponse { warning: string; response: { item: ShopeeProductItemId[]; total_count: number; has_next_page: boolean; next_offset: number; }; } declare type ShopeeProductAttributeInputValidationType = 'INT_TYPE' | 'STRING_TYPE' | 'ENUM_TYPE' | 'FLOAT_TYPE' | 'DATE_TYPE' | 'TIMESTAMP_TYPE'; declare type ShopeeProductAttributeFormatType = 'NORMAL' | 'QUANTITATIVE'; declare type ShopeeProductAttributeDateFormatType = 'YEAR_MONTH_DATE' | 'YEAR_MONTH'; declare type ShopeeProductAttributeInputType = 'DROP_DOWN' | 'MULTIPLE_SELECT' | 'TEXT_FILED' | 'COMBO_BOX' | 'MULTIPLE_SELECT_COMBO_BOX'; interface ShopeeProductAttributeBrand { parent_brand_id: number; } interface ShopeeProductAttributeParentAttribute { parent_attribute_id: number; parent_value_id: number; } interface ShopeeProductAttributeValue { value_id: number; original_value_name: string; display_value_name: string; value_unit: string; parent_attribute_list: ShopeeProductAttributeParentAttribute[]; parent_brand_list: ShopeeProductAttributeBrand[]; } interface ShopeeProductAttribute { attribute_id: number; original_attribute_name: string; display_attribute_name: string; is_mandatory: boolean; input_validation_type: ShopeeProductAttributeInputValidationType; format_type: ShopeeProductAttributeFormatType; date_format_type: ShopeeProductAttributeDateFormatType; input_type: ShopeeProductAttributeInputType; attribute_unit: string[]; attribute_value_list: ShopeeProductAttributeValue[]; max_input_value_number: number; } /** * @see https://open.shopee.com/documents/v2/v2.product.get_attributes?module=89&type=1 * * Example Payload * * ```json * { * "error": "", * "message": "", * "warning": "", * "request_id": "159ef3b9216fd3e799a4db4453c22720", * "response": { * "attribute_list": [ * { * "attribute_id": 100002, * "original_attribute_name": "Aquarium Decoration Type", * "display_attribute_name": "Aquarium Decoration Type", * "is_mandatory": false, * "input_validation_type": "STRING_TYPE", * "format_type": "NORMAL", * "date_format_type": "YEAR_MONTH_DATE", * "input_type": "COMBO_BOX", * "attribute_unit": [], * "attribute_value_list": [], * "max_input_value_number": 1 * } * ] * } * }, * ``` */ interface ShopeeProductGetAttributesResponse extends ShopeeBaseResponse { warning: string; response: { attribute_list: ShopeeProductAttribute[]; }; } interface ShopeeProductBaseInfoDescriptionFieldList { field_type: string; text?: string; image_info?: { image_id: string; image_url: string; }; } interface ShopeeProductBaseInfoLogisticInfo { logistic_id: number; logistic_name: string; enabled: boolean; shipping_fee: number; is_free: boolean; } interface ShopeeProductBaseInfoAttributeValue { value_id: number; original_value_name: string; value_unit: string; } interface ShopeeProductBaseInfoSellerStock { location_id: string; stock: number; } interface ShopeeProductBaseInfoPriceInfo { currency: string; original_price: number; current_price: number; } interface ShopeeProductBaseInfoAttribute { attribute_id: number; original_attribute_name: number; is_mandatory: boolean; attribute_value_list: ShopeeProductBaseInfoAttributeValue[]; } interface ShopeeProductBaseInfo { item_id: number; category_id: number; item_name: string; item_sku: string; create_time: number; update_time: number; attribute_list: ShopeeProductBaseInfoAttribute[]; price_info: ShopeeProductBaseInfoPriceInfo[]; stock_info_v2: { summary_info: { total_reserved_stock: number; total_available_stock: number; }; seller_stock: ShopeeProductBaseInfoSellerStock[]; }; image: { image_url_list: string[]; image_id_list: string[]; }; weight: string; dimension: { package_length: number; package_width: number; package_height: number; }; logistic_info: ShopeeProductBaseInfoLogisticInfo[]; pre_order: { is_pre_order: boolean; days_to_ship: number; }; condition: string; size_chart: string; item_status: string; has_model: boolean; promotion_id: number; brand?: { brand_id: number; original_brand_name: string; }; tax_info: { ncm: number; same_state_cfop: number; diff_state_cfop: number; csosn: number; origin: number; }; description_type: string; description_info: { extended_description: { field_list: ShopeeProductBaseInfoDescriptionFieldList[]; }; }; } /** * Example * * ``` * { "error": "", "message": "", "warning": "Normal_stock will be offline under Oct 15th, please switch to a new field seller_stock as soon as possible.", "request_id": "249c3b5cb1f699ebac6e52c787435b20", "response": { "item_list": [ { "item_id": 1830743, "category_id": 101941, "item_name": "ปุ่มเทสบนคีย์บอร์ดสีแดง", "item_sku": "", "create_time": 1667524089, "update_time": 1667524089, "price_info": [ { "currency": "THB", "original_price": 551, "current_price": 551 } ], "stock_info": [ { "stock_type": 2, "current_stock": 30, "normal_stock": 30, "reserved_stock": 0 } ], "image": { "image_url_list": [ "https://cf.shopee.co.th/file/74a228cdbecc3050b8198e0610bd9038" ], "image_id_list": [ "74a228cdbecc3050b8198e0610bd9038" ] }, "weight": "0.200", "dimension": { "package_length": 10, "package_width": 10, "package_height": 10 }, "logistic_info": [ { "logistic_id": 70020, "logistic_name": "DHL Domestic", "enabled": true, "is_free": false, "estimated_shipping_fee": 20 }, { "logistic_id": 70023, "logistic_name": "Best Express", "enabled": false, "is_free": false, "estimated_shipping_fee": 20 } ], "pre_order": { "is_pre_order": false, "days_to_ship": 2 }, "condition": "NEW", "size_chart": "", "item_status": "NORMAL", "has_model": false, "promotion_id": 0, "brand": { "brand_id": 0, "original_brand_name": "NoBrand" }, "item_dangerous": 0, "description_info": { "extended_description": { "field_list": [ { "field_type": "text", "text": "ปุ่มบน Keyboard สีแดงคำว่า \"Test\"" } ] } }, "description_type": "extended", "stock_info_v2": { "summary_info": { "total_reserved_stock": 0, "total_available_stock": 30 }, "seller_stock": [ { "location_id": "", "stock": 30 } ], "shopee_stock": [ { "location_id": "", "stock": 0 } ] } }, { "item_id": 1830497, "category_id": 102057, "item_name": "Tobolone Peak สุดที่ปลายเขา", "item_sku": "", "create_time": 1667488380, "update_time": 1667488380, "image": { "image_url_list": [ "https://cf.shopee.co.th/file/2b3a62ca1212d0feb36f897e7c618734" ], "image_id_list": [ "2b3a62ca1212d0feb36f897e7c618734" ] }, "weight": "0.300", "dimension": { "package_length": 30, "package_width": 15, "package_height": 30 }, "logistic_info": [ { "logistic_id": 70020, "logistic_name": "DHL Domestic", "enabled": true, "is_free": false, "estimated_shipping_fee": 20 }, { "logistic_id": 70023, "logistic_name": "Best Express", "enabled": false, "is_free": false, "estimated_shipping_fee": 20 } ], "pre_order": { "is_pre_order": false, "days_to_ship": 2 }, "condition": "NEW", "size_chart": "", "item_status": "NORMAL", "has_model": true, "brand": { "brand_id": 0, "original_brand_name": "NoBrand" }, "item_dangerous": 0, "description_info": { "extended_description": { "field_list": [ { "field_type": "text", "text": "เพิ่มน้ำหนักเป็น 10ๆ เท่าแค่กินเยอะๆ" } ] } }, "description_type": "extended" } ] } } ``` */ interface ShopeeProductItemBaseInfoResponse extends ShopeeBaseResponse { warning: string; response: { item_list: ShopeeProductBaseInfo[]; }; } interface ShopeeProductModelListTierVariationOptionList { option: string; image: { image_id: string; image_url: string; }; } interface ShopeeProductModelListTierVariation { name: string; option_list: ShopeeProductModelListTierVariationOptionList[]; } interface ShopeeProductModelListModelPriceInfo { current_price: number; original_price: number; inflated_price_of_current_price: number; inflated_price_of_original_price: number; sip_item_price?: number; sip_item_price_source?: number; currency?: string; } interface ShopeeProductModelListModel { model_id: number; tier_index: number[]; promotion_id: number; model_sku: string; gtin_code: string; price_info: ShopeeProductModelListModelPriceInfo[]; pre_order: { is_pre_order: boolean; days_to_ship: number; }; summary_info: { total_reserved_stock: number; total_available_stock: number; }; seller_stock: ShopeeProductBaseInfoSellerStock[]; } /** * Example * * ``` * { "error": "", "message": "", "warning": "", "request_id": "b338afa23ffd3ea3d46dc0dc5998d225", "response": { "tier_variation": [ { "name": "size", "option_list": [ { "option": "XS" }, { "option": "S" }, { "option": "M" } ] } ], "model": [ { "model_id": 9182545, "promotion_id": 0, "tier_index": [ 1 ], "price_info": [ { "current_price": 800, "original_price": 800, "inflated_price_of_current_price": 800, "inflated_price_of_original_price": 800 } ], "model_sku": "3344", "pre_order": { "is_pre_order": false, "days_to_ship": 2 }, "stock_info_v2": { "summary_info": { "total_reserved_stock": 0, "total_available_stock": 100 }, "seller_stock": [ { "location_id": "TWZ", "stock": 100 } ] } }, { "model_id": 9182546, "promotion_id": 0, "tier_index": [ 0 ], "price_info": [ { "current_price": 800, "original_price": 800, "inflated_price_of_current_price": 800, "inflated_price_of_original_price": 800 } ], "model_sku": "1123", "pre_order": { "is_pre_order": false, "days_to_ship": 2 }, "stock_info_v2": { "summary_info": { "total_reserved_stock": 0, "total_available_stock": 100 }, "seller_stock": [ { "location_id": "TWZ", "stock": 100 } ] } } ] } } ``` */ interface ShopeeProductModelListResponse extends ShopeeBaseResponse { warning: string; response: { tier_variation: { option_list: ShopeeProductModelListTierVariation[]; }; model: ShopeeProductModelListModel; }; } declare type ShopeeOrderStatus = 'UNPAID' | 'READY_TO_SHIP' | 'PROCESSED' | 'SHIPPED' | 'COMPLETED' | 'IN_CANCEL' | 'CANCELLED' | 'INVOICE_PENDING'; /** * @see https://open.shopee.com/documents/v2/v2.order.get_order_list?module=94&type=1 * * Example Payload * * ```json * { * "error": "", * "message": "", * "warning": "", * "request_id": "b937c04e554847789cbf3fe33a0ad5f1", * "response": { * "mode": true, * "next_cursor":"20", * "order_list": [ * { * "order_sn": "string" * }, * { * "order_sn": "string" * } * ], * } * }, * ``` */ interface ShopeeOrderList { order_sn: string; } interface ShopeeGetOrderListResponse extends ShopeeBaseResponse { error: string; response: { more: boolean; next_cursor: string; order_list: ShopeeOrderList[]; }; } interface ShopeeOrderInvoice { number: string; series_number: string; access_key: string; issue_date: number; total_value: number; products_total_value: number; tax_code: string; } interface ShopeeOrderPackageItem { item_id: number; model_id: number; model_quantity: number; } interface ShopeeOrderPackage { package_number: string; logistics_status: string; shipping_carrier: string; parcel_chargeable_weight_gram: number; item_list: ShopeeOrderPackageItem[]; } interface ShopeeOrderItem { item_id: number; item_name: string; item_sku: string; model_id: number; model_name: string; model_sku: string; model_quantity_purchased: number; model_original_price: number; model_discounted_price: number; wholesale: boolean; weight: number; add_on_deal: boolean; main_item: boolean; add_on_deal_id: number; promotion_type: string; promotion_id: number; order_item_id: number; promotion_group_id: number; image_info: { image_url: string; product_location_id: string[]; }; } interface ShopeeOrderRecipientAddress { name: string; phone: string; town: string; district: string; city: string; state: string; region: string; zipcode: string; full_address: string; } interface ShopeeOrder { order_sn: string; region: string; currency: string; cod: boolean; total_amount: number; order_status: string; shipping_carrie: string; payment_method: string; estimated_shipping_fee: number; message_to_seller: string; create_time: number; update_time: number; days_to_ship: number; ship_by_date: number; buyer_user_id: number; buyer_username: number; actual_shipping_fee: number; goods_to_declare: boolean; note: string; note_update_time: number; recipient_address: ShopeeOrderRecipientAddress; item_list: ShopeeOrderItem; pay_time: number; dropshipper: string; dropshipper_phone: string; split_up: boolean; buyer_cancel_reason: string; cancel_by: string; cancel_reason: string; actual_shipping_fee_confirmed: boolean; buyer_cpf_id: string; fulfillment_flag: string; pickup_done_time: number; package_list: ShopeeOrderPackage[]; invoice_data: ShopeeOrderInvoice; checkout_shipping_carrier: string; reverse_shipping_fee: number; order_chargeable_weight_gram: number; edt_from: number; edt_to: number; prescription_images: string[]; prescription_check_status: number; } /** * Example * * ``` * { "error": "", "message": "", "response": { "order_list": [ { " checkout_shipping_carrier": null, " reverse_shipping_fee.": null, "actual_shipping_fee ": null, "actual_shipping_fee_confirmed": false, "buyer_cancel_reason": "", "buyer_cpf_id": null, "buyer_user_id": 258065, "buyer_username": "drcbuy_uat_sg_1", "cancel_by": "", "cancel_reason": "", "cod": false, "create_time": 1632973421, "currency": "SGD", "days_to_ship": 3, "dropshipper": "", "dropshipper_phone": "", "estimated_shipping_fee": 3.99, "fulfillment_flag": "fulfilled_by_local_seller", "goods_to_declare": false, "invoice_data": null, "item_list": [ { "item_id": 101513055, "item_name": "Vitamin Bottles - Acc", "item_sku": "", "model_id": 0, "model_name": "", "model_sku": "", "model_quantity_purchased": 1, "model_original_price": 3000, "model_discounted_price": 3000, "wholesale": false, "weight": 0.3, "add_on_deal": false, "main_item": false, "add_on_deal_id": 0, "promotion_type": "", "promotion_id": 0, "order_item_id": 101513055, "promotion_group_id": 0, "image_info": { "image_url": "https://cf.shopee.sg/file/fe05b113170c5e97ed515cf0f2fb9c0e_tn" }, "product_location_id": ["IDL", "IDG"] } ], "message_to_seller": "", "note": "", "note_update_time": 0, "order_sn": "210930KJDNF06T", "order_status": "COMPLETED", "package_list": [ { "package_number": "OFG86672620092786", "logistics_status": "LOGISTICS_DELIVERY_DONE", "shipping_carrier": "Singpost POPstation - LPS (seller)", "item_list": [ { "item_id": 101513055, "model_id": 0, "model_quantity": 1 } ] } ], "pay_time": 1632973437, "payment_method": "Credit/Debit Card", "pickup_done_time": 1632973711, "recipient_address": { "name": "Buyer", "phone": "******10", "town": "", "district": "", "city": "", "state": "", "region": "SG", "zipcode": "820116", "full_address": "BLOCK 116, EDGEFIELD PLAINS, #05-334, SG, 820116" }, "region": "SG", "reverse_shipping_fee": 0, "ship_by_date": 1633405439, "shipping_carrier": "Singpost POPstation - LPS (seller)", "split_up": false, "total_amount": 2988.99, "update_time": 1633001809 } ] }, "request_id": "971b45d6a002bfc680019320c9a685a0" } ``` */ interface ShopeeOrdersDetailResponse extends ShopeeBaseResponse { request_id: string; error: string; response: { order_list: ShopeeOrder[]; }; } interface ShopeeUpdateProductStockInputSellerStock { location_id?: string; stock: number; } interface ShopeeUpdateProductStockInputStock { model_id?: number; seller_stock: ShopeeUpdateProductStockInputSellerStock[]; } interface ShopeeUpdateProductStockInput { item_id: number; stock_list: ShopeeUpdateProductStockInputStock[]; } interface ShopeeUpdateProductStockFailure { model_id: number; failed_reason: string; } interface ShopeeUpdateProductStockSuccess { model_id: number; location_id: string; stock: number; } /** * @see https://open.shopee.com/documents/v2/v2.product.update_stock?module=89&type=1 * * Example * * { "error": "-", "message": "-", "warning": "-", "request_id": "-", "response": { "failure_list": [ { "model_id": 0, "failed_reason": "-" } ], "success_list": [ { "model_id": 0, "location_id": "-", "stock": 0 } ] } } */ interface ShopeeUpdateProductStockResponse extends ShopeeBaseResponse { error: string; message: string; warning: string; request_id: string; response: { failure_list: ShopeeUpdateProductStockFailure[]; success_list: ShopeeUpdateProductStockSuccess[]; }; } interface ShopeeUpdateProductPriceInputPrice { model_id?: number; original_price: number; } interface ShopeeUpdateProductPriceInput { item_id: number; price_list: ShopeeUpdateProductPriceInputPrice[]; } interface ShopeeUpdateProductPriceFailure { model_id: number; failed_reason: string; } interface ShopeeUpdateProductPriceSuccess { model_id: number; original_price: number; } /** * @see https://open.shopee.com/documents/v2/v2.product.update_price?module=89&type=1 * * Example * * { "error": "", "message": "", "warning": "", "request_id": "aaaaaaa", "response": { "failure_list": [{ "model_id": 3456, "failed_reason": "fail" }], "success_list": [{ "model_id": 0, "original_price": 11.11 }] } } */ interface ShopeeUpdateProductPriceResponse extends ShopeeBaseResponse { error: string; message: string; warning: string; request_id: string; response: { failure_list: ShopeeUpdateProductPriceFailure[]; success_list: ShopeeUpdateProductPriceSuccess[]; }; } interface ShopeeGetAddressListAddress { address_id: number; region: string; state: string; city: string; address: string; zipcode: string; district: string; town: string; address_type: "DEFAULT_ADDRESS" | "PICK_UP_ADDRESS" | "RETURN_ADDRESS"; } /** * @see https://open.shopee.com/documents/v2/v2.logistics.get_address_list?module=95&type=1 * * Example Payload * * ```json { "error": "", "message": "", "response": { "show_pickup_address": false, "address_list": [ { "address_id": 1173, "region": "TH", "state": "จังหวัดกาฬสินธุ์", "city": "อำเภอห้วยผึ้ง", "address": "unit 1, building 2", "zipcode": "46240", "district": "", "town": "", "address_type": [] }, { "address_id": 1191, "region": "TH", "state": "จังหวัดชลบุรี", "city": "อำเภอเกาะสีชัง", "address": "unit 123", "zipcode": "20120", "district": "", "town": "", "address_type": [ "PICK_UP_ADDRESS", "RETURN_ADDRESS" ] }, { "address_id": 1238, "region": "TH", "state": "จังหวัดชลบุรี", "city": "อำเภอพานทอง", "address": "2312312313", "zipcode": "12323", "district": "", "town": "", "address_type": [] } ] }, "request_id": "675015f4f59943a39f2f69c22da431f8" } * ``` */ interface ShopeeGetAddressListResponse extends ShopeeBaseResponse { error: string; message: string; response: { show_pickup_address: boolean; address_list: ShopeeGetAddressListAddress[]; }; } interface ShopeeHandleBuyerCancellationInput { order_sn: string; operation: 'ACCEPT' | 'REJECT'; } /** * @see https://open.shopee.com/documents/v2/v2.order.handle_buyer_cancellation?module=94&type=1 * * Example Payload * * ```json * { "request_id": "b937c04e554847789cbf3fe33a0ad5f1", "error": "", "message": "", "response": { "update_time": 14981918191 } * }, * ``` */ interface ShopeeHandleBuyerCancellationResponse extends ShopeeBaseResponse { request_id: string; error: string; message: string; response: { update_time: number; }; } interface ShopeeCancelOrderItem { item_id: number; model_id: number; } interface ShopeeCancelOrderInput { order_sn: string; cancel_reason: 'OUT_OF_STOCK' | 'CUSTOMER_REQUEST' | 'UNDELIVERABLE_AREA' | 'COD_NOT_SUPPORTED'; item_list: ShopeeCancelOrderItem[]; } /** * @see https://open.shopee.com/documents/v2/v2.order.cancel_order?module=94&type=1 * * Example Payload * * ```json * { "error": "", "message": "", "request_id": "2ead12d461c34e7c9275c42c2f70fa7d", "response": { "update_time": 1603184533 } * }, * ``` */ interface ShopeeCancelOrderResponse extends ShopeeBaseResponse { error: string; message: string; request_id: string; response: { update_time: number; }; } interface ShopeeGetShippingParameterTimeSlot { date: number; time_text: string; pickup_time_id: string; } interface ShopeeGetShippingParameterAddress { address_id: number; region: string; state: string; city: string; district: string; town: string; address: string; zipcode: string; address_flag: string; time_slot_list: ShopeeGetShippingParameterTimeSlot[]; } interface ShopeeGetShippingParameterPickup { address_list: ShopeeGetShippingParameterAddress[]; } interface ShopeeGetShippingParameterSlug { slug: string; slug_name: string; } interface ShopeeGetShippingParameterBranch { branch_id: number; region: string; state: string; city: string; address: string; zipcode: string; district: string; town: string; } interface ShopeeGetShippingParameterInfo { dropoff: string[]; pickup: string[]; non_integrated: string[]; } interface ShopeeGetShippingParameterDropoff { branch_list: ShopeeGetShippingParameterBranch[]; slug_list: ShopeeGetShippingParameterSlug[]; } interface ShopeeGetShippingParameterResponse extends ShopeeBaseResponse { request_id: string; message: string; error?: string; response: { info_needed: ShopeeGetShippingParameterInfo; dropoff: ShopeeGetShippingParameterDropoff; pickup: ShopeeGetShippingParameterPickup; }; } interface ShopeeShipOrderPickup { address_id?: number; pickup_time_id?: string; tracking_number?: string; } interface ShopeeShipOrderDropOff { branch_id?: number; sender_real_name?: string; tracking_number?: string; slug?: string; } interface ShopeeShipOrderNonIntegrated { tracking_number?: string; } interface ShopeeShipOrderInput { order_sn: string; package_number?: string; pickup?: ShopeeShipOrderPickup; dropoff?: ShopeeShipOrderDropOff; non_integrated?: ShopeeShipOrderNonIntegrated; } interface ShopeeShipOrderResponse extends ShopeeBaseResponse { request_id: string; error: string; message: string; } declare class ShopContext { readonly host: string; readonly shopId: string; readonly signer: RequestSigner; readonly refresher: () => Promise; readonly ax: AxiosInstance; constructor(host: string, shopId: string, signer: RequestSigner, refresher: () => Promise); /** * List all categories provided by Shopee's service * * @param language */ getCategory(language?: string): Promise; /** * Fetch Shop's Info * * @see https://open.shopee.com/documents/v2/v2.shop.get_shop_info?module=92&type=1 */ getShopInfo(): Promise; /** * Fetch Shop's Profile Info * * @see https://open.shopee.com/documents/v2/v2.shop.get_profile?module=92&type=1 */ getProfileInfo(): Promise; /** * Fetch product item id from Shopee * * @see https://open.shopee.com/documents/v2/v2.product.get_item_list?module=89&type=1 * * @param offset default is 0 * @param pageSize * @param opts.updateTimeFrom * @param opts.updateTimeTo * @param opts.itemStatus */ getProductItemList(offset?: number, pageSize?: number, opts?: Partial<{ updateTimeFrom: number; updateTimeTo: number; itemStatus: ShopeeProductItemStatus[]; }>): Promise; /** * Fetch attributes associated with given specific category. * * @param categoryId * @param language * @returns */ getProductAttributes(categoryId: number, language?: string): Promise; /** * Fetch list of Shopee product detail by productId * see https://open.shopee.com/documents/v2/v2.product.get_item_base_info?module=89&type=1 * * @param productIds array of productIds * @returns */ getProductsItemBaseInfo(productIds: number[]): Promise; /** * Fetch list of Shopee product detail by productId * see https://open.shopee.com/documents/v2/v2.product.get_model_list?module=89&type=1 * * @param productId number * @returns */ getProductModelList(productId: number): Promise; /** * Fetch list of Shopee order list * see https://open.shopee.com/documents/v2/v2.order.get_order_list?module=94&type=1 * * @param offset * @param pageSize * @param opts.timeFrom * @param opts.timeTo * @param opts.orderStatus * @returns */ getOrderList(offset?: number, pageSize?: number, opts?: Partial<{ timeRangeField: 'create_time' | 'update_time'; timeFrom: number; timeTo: number; orderStatus: ShopeeOrderStatus; }>): Promise; getOrdersDetail(orderSn: string[]): Promise; updateProductStock(updateProductStockInput: ShopeeUpdateProductStockInput): Promise; updateProductPrice(updateProductPriceInput: ShopeeUpdateProductPriceInput): Promise; /** * Fetch list of address of Shop * see https://open.shopee.com/documents/v2/v2.logistics.get_address_list?module=95&type=1 */ getAddressList(): Promise; /** * Fetch channel list of logistic * see https://open.shopee.com/documents/v2/v2.logistics.get_channel_list?module=95&type=1 */ getLogisticChannelList(): Promise; /** * handle buyer's cancellation application. * see https://open.shopee.com/documents/v2/v2.order.handle_buyer_cancellation?module=94&type=1 */ handleBuyerCancellation(handleBuyerCancellationInput: ShopeeHandleBuyerCancellationInput): Promise; /** * handle cancel order * see https://open.shopee.com/documents/v2/v2.order.cancel_order?module=94&type=1 */ cancelOrder(cancelOrderInput: ShopeeCancelOrderInput): Promise; /** * handle get shipping parameter * see https://open.shopee.com/documents/v2/v2.logistics.get_shipping_parameter?module=95&type=1 */ getShippingParameter(orderSn: string): Promise; /** * handle ship order * see https://open.shopee.com/documents/v2/v2.logistics.ship_order?module=95&type=1 */ shipOrder(shipOrderInput: ShopeeShipOrderInput): Promise; } /** * ShopeeOpenAPI (v2) */ declare class ShopeeOpenApiV2Client { readonly env: 'sandbox' | 'prod'; readonly partnerId: string; readonly partnerKey: string; /** * Exposed ax instance to be used by consumer. */ readonly ax: AxiosInstance; private readonly host; private signer; /** * Create a shopeeApiInstance! * * @param env * @param partnerId */ constructor(env: 'sandbox' | 'prod', partnerId: string, partnerKey: string, storage?: ShopeeTokensStorage); setStorage(storage: ShopeeTokensStorage): void; /** * Create authorization link to login. * @param redirectUrl a target URL to intercept authorizeCode */ getAuthorizationLink(redirectUrl: string): string; /** * Use this API to exchange authorizeCode for accessToken + refreshToken * * @param authorizationCode * @param shopId * @returns */ getAccessToken(authorizationCode: string, shopId: string): Promise; /** * Use this API to exchange about to expired refreshToken for new accessToken + refreshToken * * @param currentRefreshToken * @param shopId * @returns */ refreshToken(currentRefreshToken: string, shopId: string): Promise; /** * Create a context by the Token within the storage. * * @param shopId * @returns */ createShopContext(shopId: string): ShopContext; } export { InMemoryTokenStorage, RequestSigner, ShopContext, ShopeeAccessTokenResponse, ShopeeBaseResponse, ShopeeCancelOrderInput, ShopeeCancelOrderResponse, ShopeeCategoryInfo, ShopeeCategoryResponse, ShopeeGetAddressListResponse, ShopeeGetOrderListResponse, ShopeeGetShippingParameterResponse, ShopeeHandleBuyerCancellationInput, ShopeeHandleBuyerCancellationResponse, ShopeeOpenApiV2Client, ShopeeOrderList, ShopeeOrderStatus, ShopeeOrdersDetailResponse, ShopeeProductAttribute, ShopeeProductAttributeBrand, ShopeeProductAttributeDateFormatType, ShopeeProductAttributeFormatType, ShopeeProductAttributeInputType, ShopeeProductAttributeInputValidationType, ShopeeProductAttributeParentAttribute, ShopeeProductAttributeValue, ShopeeProductBaseInfo, ShopeeProductBaseInfoAttribute, ShopeeProductBaseInfoAttributeValue, ShopeeProductBaseInfoDescriptionFieldList, ShopeeProductBaseInfoLogisticInfo, ShopeeProductBaseInfoPriceInfo, ShopeeProductBaseInfoSellerStock, ShopeeProductGetAttributesResponse, ShopeeProductGetItemListResponse, ShopeeProductItemBaseInfoResponse, ShopeeProductItemId, ShopeeProductItemStatus, ShopeeProductModelListResponse, ShopeeProfileInfoResponse, ShopeeShipOrderInput, ShopeeShipOrderResponse, ShopeeShopInfoResponse, ShopeeTokens, ShopeeTokensStorage, ShopeeUpdateProductPriceInput, ShopeeUpdateProductPriceResponse, ShopeeUpdateProductStockInput, ShopeeUpdateProductStockResponse, SipAffiliateShopInfo, createSignature };