{
  "document": {
    "integrations": {
      "apis": [
        {
          "description": "GET 请求 Open-Meteo 当前天气，返回 current_weather 对象",
          "inputExample": {},
          "label": "获取北京实时天气",
          "method": "GET",
          "name": "loadWeather",
          "responseExample": {
            "current_weather": {
              "temperature": 24.6,
              "time": "2024-05-01T12:00",
              "weathercode": 1,
              "winddirection": 176,
              "windspeed": 9.4
            },
            "latitude": 39.875,
            "longitude": 116.375,
            "timezone": "Asia/Shanghai"
          },
          "url": "https://api.open-meteo.com/v1/forecast?latitude=39.9042&longitude=116.4074&current_weather=true&timezone=Asia/Shanghai"
        }
      ],
      "callbacks": []
    },
    "parameters": [],
    "schemaVersion": "lingui.document/2",
    "state": {
      "error": "",
      "fetched": false,
      "loading": false,
      "response": {}
    },
    "title": "文档演示 · 北京实时天气",
    "source": "root = Column({\"children\":[\"title\",\"subtitle\",\"actionRow\",\"cond_empty\",\"cond_loading\",\"cond_error\",\"cond_result\",\"footer\"],\"id\":\"root\"}, [n1, n2, n3, n6, n8, n10, n12, n30])\nn1 = Text({\"id\":\"title\",\"text\":\"北京 · 实时天气\",\"variant\":\"h1\"}, [])\nn2 = Text({\"id\":\"subtitle\",\"text\":\"数据来自 Open-Meteo 免费天气接口 · 时区 Asia/Shanghai · 纬度 39.9042 / 经度 116.4074\",\"variant\":\"caption\"}, [])\nn3 = Row({\"align\":\"center\",\"children\":[\"btn_fetch\"],\"id\":\"actionRow\",\"justify\":\"start\"}, [n4])\nn4 = Button({\"child\":\"btn_fetch_text\",\"disabled\":{\"path\":\"/loading\"},\"events\":{\"click\":{\"actions\":[{\"actions\":[{\"path\":\"/fetched\",\"type\":\"setState\",\"value\":false},{\"path\":\"/error\",\"type\":\"setState\",\"value\":\"\"}],\"type\":\"local\"},{\"args\":{},\"name\":\"loadWeather\",\"timeoutMs\":15000,\"type\":\"api\"}],\"concurrency\":\"drop\",\"errorPath\":\"/error\",\"loadingPath\":\"/loading\",\"onSuccess\":[{\"actions\":[{\"path\":\"/fetched\",\"type\":\"setState\",\"value\":true}],\"type\":\"local\"}],\"resultPath\":\"/response\"}},\"id\":\"btn_fetch\",\"loading\":{\"path\":\"/loading\"},\"size\":\"medium\",\"variant\":\"primary\"}, [n5])\nn5 = Text({\"id\":\"btn_fetch_text\",\"text\":\"获取实时天气\",\"variant\":\"body\"}, [])\nn6 = LingUI_Conditional({\"child\":\"hint\",\"condition\":{\"args\":[{\"path\":\"/fetched\"}],\"op\":\"not\"},\"id\":\"cond_empty\"}, [n7])\nn7 = Text({\"id\":\"hint\",\"text\":\"尚未获取数据：点击上方按钮读取北京当前的气温、风速与风向。\",\"variant\":\"body\"}, [])\nn8 = LingUI_Conditional({\"child\":\"spinner\",\"condition\":{\"path\":\"/loading\"},\"id\":\"cond_loading\"}, [n9])\nn9 = LingUI_Spinner({\"id\":\"spinner\",\"label\":\"正在获取天气数据…\",\"size\":\"medium\"}, [])\nn10 = LingUI_Conditional({\"child\":\"err_status\",\"condition\":{\"args\":[{\"path\":\"/error\"},\"\"],\"op\":\"neq\"},\"id\":\"cond_error\"}, [n11])\nn11 = LingUI_Status({\"id\":\"err_status\",\"text\":{\"path\":\"/error\"},\"tone\":\"danger\"}, [])\nn12 = LingUI_Conditional({\"child\":\"card\",\"condition\":{\"path\":\"/fetched\"},\"id\":\"cond_result\"}, [n13])\nn13 = Card({\"child\":\"card_col\",\"id\":\"card\",\"variant\":\"soft\"}, [n14])\nn14 = Column({\"children\":[\"desc_col\",\"metrics_row1\",\"metrics_row2\",\"metrics_row3\"],\"id\":\"card_col\"}, [n15, n22, n25, n28])\nn15 = Column({\"children\":[\"cond_sunny\",\"cond_cloudy\",\"cond_rain\"],\"id\":\"desc_col\"}, [n16, n18, n20])\nn16 = LingUI_Conditional({\"child\":\"t_sunny\",\"condition\":{\"args\":[{\"path\":\"/response/current_weather/weathercode\"},0],\"op\":\"eq\"},\"id\":\"cond_sunny\"}, [n17])\nn17 = Text({\"id\":\"t_sunny\",\"text\":\"当前天气：晴朗无云\",\"variant\":\"h3\"}, [])\nn18 = LingUI_Conditional({\"child\":\"t_cloudy\",\"condition\":{\"args\":[{\"args\":[{\"path\":\"/response/current_weather/weathercode\"},1],\"op\":\"eq\"},{\"args\":[{\"path\":\"/response/current_weather/weathercode\"},2],\"op\":\"eq\"},{\"args\":[{\"path\":\"/response/current_weather/weathercode\"},3],\"op\":\"eq\"}],\"op\":\"or\"},\"id\":\"cond_cloudy\"}, [n19])\nn19 = Text({\"id\":\"t_cloudy\",\"text\":\"当前天气：多云到阴\",\"variant\":\"h3\"}, [])\nn20 = LingUI_Conditional({\"child\":\"t_rain\",\"condition\":{\"args\":[{\"args\":[{\"path\":\"/response/current_weather/weathercode\"},51],\"op\":\"eq\"},{\"args\":[{\"path\":\"/response/current_weather/weathercode\"},53],\"op\":\"eq\"},{\"args\":[{\"path\":\"/response/current_weather/weathercode\"},55],\"op\":\"eq\"},{\"args\":[{\"path\":\"/response/current_weather/weathercode\"},61],\"op\":\"eq\"},{\"args\":[{\"path\":\"/response/current_weather/weathercode\"},63],\"op\":\"eq\"},{\"args\":[{\"path\":\"/response/current_weather/weathercode\"},65],\"op\":\"eq\"}],\"op\":\"or\"},\"id\":\"cond_rain\"}, [n21])\nn21 = Text({\"id\":\"t_rain\",\"text\":\"当前天气：有降雨，注意携带雨具\",\"variant\":\"h3\"}, [])\nn22 = Row({\"align\":\"stretch\",\"children\":[\"m_temp\",\"m_wind\"],\"id\":\"metrics_row1\",\"justify\":\"start\"}, [n23, n24])\nn23 = LingUI_Metric({\"description\":\"观测点：北京市中心\",\"id\":\"m_temp\",\"label\":\"当前温度 · °C\",\"value\":{\"path\":\"/response/current_weather/temperature\"}}, [])\nn24 = LingUI_Metric({\"description\":\"10 米高度平均风速\",\"id\":\"m_wind\",\"label\":\"风速 · km/h\",\"value\":{\"path\":\"/response/current_weather/windspeed\"}}, [])\nn25 = Row({\"align\":\"stretch\",\"children\":[\"m_dir\",\"m_time\"],\"id\":\"metrics_row2\",\"justify\":\"start\"}, [n26, n27])\nn26 = LingUI_Metric({\"description\":\"0 度为正北，顺时针增加\",\"id\":\"m_dir\",\"label\":\"风向 · 度\",\"value\":{\"path\":\"/response/current_weather/winddirection\"}}, [])\nn27 = LingUI_Metric({\"description\":\"接口返回的本地时间\",\"id\":\"m_time\",\"label\":\"观测时间\",\"value\":{\"path\":\"/response/current_weather/time\"}}, [])\nn28 = Row({\"align\":\"stretch\",\"children\":[\"m_code\"],\"id\":\"metrics_row3\",\"justify\":\"start\"}, [n29])\nn29 = LingUI_Metric({\"description\":\"按 WMO 标准编码，0 为晴，1–3 为多云，51–65 为降雨\",\"id\":\"m_code\",\"label\":\"WMO 天气代码\",\"value\":{\"path\":\"/response/current_weather/weathercode\"}}, [])\nn30 = Text({\"id\":\"footer\",\"text\":\"点击按钮即向接口发起一次 GET 请求，多次点击以最后一次结果为准。\",\"variant\":\"caption\"}, [])"
  }
}