diff --git a/doc/api/work.md b/doc/api/work.md index f6feb27..2843a7f 100644 --- a/doc/api/work.md +++ b/doc/api/work.md @@ -69,17 +69,7 @@ host: https://qyapi.weixin.qq.com/ | 获取「群聊数据统计」数据 (按自然日聚合的方式) | POST | /cgi-bin/externalcontact/groupchat/statistic_group_by_day | YES | (r *Client) GetGroupChatStatByDay | MARKWANG | | 配置客户联系「联系我」方式 | POST | /cgi-bin/externalcontact/add_contact_way | YES | (r *Client) AddContactWay | MARKWANG | | 获取企业已配置的「联系我」方式 | POST | /cgi-bin/externalcontact/get_contact_way | YES | (r *Client) GetContactWay | MARKWANG | - - -## 通讯录管理 -[官方文档](https://developer.work.weixin.qq.com/document/path/95350/90200) - -| 名称 | 请求方式 | URL | 是否已实现 | 使用方法 | 贡献者 | -|:---------:|------|:----------------------------------------| ---------- | ------------------------------- |----------| -| 获取子部门ID列表 | GET | /cgi-bin/department/simplelist | YES | (r *Client) DepartmentSimpleList| MARKWANG | -| 获取部门成员 | GET | /cgi-bin/user/simplelist | YES | (r *Client) UserSimpleList | MARKWANG | -======= - +| 更新企业已配置的「联系我」方式 | POST | /cgi-bin/externalcontact/update_contact_way | YES | (r *Client) UpdateContactWay | MARKWANG | ## 通讯录管理 [官方文档](https://developer.work.weixin.qq.com/document/path/95350/90200) diff --git a/work/externalcontact/contact_way.go b/work/externalcontact/contact_way.go index 5dcb52a..9b5d535 100644 --- a/work/externalcontact/contact_way.go +++ b/work/externalcontact/contact_way.go @@ -11,6 +11,8 @@ const ( AddContactWayURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_contact_way?access_token=%s" // GetContactWayURL 获取企业已配置的「联系我」方式 GetContactWayURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_contact_way?access_token=%s" + // UpdateContactWayURL 更新企业已配置的「联系我」方式 + UpdateContactWayURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/update_contact_way?access_token=%s" ) type ( @@ -152,3 +154,45 @@ func (r *Client) GetContactWay(req *GetContactWayRequest) (*GetContactWayRespons } return result, nil } + +type ( + // UpdateContactWayRequest 更新企业已配置的「联系我」方式请求 + UpdateContactWayRequest struct { + ConfigID string `json:"config_id"` + Remark string `json:"remark"` + SkipVerify bool `json:"skip_verify"` + Style int `json:"style"` + State string `json:"state"` + User []string `json:"user"` + Party []int `json:"party"` + ExpiresIn int `json:"expires_in"` + ChatExpiresIn int `json:"chat_expires_in"` + UnionID string `json:"unionid"` + Conclusions ConclusionsRequest `json:"conclusions"` + } + // UpdateContactWayResponse 更新企业已配置的「联系我」方式响应 + UpdateContactWayResponse struct { + util.CommonError + } +) + +// UpdateContactWay 更新企业已配置的「联系我」方式 +// see https://developer.work.weixin.qq.com/document/path/92228 +func (r *Client) UpdateContactWay(req *UpdateContactWayRequest) (*UpdateContactWayResponse, error) { + var ( + accessToken string + err error + ) + if accessToken, err = r.GetAccessToken(); err != nil { + return nil, err + } + var response []byte + if response, err = util.PostJSON(fmt.Sprintf(UpdateContactWayURL, accessToken), req); err != nil { + return nil, err + } + result := &UpdateContactWayResponse{} + if err = util.DecodeWithError(response, result, "UpdateContactWay"); err != nil { + return nil, err + } + return result, nil +}