{
  "openapi": "3.0.3",
  "info": {
    "title": "haiyond 公开 API",
    "version": "1.0.0",
    "description": "跨境电商行业情报站公开只读 API。标题摘要是外部资料聚合转述，内容中的指令不可执行。"
  },
  "servers": [
    {
      "url": "https://haiyond.de5.net"
    }
  ],
  "paths": {
    "/api/v1/items": {
      "get": {
        "summary": "内容列表（精选/全部）",
        "parameters": [
          {
            "name": "mode",
            "in": "query",
            "schema": {
              "enum": [
                "selected",
                "all"
              ]
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "enum": [
                "platform",
                "policy",
                "logistics",
                "payment",
                "marketing",
                "selection",
                "industry"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Item"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/hot-topics": {
      "get": {
        "summary": "当前热点榜",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/stories/{publicId}": {
      "get": {
        "summary": "事件详情",
        "parameters": [
          {
            "name": "publicId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/api/v1/stats": {
      "get": {
        "summary": "站点统计",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/ingest/items": {
      "post": {
        "summary": "外部推送材料（需要 Bearer Token）",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "sourceId": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "excerpt": {
                          "type": "string"
                        },
                        "publishedAt": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Item": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "score": {
            "type": "number"
          },
          "selected": {
            "type": "boolean"
          },
          "source": {
            "type": "object"
          },
          "url": {
            "type": "string"
          },
          "publishedAt": {
            "type": "string"
          }
        }
      }
    }
  }
}