Skip to content

Commit

Permalink
Merge #113
Browse files Browse the repository at this point in the history
113: feat: 获取员工创建的客户(外部)群列表及客户(外部)群详细 r=xen0n a=tiger1103



### `ReqChatListOwnerFilter` 群主过滤

Name|JSON|Type|Doc
:---|:---|:---|:--
`UserIDList`|`userid_list`|`[]string`| 用户ID列表。最多100个



### `ReqChatList` 获取客户群列表参数

Name|JSON|Type|Doc
:---|:---|:---|:--
`StatusFilter`|`status_filter`|`int64`| 客户群跟进状态过滤
`OwnerFilter`|`owner_filter`|`ReqChatListOwnerFilter`| 群主过滤
`Cursor`|`cursor`|`string`| 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用不填
`Limit`|`limit`|`int64`| 分页,预期请求的数据量,取值范围 1 ~ 1000


### `RespGroupChatList` 客户群列表数据

Name|JSON|Type|Doc
:---|:---|:---|:--
`ChatID`|`chat_id`|`string`| 客户群ID
`Status`|`status`|`int64`| 客户群跟进状态 0 - 跟进人正常 1 - 跟进人离职 2 - 离职继承中 3 - 离职继承完成




### `RespAppchatList` 客户群列表结果

Name|JSON|Type|Doc
:---|:---|:---|:--
`GroupChatList`|`group_chat_list`|`[]RespGroupChatList`| 客户群列表
`NextCursor`|`next_cursor`|`string`| 分页游标

### `ChatMemberList` 客户群成员列表

Name|JSON|Type|Doc
:---|:---|:---|:--
`UserID`|`userid`|`string`| 群成员ID
`Type`|`type`|`int64`| 群成员类型 1 - 企业成员  2 - 外部联系人
`UnionID`|`unionid`|`string`| 微信unionid
`JoinTime`|`join_time`|`int64`| 入群时间
`JoinScene`|`join_scene`|`int64`| 入群方式。1 - 由群成员邀请入群(直接邀请入群)2 - 由群成员邀请入群(通过邀请链接入群)3 - 通过扫描群二维码入群
`Invitor`|`invitor`|`ChatMemberListInvitor`| 邀请者。目前仅当是由本企业内部成员邀请入群时会返回该值
`GroupNickname`|`group_nickname`|`string`| 在群里的昵称
`Name`|`name`|`string`| 在群里名字


### `ChatMemberListInvitor` 入群邀请者

Name|JSON|Type|Doc
:---|:---|:---|:--
`UserID`|`userid`|`string`| 邀请者ID

### `ChatAdminList` 客户群管理员列表

Name|JSON|Type|Doc
:---|:---|:---|:--
`UserID`|`userid`|`string`| 管理员ID


### `RespAppChatInfo` 客户群详情
Name|JSON|Type|Doc
:---|:---|:---|:--
`ChatID`|`chat_id`|`string`| 客户群ID
`Name`|`name`|`string`| 客户群名称
`Owner`|`owner`|`string`| 群主ID
`CreateTime`|`create_time`|`int64`| 群创建时间
`Notice`|`notice`|`string`| 群公告
`MemberList`|`member_list`|`[]*ChatMemberList`| 群成员列表
`AdminList`|`admin_list`|`[]*ChatAdminList`| 群管理员列表



```go
// ChatNeedName 是否需要返回群成员的名字 0-不返回;1-返回。默认不返回
const ChatNeedName int64 = 1
```


Co-authored-by: yxh <yxh1103@qq.com>
  • Loading branch information
bors[bot] and tiger1103 committed Oct 10, 2022
2 parents d6222b1 + 63b67ec commit 2b77160
Show file tree
Hide file tree
Showing 6 changed files with 268 additions and 0 deletions.
28 changes: 28 additions & 0 deletions apis.md.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions appchat.go
Expand Up @@ -24,3 +24,26 @@ func (c *WorkwxApp) GetAppchat(chatid string) (*ChatInfo, error) {
obj := resp.ChatInfo
return obj, nil
}

// GetAppChatList 获取客户群列表
func (c *WorkwxApp) GetAppChatList(req ReqChatList) (*RespAppchatList, error) {
resp, err := c.execAppchatListGet(reqAppchatList{
ReqChatList: req,
})
if err != nil {
return nil, err
}
return resp.RespAppchatList, nil
}

// GetAppChatInfo 获取客户群详细信息
func (c *WorkwxApp) GetAppChatInfo(chatId string) (*RespAppChatInfo, error) {
resp, err := c.execAppchatInfoGet(reqAppchatInfo{
ChatId: chatId,
NeedName: ChatNeedName,
})
if err != nil {
return nil, err
}
return resp.GroupChat, nil
}
87 changes: 87 additions & 0 deletions chat_info.md.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/apis.md
Expand Up @@ -127,6 +127,8 @@ Name|Request Type|Response Type|Access Token|URL|Doc

