{
  "name": "Soke — Thumbnail Generation (Async with Polling)",
  "flow": [
    {
      "id": 1,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": { "handleErrors": true, "useNewZLibDeCompress": true },
      "mapper": {
        "url": "https://api.usesoke.ai/api/v1/thumbnail/generate",
        "method": "post",
        "headers": [
          { "name": "Content-Type", "value": "application/json" },
          { "name": "X-Soke-Key", "value": "sk_live_your_api_key" }
        ],
        "bodyType": "raw",
        "parseResponse": true,
        "contentType": "application/json",
        "body": "{\"manualTitle\": \"10 Developer Productivity Hacks\", \"manualPrompt\": \"A developer at a clean desk with multiple monitors\", \"colorGrading\": \"Cinematic\", \"layoutType\": \"TextCenter\", \"resolution\": \"1280x720\", \"platform\": \"youtube\"}"
      },
      "metadata": {
        "designer": { "x": 0, "y": 0 }
      }
    },
    {
      "id": 2,
      "module": "builtin:BasicFeeder",
      "version": 1,
      "parameters": {},
      "mapper": {
        "array": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
      },
      "metadata": {
        "designer": { "x": 300, "y": 0 },
        "restore": {
          "expect": {
            "array": { "mode": "chose" }
          }
        }
      }
    },
    {
      "id": 3,
      "module": "util:Sleep",
      "version": 1,
      "parameters": {},
      "mapper": {
        "timeout": 5
      },
      "metadata": {
        "designer": { "x": 600, "y": 0 }
      }
    },
    {
      "id": 4,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": { "handleErrors": true, "useNewZLibDeCompress": true },
      "mapper": {
        "url": "https://api.usesoke.ai/api/v1/thumbnail/{{1.data.data.id}}",
        "method": "get",
        "headers": [
          { "name": "X-Soke-Key", "value": "sk_live_your_api_key" }
        ],
        "parseResponse": true
      },
      "metadata": {
        "designer": { "x": 900, "y": 0 }
      }
    },
    {
      "id": 5,
      "module": "builtin:BasicRouter",
      "version": 1,
      "parameters": {},
      "mapper": null,
      "metadata": {
        "designer": { "x": 1200, "y": 0 }
      },
      "routes": [
        {
          "flow": [
            {
              "id": 6,
              "module": "util:SetVariable2",
              "version": 1,
              "parameters": {},
              "mapper": {
                "name": "thumbnailUrl",
                "value": "{{4.data.data.imageUrl}}"
              },
              "metadata": {
                "designer": { "x": 1500, "y": -100 }
              },
              "filter": {
                "name": "Completed",
                "conditions": [
                  [{ "a": "{{4.data.data.status}}", "b": "Completed", "o": "text:equal" }]
                ]
              }
            }
          ]
        },
        {
          "flow": [
            {
              "id": 7,
              "module": "builtin:BasicFeeder",
              "version": 1,
              "parameters": {},
              "mapper": {
                "array": ["continue"]
              },
              "metadata": {
                "designer": { "x": 1500, "y": 100 }
              },
              "filter": {
                "name": "Still Processing",
                "conditions": [
                  [{ "a": "{{4.data.data.status}}", "b": "Completed", "o": "text:notEqual" }]
                ]
              }
            }
          ]
        }
      ]
    }
  ],
  "metadata": {
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": true,
      "confidential": false,
      "dataloss": false,
      "dlq": false
    },
    "designer": { "orphans": [] }
  }
}
