1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "prd": {
12 "app_name": "Field Notes",
13 "package_name": "com.example.fieldnotes",
14 "description": "A small field-research capture app.",
15 "theme": "material",
16 "auth": true,
17 "models": [
18 {
19 "name": "Observation",
20 "collection": "observations",
21 "fields": [
22 {
23 "name": "title",
24 "label": "Title",
25 "type": "text"
26 },
27 {
28 "name": "count",
29 "label": "Specimen count",
30 "type": "number"
31 },
32 {
33 "name": "verified",
34 "label": "Verified",
35 "type": "bool"
36 }
37 ]
38 }
39 ],
40 "screens": [
41 {
42 "id": "observations",
43 "title": "Observations",
44 "kind": "list",
45 "model": "Observation",
46 "actions": [
47 {
48 "name": "openCapture",
49 "kind": "navigate",
50 "target": "capture"
51 }
52 ]
53 },
54 {
55 "id": "capture",
56 "title": "New observation",
57 "kind": "form",
58 "model": "Observation",
59 "actions": [
60 {
61 "name": "saveObservation",
62 "kind": "create",
63 "target": "Observation"
64 }
65 ]
66 }
67 ]
68 }
69};
70
71
72const run = await client.actor("vigorous_spit/prd-to-flutter-apk").call(input);
73
74
75console.log('Results from dataset');
76console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
77const { items } = await client.dataset(run.defaultDatasetId).listItems();
78items.forEach((item) => {
79 console.dir(item);
80});
81
82