Skip to content

Commit

Permalink
Merge pull request #15 from bcho/feat-api/update.me
Browse files Browse the repository at this point in the history
feat(api): add `user.update_me` API
  • Loading branch information
aphawk authored Apr 20, 2017
2 parents 7cedc49 + eb8a223 commit 17a7d19
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 49 deletions.
147 changes: 99 additions & 48 deletions api/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,63 @@ paths:
schema:
$ref: '#/definitions/Error'

# /user.update_me: TODO
/user.update_me:
patch:
tags:
- user
description: |
更新当前用户信息。
authentication: true
responses:
200:
schema:
$ref: '#/definitions/User'
examples:
user response: |
{
"inactive": false,
"role": "normal",
"email": "support@bearyinnovative.com",
"name": "BearyBot",
"type": "assistant",
"created": "2017-01-11T12:28:31.000+0000",
"id": "=bwMkR",
"avatars": {
"small": null,
"medium": null,
"large": null
},
"team_id": "=bw52O",
"full_name": "倍洽小助手",
"mobile": null,
"profile": {
"bio": null,
"position": null,
"skype": null
}
}
default:
schema:
$ref: '#/definitions/Error'
parameters:
- name: name
in: body
description: 用户名 (@name)
example: 'beary_bot'
required: false
- name: full_name
in: body
description: 用户全名
example: 'BearyBot'
required: false

#---------------------------------------------------------------------------
# 聊天会话相关
#---------------------------------------------------------------------------
/vchannel.info:
get:
tags:
- vchannel
description: |
返回指定聊天会话的完整信息。
authentication: true
Expand All @@ -214,55 +264,56 @@ paths:
type: object
description: |
Channel / SessionChannel / P2PChannel 的其中一种
example: |
// Channel
{
"private": false,
"general": true,
"latest_ts": 1486367046281,
"uid": "=bw52O",
"name": "所有人",
"is_member": false,
"is_active": true,
"type": "normal",
"topic": null,
"member_uids": [
"=bw52O"
],
"vchannel_id": "=bw52O",
"id": "=bw52O",
"team_id": "=bw52O"
}
examples:
vchannel response: |
// Channel
{
"private": false,
"general": true,
"latest_ts": 1486367046281,
"uid": "=bw52O",
"name": "所有人",
"is_member": false,
"is_active": true,
"type": "normal",
"topic": null,
"member_uids": [
"=bw52O"
],
"vchannel_id": "=bw52O",
"id": "=bw52O",
"team_id": "=bw52O"
}
// SessionChannel
{
"latest_ts": "1489242467694",
"name": "临时讨论组名称",
"is_member": true,
"is_active": true,
"type": "session",
"member_uids": [
"=bw52O"
],
"vchannel_id": "=bw52O",
"id": "=bw52O",
"team_id": "=bw52O"
}
// SessionChannel
{
"latest_ts": "1489242467694",
"name": "临时讨论组名称",
"is_member": true,
"is_active": true,
"type": "session",
"member_uids": [
"=bw52O"
],
"vchannel_id": "=bw52O",
"id": "=bw52O",
"team_id": "=bw52O"
}
// P2PChannel
{
"id": "=bw52O",
"team_id": "=bw52O",
"vchannel_id": "=bw52O",
"type": "p2p",
"is_active": true,
"is_member": true,
"member_uids": [
"=bw52O",
"=bw52P"
],
"latest_ts": 1485238998284
}
// P2PChannel
{
"id": "=bw52O",
"team_id": "=bw52O",
"vchannel_id": "=bw52O",
"type": "p2p",
"is_active": true,
"is_member": true,
"member_uids": [
"=bw52O",
"=bw52P"
],
"latest_ts": 1485238998284
}
parameters:
- name: vchannel_id
in: body
Expand Down
57 changes: 57 additions & 0 deletions api/user.update_me.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# user.update_me

更新当前用户信息。

## 请求方式

```
PATCH {base_url}/user.update_me
```

## 请求参数

**需要登录**

| 参数名称 | 参数类型 | 参数是否必须? | 说明 | 样例 |
|:--------:|:--------:|:--------------:|------|------|
| `name` | `string` || 用户名 (@name) | beary_bot |
| `full_name` | `string` || 用户全名 | BearyBot |

## 响应

### 200

```javascript
{
"inactive": false,
"role": "normal",
"email": "support@bearyinnovative.com",
"name": "BearyBot",
"type": "assistant",
"created": "2017-01-11T12:28:31.000+0000",
"id": "=bwMkR",
"avatars": {
"small": null,
"medium": null,
"large": null
},
"team_id": "=bw52O",
"full_name": "倍洽小助手",
"mobile": null,
"profile": {
"bio": null,
"position": null,
"skype": null
}
}
```
### 错误响应

```javascript
{
"code": // error code,
"error": "unexpected error"
}
```

<!-- generated by gen_doc.js -->
2 changes: 1 addition & 1 deletion api/vchannel.info.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ GET {base_url}/vchannel.info

### 200

```json
```javascript
// Channel
{
"private": false,
Expand Down

0 comments on commit 17a7d19

Please sign in to comment.