node-red-contrib-gitlabapi
Version:
Node-RED node for gitlabapi
685 lines (684 loc) • 13.7 kB
JSON
[
{
"id": "b82a3af45db03ecc",
"type": "inject",
"z": "a3e8559a.484128",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 160,
"y": 340,
"wires": [
[
"37d4aa9ad0bca0e6"
]
]
},
{
"id": "37d4aa9ad0bca0e6",
"type": "function",
"z": "a3e8559a.484128",
"name": "",
"func": "// msg.method = 'get';\n// msg.api = 'projects';\n// msg.path = '';\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 310,
"y": 340,
"wires": [
[
"dabfac751d594ac1"
]
]
},
{
"id": "dabfac751d594ac1",
"type": "gitlabapi",
"z": "a3e8559a.484128",
"name": "get projects",
"api": "projects",
"path": "",
"method": "get",
"uid": "",
"params": "",
"creds": "08d3b4a33e35254d",
"x": 530,
"y": 340,
"wires": [
[
"47ee58b03ba30289"
]
]
},
{
"id": "47ee58b03ba30289",
"type": "debug",
"z": "a3e8559a.484128",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 340,
"wires": []
},
{
"id": "df70f34d2d930abf",
"type": "inject",
"z": "a3e8559a.484128",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 160,
"y": 460,
"wires": [
[
"8d0cfa395e3b5d59"
]
]
},
{
"id": "8d0cfa395e3b5d59",
"type": "function",
"z": "a3e8559a.484128",
"name": "issue with params",
"func": "// msg.method = 'get';\n// msg.api = 'projects';\n// msg.path = '';\nmsg.params = {}\n// msg.params.assignee_id=1\n// msg.params.author_id=5\n// msg.params.labels='test'\n// msg.params.state='opened'\nmsg.params.state='closed'\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 340,
"y": 460,
"wires": [
[
"8b621182a9fd8224"
]
]
},
{
"id": "8b621182a9fd8224",
"type": "gitlabapi",
"z": "a3e8559a.484128",
"name": "get issues",
"api": "issues",
"path": "",
"method": "get",
"uid": "",
"params": "",
"creds": "08d3b4a33e35254d",
"x": 520,
"y": 460,
"wires": [
[
"4262dbae0113213a"
]
]
},
{
"id": "4262dbae0113213a",
"type": "debug",
"z": "a3e8559a.484128",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 460,
"wires": []
},
{
"id": "08cd230793200b54",
"type": "inject",
"z": "a3e8559a.484128",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 160,
"y": 380,
"wires": [
[
"b081c1d6aba85c2d"
]
]
},
{
"id": "b081c1d6aba85c2d",
"type": "function",
"z": "a3e8559a.484128",
"name": "",
"func": "// msg.method = 'get';\n// msg.api = 'projects';\n// msg.path = '';\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 310,
"y": 380,
"wires": [
[
"7869649417673d6d"
]
]
},
{
"id": "7869649417673d6d",
"type": "gitlabapi",
"z": "a3e8559a.484128",
"name": "get projects/1",
"api": "projects",
"path": "/1",
"method": "get",
"uid": "",
"params": "",
"creds": "08d3b4a33e35254d",
"x": 540,
"y": 380,
"wires": [
[
"13c0c7033f011eee"
]
]
},
{
"id": "13c0c7033f011eee",
"type": "debug",
"z": "a3e8559a.484128",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 380,
"wires": []
},
{
"id": "62936e43ae9f797f",
"type": "inject",
"z": "a3e8559a.484128",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 160,
"y": 420,
"wires": [
[
"993041fc9ad18a83"
]
]
},
{
"id": "993041fc9ad18a83",
"type": "function",
"z": "a3e8559a.484128",
"name": "project with params",
"func": "// msg.method = 'get';\n// msg.api = 'projects';\n// msg.path = '';\nmsg.params = {};\nmsg.params.order_by='id';\nmsg.params.sort='asc';\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 340,
"y": 420,
"wires": [
[
"1aa68c32d981e852"
]
]
},
{
"id": "1aa68c32d981e852",
"type": "gitlabapi",
"z": "a3e8559a.484128",
"name": "get projects",
"api": "projects",
"path": "",
"method": "get",
"uid": "",
"params": "",
"creds": "08d3b4a33e35254d",
"x": 530,
"y": 420,
"wires": [
[
"347625bcd4f9564d"
]
]
},
{
"id": "347625bcd4f9564d",
"type": "debug",
"z": "a3e8559a.484128",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 420,
"wires": []
},
{
"id": "edbb11515c562b42",
"type": "inject",
"z": "a3e8559a.484128",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 160,
"y": 500,
"wires": [
[
"ca8744959a199b25"
]
]
},
{
"id": "ca8744959a199b25",
"type": "function",
"z": "a3e8559a.484128",
"name": "project with params",
"func": "msg.method = 'post';\nmsg.api = 'projects';\nmsg.path = '/1/issues';\nmsg.params = {};\nmsg.params.title= 'gitlab rest api post test'\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 340,
"y": 500,
"wires": [
[
"9e2c68612f126888"
]
]
},
{
"id": "9e2c68612f126888",
"type": "gitlabapi",
"z": "a3e8559a.484128",
"name": "post projects",
"api": "projects",
"path": "",
"method": "",
"uid": "",
"params": "",
"creds": "08d3b4a33e35254d",
"x": 530,
"y": 500,
"wires": [
[
"591812db198597a5"
]
]
},
{
"id": "591812db198597a5",
"type": "debug",
"z": "a3e8559a.484128",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 500,
"wires": []
},
{
"id": "c18511acd84b267d",
"type": "inject",
"z": "a3e8559a.484128",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 160,
"y": 540,
"wires": [
[
"6bbccec2f797dd52"
]
]
},
{
"id": "6bbccec2f797dd52",
"type": "function",
"z": "a3e8559a.484128",
"name": "",
"func": "// msg.method = 'get';\n// msg.api = 'projects';\n// msg.path = '';\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 320,
"y": 540,
"wires": [
[
"0f45b2a32b4f90d2"
]
]
},
{
"id": "0f45b2a32b4f90d2",
"type": "gitlabapi",
"z": "a3e8559a.484128",
"name": "get projects",
"api": "projects",
"path": "",
"method": "get",
"uid": "",
"params": "",
"creds": "08d3b4a33e35254d",
"x": 530,
"y": 540,
"wires": [
[
"df35a58c753be4c4",
"501dd97e75d3a32b"
]
]
},
{
"id": "df35a58c753be4c4",
"type": "debug",
"z": "a3e8559a.484128",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 540,
"wires": []
},
{
"id": "0577cf022a926b9e",
"type": "function",
"z": "a3e8559a.484128",
"name": "project issue with params",
"func": "msg.method = 'get';\nmsg.api = '/projects';\nmsg.path = '/' + msg.payload.id + '/issues';\nmsg.params = {}\n// msg.params.assignee_id=1\n// msg.params.author_id=5\n// msg.params.labels='test'\n// msg.params.state='opened'\n// msg.params.state='closed'\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 570,
"y": 580,
"wires": [
[
"d62762e69527dcba"
]
]
},
{
"id": "d62762e69527dcba",
"type": "gitlabapi",
"z": "a3e8559a.484128",
"name": "get issues",
"api": "",
"path": "",
"method": "",
"uid": "",
"params": "",
"creds": "08d3b4a33e35254d",
"x": 760,
"y": 580,
"wires": [
[
"1e843047b4c9cc11",
"cdc9c69e9a16c7d8"
]
]
},
{
"id": "b5f9f50314381bdc",
"type": "delay",
"z": "a3e8559a.484128",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 330,
"y": 580,
"wires": [
[
"0577cf022a926b9e"
]
]
},
{
"id": "501dd97e75d3a32b",
"type": "split",
"z": "a3e8559a.484128",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 170,
"y": 580,
"wires": [
[
"b5f9f50314381bdc"
]
]
},
{
"id": "1e843047b4c9cc11",
"type": "debug",
"z": "a3e8559a.484128",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 930,
"y": 580,
"wires": []
},
{
"id": "c13dcb968676999d",
"type": "delay",
"z": "a3e8559a.484128",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 330,
"y": 620,
"wires": [
[
"3c21ac0eb9f3861f"
]
]
},
{
"id": "cdc9c69e9a16c7d8",
"type": "split",
"z": "a3e8559a.484128",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 170,
"y": 620,
"wires": [
[
"c13dcb968676999d"
]
]
},
{
"id": "3c21ac0eb9f3861f",
"type": "function",
"z": "a3e8559a.484128",
"name": "if issue exist",
"func": "if(msg.payload){\n if(msg.payload.id){\n return msg; \n }\n}\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 530,
"y": 620,
"wires": [
[
"3c6608112c562aa5"
]
]
},
{
"id": "3c6608112c562aa5",
"type": "debug",
"z": "a3e8559a.484128",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 620,
"wires": []
},
{
"id": "08d3b4a33e35254d",
"type": "gitlabapiApiKey",
"name": ""
}
]