first version
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 2025 SimcuTeam. All rights reserved.
|
||||
* 移植自 C# 项目 SimApi(E:\simcu\simapi-net),遵循 MIT 许可证。
|
||||
* 对齐 C# 的 Configurations/SimApiDocOptions.cs。
|
||||
*/
|
||||
|
||||
package simapi.configurations
|
||||
|
||||
import std.collection.*
|
||||
|
||||
/**
|
||||
* 文档组配置(对齐 C# SimApiDocGroupOption)。
|
||||
*/
|
||||
public class SimApiDocGroup {
|
||||
public var id: String = ""
|
||||
public var name: String = ""
|
||||
public var description: String = ""
|
||||
|
||||
public init() {}
|
||||
|
||||
public init(id: String, name: String, description!: String = "") {
|
||||
this.id = id
|
||||
this.name = name
|
||||
this.description = description
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档授权配置(对齐 C# SimApiAuthOption)。
|
||||
* Type 支持 "SimApiAuth"、"ClientCredentials"、"Implicit"、"AuthorizationCode"、"Password"。
|
||||
*/
|
||||
public class SimApiAuthOption {
|
||||
/**
|
||||
* 认证方式(默认 ["SimApiAuth"])。
|
||||
* `type` 是仓颉关键字,用反引号转义以对齐 C# 属性名 Type。
|
||||
*/
|
||||
public var `type`: Array<String> = ["SimApiAuth"]
|
||||
|
||||
/**
|
||||
* 认证描述(默认 "认证服务器颁发的AccessToken")。
|
||||
*/
|
||||
public var description: String = "认证服务器颁发的AccessToken"
|
||||
|
||||
/**
|
||||
* 授权地址。
|
||||
*/
|
||||
public var authorizationUrl: String = ""
|
||||
|
||||
/**
|
||||
* Token 地址。
|
||||
*/
|
||||
public var tokenUrl: String = ""
|
||||
|
||||
/**
|
||||
* 授权范围。
|
||||
*/
|
||||
public var scopes: HashMap<String, String> = HashMap<String, String>()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档相关配置(默认值与 C# 一致)。
|
||||
*/
|
||||
public class SimApiDocOptions {
|
||||
/**
|
||||
* 文档组配置(默认 [new("api", "Api", "Api接口文档")])。
|
||||
*/
|
||||
public var apiGroups: ArrayList<SimApiDocGroup> = ArrayList<SimApiDocGroup>()
|
||||
|
||||
/**
|
||||
* 授权配置(默认 SimApiAuthOption())。
|
||||
*/
|
||||
public var apiAuth = SimApiAuthOption()
|
||||
|
||||
/**
|
||||
* 文档页面标题(默认 "API接口文档")。
|
||||
*/
|
||||
public var documentTitle: String = "API接口文档"
|
||||
|
||||
/**
|
||||
* 接口支持的调用方式(默认仅 POST)。
|
||||
*/
|
||||
public var supportedMethods: Array<String> = ["POST"]
|
||||
|
||||
public init() {
|
||||
apiGroups.add(SimApiDocGroup("api", "Api", description: "Api接口文档"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user