1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "currentItems": [
12 {
13 "offerId": "DEMO-LAMP-01",
14 "title": "FICTIONAL LED lamp",
15 "sellerLoginId": "DEMO_ALPHA",
16 "priceCny": 17,
17 "minOrderQuantity": 50,
18 "priceTiers": [
19 {
20 "minQty": 50,
21 "priceCny": 17
22 },
23 {
24 "minQty": 100,
25 "priceCny": 14.5
26 }
27 ],
28 "supplierScore": 75,
29 "shippingUsd": 44,
30 "sourceSurface": "FICTIONAL_DEMO"
31 },
32 {
33 "offerId": "DEMO-LAMP-02",
34 "title": "FICTIONAL LED lamp",
35 "sellerLoginId": "DEMO_BETA",
36 "priceCny": 15.5,
37 "minOrderQuantity": 200,
38 "priceTiers": [
39 {
40 "minQty": 200,
41 "priceCny": 13
42 },
43 {
44 "minQty": 500,
45 "priceCny": 10.5
46 }
47 ],
48 "supplierScore": 82,
49 "shippingUsd": 65,
50 "isSponsored": true,
51 "sourceSurface": "FICTIONAL_DEMO"
52 },
53 {
54 "offerId": "DEMO-LAMP-03",
55 "title": "FICTIONAL LED lamp",
56 "sellerLoginId": "DEMO_GAMMA",
57 "priceCny": 20,
58 "minOrderQuantity": 10,
59 "priceTiers": [
60 {
61 "minQty": 10,
62 "priceCny": 20
63 },
64 {
65 "minQty": 80,
66 "priceCny": 16
67 }
68 ],
69 "supplierScore": 88,
70 "shippingUsd": 39,
71 "sourceSurface": "FICTIONAL_DEMO"
72 }
73 ],
74 "previousItems": [
75 {
76 "offerId": "DEMO-LAMP-01",
77 "priceCny": 19
78 },
79 {
80 "offerId": "DEMO-LAMP-02",
81 "priceCny": 12
82 }
83 ]
84};
85
86
87const run = await client.actor("quanmatrix/1688-tier-price-margin-auditor").call(input);
88
89
90console.log('Results from dataset');
91console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
92const { items } = await client.dataset(run.defaultDatasetId).listItems();
93items.forEach((item) => {
94 console.dir(item);
95});
96
97