Name|Request Type|Response Type|Access Token|URL|Doc
:---|------------|-------------|------------|:--|:--
`execAppchatListGet`|`reqAppchatList`|`respAppchatList`|+|`POST /cgi-bin/externalcontact/groupchat/list`|[获取客户群列表](https://developer.work.weixin.qq.com/document/path/92120)
`execAppchatInfoGet`|`reqAppchatInfo`|`respAppchatInfo`|+|`POST /cgi-bin/externalcontact/groupchat/get`|[获取客户群详细](https://developer.work.weixin.qq.com/document/path/92122)
`execAppchatCreate`|`reqAppchatCreate`|`respAppchatCreate`|+|`POST /cgi-bin/appchat/create`|[创建群聊会话](https://work.weixin.qq.com/api/doc#90000/90135/90245)
`execAppchatUpdate`|TODO|TODO|+|`POST /cgi-bin/appchat/update`|[修改群聊会话](https://work.weixin.qq.com/api/doc#90000/90135/90246)
`execAppchatGet`|`reqAppchatGet`|`respAppchatGet`|+|`GET /cgi-bin/appchat/get`|[获取群聊会话](https://work.weixin.qq.com/api/doc#90000/90135/90247)
Expand Down
87 changes: 87 additions & 0 deletions docs/chat_info.md
Expand Up @@ -10,3 +10,90 @@ Name|JSON|Type|Doc
`Name`|`name`|`string`|群聊名
`OwnerUserID`|`owner`|`string`|群主id
`MemberUserIDs`|`userlist`|`[]string`|群成员id列表



### `ReqChatListOwnerFilter` 群主过滤

Name|JSON|Type|Doc
:---|:---|:---|:--
`UserIDList`|`userid_list`|`[]string`| 用户ID列表。最多100个



### `ReqChatList` 获取客户群列表参数

Name|JSON|Type|Doc
:---|:---|:---|:--
`StatusFilter`|`status_filter`|`int64`| 客户群跟进状态过滤
`OwnerFilter`|`owner_filter`|`ReqChatListOwnerFilter`| 群主过滤
`Cursor`|`cursor`|`string`| 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用不填
`Limit`|`limit`|`int64`| 分页,预期请求的数据量,取值范围 1 ~ 1000


### `RespGroupChatList` 客户群列表数据

Name|JSON|Type|Doc
:---|:---|:---|:--
`ChatID`|`chat_id`|`string`| 客户群ID
`Status`|`status`|`int64`| 客户群跟进状态 0 - 跟进人正常 1 - 跟进人离职 2 - 离职继承中 3 - 离职继承完成




### `RespAppchatList` 客户群列表结果

Name|JSON|Type|Doc
:---|:---|:---|:--
`GroupChatList`|`group_chat_list`|`[]RespGroupChatList`| 客户群列表
`NextCursor`|`next_cursor`|`string`| 分页游标

### `ChatMemberList` 客户群成员列表

Name|JSON|Type|Doc
:---|:---|:---|:--
`UserID`|`userid`|`string`| 群成员ID
`Type`|`type`|`int64`| 群成员类型 1 - 企业成员 2 - 外部联系人
`UnionID`|`unionid`|`string`| 微信unionid
`JoinTime`|`join_time`|`int64`| 入群时间
`JoinScene`|`join_scene`|`int64`| 入群方式。1 - 由群成员邀请入群(直接邀请入群)2 - 由群成员邀请入群(通过邀请链接入群)3 - 通过扫描群二维码入群
`Invitor`|`invitor`|`ChatMemberListInvitor`| 邀请者。目前仅当是由本企业内部成员邀请入群时会返回该值
`GroupNickname`|`group_nickname`|`string`| 在群里的昵称
`Name`|`name`|`string`| 在群里名字


### `ChatMemberListInvitor` 入群邀请者

Name|JSON|Type|Doc
:---|:---|:---|:--
`UserID`|`userid`|`string`| 邀请者ID

### `ChatAdminList` 客户群管理员列表

Name|JSON|Type|Doc
:---|:---|:---|:--
`UserID`|`userid`|`string`| 管理员ID


### `RespAppChatInfo` 客户群详情
Name|JSON|Type|Doc
:---|:---|:---|:--
`ChatID`|`chat_id`|`string`| 客户群ID
`Name`|`name`|`string`| 客户群名称
`Owner`|`owner`|`string`| 群主ID
`CreateTime`|`create_time`|`int64`| 群创建时间
`Notice`|`notice`|`string`| 群公告
`MemberList`|`member_list`|`[]*ChatMemberList`| 群成员列表
`AdminList`|`admin_list`|`[]*ChatAdminList`| 群管理员列表








```go
// ChatNeedName 是否需要返回群成员的名字 0-不返回;1-返回。默认不返回
const ChatNeedName int64 = 1
```
41 changes: 41 additions & 0 deletions models.go
Expand Up @@ -891,6 +891,47 @@ type respTransferGroupChatExternalContact struct {
FailedChatList []ExternalContactGroupChatTransferFailed `json:"failed_chat_list"`
}

type reqAppchatList struct {
ReqChatList ReqChatList
}

func (x reqAppchatList) intoBody() ([]byte, error) {
result, err := json.Marshal(x.ReqChatList)
if err != nil {
return nil, err
}

return result, nil
}

var _ bodyer = reqAppchatList{}

type respAppchatList struct {
respCommon
*RespAppchatList
}

type reqAppchatInfo struct {
ChatId string `json:"chat_id"`
NeedName int64 `json:"need_name"`
}

func (x reqAppchatInfo) intoBody() ([]byte, error) {
result, err := json.Marshal(x)
if err != nil {
return nil, err
}

return result, nil
}

var _ bodyer = reqAppchatInfo{}

type respAppchatInfo struct {
respCommon
GroupChat *RespAppChatInfo `json:"group_chat"`
}

type reqOAGetTemplateDetail struct {
TemplateID string `json:"template_id"`
}
Expand Down

0 comments on commit 2b77160

Please sign in to comment.