{ "kind": "open-flow-workflow", "version": 1, "name": "Disqus Forum Reader", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_2523493e45dd3fe7": { "name": "Enter Disqus forum short name", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "forum" } ] }, "n_8aed0ca2a81e0031": { "inputs": { "url": { "kind": "value", "value": "https://disqus.com/api/3.0/forums/details.json" }, "query.forum": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2523493e45dd3fe7", "output": "forum" } ] }, "header.Referer": { "kind": "value", "value": "https://your-registered-site.example/" }, "auth.token": { "kind": "unset" } }, "name": "Read public Disqus forum", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": { "anyOf": [ { "type": [ "string", "number", "boolean" ] }, { "type": "array", "items": { "type": [ "string", "number", "boolean" ] } } ] }, "nullable": true, "handle": "query.forum" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "header.Referer" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "auth.token" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" } ], "name": "Read public Disqus forum", "executor": { "method": "GET", "query": { "mode": "fields", "names": [ "forum" ] }, "headers": { "mode": "fields", "names": [ "Referer" ] }, "bodyFormat": "none", "authentication": { "type": "apiKey", "name": "api_key", "in": "query" }, "responseFormat": "json", "statusPolicy": "success", "kind": "http-request" } } }, "n_00f64ccac02e3070": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_8aed0ca2a81e0031", "output": "body" } ] } }, "name": "Check forum response", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "forum" } ], "name": "Check forum response", "moduleId": "n_34acfd07e68d58a0", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_a616199f333dff6b": { "name": "Public Disqus forum details", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "forum" } ], "outputMappings": { "forum": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_00f64ccac02e3070", "output": "forum" } ] } } } }, "edges": [ { "source": "n_2523493e45dd3fe7", "target": "n_8aed0ca2a81e0031" }, { "source": "n_8aed0ca2a81e0031", "target": "n_00f64ccac02e3070" }, { "source": "n_00f64ccac02e3070", "target": "n_a616199f333dff6b" } ] } }, "modules": { "n_34acfd07e68d58a0": { "name": "Check forum response", "imports": [], "source": "function readDisqusForum(body) {\n const forum = body && typeof body === 'object' && body.response;\n if (body?.code !== 0 || !forum || typeof forum !== 'object' || Array.isArray(forum) || typeof forum.id !== 'string' || !forum.id.trim()) {\n throw new Error('Disqus did not return the requested forum details');\n }\n return forum;\n}\nexport default async function disqusForum({ body }) {\n return { forum: readDisqusForum(body) };\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }