Skip to content

Commit

Permalink
新增API:撤回应用消息
Browse files Browse the repository at this point in the history
  • Loading branch information
zsmhub committed Aug 30, 2022
1 parent 1ff0b45 commit 9b88977
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions apis/发送应用消息-撤回应用消息.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package apis

import (
"encoding/json"
)

// 自动生成的文件, 生成方式: make api doc=微信文档地址url
// 可自行修改生成的文件,以满足开发需求

// ReqRecallMessage 撤回应用消息请求
// 文档:https://developer.work.weixin.qq.com/document/path/94947#撤回应用消息
type ReqRecallMessage struct {
// Msgid 消息ID。从应用发送消息接口处获得。,必填
Msgid string `json:"msgid"`
}

var _ bodyer = ReqRecallMessage{}

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

// RespRecallMessage 撤回应用消息响应
// 文档:https://developer.work.weixin.qq.com/document/path/94947#撤回应用消息
type RespRecallMessage struct {
CommonResp
}

var _ bodyer = RespRecallMessage{}

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

// ExecRecallMessage 撤回应用消息
// 文档:https://developer.work.weixin.qq.com/document/path/94947#撤回应用消息
func (c *ApiClient) ExecRecallMessage(req ReqRecallMessage) (RespRecallMessage, error) {
var resp RespRecallMessage
err := c.executeWXApiPost("/cgi-bin/message/recall", req, &resp, true)
if err != nil {
return RespRecallMessage{}, err
}
if bizErr := resp.TryIntoErr(); bizErr != nil {
return RespRecallMessage{}, bizErr
}
return resp, nil
}

0 comments on commit 9b88977

Please sign in to comment.