openapi: "3.1.0"
info: 
  title: U2 API
  version: "1.0"
servers: 
  - url: "https://u2.kysdm.com/api"
    description: API
security: []
paths:
  /v1/token:
    post:
      operationId: getToken
      summary: 鉴权
      externalDocs: 
        url: https://github.com/kysdm/u2_api#鉴权
      requestBody: 
        content: 
          application/json:
            schema: 
              type: object
              required: [uid]
              properties:
                uid:
                  type: integer
                  description: u2账户id
                key:
                  type: string
                  description: 上一步操作返回的 key 值
      responses: 
        "200":
          description: OK
          content:
            application/json:
              schema: 
                type: object
  /v1/promotion:
    get: 
      operationId: getPromotion
      summary: 魔法
      externalDocs: 
        url: https://github.com/kysdm/u2_api#魔法
      parameters: 
        - name: uid
          schema: 
            type: integer
          in: query
          description: u2账户id
          required: true
        - name: token
          schema: 
            type: string
            format: password
          in: query
          description: 鉴权中返回的值
          required: true
        - name: scope
          schema: 
            type: string
            enum: [global, public, private, all]
            default: all
          in: query
          description: 魔法类型
        - name: maximum
          schema: 
            type: integer
            minimum: 1
            maximum: 60
            default: 10
          in: query
          description: 返回数据条数
      responses: 
        "200":
          description: OK
          content:
            application/json:
              schema: 
                type: object
  /v1/promotion_super:
    get: 
      operationId: getPromotionSuper
      summary: 魔法叠加
      externalDocs: 
        url: https://github.com/kysdm/u2_api#魔法叠加
      parameters: 
        - name: uid
          schema: 
            type: integer
          in: query
          description: u2账户id
          required: true
        - name: token
          schema: 
            type: string
            format: password
          in: query
          description: 鉴权中返回的值
          required: true
        - name: torrent_id
          schema: 
            type: integer
          in: query
          description: 种子ID
          required: true
        - name: valid_uid
          schema: 
            type: integer
          in: query
          description: |
            筛选对此用户生效的魔法(包含私有魔法)  
            默认为请求者的UID
        - name: skip_cache
          schema: 
            type: integer
            enum: [0, 1]
          in: query
          description: |
            0 正常请求[默认]  
            1 跳过缓存请求
      responses: 
        "200":
          description: OK
          content:
            application/json:
              schema: 
                type: object
  /v1/promotion_specific:
    get:
      operationId: getPromotionSpecific
      summary: 特定种子当前有效魔法
      externalDocs: 
        url: https://github.com/kysdm/u2_api#特定种子当前有效魔法
      parameters: 
        - name: uid
          schema: 
            type: integer
          in: query
          description: u2账户id
          required: true
        - name: token
          schema: 
            type: string
            format: password
          in: query
          description: 鉴权中返回的值
          required: true
        - name: torrent_id
          schema: 
            type: integer
          in: query
          description: 种子ID
          required: true
      responses: 
        "200":
          description: OK
          content:
            application/json:
              schema: 
                type: object
