-
Notifications
You must be signed in to change notification settings - Fork 165
/
client.go
141 lines (138 loc) · 4.6 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
package base
import (
"github.com/ArtisanCloud/PowerWeChat/v3/src/kernel"
)
type Client struct {
BaseClient *kernel.BaseClient
}
//// 使用授权码获取授权信息
//// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/token/authorization_info.html
//func (comp *Client) HandleAuthorize(authCode string) (*response.ResponseHandleAuthorize, error) {
//
// result := &response.ResponseHandleAuthorize{}
//
// config := (*comp.App).GetConfig()
//
// if authCode == "" {
// authCode = config.GetString("app_id", "auth_code")
// }
//
// params := &object.HashMap{
// "component_appid": config.GetString("app_id", ""),
// "authorization_code": authCode,
// }
//
// _, err := comp.BaseClient.HttpPostJson(ctx,"cgi-bin/component/api_query_auth", params, nil, nil, result)
//
// return result, err
//}
//
//// 获取授权帐号详情
//// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/token/api_get_authorizer_info.html
//func (comp *Client) GetAuthorizer(appID string) (*response.ResponseGetAuthorizer, error) {
//
// result := &response.ResponseGetAuthorizer{}
//
// config := (*comp.App).GetConfig()
//
// params := &object.HashMap{
// "component_appid": config.GetString("app_id", ""),
// "authorizer_appid": appID,
// }
//
// _, err := comp.BaseClient.HttpPostJson(ctx,"cgi-bin/component/api_get_authorizer_info", params, nil, nil, result)
//
// return result, err
//}
//
//// 获取授权方选项信息
//// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/Account_Authorization/api_get_authorizer_option.html
//func (comp *Client) GetAuthorizerOption(appID string, name string) (*response.ResponseGetAuthorizerOption, error) {
//
// result := &response.ResponseGetAuthorizerOption{}
//
// config := (*comp.App).GetConfig()
//
// params := &object.HashMap{
// "component_appid": config.GetString("app_id", ""),
// "authorizer_appid": appID,
// "option_name": name,
// }
//
// _, err := comp.BaseClient.HttpPostJson(ctx,"cgi-bin/component/api_get_authorizer_option", params, nil, nil, result)
//
// return result, err
//}
//
//// 设置授权方选项信息
//// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/Account_Authorization/api_set_authorizer_option.html
//func (comp *Client) SetAuthorizerOption(appID string, name string, value string) (*response2.ResponseOpenPlatform, error) {
//
// result := &response2.ResponseOpenPlatform{}
//
// config := (*comp.App).GetConfig()
//
// params := &object.HashMap{
// "component_appid": config.GetString("app_id", ""),
// "authorizer_appid": appID,
// "option_name": name,
// "option_value": value,
// }
//
// _, err := comp.BaseClient.HttpPostJson(ctx,"cgi-bin/component/api_set_authorizer_option", params, nil, nil, result)
//
// return result, err
//}
//
//// 拉取所有已授权的帐号信息
//// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/Account_Authorization/api_get_authorizer_list.html
//func (comp *Client) GetAuthorizers(offset int, count int) (*response2.ResponseOpenPlatform, error) {
//
// result := &response2.ResponseOpenPlatform{}
//
// config := (*comp.App).GetConfig()
//
// params := &object.HashMap{
// "component_appid": config.GetString("app_id", ""),
// "offset": offset,
// "count": count,
// }
//
// _, err := comp.BaseClient.HttpPostJson(ctx,"cgi-bin/component/api_get_authorizer_list", params, nil, nil, result)
//
// return result, err
//}
//
//// 预授权码
//// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/token/pre_auth_code.html
//func (comp *Client) CreatePreAuthorizationCode() (*response.ResponseCreatePreAuthorizationCode, error) {
//
// result := &response.ResponseCreatePreAuthorizationCode{}
//
// config := (*comp.App).GetConfig()
//
// params := &object.HashMap{
// "component_appid": config.GetString("app_id", ""),
// }
//
// _, err := comp.BaseClient.HttpPostJson(ctx,"cgi-bin/component/api_create_preauthcode", params, nil, nil, result)
//
// return result, err
//}
//
//// 清空 api 的调用quota
//// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/openApi/clear_quota.html
//func (comp *Client) ClearQuota() (*response2.ResponseOpenPlatform, error) {
//
// result := &response2.ResponseOpenPlatform{}
//
// config := (*comp.App).GetConfig()
//
// params := &object.HashMap{
// "component_appid": config.GetString("app_id", ""),
// }
//
// _, err := comp.BaseClient.HttpPostJson(ctx,"cgi-bin/component/clear_quota", params, nil, nil, result)
//
// return result, err
//}