add: notice message skeletal code

This commit is contained in:
2021-09-09 16:32:13 +08:00
parent 8c60ce1d76
commit 86d634d94f
43 changed files with 1696 additions and 236 deletions

View File

@@ -1,7 +1,7 @@
<!--
* @Date: 2021-03-01 10:35:21
* @LastEditors: viletyy
* @LastEditTime: 2021-06-11 16:28:51
* @LastEditTime: 2021-09-09 16:24:28
* @FilePath: /forgeplus/app/docs/slate/source/includes/_users.md
-->
# Users
@@ -47,6 +47,254 @@ await octokit.request('GET /api/users/me.json')
Success Data.
</aside>
## 用户消息列表
获取用户消息列表
> 示例:
```shell
curl -X GET http://localhost:3000/api/users/:login/messages.json
```
```javascript
await octokit.request('GET /api/users/:login/messages.json')
```
### HTTP 请求
`GET api/users/yystopf/messages.json`
### 请求字段说明:
参数 | 类型 | 字段说明
--------- | ----------- | -----------
|type | string | 消息类型不传为所有消息notification为系统消息atme为@我消息|
|status | integer | 是否已读不传为所有消息0为未读1为已读 |
|limit | integer | 每页个数 |
|page | integer | 页码 |
### 返回字段说明:
参数 | 类型 | 字段说明
--------- | ----------- | -----------
|total_count | integer | 消息总数 |
|type | string | 消息类型 |
|unread_notification | integer | 未读系统通知数量 |
|unread_atme | integer | 未读@我数量 |
|messages.id | integer | 消息id |
|messages.status | integer | 消息是否已读0为未读1为已读 |
|messages.content | string | 消息内容 |
|messages.notification_url | string | 消息跳转地址 |
|messages.source | string | 消息来源 |
|messages.type | string | 消息类型notification为系统消息atme为@我消息|
|sender | object | 消息发送者 |
#### 消息来源source字段说明
类型|说明
--------- | -----------
|IssueAssigned | 有新指派给我的易修 |
|IssueAssignerExpire | 我负责的易修截止日期到达最后一天 |
|IssueAtme | 在易修中@我 |
|IssueChanged | 我创建或负责的易修状态变更 |
|IssueCreatorExpire | 我创建的易修截止日期到达最后一天 |
|IssueDeleted | 我创建或负责的易修删除 |
|IssueJournal | 我创建或负责的易修有新的评论 |
|LoginIpTip | 登录异常提示 |
|OrganizationJoined | 账号被拉入组织 |
|OrganizationLeft | 账号被移出组织 |
|OrganizationRole | 账号组织权限变更 |
|ProjectDelete | 我关注的仓库被删除 |
|ProjectFollowed | 我管理的仓库被关注 |
|ProjectForked | 我管理的仓库被复刻 |
|ProjectIssue | 我管理/关注的仓库有新的易修 |
|ProjectJoined | 账号被拉入项目 |
|ProjectLeft | 账号被移出项目 |
|ProjectMemberJoined | 我管理的仓库有成员加入 |
|ProjectMemberLeft | 我管理的仓库有成员移出 |
|ProjectMilestone | 我管理的仓库有新的里程碑 |
|ProjectPraised | 我管理的仓库被点赞 |
|ProjectPullRequest | 我管理/关注的仓库有新的合并请求 |
|ProjectRole | 账号仓库权限变更 |
|ProjectSettingChanged | 我管理的仓库项目设置被更改 |
|ProjectTransfer | 我关注的仓库被转移 |
|ProjectVersion | 我关注的仓库有新的发行版 |
|PullRequestAssigned | 有新指派给我的合并请求 |
|PullReuqestAtme | 在合并请求中@我 |
|PullRequestChanged | 我创建或负责的合并请求状态变更 |
|PullRequestJournal | 我创建或负责的合并请求有新的评论 |
> 返回的JSON示例:
```json
{
"total_count": 5,
"type": "",
"unread_notification": 3,
"unread_atme": 2,
"messages": [
{
"id": 1,
"status": 1,
"content": "Atme Message Content 1",
"notification_url": "http://www.baidu.com",
"source": "PullRequestAtme",
"type": "atme",
"sender": {
"id": 5,
"type": "User",
"name": "testforge2",
"login": "testforge2",
"image_url": "system/lets/letter_avatars/2/T/236_177_85/120.png"
}
},
{
"id": 2,
"status": 0,
"content": "Atme Message Content 2",
"notification_url": "http://www.baidu.com",
"source": "IssueAtme",
"type": "atme",
"sender": {
"id": 4,
"type": "User",
"name": "testforge1",
"login": "testforge1",
"image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
}
},
{
"id": 3,
"status": 1,
"content": "Notification Message Content 1",
"notification_url": "http://www.baidu.com",
"source": "IssueDelete",
"type": "notification"
},
{
"id": 4,
"status": 0,
"content": "Notification Message Content 2",
"notification_url": "http://www.baidu.com",
"source": "IssueChanged",
"type": "notification"
},
{
"id": 5,
"status": 0,
"content": "Notification Message Content 3",
"notification_url": "http://www.baidu.com",
"source": "ProjectJoined",
"type": "notification"
}
]
}
```
<aside class="success">
Success Data.
</aside>
## 发送消息
发送消息
> 示例:
```shell
curl -X POST http://localhost:3000/api/users/:login/messages.json
```
```javascript
await octokit.request('POST /api/users/:login/messages.json')
```
### HTTP 请求
`POST api/users/yystopf/messages.json`
### 请求字段说明:
参数 | 类型 | 字段说明
--------- | ----------- | -----------
|type | string | 消息类型 |
|recervers_login | array | 需要发送消息的用户名数组|
|content | string | 消息内容 |
> 返回的JSON示例:
```json
{
"status": 0,
"message": "success"
}
```
<aside class="success">
Success Data.
</aside>
## 阅读消息
阅读消息
> 示例:
```shell
curl -X POST http://localhost:3000/api/users/:login/messages/read.json
```
```javascript
await octokit.request('POST /api/users/:login/messages/read.json')
```
### HTTP 请求
`POST api/users/yystopf/messages/read.json`
### 请求字段说明:
参数 | 类型 | 字段说明
--------- | ----------- | -----------
|type | string | 消息类型不传为所有消息notification为系统消息atme为@我消息|
|ids | array | 消息id数组包含-1则把所有未读消息标记为已读|
> 返回的JSON示例:
```json
{
"status": 0,
"message": "success"
}
```
<aside class="success">
Success Data.
</aside>
## 删除消息
删除消息
> 示例:
```shell
curl -X DELETE http://localhost:3000/api/users/:login/messages.json
```
```javascript
await octokit.request('DELETE /api/users/:login/messages.json')
```
### HTTP 请求
`DELETE api/users/yystopf/messages.json`
### 请求字段说明:
参数 | 类型 | 字段说明
--------- | ----------- | -----------
|type | string | 消息类型atme为@我消息|
|ids | array | 消息id数组包含-1则把所有消息删除|
> 返回的JSON示例:
```json
{
"status": 0,
"message": "success"
}
```
<aside class="success">
Success Data.
</aside>
## 更改用户信息
更改用户信息