| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- syntax = "v1"
- type Request {
- Name string `path:"name,options=you|me"`
- }
- type Response {
- Message string `json:"message"`
- }
- type DbPingResponse {
- Ok bool `json:"ok"`
- Version string `json:"version"`
- Database string `json:"database"`
- }
- type DeleteResp {
- Ok bool `json:"ok"`
- }
- type CreateDirectoryReq {
- Id int64 `json:"id,optional"`
- ServiceId int64 `json:"serviceId,optional"`
- Directory string `json:"directory,optional"`
- }
- type UpdateDirectoryReq {
- Id int64 `path:"id"`
- ServiceId int64 `json:"serviceId,optional"`
- Directory string `json:"directory,optional"`
- }
- type DirectoryIdReq {
- Id int64 `path:"id"`
- }
- type DirectoryResp {
- Id int64 `json:"id"`
- ServiceId int64 `json:"serviceId"`
- Directory string `json:"directory"`
- }
- type ListDirectoryReq {
- Page int64 `form:"page,optional"`
- PageSize int64 `form:"pageSize,optional"`
- }
- type DirectoryListResp {
- List []DirectoryResp `json:"list"`
- Total int64 `json:"total"`
- }
- type CreateKeyReq {
- Name string `json:"name"`
- }
- type UpdateKeyReq {
- Id int64 `json:"id"`
- Status string `json:"status"`
- }
- type KeyIdReq {
- Id int64 `json:"id"`
- }
- type KeyResp {
- Id int64 `json:"id"`
- Iden string `json:"iden"`
- Name string `json:"name"`
- Content string `json:"content"`
- Status string `json:"status"`
- CreateAt string `json:"createAt"`
- }
- type ListKeysReq {
- Page int64 `json:"page,optional"`
- PageSize int64 `json:"pageSize,optional"`
- Name string `json:"name,optional"`
- Status string `json:"status,optional"`
- }
- type KeyListResp {
- List []KeyResp `json:"list"`
- Total int64 `json:"total"`
- }
- type CreateServiceReq {
- Id int64 `json:"id,optional"`
- Name string `json:"name,optional"`
- Ip string `json:"ip,optional"`
- Port string `json:"port,optional"`
- Iden string `json:"iden,optional"`
- KeyIden string `json:"keyIden,optional"`
- KeyAlgo string `json:"keyAlgo,optional"`
- Status string `json:"status,optional"`
- Directories []string `json:"directories,optional"`
- }
- type UpdateServiceReq {
- Id int64 `path:"id"`
- Name string `json:"name,optional"`
- Ip string `json:"ip,optional"`
- Port string `json:"port,optional"`
- Iden string `json:"iden,optional"`
- KeyIden string `json:"keyIden,optional"`
- KeyAlgo string `json:"keyAlgo,optional"`
- Status string `json:"status,optional"`
- }
- type ServiceIdReq {
- Id int64 `path:"id"`
- }
- type ServiceResp {
- Id int64 `json:"id"`
- Name string `json:"name"`
- Ip string `json:"ip"`
- Port string `json:"port"`
- Iden string `json:"iden"`
- KeyIden string `json:"keyIden"`
- KeyAlgo string `json:"keyAlgo"`
- Status string `json:"status"`
- CreateAt string `json:"createAt"`
- }
- type ListServiceReq {
- Page int64 `form:"page,optional"`
- PageSize int64 `form:"pageSize,optional"`
- }
- type ServiceListResp {
- List []ServiceResp `json:"list"`
- Total int64 `json:"total"`
- }
- // 本地目录懒加载(udeServer 所在 Linux 主机文件系统,只列目录不列文件)
- type ListDirChildrenReq {
- Path string `form:"path"` // 空或 "/" 表示根目录
- }
- type LocalDirNode {
- Name string `json:"name"` // 目录名,如 "usr"
- Path string `json:"path"` // 完整绝对路径,如 "/usr"
- IsDir bool `json:"isDir"` // 恒 true
- HasChildren bool `json:"hasChildren"` // 是否含子目录(前端据此决定是否显示展开箭头)
- }
- type DirChildrenResp {
- Nodes []LocalDirNode `json:"nodes"`
- }
- // 自动检测 SMB 共享的目录树
- type ScanDirectoriesReq {
- Ip string `json:"ip"`
- Port string `json:"port,optional"`
- Share string `json:"share,optional"` // 留空读 config.DefaultShare
- }
- type DirectoryNode {
- Name string `json:"name"`
- SmbPath string `json:"smbPath"` // SMB 路径: \\ip\share\dir
- LocalMount string `json:"localMount"` // 真实挂载点: /var/ude/mnt/svc-123/data
- IsDir bool `json:"isDir"`
- Children []DirectoryNode `json:"children,optional"`
- }
- @server (
- prefix: /api/v1
- )
- service udeServer-api {
- @handler UdeServerHandler
- get /from/:name (Request) returns (Response)
- @handler DbPingHandler
- get /db/ping returns (DbPingResponse)
- @handler CreateDirectoryHandler
- post /directories (CreateDirectoryReq) returns (DirectoryResp)
- @handler ListDirectoriesHandler
- get /directories (ListDirectoryReq) returns (DirectoryListResp)
- @handler GetDirectoryHandler
- get /directories/:id (DirectoryIdReq) returns (DirectoryResp)
- @handler UpdateDirectoryHandler
- put /directories/:id (UpdateDirectoryReq) returns (DirectoryResp)
- @handler DeleteDirectoryHandler
- delete /directories/:id (DirectoryIdReq) returns (DeleteResp)
- @handler CreateKeyHandler
- post /keys/create (CreateKeyReq) returns (KeyResp)
- @handler ListKeysHandler
- post /keys/list (ListKeysReq) returns (KeyListResp)
- @handler GetKeyHandler
- post /keys/detail (KeyIdReq) returns (KeyResp)
- @handler UpdateKeyHandler
- post /keys/update (UpdateKeyReq) returns (KeyResp)
- @handler DeleteKeyHandler
- post /keys/delete (KeyIdReq) returns (DeleteResp)
- @handler CreateServiceHandler
- post /services (CreateServiceReq) returns (ServiceResp)
- @handler ListServicesHandler
- get /services (ListServiceReq) returns (ServiceListResp)
- @handler GetServiceHandler
- get /services/:id (ServiceIdReq) returns (ServiceResp)
- @handler UpdateServiceHandler
- put /services/:id (UpdateServiceReq) returns (ServiceResp)
- @handler DeleteServiceHandler
- delete /services/:id (ServiceIdReq) returns (DeleteResp)
- @handler BrushServiceHandler
- post /services/:id/brush (ServiceIdReq) returns (DeleteResp)
- @handler ListDirChildrenHandler
- get /dirs/children (ListDirChildrenReq) returns (DirChildrenResp)
- }
|