1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "tasks": [
12 {
13 "name": "inline-yaml",
14 "inputData": "name: John Doe\nage: 30\nroles:\n - admin\n - editor"
15 },
16 {
17 "name": "inline-json",
18 "inputData": "{\"service\":\"api\",\"enabled\":true,\"replicas\":2}"
19 },
20 {
21 "name": "inline-toml",
22 "inputData": "title = \"Example\"\n[owner]\nname = \"Ada\""
23 },
24 {
25 "name": "yaml-stream",
26 "inputData": "---\nkind: ConfigMap\nmetadata:\n name: app-config\n---\nkind: Secret\nmetadata:\n name: app-secret\n"
27 },
28 {
29 "name": "public-config",
30 "inputUrl": "https://raw.githubusercontent.com/apify/crawlee/master/package.json"
31 }
32 ],
33 "operation": "validate",
34 "outputFormat": "json",
35 "jsonIndent": 2,
36 "stopOnError": false,
37 "includeOriginal": false
38};
39
40
41const run = await client.actor("maximedupre/yaml-validator-converter").call(input);
42
43
44console.log('Results from dataset');
45console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
46const { items } = await client.dataset(run.defaultDatasetId).listItems();
47items.forEach((item) => {
48 console.dir(item);
49});
50
51