Comparing version 0.4.9 to 0.4.10
# ae_sdk | ||
## 0.4.10 | ||
### Patch Changes | ||
- Ensure API returns predefined types #5 | ||
## 0.4.9 | ||
@@ -4,0 +10,0 @@ |
@@ -180,31 +180,2 @@ type AE_API_NAMES = DS_API_NAMES | AFFILIATE_API_NAMES | SYSTEM_API_NAMES; | ||
* AFFILIATE API | ||
* GENERATE AFFILIATE LINKS | ||
*/ | ||
interface Affiliate_Generate_Affiliate_Links_Params { | ||
/** Promotion link type: 0 for normal link which has standard commission , and 2 for hot link which has hot product commission */ | ||
promotion_link_type: number; | ||
source_values: string; | ||
tracking_id: string; | ||
app_signature?: string; | ||
} | ||
interface Affiliate_Promo_Link { | ||
promotion_link: string; | ||
source_value: string; | ||
} | ||
interface Affiliate_Generate_Affiliate_Links { | ||
total_result_count: number; | ||
tracking_id: string; | ||
promotion_links: Affiliate_Promo_Link[]; | ||
} | ||
interface Affiliate_Generate_Affiliate_Links_Result { | ||
aliexpress_affiliate_link_generate_response: { | ||
resp_result: { | ||
resp_code?: number; | ||
resp_msg?: string; | ||
result: Affiliate_Generate_Affiliate_Links; | ||
}; | ||
}; | ||
} | ||
/** | ||
* AFFILIATE API | ||
* PRODUCT DETAILS | ||
@@ -250,4 +221,4 @@ */ | ||
promotion_link?: string; | ||
promo_code_info: Affiliate_Product_Promo_Code_Info; | ||
relevant_market_commission_rate: string; | ||
promo_code_info?: Affiliate_Product_Promo_Code_Info; | ||
relevant_market_commission_rate?: string; | ||
sale_price: string; | ||
@@ -265,23 +236,29 @@ sale_price_currency: AE_Currency; | ||
target_app_sale_price_currency: AE_Currency; | ||
} | ||
interface Affiliate_Product_Details extends Affiliate_Base_Product_Details { | ||
ship_to_days?: string; | ||
} | ||
interface Affiliate_Product_Details_Params extends Affiliate_Base_Product_Params { | ||
product_ids: string; | ||
country?: string; | ||
} | ||
interface Affiliate_Product_Details_Records { | ||
interface Affiliate_Base_Products_Cursor { | ||
products: Affiliate_Base_Product_Details[]; | ||
current_record_count: number; | ||
products: Affiliate_Product_Details[]; | ||
current_page_no?: number; | ||
total_page_no?: number; | ||
total_record_count?: number; | ||
is_finished?: boolean; | ||
} | ||
interface Affiliate_Product_Details_Response { | ||
interface Affiliate_Base_Products_Cursor_Response { | ||
resp_result: { | ||
resp_code: number; | ||
resp_msg: string; | ||
result: Affiliate_Product_Details_Records; | ||
result: Affiliate_Base_Products_Cursor; | ||
resp_code?: number; | ||
resp_msg?: string; | ||
}; | ||
} | ||
/** | ||
* AFFILIATE API | ||
* PRODUCT DETAILS | ||
*/ | ||
interface Affiliate_Product_Details_Params extends Affiliate_Base_Product_Params { | ||
product_ids: string; | ||
country?: string; | ||
} | ||
interface Affiliate_Product_Details_Result { | ||
aliexpress_affiliate_productdetail_get_response: Affiliate_Product_Details_Response; | ||
aliexpress_affiliate_productdetail_get_response: Affiliate_Base_Products_Cursor_Response; | ||
} | ||
@@ -310,18 +287,4 @@ /** | ||
} | ||
interface Affiliate_Products { | ||
current_page_no: number; | ||
current_record_count: number; | ||
products: Affiliate_Product_Details[]; | ||
total_page_no: number; | ||
total_record_count: number; | ||
} | ||
interface Affiliate_Products_Response { | ||
resp_result: { | ||
resp_code: number; | ||
resp_msg: string; | ||
result: Affiliate_Products; | ||
}; | ||
} | ||
interface Affiliate_Products_Result { | ||
aliexpress_affiliate_product_query_response: Affiliate_Products_Response; | ||
aliexpress_affiliate_product_query_response: Affiliate_Base_Products_Cursor_Response; | ||
} | ||
@@ -335,6 +298,115 @@ /** | ||
interface Affiliate_Hotproducts_Result { | ||
aliexpress_affiliate_hotproduct_query_response: Affiliate_Products_Response; | ||
aliexpress_affiliate_hotproduct_query_response: Affiliate_Base_Products_Cursor_Response; | ||
} | ||
/** | ||
* AFFILIATE API | ||
* FEATURED PROMO PRODUCTS | ||
*/ | ||
interface Affiliate_Featured_Promo_Products_Params extends Affiliate_Base_Product_Params { | ||
category_id?: string; | ||
page_no?: string; | ||
page_size?: string; | ||
promotion_end_time?: string; | ||
promotion_name?: string; | ||
promotion_start_time?: string; | ||
sort?: AE_Sort_Promo_Filter; | ||
country?: string; | ||
} | ||
interface Affiliate_Featured_Promo_Products_Result { | ||
aliexpress_affiliate_featuredpromo_products_get_response: Affiliate_Base_Products_Cursor_Response; | ||
} | ||
/** | ||
* AFFILIATE API | ||
* GET HOTPRODUCT DOWNLOAD | ||
*/ | ||
interface Affiliate_Hotproducts_Download_Params { | ||
/** API signature */ | ||
app_signature?: string; | ||
/** Category ID, you can get category ID via "get category" API https://developers.aliexpress.com/en/doc.htm?docId=45801&docType=2 */ | ||
category_id: string; | ||
/** Respond parameter list. eg: commission_rate,sale_price */ | ||
fields?: string; | ||
/** Local site:global, it_site, es_site, ru_site */ | ||
locale_site?: AE_Locale_Site; | ||
page_no?: number; | ||
page_size?: number; | ||
/** Target Currency:USD, GBP, CAD, EUR, UAH, MXN, TRY, RUB, BRL, AUD, INR, JPY, IDR, SEK,KRW,ILS,THB,CLP,VND */ | ||
target_currency?: AE_Currency; | ||
/** Target Language:EN,RU,PT,ES,FR,ID,IT,TH,JA,AR,VI,TR,DE,HE,KO,NL,PL,MX,CL,IN */ | ||
target_language?: AE_Language; | ||
/** Your trackingID */ | ||
tracking_id?: string; | ||
/** The Ship to country. Filter products that can be sent to that country; Returns the price according to the country’s tax rate policy.*/ | ||
country?: string; | ||
} | ||
interface Affiliate_Hotproducts_Download_Result { | ||
aliexpress_affiliate_hotproduct_download_response: Affiliate_Base_Products_Cursor_Response; | ||
} | ||
/** | ||
* AFFILIATE API | ||
* SMART MATCH PRODUCTS | ||
*/ | ||
interface Affiliate_Smart_Match_Products_Params { | ||
/** App information */ | ||
app?: string; | ||
/** API signature */ | ||
app_signature?: string; | ||
/** Device infomation */ | ||
device?: string; | ||
/** adid or idfa, for more information please refer to https://support.google.com/admanager/answer/6238701 Can be null, if it is null, it can be recommended based on keywords or product ID */ | ||
device_id: string; | ||
/** Respond parameter list, eg: commission_rate,sale_price */ | ||
fields?: string; | ||
/** Recommend products by keywords. eg: mp3 */ | ||
keywords?: string; | ||
/** Request page number */ | ||
page_no?: number; | ||
/** Product ID, matching related products product ID */ | ||
product_id?: string; | ||
/** site information */ | ||
site?: string; | ||
/** Target Currency: USD, GBP, CAD, EUR, UAH, MXN, TRY, RUB, BRL, AUD, INR, JPY, IDR, SEK,KRW,ILS,THB,CLP,VND */ | ||
target_currency?: AE_Currency; | ||
/** Target Languages: EN,RU,PT,ES,FR,ID,IT,TH,JA,AR,VI,TR,DE,HE,KO,NL,PL,MX,CL,IN */ | ||
target_language?: AE_Language; | ||
tracking_id?: string; | ||
/** user id */ | ||
user?: string; | ||
/** The Ship to country. Filter products that can be sent to that country; Returns the price according to the country’s tax rate policy. */ | ||
country?: string; | ||
} | ||
interface Affiliate_Smart_Match_Products_Result { | ||
aliexpress_affiliate_product_smartmatch_response: Affiliate_Base_Products_Cursor_Response; | ||
} | ||
/** | ||
* AFFILIATE API | ||
* GENERATE AFFILIATE LINKS | ||
*/ | ||
interface Affiliate_Generate_Affiliate_Links_Params { | ||
/** Promotion link type: 0 for normal link which has standard commission , and 2 for hot link which has hot product commission */ | ||
promotion_link_type: number; | ||
source_values: string; | ||
tracking_id: string; | ||
app_signature?: string; | ||
} | ||
interface Affiliate_Promo_Link { | ||
promotion_link: string; | ||
source_value: string; | ||
} | ||
interface Affiliate_Generate_Affiliate_Links { | ||
total_result_count: number; | ||
tracking_id: string; | ||
promotion_links: Affiliate_Promo_Link[]; | ||
} | ||
interface Affiliate_Generate_Affiliate_Links_Result { | ||
aliexpress_affiliate_link_generate_response: { | ||
resp_result: { | ||
resp_code?: number; | ||
resp_msg?: string; | ||
result: Affiliate_Generate_Affiliate_Links; | ||
}; | ||
}; | ||
} | ||
/** | ||
* AFFILIATE API | ||
* CATEGORIES | ||
@@ -387,32 +459,2 @@ */ | ||
* AFFILIATE API | ||
* FEATURED PROMO PRODUCTS | ||
*/ | ||
interface Affiliate_Featured_Promo_Products_Params extends Affiliate_Base_Product_Params { | ||
category_id?: string; | ||
page_no?: string; | ||
page_size?: string; | ||
promotion_end_time?: string; | ||
promotion_name?: string; | ||
promotion_start_time?: string; | ||
sort?: AE_Sort_Promo_Filter; | ||
country?: string; | ||
} | ||
interface Affiliate_Featured_Promo_Products_Result { | ||
aliexpress_affiliate_featuredpromo_products_get_response: { | ||
resp_result: { | ||
resp_code: number; | ||
resp_msg: string; | ||
result: { | ||
current_page_no: number; | ||
current_record_count: number; | ||
total_page_no: number; | ||
total_record_count: number; | ||
is_finished: boolean; | ||
products: Affiliate_Base_Product_Details[]; | ||
}; | ||
}; | ||
}; | ||
} | ||
/** | ||
* AFFILIATE API | ||
* GET ORDER INFO | ||
@@ -546,77 +588,2 @@ */ | ||
} | ||
/** | ||
* AFFILIATE API | ||
* GET HOTPRODUCT DOWNLOAD | ||
*/ | ||
interface Affiliate_Hotproducts_Download_Params { | ||
/** API signature */ | ||
app_signature?: string; | ||
/** Category ID, you can get category ID via "get category" API https://developers.aliexpress.com/en/doc.htm?docId=45801&docType=2 */ | ||
category_id: string; | ||
/** Respond parameter list. eg: commission_rate,sale_price */ | ||
fields?: string; | ||
/** Local site:global, it_site, es_site, ru_site */ | ||
locale_site?: AE_Locale_Site; | ||
page_no?: number; | ||
page_size?: number; | ||
/** Target Currency:USD, GBP, CAD, EUR, UAH, MXN, TRY, RUB, BRL, AUD, INR, JPY, IDR, SEK,KRW,ILS,THB,CLP,VND */ | ||
target_currency?: AE_Currency; | ||
/** Target Language:EN,RU,PT,ES,FR,ID,IT,TH,JA,AR,VI,TR,DE,HE,KO,NL,PL,MX,CL,IN */ | ||
target_language?: AE_Language; | ||
/** Your trackingID */ | ||
tracking_id?: string; | ||
/** The Ship to country. Filter products that can be sent to that country; Returns the price according to the country’s tax rate policy.*/ | ||
country?: string; | ||
} | ||
interface Affiliate_Hotproducts_Download { | ||
current_page_no: number; | ||
current_record_count: number; | ||
products: Affiliate_Base_Product_Details[]; | ||
} | ||
interface Affiliate_Hotproducts_Download_Response { | ||
resp_result: { | ||
result: Affiliate_Hotproducts_Download; | ||
resp_code?: number; | ||
resp_msg?: string; | ||
}; | ||
} | ||
interface Affiliate_Hotproducts_Download_Result { | ||
aliexpress_affiliate_hotproduct_download_response: Affiliate_Hotproducts_Download_Response; | ||
} | ||
/** | ||
* AFFILIATE API | ||
* SMART MATCH PRODUCTS | ||
*/ | ||
interface Affiliate_Smart_Match_Products_Params { | ||
/** App information */ | ||
app?: string; | ||
/** API signature */ | ||
app_signature?: string; | ||
/** Device infomation */ | ||
device?: string; | ||
/** adid or idfa, for more information please refer to https://support.google.com/admanager/answer/6238701 Can be null, if it is null, it can be recommended based on keywords or product ID */ | ||
device_id: string; | ||
/** Respond parameter list, eg: commission_rate,sale_price */ | ||
fields?: string; | ||
/** Recommend products by keywords. eg: mp3 */ | ||
keywords?: string; | ||
/** Request page number */ | ||
page_no?: number; | ||
/** Product ID, matching related products product ID */ | ||
product_id?: string; | ||
/** site information */ | ||
site?: string; | ||
/** Target Currency: USD, GBP, CAD, EUR, UAH, MXN, TRY, RUB, BRL, AUD, INR, JPY, IDR, SEK,KRW,ILS,THB,CLP,VND */ | ||
target_currency?: AE_Currency; | ||
/** Target Languages: EN,RU,PT,ES,FR,ID,IT,TH,JA,AR,VI,TR,DE,HE,KO,NL,PL,MX,CL,IN */ | ||
target_language?: AE_Language; | ||
tracking_id?: string; | ||
/** user id */ | ||
user?: string; | ||
/** The Ship to country. Filter products that can be sent to that country; Returns the price according to the country’s tax rate policy. */ | ||
country?: string; | ||
} | ||
interface Affiliate_Smart_Match_Products_Result { | ||
aliexpress_affiliate_product_smartmatch_response: Affiliate_Hotproducts_Download_Response; | ||
} | ||
@@ -623,0 +590,0 @@ /** |
@@ -66,14 +66,14 @@ "use strict"; | ||
// src/utils/index.ts | ||
var parse_affiliate_products = (data) => { | ||
var _a; | ||
if (data.resp_result.result.products.product) | ||
data.resp_result.result.products = data.resp_result.result.products.product; | ||
if (((_a = data.resp_result.result.products[0]) == null ? void 0 : _a.product_small_image_urls).string) | ||
data.resp_result.result.products = data.resp_result.result.products.map( | ||
(product) => { | ||
product.product_small_image_urls = product.product_small_image_urls.string; | ||
return product; | ||
} | ||
); | ||
return data; | ||
var parse_affiliate_products = (input) => { | ||
var _a, _b; | ||
let data = (_a = input.resp_result) == null ? void 0 : _a.result.products; | ||
if (data && data.product) | ||
data = data.product; | ||
if ((data && ((_b = data[0]) == null ? void 0 : _b.product_small_image_urls)).string) { | ||
data = data == null ? void 0 : data.map((product) => { | ||
product.product_small_image_urls = product.product_small_image_urls.string; | ||
return product; | ||
}); | ||
} | ||
return input; | ||
}; | ||
@@ -227,3 +227,13 @@ | ||
return __async(this, null, function* () { | ||
return yield this.execute("aliexpress.affiliate.link.generate", args); | ||
let response = yield this.execute( | ||
"aliexpress.affiliate.link.generate", | ||
args | ||
); | ||
if (response.ok) { | ||
let data = response.data.aliexpress_affiliate_link_generate_response.resp_result.result.promotion_links; | ||
if (data.promotion_link) { | ||
data = data.promotion_link; | ||
} | ||
} | ||
return response; | ||
}); | ||
@@ -242,4 +252,8 @@ } | ||
); | ||
if (response.ok && response.data.aliexpress_affiliate_category_get_response.resp_result.result.categories.category) | ||
response.data.aliexpress_affiliate_category_get_response.resp_result.result.categories = response.data.aliexpress_affiliate_category_get_response.resp_result.result.categories.category; | ||
if (response.ok) { | ||
let data = response.data.aliexpress_affiliate_category_get_response.resp_result.result.categories; | ||
if (data.category) { | ||
data = data.category; | ||
} | ||
} | ||
return response; | ||
@@ -255,3 +269,13 @@ }); | ||
return __async(this, null, function* () { | ||
return yield this.execute("aliexpress.affiliate.featuredpromo.get", args); | ||
let response = yield this.execute( | ||
"aliexpress.affiliate.featuredpromo.get", | ||
args | ||
); | ||
if (response.ok) { | ||
let data = response.data.aliexpress_affiliate_featuredpromo_get_response.result.promos; | ||
if (data.promo) { | ||
data = data.promo; | ||
} | ||
} | ||
return response; | ||
}); | ||
@@ -266,6 +290,11 @@ } | ||
return __async(this, null, function* () { | ||
return yield this.execute( | ||
let response = yield this.execute( | ||
"aliexpress.affiliate.featuredpromo.products.get", | ||
args | ||
); | ||
if (response.ok) { | ||
let data = response.data.aliexpress_affiliate_featuredpromo_products_get_response; | ||
data = parse_affiliate_products(data); | ||
} | ||
return response; | ||
}); | ||
@@ -280,3 +309,11 @@ } | ||
return __async(this, null, function* () { | ||
return yield this.execute("aliexpress.affiliate.hotproduct.download", args); | ||
let response = yield this.execute( | ||
"aliexpress.affiliate.hotproduct.download", | ||
args | ||
); | ||
if (response.ok) { | ||
let data = response.data.aliexpress_affiliate_hotproduct_download_response; | ||
data = parse_affiliate_products(data); | ||
} | ||
return response; | ||
}); | ||
@@ -296,5 +333,4 @@ } | ||
if (response.ok) { | ||
response.data.aliexpress_affiliate_hotproduct_query_response = parse_affiliate_products( | ||
response.data.aliexpress_affiliate_hotproduct_query_response | ||
); | ||
let data = response.data.aliexpress_affiliate_hotproduct_query_response; | ||
data = parse_affiliate_products(data); | ||
} | ||
@@ -335,3 +371,11 @@ return response; | ||
return __async(this, null, function* () { | ||
return yield this.execute("aliexpress.affiliate.productdetail.get", args); | ||
let response = yield this.execute( | ||
"aliexpress.affiliate.productdetail.get", | ||
args | ||
); | ||
if (response.ok) { | ||
let data = response.data.aliexpress_affiliate_productdetail_get_response; | ||
data = parse_affiliate_products(data); | ||
} | ||
return response; | ||
}); | ||
@@ -349,5 +393,4 @@ } | ||
if (response.ok) { | ||
response.data.aliexpress_affiliate_product_query_response = parse_affiliate_products( | ||
response.data.aliexpress_affiliate_product_query_response | ||
); | ||
let data = response.data.aliexpress_affiliate_product_query_response; | ||
data = parse_affiliate_products(data); | ||
} | ||
@@ -362,3 +405,11 @@ return response; | ||
return __async(this, null, function* () { | ||
return yield this.execute("aliexpress.affiliate.product.smartmatch", args); | ||
let response = yield this.execute( | ||
"aliexpress.affiliate.product.smartmatch", | ||
args | ||
); | ||
if (response.ok) { | ||
let data = response.data.aliexpress_affiliate_product_smartmatch_response; | ||
data = parse_affiliate_products(data); | ||
} | ||
return response; | ||
}); | ||
@@ -365,0 +416,0 @@ } |
{ | ||
"name": "ae_sdk", | ||
"version": "0.4.9", | ||
"version": "0.4.10", | ||
"description": "A simple SDK for Aliexpress (dropshipping and affiliate) APIs.", | ||
@@ -5,0 +5,0 @@ "private": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
156422
2735