node-red-contrib-contribgen
Version:
make node for node-red
91 lines (90 loc) • 2.58 kB
JSON
[
{
"id": "d2ec8c7b.d11a9",
"type": "inject",
"z": "a49a72c8.3d0a7",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 220,
"wires": [
[
"c7d049a6.35d868"
]
]
},
{
"id": "c7d049a6.35d868",
"type": "function",
"z": "a49a72c8.3d0a7",
"name": "newsapi",
"func": "msg = {};\nmsg.prefix = 'node-red-contrib-';\nmsg.fname = 'newsapi';\nmsg.module = '';\nmsg.version = '1.0.0';\nmsg.keywords = 'newsapi';\nmsg.category = '';\nmsg.icon = '';\nmsg.color = '';\n// if OS is linux, MAC\nmsg.dst = '/home/server/.node-red/node_modules/';\n// if OS is Window\nmsg.dst = 'C:/Users/user/.node-red/node_modules/';\n// msg.dst = 'D:/project/';\nmsg.lang = '';\nmsg.dependencies = '\"newsapi\": \"^2.4.1\"';\nmsg.require = 'const NewsAPI = require(\"newsapi\");';\nmsg.ncontent = 'const newsapi = new NewsAPI(n.key);';\nmsg.content = 'newsapi.v2[node.api](node.queries).then(response => {msg.payload = response;node.send(msg);});';\nmsg.form = ' <div class=\"form-row\">';\nmsg.form += ' <label for=\"node-input-key\"><i class=\"fa fa-key\"></i> key</label>';\nmsg.form += ' <input type=\"text\" id=\"node-input-key\" data-i18n=\"key\">';\nmsg.form += ' </div>';\nmsg.parameters = 'api: {value:\"\", required:false},';\nmsg.parameters += 'key: {value:\"\", required:false},';\nmsg.parameters += 'queries: {value:\"\", required:false},'\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 300,
"y": 220,
"wires": [
[
"2631fc14.d4ad24"
]
]
},
{
"id": "e81ccdfa.57e84",
"type": "debug",
"z": "a49a72c8.3d0a7",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 650,
"y": 220,
"wires": []
},
{
"id": "2631fc14.d4ad24",
"type": "contribgen",
"z": "a49a72c8.3d0a7",
"prefix": "",
"fname": "",
"module": "",
"version": "",
"keywords": "",
"category": "",
"icon": "",
"color": "",
"dst": "",
"lang": "",
"template": "",
"name": "contribgen",
"x": 490,
"y": 220,
"wires": [
[
"e81ccdfa.57e84"
]
]
}
]