[
	{
		"id": "ebb36f5a.4d2f2",
		"type": "inject",
		"z": "4785bb75.860ce4",
		"name": "",
		"topic": "",
		"payload": "",
		"payloadType": "date",
		"repeat": "",
		"crontab": "",
		"once": false,
		"onceDelay": 0.1,
		"x": 140,
		"y": 100,
		"wires": [
			[
				"b269fa5e.093f18"
			]
		]
	},
	{
		"id": "b269fa5e.093f18",
		"type": "forge-dm",
		"z": "4785bb75.860ce4",
		"name": "",
		"topic": "",
		"forge": "",
		"operation": "ListHubs",
		"raw": false,
		"hubid": "",
		"projectid": "",
		"folderid": "",
		"itemid": "",
		"versionid": "",
		"downloadid": "",
		"jobid": "",
		"ifModifiedSince": "",
		"includeHidden": false,
		"includePathInProject": false,
		"contentType": "application/vnd.api+json",
		"pageNumber": "",
		"pageLimit": "",
		"filters": [
			{
				"id": "attributes.name",
				"custom": "",
				"modifier": "",
				"expr": "Autodesk Forge Partner Development"
			}
		],
		"body": "",
		"copyFrom": "",
		"xuserid": "",
		"x": 490,
		"y": 100,
		"wires": [
			[
				"15f7f067.53af6",
				"b3b4540a.040b28"
			],
			[
				"574926bb.3591d8"
			]
		]
	},
	{
		"id": "574926bb.3591d8",
		"type": "debug",
		"z": "4785bb75.860ce4",
		"name": "Error",
		"active": false,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "true",
		"targetType": "full",
		"x": 1010,
		"y": 100,
		"wires": []
	},
	{
		"id": "15f7f067.53af6",
		"type": "debug",
		"z": "4785bb75.860ce4",
		"name": "Result",
		"active": false,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "true",
		"targetType": "full",
		"x": 870,
		"y": 100,
		"wires": []
	},
	{
		"id": "b3b4540a.040b28",
		"type": "change",
		"z": "4785bb75.860ce4",
		"name": "",
		"rules": [
			{
				"t": "set",
				"p": "hubid",
				"pt": "msg",
				"to": "payload.data[0].id",
				"tot": "msg"
			}
		],
		"action": "",
		"property": "",
		"from": "",
		"to": "",
		"reg": false,
		"x": 680,
		"y": 140,
		"wires": [
			[
				"2d504389.793d2c"
			]
		]
	},
	{
		"id": "2d504389.793d2c",
		"type": "forge-dm",
		"z": "4785bb75.860ce4",
		"name": "",
		"topic": "",
		"forge": "",
		"operation": "ListProjects",
		"raw": false,
		"hubid": "",
		"projectid": "",
		"folderid": "",
		"itemid": "",
		"versionid": "",
		"downloadid": "",
		"jobid": "",
		"ifModifiedSince": "",
		"includeHidden": false,
		"includePathInProject": false,
		"contentType": "application/vnd.api+json",
		"pageNumber": "",
		"pageLimit": "",
		"filters": [
			{
				"id": "id",
				"custom": "",
				"modifier": "",
				"expr": "b.dd31c918-027a-4a29-9946-ec292facdf7a"
			}
		],
		"body": "",
		"copyFrom": "",
		"xuserid": "",
		"x": 500,
		"y": 200,
		"wires": [
			[
				"94efee.77f6601",
				"ab5c0cd8.e6c9e"
			],
			[
				"25775b4.74730a4"
			]
		]
	},
	{
		"id": "94efee.77f6601",
		"type": "debug",
		"z": "4785bb75.860ce4",
		"name": "Result",
		"active": false,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "true",
		"targetType": "full",
		"x": 870,
		"y": 200,
		"wires": []
	},
	{
		"id": "25775b4.74730a4",
		"type": "debug",
		"z": "4785bb75.860ce4",
		"name": "Error",
		"active": false,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "true",
		"targetType": "full",
		"x": 1010,
		"y": 200,
		"wires": []
	},
	{
		"id": "ab5c0cd8.e6c9e",
		"type": "change",
		"z": "4785bb75.860ce4",
		"name": "",
		"rules": [
			{
				"t": "set",
				"p": "projectid",
				"pt": "msg",
				"to": "payload.data[0].id",
				"tot": "msg"
			},
			{
				"t": "set",
				"p": "result",
				"pt": "msg",
				"to": "{}",
				"tot": "json"
			}
		],
		"action": "",
		"property": "",
		"from": "",
		"to": "",
		"reg": false,
		"x": 680,
		"y": 240,
		"wires": [
			[
				"fc79044.9baf3f8"
			]
		]
	},
	{
		"id": "fc79044.9baf3f8",
		"type": "forge-dm",
		"z": "4785bb75.860ce4",
		"name": "Root Folders",
		"topic": "",
		"forge": "",
		"operation": "ListFolders",
		"raw": false,
		"hubid": "",
		"projectid": "",
		"folderid": "",
		"itemid": "",
		"versionid": "",
		"downloadid": "",
		"jobid": "",
		"ifModifiedSince": "",
		"includeHidden": false,
		"includePathInProject": false,
		"contentType": "application/vnd.api+json",
		"pageNumber": "",
		"pageLimit": "",
		"filters": [],
		"body": "",
		"copyFrom": "",
		"xuserid": "",
		"x": 490,
		"y": 300,
		"wires": [
			[
				"3e1143e3.02444c",
				"440be89c.cd9658"
			],
			[
				"f36c72de.121ef"
			]
		]
	},
	{
		"id": "3e1143e3.02444c",
		"type": "debug",
		"z": "4785bb75.860ce4",
		"name": "Result",
		"active": false,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "true",
		"targetType": "full",
		"x": 870,
		"y": 300,
		"wires": []
	},
	{
		"id": "f36c72de.121ef",
		"type": "debug",
		"z": "4785bb75.860ce4",
		"name": "Error",
		"active": false,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "true",
		"targetType": "full",
		"x": 1010,
		"y": 300,
		"wires": []
	},
	{
		"id": "440be89c.cd9658",
		"type": "function",
		"z": "4785bb75.860ce4",
		"name": "",
		"func": "msg.array = [];\nmsg.refs = {};\n// for ( var i = 0 ; i < msg.payload.data.length ; i++ ) {\n//     var topFolder = msg.payload.data[i];\n//     msg.result[topFolder.id] = {\n//         name: topFolder.attributes.displayName || topFolder.attributes.name,\n//         id: topFolder.id,\n//         type: topFolder.attributes.extension.type\n//     };\n//     if ( topFolder.attributes.extension.type === 'folders:autodesk.bim360:Folder' ) {\n//         msg.array.push (topFolder.id);\n//         msg.result[topFolder.id].content = {};\n//         msg.refs[topFolder.id] = msg.result[topFolder.id];\n//     }\n// }\n// return (msg);\n\nfor ( var i = 0 ; i < msg.payload.data.length ; i++ ) {\n    var topFolder = msg.payload.data[i];\n    var name = topFolder.attributes.displayName || topFolder.attributes.name;\n    msg.result[name] = {\n        id: topFolder.id,\n        type: topFolder.attributes.extension.type\n    };\n    if ( topFolder.attributes.extension.type === 'folders:autodesk.bim360:Folder' ) {\n        msg.array.push (topFolder.id);\n        msg.result[name].content = {};\n        msg.refs[topFolder.id] = msg.result[name];\n    }\n}\nreturn (msg);",
		"outputs": 1,
		"noerr": 0,
		"x": 650,
		"y": 340,
		"wires": [
			[
				"10f9adeb.4c4262",
				"38ab5106.b4618e"
			]
		]
	},
	{
		"id": "10f9adeb.4c4262",
		"type": "debug",
		"z": "4785bb75.860ce4",
		"name": "Result",
		"active": false,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "true",
		"targetType": "full",
		"x": 870,
		"y": 340,
		"wires": []
	},
	{
		"id": "6a74a4b9.d2f07c",
		"type": "forge-dm",
		"z": "4785bb75.860ce4",
		"name": "",
		"topic": "",
		"forge": "",
		"operation": "FolderContents",
		"raw": false,
		"hubid": "",
		"projectid": "",
		"folderid": "",
		"itemid": "",
		"versionid": "",
		"downloadid": "",
		"jobid": "",
		"ifModifiedSince": "",
		"includeHidden": false,
		"includePathInProject": false,
		"contentType": "application/vnd.api+json",
		"pageNumber": "",
		"pageLimit": "",
		"filters": [
			{
				"id": "type",
				"custom": "",
				"modifier": "",
				"expr": "folders"
			}
		],
		"body": "",
		"copyFrom": "",
		"xuserid": "",
		"x": 510,
		"y": 500,
		"wires": [
			[
				"b04eca0d.aff348",
				"ca779ee9.4347a",
				"38ab5106.b4618e"
			],
			[
				"2847640e.fdc5ac"
			]
		]
	},
	{
		"id": "b04eca0d.aff348",
		"type": "debug",
		"z": "4785bb75.860ce4",
		"name": "Result",
		"active": false,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "true",
		"targetType": "full",
		"x": 870,
		"y": 500,
		"wires": []
	},
	{
		"id": "318c7999.529236",
		"type": "debug",
		"z": "4785bb75.860ce4",
		"name": "Result",
		"active": false,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "true",
		"targetType": "full",
		"x": 870,
		"y": 440,
		"wires": []
	},
	{
		"id": "46ee708.8568a9",
		"type": "debug",
		"z": "4785bb75.860ce4",
		"name": "Result",
		"active": false,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "true",
		"targetType": "full",
		"x": 870,
		"y": 400,
		"wires": []
	},
	{
		"id": "2847640e.fdc5ac",
		"type": "debug",
		"z": "4785bb75.860ce4",
		"name": "Error",
		"active": false,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "true",
		"targetType": "full",
		"x": 1010,
		"y": 500,
		"wires": []
	},
	{
		"id": "b28ae69a.f50b28",
		"type": "function",
		"z": "4785bb75.860ce4",
		"name": "",
		"func": "msg.folderid = msg.array[msg.index];\nreturn msg;",
		"outputs": 1,
		"noerr": 0,
		"x": 650,
		"y": 440,
		"wires": [
			[
				"318c7999.529236",
				"6a74a4b9.d2f07c"
			]
		]
	},
	{
		"id": "38ab5106.b4618e",
		"type": "array-loop",
		"z": "4785bb75.860ce4",
		"name": "",
		"key": "index",
		"keyType": "msg",
		"reset": true,
		"resetValue": "value-null",
		"array": "array",
		"arrayType": "msg",
		"x": 480,
		"y": 400,
		"wires": [
			[
				"46ee708.8568a9",
				"7dc0141c.ff497c"
			],
			[
				"b28ae69a.f50b28"
			]
		]
	},
	{
		"id": "ca779ee9.4347a",
		"type": "join",
		"z": "4785bb75.860ce4",
		"name": "",
		"mode": "custom",
		"build": "array",
		"property": "payload",
		"propertyType": "msg",
		"key": "topic",
		"joiner": "\\n",
		"joinerType": "str",
		"accumulate": false,
		"timeout": "",
		"count": "",
		"reduceRight": false,
		"reduceExp": "",
		"reduceInit": "",
		"reduceInitType": "",
		"reduceFixup": "",
		"x": 470,
		"y": 560,
		"wires": [
			[
				"e1508329.36c23",
				"9a4b265d.4d7898"
			]
		]
	},
	{
		"id": "7dc0141c.ff497c",
		"type": "function",
		"z": "4785bb75.860ce4",
		"name": "complete",
		"func": "return ({ complete: true });",
		"outputs": 1,
		"noerr": 0,
		"x": 300,
		"y": 560,
		"wires": [
			[
				"ca779ee9.4347a"
			]
		]
	},
	{
		"id": "e1508329.36c23",
		"type": "debug",
		"z": "4785bb75.860ce4",
		"name": "Result",
		"active": false,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "true",
		"targetType": "full",
		"x": 870,
		"y": 560,
		"wires": []
	},
	{
		"id": "40310f2f.ce526",
		"type": "switch",
		"z": "4785bb75.860ce4",
		"name": "continue?",
		"property": "array",
		"propertyType": "msg",
		"rules": [
			{
				"t": "nnull"
			},
			{
				"t": "else"
			}
		],
		"checkall": "true",
		"repair": false,
		"outputs": 2,
		"x": 300,
		"y": 660,
		"wires": [
			[
				"38ab5106.b4618e"
			],
			[
				"99ba9ae0.b82158"
			]
		]
	},
	{
		"id": "7803203f.50ed6",
		"type": "debug",
		"z": "4785bb75.860ce4",
		"name": "Result",
		"active": true,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "result",
		"targetType": "msg",
		"x": 870,
		"y": 660,
		"wires": []
	},
	{
		"id": "9a4b265d.4d7898",
		"type": "function",
		"z": "4785bb75.860ce4",
		"name": "",
		"func": "// for ( var i = 0 ; i < msg.payload.data.length ; i++ ) {\n//     var topFolder = msg.payload.data[i];\n//     msg.result[topFolder.id] = {\n//         name: topFolder.attributes.displayName || topFolder.attributes.name,\n//         id: topFolder.id,\n//         type: topFolder.attributes.extension.type\n//     };\n//     if ( topFolder.attributes.extension.type === 'folders:autodesk.bim360:Folder' ) {\n//         msg.array.push (topFolder.id);\n//         msg.result[topFolder.id].content = {};\n//         msg.refs[topFolder.id] = msg.result[topFolder.id];\n//     }\n// }\n// return (msg);\nmsg.array = [];\nfor ( var p = 0 ; p < msg.payload.length ; p++ ) {\n    var payload = msg.payload[p];\n    for ( var i = 0 ; i < payload.data.length ; i++ ) {\n        var folder = payload.data[i];\n        var name = folder.attributes.displayName || folder.attributes.name;\n        var parentid = folder.relationships.parent.data.id;\n        msg.refs[parentid].content[name] = {\n            id: folder.id,\n            type: folder.attributes.extension.type\n        };\n        if ( folder.attributes.extension.type === 'folders:autodesk.bim360:Folder' ) {\n            msg.array.push (folder.id);\n            msg.refs[folder.id] = msg.refs[parentid].content[name];\n            msg.refs[folder.id].content ={};\n        }\n    }\n}\ndelete msg.payload;\ndelete msg.index;\ndelete msg.folderid;\nif ( msg.array.length === 0 )\n    delete msg.array;\nreturn (msg);",
		"outputs": 1,
		"noerr": 0,
		"x": 650,
		"y": 600,
		"wires": [
			[
				"da4f296a.96aec8",
				"40310f2f.ce526"
			]
		]
	},
	{
		"id": "da4f296a.96aec8",
		"type": "debug",
		"z": "4785bb75.860ce4",
		"name": "Result",
		"active": false,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "true",
		"targetType": "full",
		"x": 870,
		"y": 600,
		"wires": []
	},
	{
		"id": "99ba9ae0.b82158",
		"type": "change",
		"z": "4785bb75.860ce4",
		"name": "cleanup",
		"rules": [
			{
				"t": "delete",
				"p": "array",
				"pt": "msg"
			},
			{
				"t": "delete",
				"p": "refs",
				"pt": "msg"
			},
			{
				"t": "delete",
				"p": "payload",
				"pt": "msg"
			},
			{
				"t": "delete",
				"p": "folderid",
				"pt": "msg"
			},
			{
				"t": "delete",
				"p": "index",
				"pt": "msg"
			},
			{
				"t": "delete",
				"p": "op",
				"pt": "msg"
			},
			{
				"t": "delete",
				"p": "hubid",
				"pt": "msg"
			},
			{
				"t": "delete",
				"p": "projectid",
				"pt": "msg"
			},
			{
				"t": "delete",
				"p": "_msgid",
				"pt": "msg"
			}
		],
		"action": "",
		"property": "",
		"from": "",
		"to": "",
		"reg": false,
		"x": 660,
		"y": 660,
		"wires": [
			[
				"7803203f.50ed6"
			]
		]
	},
	{
		"id": "da7e76db.c95298",
		"type": "comment",
		"z": "4785bb75.860ce4",
		"name": "Parsing directory structure of a project",
		"info": "",
		"x": 210,
		"y": 60,
		"wires": []
	}
]