Files
schisandra-album-cloud-micr…/app/auth/api/auth.api
2025-02-08 00:46:03 +08:00

584 lines
16 KiB
Plaintext

syntax = "v1"
info (
title: "鉴权服务"
desc: "鉴权服务"
author: "landaiqing"
email: "landaiqing@126.com"
version: "v1.0.0"
)
// 登录请求参数
type (
// 账户登录请求参数
AccountLoginRequest {
Account string `json:"account"`
Password string `json:"password"`
AutoLogin bool `json:"auto_login"`
Angle int64 `json:"angle"`
Key string `json:"key"`
}
// 手机号登录请求参数
PhoneLoginRequest {
Phone string `json:"phone"`
Captcha string `json:"captcha"`
AutoLogin bool `json:"auto_login"`
}
// 重置密码请求参数
ResetPasswordRequest {
Phone string `json:"phone"`
Captcha string `json:"captcha"`
Password string `json:"password"`
Repassword string `json:"repassword"`
}
WechatOffiaccountLoginRequest {
Openid string `json:"openid"`
ClientId string `json:"client_id"`
}
// 登录响应参数
LoginResponse {
AccessToken string `json:"access_token"`
ExpireAt int64 `json:"expire_at"`
UID string `json:"uid"`
Username string `json:"username,omitempty"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Status int64 `json:"status"`
}
)
// OAuth请求参数
type (
// OAuth请求参数
OAuthRequest {
state string `form:"state"`
}
// OAuth回调请求参数
OAuthCallbackRequest {
Code string `form:"code"`
}
OAuthWechatRequest {
clientId string `json:"client_id"`
}
)
// 短信发送请求参数
type (
SmsSendRequest {
Phone string `json:"phone"`
Angle int64 `json:"angle"`
Key string `json:"key"`
}
)
// 刷新token响应参数
type (
RefreshTokenResponse {
AccessToken string `json:"access_token"`
ExpireAt int64 `json:"expire_at"`
}
)
// 验证码响应参数
type (
RotateCaptchaResponse {
Key string `json:"key"`
Image string `json:"image"`
Thumb string `json:"thumb"`
}
SlideCaptchaResponse {
Key string `json:"key"`
Image string `json:"image"`
Thumb string `json:"thumb"`
ThumbWidth int64 `json:"thumb_width"`
ThumbHeight int64 `json:"thumb_height"`
ThumbX int64 `json:"thumb_x"`
ThumbY int64 `json:"thumb_y"`
}
)
// 用户服务
@server (
group: user // 微服务分组
prefix: /api/user // 微服务前缀
timeout: 10s // 超时时间
maxBytes: 1048576 // 最大请求大小
signature: true // 是否开启签名验证
middleware: SecurityHeadersMiddleware,NonceMiddleware // 注册中间件
MaxConns: true // 是否开启最大连接数限制
Recover: true // 是否开启自动恢复
)
service auth {
// 账户登录
@handler accountLogin
post /login (AccountLoginRequest) returns (LoginResponse)
// 手机号登录
@handler phoneLogin
post /phone/login (PhoneLoginRequest) returns (LoginResponse)
// 重置密码
@handler resetPassword
post /reset/password (ResetPasswordRequest)
// 微信公众号登录
@handler wechatOffiaccountLogin
post /wechat/offiaccount/login (WechatOffiaccountLoginRequest) returns (LoginResponse)
// 获取微信公众号二维码
@handler getWechatOffiaccountQrcode
post /wechat/offiaccount/qrcode (OAuthWechatRequest) returns (string)
}
@server (
group: token // 微服务分组
prefix: /api/auth // 微服务前缀
timeout: 10s // 超时时间
maxBytes: 1048576 // 最大请求大小
signature: true // 是否开启签名验证
middleware: SecurityHeadersMiddleware,CasbinVerifyMiddleware,NonceMiddleware // 注册中间件
MaxConns: true // 是否开启最大连接数限制
Recover: true // 是否开启自动恢复
)
service auth {
@handler refreshToken
post /token/refresh returns (RefreshTokenResponse)
}
// 客户端服务
@server (
group: client // 微服务分组
prefix: /api/client // 微服务前缀
timeout: 10s // 超时时间
maxBytes: 1048576 // 最大请求大小
signature: false // 是否开启签名验证
middleware: SecurityHeadersMiddleware,NonceMiddleware // 注册中间件
MaxConns: true // 是否开启最大连接数限制
Recover: true // 是否开启自动恢复
)
service auth {
@handler generateClientId
get /generate returns (string)
}
@server (
group: websocket // 微服务分组
prefix: /api/ws // 微服务前缀
)
service auth {
@handler qrcodeWebsocket
get /qrcode
@handler messageWebsocket
get /message
@handler fileWebsocket
get /file
}
@server (
group: oauth // 微服务分组
prefix: /api/oauth // 微服务前缀
timeout: 10s // 超时时间
maxBytes: 1048576 // 最大请求大小
signature: false // 是否开启签名验证
middleware: SecurityHeadersMiddleware // 注册中间件
MaxConns: true // 是否开启最大连接数限制
Recover: true // 是否开启自动恢复
)
service auth {
@handler getGiteeOauthUrl
get /gitee/url returns (string)
@handler getGithubOauthUrl
get /github/url (OAuthRequest) returns (string)
@handler getQqOauthUrl
get /qq/url (OAuthRequest) returns (string)
@handler giteeCallback
get /gitee/callback (OAuthCallbackRequest) returns (string)
@handler githubCallback
get /github/callback (OAuthCallbackRequest) returns (string)
@handler qqCallback
get /qq/callback (OAuthCallbackRequest) returns (string)
@handler wechatOffiaccountCallback
post /wechat/offiaccount/callback
// important!
@handler wechatOffiaccountCallbackVerify
get /wechat/offiaccount/callback
}
@server (
group: sms // 微服务分组
prefix: /api/sms // 微服务前缀
timeout: 10s // 超时时间
maxBytes: 1048576 // 最大请求大小
signature: false // 是否开启签名验证
middleware: SecurityHeadersMiddleware,NonceMiddleware // 注册中间件
MaxConns: true // 是否开启最大连接数限制
Recover: true // 是否开启自动恢复
)
service auth {
@handler sendSmsByAliyun
post /ali/send (SmsSendRequest)
@handler sendSmsBySmsbao
post /smsbao/send (SmsSendRequest)
@handler sendSmsByTest
post /test/send (SmsSendRequest) returns (string)
}
@server (
group: captcha // 微服务分组
prefix: /api/captcha // 微服务前缀
timeout: 10s // 超时时间
maxBytes: 1048576 // 最大请求大小
signature: false // 是否开启签名验证
middleware: SecurityHeadersMiddleware,NonceMiddleware // 注册中间件
MaxConns: true // 是否开启最大连接数限制
Recover: true // 是否开启自动恢复
)
service auth {
@handler generateRotateCaptcha
get /rotate/generate returns (RotateCaptchaResponse)
@handler generateSlideBasicCaptcha
get /slide/generate returns (SlideCaptchaResponse)
}
type (
// 评论提交请求参数
CommentRequest {
Content string `json:"content"`
Images string `json:"images,optional"`
TopicId string `json:"topic_id"`
Author string `json:"author"`
Key string `json:"key"`
Point []int64 `json:"point"`
}
// 回复评论提交请求参数
ReplyCommentRequest {
Content string `json:"content"`
Images string `json:"images,optional"`
TopicId string `json:"topic_id" `
ReplyId int64 `json:"reply_id" `
ReplyUser string `json:"reply_user" `
Author string `json:"author"`
Key string `json:"key"`
Point []int64 `json:"point"`
}
// 回复回复请求参数
ReplyReplyRequest {
Content string `json:"content"`
Images string `json:"images,optional"`
TopicId string `json:"topic_id"`
ReplyTo int64 `json:"reply_to"`
ReplyId int64 `json:"reply_id"`
ReplyUser string `json:"reply_user" `
Author string `json:"author"`
Key string `json:"key"`
Point []int64 `json:"point"`
}
// 评论列表请求参数
CommentListRequest {
TopicId string `json:"topic_id"`
Page int `json:"page,default=1,optional"`
Size int `json:"size,default=5,optional"`
IsHot bool `json:"is_hot,default=true,optional"`
}
// 回复列表请求参数
ReplyListRequest {
TopicId string `json:"topic_id"`
CommentId int64 `json:"comment_id"`
Page int `json:"page,default=1,optional"`
Size int `json:"size,default=5,optional"`
}
// 点赞评论的请求参数
CommentLikeRequest {
TopicId string `json:"topic_id"`
CommentId int64 `json:"comment_id"`
}
CommentDisLikeRequest {
TopicId string `json:"topic_id"`
CommentId int64 `json:"comment_id"`
}
)
// 响应参数
type (
// CommentContent 评论内容
CommentContent {
NickName string `json:"nickname"`
Avatar string `json:"avatar"`
Level int64 `json:"level,omitempty" default:"0"`
Id int64 `json:"id"`
UserId string `json:"user_id"`
TopicId string `json:"topic_id"`
Content string `json:"content"`
ReplyTo int64 `json:"reply_to,omitempty"`
ReplyId int64 `json:"reply_id,omitempty"`
ReplyUser string `json:"reply_user,omitempty"`
ReplyNickname string `json:"reply_nickname,omitempty"`
IsAuthor int64 `json:"is_author"`
Likes int64 `json:"likes"`
ReplyCount int64 `json:"reply_count"`
CreatedTime string `json:"created_time"`
Location string `json:"location"`
Browser string `json:"browser"`
OperatingSystem string `json:"operating_system"`
IsLiked bool `json:"is_liked" default:"false"`
Images string `json:"images,omitempty"`
}
// CommentListPageResponse 评论返回值
CommentListPageResponse {
Size int `json:"size"`
Total int64 `json:"total"`
Current int `json:"current"`
Comments []CommentContent `json:"comments"`
}
// CommentResponse 提交评论响应
CommentResponse {
Id int64 `json:"id"`
Content string `json:"content"`
UserId string `json:"user_id"`
TopicId string `json:"topic_id"`
Author int64 `json:"author"`
Location string `json:"location"`
Browser string `json:"browser"`
OperatingSystem string `json:"operating_system"`
CreatedTime string `json:"created_time"`
ReplyId int64 `json:"reply_id,omitempty"`
ReplyUser string `json:"reply_user,omitempty"`
ReplyTo int64 `json:"reply_to,omitempty"`
}
)
@server (
group: comment // 微服务分组
prefix: /api/auth/comment // 微服务前缀
timeout: 10s // 超时时间
maxBytes: 1048576 // 最大请求大小
signature: false // 是否开启签名验证
middleware: SecurityHeadersMiddleware,CasbinVerifyMiddleware,NonceMiddleware // 注册中间件
MaxConns: true // 是否开启最大连接数限制
Recover: true // 是否开启自动恢复
jwt: Auth // 是否开启jwt验证
)
service auth {
@handler getCommentList
post /list (CommentListRequest) returns (CommentListPageResponse)
@handler getReplyList
post /reply/list (ReplyListRequest) returns (CommentListPageResponse)
@handler submitComment
post /submit (CommentRequest) returns (CommentResponse)
@handler submitReplyComment
post /reply/submit (ReplyCommentRequest) returns (CommentResponse)
@handler submitReplyReply
post /reply/reply/submit (ReplyReplyRequest) returns (CommentResponse)
@handler likeComment
post /like (CommentLikeRequest)
@handler dislikeComment
post /dislike (CommentDisLikeRequest)
}
// 上传图片请求参数
type (
UploadRequest {
Image string `json:"image"`
AccessToken string `json:"access_token"`
userId string `json:"user_id"`
}
)
@server (
group: upscale // 微服务分组
prefix: /api/auth/upscale // 微服务前缀
timeout: 10s // 超时时间
maxBytes: 10485760 // 最大请求大小
signature: false // 是否开启签名验证
middleware: SecurityHeadersMiddleware,NonceMiddleware // 注册中间件
MaxConns: true // 是否开启最大连接数限制
Recover: true // 是否开启自动恢复
)
service auth {
@handler uploadImage
post /phone/upload (UploadRequest)
}
// 文件上传配置请求参数
type (
StorageConfigRequest {
Type string `json:"type"`
AccessKey string `json:"access_key"`
SecretKey string `json:"secret_key"`
Endpoint string `json:"endpoint"`
Bucket string `json:"bucket"`
Region string `json:"region"`
}
FaceSampleLibrary {
ID int64 `json:"id"`
FaceName string `json:"face_name"`
FaceImage string `json:"face_image"`
}
FaceSampleLibraryListRequest {
Type int64 `json:"type"`
}
FaceSampleLibraryListResponse {
faces []FaceSampleLibrary `json:"faces"`
}
ModifyFaceNameRequestAndResponse {
ID int64 `json:"id"`
FaceName string `json:"face_name"`
}
ModifyFaceTypeRequest {
IDs []int64 `json:"ids"`
FaceType int64 `json:"face_type"`
}
ModifyFaceTypeResponse {
result string `json:"result"`
}
FaceDetailListRequest {
FaceID int64 `json:"face_id"`
}
// 创建相册请求参数
AlbumCreateRequest {
Name string `json:"name"`
}
// 创建相册响应参数
AlbumCreateResponse {
ID int64 `json:"id"`
}
// 相册列表请求参数
AlbumListRequest {
Type string `json:"type"`
Sort bool `json:"sort"`
}
// 相册列表响应参数
Album {
ID int64 `json:"id"`
Name string `json:"name"`
CreatedAt string `json:"created_at"`
Type string `json:"type"`
CoverImage string `json:"cover_image"`
}
AlbumListResponse {
Albums []Album `json:"albums"`
}
// 相册详情请求参数
AlbumDetailListRequest {
ID int64 `json:"id"`
}
// 重命名相册请求参数
AlbumRenameRequest {
ID int64 `json:"id"`
Name string `json:"name"`
}
// 重命名相册响应参数
AlbumRenameResponse {
ID int64 `json:"id"`
Name string `json:"name"`
}
// 删除相册请求参数
AlbumDeleteRequest {
ID int64 `json:"id"`
}
// 所有图片列表请求参数
AllImageListRequest {
Type string `json:"type"`
Sort bool `json:"sort"`
Provider string `json:"provider"`
Bucket string `json:"bucket"`
}
// 所有图片列表响应参数
ImageMeta {
ID int64 `json:"id"`
fileName string `json:"file_name"`
filePath string `json:"file_path"`
URL string `json:"url"`
fileSize string `json:"file_size"`
CreatedAt string `json:"created_at"`
}
AllImageDetail {
Date string `json:"date"`
list []ImageMeta `json:"list"`
}
AllImageListResponse {
records []AllImageDetail `json:"records"`
}
)
// 文件上传
@server (
group: storage // 微服务分组
prefix: /api/auth/storage // 微服务前缀
timeout: 20s // 超时时间
maxBytes: 104857600 // 最大请求大小
signature: false // 是否开启签名验证
middleware: SecurityHeadersMiddleware,CasbinVerifyMiddleware,NonceMiddleware // 注册中间件
MaxConns: true // 是否开启最大连接数限制
Recover: true // 是否开启自动恢复
jwt: Auth // 是否开启jwt验证
)
service auth {
// 上传文件
@handler uploadFile
post /uploads returns (string)
// 设置存储配置
@handler setStorageConfig
post /config (StorageConfigRequest) returns (string)
// 获取人脸样本库列表
@handler getFaceSampleLibraryList
post /face/sample/list (FaceSampleLibraryListRequest) returns (FaceSampleLibraryListResponse)
// 修改人脸样本名称
@handler modifyFaceLibraryName
post /face/sample/modify/name (ModifyFaceNameRequestAndResponse) returns (ModifyFaceNameRequestAndResponse)
// 修改人脸样本类型
@handler modifyFaceLibraryType
post /face/sample/modify/type (ModifyFaceTypeRequest) returns (ModifyFaceTypeResponse)
// 获取人脸详情列表 (暂定)
@handler getFaceDetailList
post /face/detail/list (FaceDetailListRequest) returns (string)
// 创建相册
@handler createAlbum
post /album/create (AlbumCreateRequest) returns (AlbumCreateResponse)
// 获取相册列表
@handler getAlbumList
post /album/list (AlbumListRequest) returns (AlbumListResponse)
// 获取相册详情(暂定)
@handler getAlbumDetail
post /album/detail/list (AlbumDetailListRequest) returns (string)
// 重命名相册
@handler renameAlbum
post /album/rename (AlbumRenameRequest) returns (AlbumRenameResponse)
// 删除相册
@handler deleteAlbum
post /album/delete (AlbumDeleteRequest) returns (string)
// 获取所有图片列表
@handler queryAllImageList
post /image/all/list (AllImageListRequest) returns (AllImageListResponse)
}