{
  "tags": [
    "消息"
  ],
  "description": "查询当前登录用户的消息订阅记录。接口要求登录，不支持筛选参数；每条记录对应一个消息类型的邮件和短信接收开关。没有订阅记录时返回空数组。",
  "operationId": "user_get_v1_messages_sub",
  "security": [
    {
      "AccessToken": []
    },
    {
      "ApiKey": [],
      "ApiSecret": []
    }
  ],
  "responses": {
    "200": {
      "description": "成功与认证错误均返回 HTTP 200。成功时 `data` 为当前用户的 `message_sub` 表记录数组。",
      "content": {
        "application/json": {
          "schema": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "code",
                  "msg",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "enum": [
                      0
                    ],
                    "description": "0 表示查询成功。"
                  },
                  "msg": {
                    "type": "string",
                    "enum": [
                      "获取订阅成功"
                    ],
                    "description": "成功提示。"
                  },
                  "data": {
                    "type": "array",
                    "description": "当前用户的订阅记录；表中没有匹配记录时为空数组。",
                    "items": {
                      "type": "object",
                      "required": [
                        "uid",
                        "msg_type",
                        "phone",
                        "email"
                      ],
                      "properties": {
                        "uid": {
                          "type": "integer",
                          "description": "订阅所属用户 ID，固定为当前登录用户。",
                          "example": 12
                        },
                        "msg_type": {
                          "type": "string",
                          "description": "订阅的消息类型。",
                          "example": "announcement"
                        },
                        "phone": {
                          "type": "integer",
                          "enum": [
                            0,
                            1
                          ],
                          "nullable": true,
                          "description": "短信订阅开关的数据库布尔值：1 开启，0 关闭；未设置时为空。"
                        },
                        "email": {
                          "type": "integer",
                          "enum": [
                            0,
                            1
                          ],
                          "nullable": true,
                          "description": "邮件订阅开关的数据库布尔值：1 开启，0 关闭；未设置时为空。"
                        }
                      },
                      "additionalProperties": false
                    }
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "object",
                "required": [
                  "code",
                  "msg",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "login_required"
                    ],
                    "description": "未登录或登录会话无效时的业务错误码。"
                  },
                  "msg": {
                    "type": "string",
                    "description": "认证失败原因。"
                  },
                  "data": {
                    "type": "string",
                    "enum": [
                      ""
                    ],
                    "description": "业务错误时为空字符串。"
                  }
                },
                "additionalProperties": false
              }
            ]
          },
          "examples": {
            "success": {
              "summary": "查询成功",
              "value": {
                "code": 0,
                "msg": "获取订阅成功",
                "data": [
                  {
                    "uid": 12,
                    "msg_type": "announcement",
                    "phone": 0,
                    "email": 1
                  }
                ]
              }
            },
            "empty": {
              "summary": "没有订阅记录",
              "value": {
                "code": 0,
                "msg": "获取订阅成功",
                "data": []
              }
            }
          },
          "example": {
            "code": 0,
            "msg": "获取订阅成功",
            "data": [
              {
                "uid": 12,
                "msg_type": "announcement",
                "phone": 0,
                "email": 1
              }
            ]
          }
        }
      }
    }
  },
  "x-python-handler": "system.MessageSubAPI",
  "x-python-route-line": 1036,
  "x-audience": "user",
  "x-auth": "user",
  "x-reviewed": true,
  "parameters": [],
  "x-itecdn-source-reviewed": true,
  "extensions": [
    {
      "key": "x-python-handler",
      "value": "system.MessageSubAPI"
    },
    {
      "key": "x-python-route-line",
      "value": 1036
    },
    {
      "key": "x-audience",
      "value": "user"
    },
    {
      "key": "x-auth",
      "value": "user"
    },
    {
      "key": "x-reviewed",
      "value": true
    },
    {
      "key": "x-itecdn-source-reviewed",
      "value": true
    }
  ],
  "method": "get",
  "path": "/v1/messages/sub",
  "servers": [
    {
      "url": "https://master.example.invalid",
      "description": "不可调用的示例地址；复制示例后替换为自己的主控域名。"
    }
  ],
  "securitySchemes": {
    "AccessToken": {
      "type": "apiKey",
      "in": "header",
      "name": "access-token",
      "description": "通过登录接口获得的短期访问令牌。"
    },
    "ApiKey": {
      "type": "apiKey",
      "in": "header",
      "name": "api-key",
      "description": "API Key；必须和 api-secret 同时发送。"
    },
    "ApiSecret": {
      "type": "apiKey",
      "in": "header",
      "name": "api-secret",
      "description": "API Secret；必须和 api-key 同时发送。"
    }
  },
  "info": {
    "title": "itecdn v5 用户 API",
    "version": "5.x",
    "description": "itecdn v5.x Python 主控用户 API。本文档不适用于 v6 或其它实现。"
  },
  "postman": {
    "name": "查询当前用户的消息订阅设置",
    "description": {
      "content": "查询当前登录用户的消息订阅记录。接口要求登录，不支持筛选参数；每条记录对应一个消息类型的邮件和短信接收开关。没有订阅记录时返回空数组。",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "v1",
        "messages",
        "sub"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [],
      "variable": []
    },
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "method": "GET",
    "auth": {
      "type": "apikey",
      "apikey": [
        {
          "type": "any",
          "value": "access-token",
          "key": "key"
        },
        {
          "type": "any",
          "value": "{{apiKey}}",
          "key": "value"
        },
        {
          "type": "any",
          "value": "header",
          "key": "in"
        }
      ]
    }
  }
}