-
Notifications
You must be signed in to change notification settings - Fork 166
/
client.go
46 lines (33 loc) · 1.32 KB
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package setting
import (
"context"
"github.com/ArtisanCloud/PowerWeChat/v3/src/kernel"
"github.com/ArtisanCloud/PowerWeChat/v3/src/openPlatform/authorizer/miniProgram/setting/request"
"github.com/ArtisanCloud/PowerWeChat/v3/src/openPlatform/authorizer/miniProgram/setting/response"
)
type Client struct {
BaseClient *kernel.BaseClient
}
func NewClient(app *kernel.ApplicationInterface) (*Client, error) {
baseClient, err := kernel.NewBaseClient(app, nil)
if err != nil {
return nil, err
}
return &Client{
baseClient,
}, nil
}
// 获取接口列表
// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html#请求地址
func (comp *Client) Get(ctx context.Context) (*response.ResponseGet, error) {
result := &response.ResponseGet{}
_, err := comp.BaseClient.HttpPostJson(ctx, "wxa/security/get_privacy_interface", nil, nil, nil, result)
return result, err
}
// 申请接口
// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/apply_privacy_interface.html
func (comp *Client) Set(ctx context.Context, params *request.RequestSet) (*response.ResponseSet, error) {
result := &response.ResponseSet{}
_, err := comp.BaseClient.HttpPostJson(ctx, "wxa/security/apply_privacy_interface", params, nil, nil, result)
return result, err
}