{
  "id": "pixmello-tools-smoke",
  "name": "Pixmello - text and file API smoke test",
  "active": false,
  "nodes": [
    {
      "id": "trigger",
      "name": "Run manually",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "input",
      "name": "Sample requests",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        220,
        0
      ],
      "parameters": {
        "jsCode": "return [{json:{request:{tool:'sha256-hash',input:'hello'}}},{json:{request:{tool:'svg-to-png',input:'<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\"><rect width=\"20\" height=\"20\" fill=\"red\"/></svg>',options:{width:40,height:40}}}}];"
      }
    },
    {
      "id": "request",
      "name": "Pixmello API",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        0
      ],
      "parameters": {
        "method": "POST",
        "url": "https://YOUR_APPROVED_PIXMELLO_HOST/api/v1/execute",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json.request) }}",
        "options": {
          "timeout": 25000,
          "response": {
            "response": {
              "fullResponse": true,
              "neverError": true
            }
          }
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "pixmello-header-auth",
          "name": "Pixmello API"
        }
      },
      "retryOnFail": false
    },
    {
      "id": "output",
      "name": "Validate and decode result",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        660,
        0
      ],
      "parameters": {
        "jsCode": "return $input.all().map(item=>{const status=item.json.statusCode??200;const body=item.json.body??item.json;if(status!==200)throw new Error('Pixmello HTTP '+status+' ('+(body.error?.code??'REQUEST_FAILED')+'). Check credentials, quota or cooldown before a manual retry.');const r=body.result;if(!r)throw new Error('Missing Pixmello result');const filename=r.filename.replace(/[^a-zA-Z0-9._-]/g,'_');const data=r.encoding==='base64'?r.data:Buffer.from(r.text??'','utf8').toString('base64');return {json:{requestId:body.requestId,filename},binary:{data:{data,mimeType:r.mime,fileName:filename}}};});"
      }
    },
    {
      "id": "save",
      "name": "Save result",
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1,
      "position": [
        880,
        0
      ],
      "parameters": {
        "operation": "write",
        "fileName": "={{ \"/files/pixmello/\" + $json.filename }}",
        "options": {}
      }
    }
  ],
  "connections": {
    "Run manually": {
      "main": [
        [
          {
            "node": "Sample requests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sample requests": {
      "main": [
        [
          {
            "node": "Pixmello API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pixmello API": {
      "main": [
        [
          {
            "node": "Validate and decode result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate and decode result": {
      "main": [
        [
          {
            "node": "Save result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
