{
  "openapi": "3.1.0",
  "info": {
    "title": "Fragment API",
    "description": "<div><h3>Quick Start</h3>welcome fragment service</div>",
    "version": "0.0.1-SNAPSHOT#106"
  },
  "servers": [
    {
      "url": "https://api.catfee.io",
      "description": "Generated server url"
    }
  ],
  "security": [
    {
      "Authorization": []
    },
    {
      "API_KEY": [],
      "API_SIGN": [],
      "API_TIMESTAMP": []
    }
  ],
  "tags": [
    {
      "name": "API SERVICE",
      "description": "API SERVICE"
    }
  ],
  "paths": {
    "/v1/stars": {
      "post": {
        "tags": ["API SERVICE"],
        "summary": "Buy Stars \n购买电报Stars",
        "operationId": "buyStars",
        "parameters": [
          {
            "name": "username",
            "in": "query",
            "description": "购买Stars的账号",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "quantity",
            "in": "query",
            "description": "购买Stars数量",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "client_order_id",
            "in": "query",
            "description": "客户自定义订单ID（长度小于等于64），保持唯一性，传入之前的客户订单号，将不创建新订单",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "CF-ACCESS-KEY",
            "in": "header",
            "description": "API access key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "CF-ACCESS-SIGN",
            "in": "header",
            "description": "Base64 encoded HMAC-SHA256 signature",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "CF-ACCESS-TIMESTAMP",
            "in": "header",
            "description": "UTC request timestamp, for example 2008-08-08T08:08:08.888Z",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/XPremiumOrderPayload"
                }
              }
            }
          }
        },
        "security": [
          {
            "API_KEY": [],
            "API_SIGN": [],
            "API_TIMESTAMP": []
          }
        ]
      }
    },
    "/v1/premium": {
      "post": {
        "tags": ["API SERVICE"],
        "summary": "Buy Premium \n购买电报会员",
        "operationId": "buyPremium",
        "parameters": [
          {
            "name": "username",
            "in": "query",
            "description": "购买会员的账号",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "months",
            "in": "query",
            "description": "购买时长（3，6，12）个月",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "client_order_id",
            "in": "query",
            "description": "客户自定义订单ID（长度小于等于64），保持唯一性，传入之前的客户订单号，将不创建新订单",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "CF-ACCESS-KEY",
            "in": "header",
            "description": "API access key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "CF-ACCESS-SIGN",
            "in": "header",
            "description": "Base64 encoded HMAC-SHA256 signature",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "CF-ACCESS-TIMESTAMP",
            "in": "header",
            "description": "UTC request timestamp, for example 2008-08-08T08:08:08.888Z",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/XPremiumOrderPayload"
                }
              }
            }
          }
        },
        "security": [
          {
            "API_KEY": [],
            "API_SIGN": [],
            "API_TIMESTAMP": []
          }
        ]
      }
    },
    "/v1/fragment/order/{orderId}": {
      "get": {
        "tags": ["API SERVICE"],
        "summary": "Query order by ID \n根据订单ID查询订单信息",
        "operationId": "order",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "description": "订单ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "CF-ACCESS-KEY",
            "in": "header",
            "description": "API access key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "CF-ACCESS-SIGN",
            "in": "header",
            "description": "Base64 encoded HMAC-SHA256 signature",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "CF-ACCESS-TIMESTAMP",
            "in": "header",
            "description": "UTC request timestamp, for example 2008-08-08T08:08:08.888Z",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/XPremiumOrderPayload"
                }
              }
            }
          }
        },
        "security": [
          {
            "API_KEY": [],
            "API_SIGN": [],
            "API_TIMESTAMP": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "PremiumOrderPayload": {
        "description": "Fragment商品订单详情",
        "properties": {
          "member_id": {
            "type": "integer",
            "format": "int64",
            "description": "会员ID"
          },
          "order_id": {
            "type": "string",
            "description": "订单ID"
          },
          "client_order_id": {
            "type": "string",
            "description": "客户自定义订单ID"
          },
          "username": {
            "type": "string",
            "description": "要购买的电报用户username"
          },
          "product_type": {
            "type": "string",
            "description": "Fragment商品类型",
            "enum": ["PREMIUM", "STARS"]
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "description": "Stars数量"
          },
          "months": {
            "type": "integer",
            "format": "int32",
            "description": "会员时长(月)"
          },
          "usdt_sun": {
            "type": "integer",
            "format": "int64",
            "description": "付款金额U"
          },
          "cost_usdt_sun": {
            "type": "integer",
            "format": "int64",
            "description": "成本金额U"
          },
          "source_type": {
            "type": "string",
            "description": "来源类型",
            "enum": ["TRANSFER", "DAPP", "BALANCE", "API", "BOT"]
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "创建时间"
          },
          "status": {
            "type": "string",
            "description": "状态",
            "enum": [
              "UNPAID",
              "PAID",
              "CREATED",
              "FINISHED",
              "PAY_FAILED",
              "BUY_FAILED",
              "CREATED_FAILED"
            ]
          }
        }
      },
      "XPremiumOrderPayload": {
        "properties": {
          "code": {
            "type": "integer",
            "format": "int32",
            "description": "成功返回0，其他均为错误"
          },
          "msg": {
            "type": "string",
            "description": "发生错误时候返回的消息"
          },
          "sub_code": {
            "type": "string"
          },
          "sub_msg": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/PremiumOrderPayload"
          }
        }
      }
    },
    "securitySchemes": {
      "Authorization": {
        "type": "http",
        "scheme": "bearer"
      },
      "API_KEY": {
        "type": "apiKey",
        "name": "CF-ACCESS-KEY",
        "in": "header"
      },
      "API_SIGN": {
        "type": "apiKey",
        "name": "CF-ACCESS-SIGN",
        "in": "header"
      },
      "API_TIMESTAMP": {
        "type": "apiKey",
        "name": "CF-ACCESS-TIMESTAMP",
        "in": "header"
      }
    }
  }
}
