Files

49 lines
1020 B
Plaintext

syntax = "v1"
import "common.api"
info (
title: "聚玩通知服务"
desc: "管理站内消息通知。ID 字段(int64)以 string 传输"
author: "Asadz"
version: "1.0"
)
type (
PathId {
Id int64 `path:"id"`
}
Notification {
Id int64 `json:"id,string"`
Type string `json:"type"`
Title string `json:"title"`
Content string `json:"content"`
Read bool `json:"read"`
Link string `json:"link,optional"`
CreatedAt string `json:"createdAt"`
}
NotificationListResp {
Items []Notification `json:"items"`
Meta PageMeta `json:"meta"`
}
)
@server (
prefix: api/v1
group: notification
)
service notifi-api {
@doc "获取通知列表"
@handler ListNotifications
get /notifications (PageReq) returns (NotificationListResp)
@doc "标记已读"
@handler ReadNotification
put /notifications/:id/read (PathId) returns (EmptyResp)
@doc "全部已读"
@handler ReadAllNotifications
put /notifications/read-all (EmptyResp) returns (EmptyResp)
}