@@ -71,7 +71,7 @@ func (mp *MiniProgram) url(path string, query url.Values) string {
71
71
return builder .String ()
72
72
}
73
73
74
- func (mp * MiniProgram ) do (ctx context.Context , method , path string , header http.Header , query url.Values , params internal. X ) ([]byte , error ) {
74
+ func (mp * MiniProgram ) do (ctx context.Context , method , path string , header http.Header , query url.Values , params X ) ([]byte , error ) {
75
75
reqURL := mp .url (path , query )
76
76
77
77
log := internal .NewReqLog (method , reqURL )
@@ -109,7 +109,7 @@ func (mp *MiniProgram) do(ctx context.Context, method, path string, header http.
109
109
return resp .Body (), nil
110
110
}
111
111
112
- func (mp * MiniProgram ) doSafe (ctx context.Context , method , path string , query url.Values , params internal. X ) ([]byte , error ) {
112
+ func (mp * MiniProgram ) doSafe (ctx context.Context , method , path string , query url.Values , params X ) ([]byte , error ) {
113
113
reqURL := mp .url (path , query )
114
114
115
115
log := internal .NewReqLog (method , reqURL )
@@ -177,13 +177,13 @@ func (mp *MiniProgram) doSafe(ctx context.Context, method, path string, query ur
177
177
return data , nil
178
178
}
179
179
180
- func (mp * MiniProgram ) encrypt (log * internal.ReqLog , path string , query url.Values , params internal. X , timestamp int64 ) (internal. X , error ) {
180
+ func (mp * MiniProgram ) encrypt (log * internal.ReqLog , path string , query url.Values , params X , timestamp int64 ) (X , error ) {
181
181
if len (mp .sfMode .aeskey ) == 0 {
182
182
return nil , errors .New ("aes-gcm key not found (forgotten configure?)" )
183
183
}
184
184
185
185
if params == nil {
186
- params = internal. X {}
186
+ params = X {}
187
187
}
188
188
189
189
params ["_n" ] = base64 .StdEncoding .EncodeToString (internal .NonceByte (16 ))
@@ -219,7 +219,7 @@ func (mp *MiniProgram) encrypt(log *internal.ReqLog, path string, query url.Valu
219
219
return nil , err
220
220
}
221
221
222
- body := internal. X {
222
+ body := X {
223
223
"iv" : base64 .StdEncoding .EncodeToString (iv ),
224
224
"data" : base64 .StdEncoding .EncodeToString (ct .Data ()),
225
225
"authtag" : base64 .StdEncoding .EncodeToString (ct .Tag ()),
@@ -365,7 +365,7 @@ func (mp *MiniProgram) AccessToken(ctx context.Context) (gjson.Result, error) {
365
365
// [普通模式] access_token有效期内重复调用该接口不会更新access_token,绝大部分场景下使用该模式;
366
366
// [强制刷新模式] 会导致上次获取的access_token失效,并返回新的access_token
367
367
func (mp * MiniProgram ) StableAccessToken (ctx context.Context , forceRefresh bool ) (gjson.Result , error ) {
368
- params := internal. X {
368
+ params := X {
369
369
"grant_type" : "client_credential" ,
370
370
"appid" : mp .appid ,
371
371
"secret" : mp .secret ,
@@ -499,7 +499,7 @@ func (mp *MiniProgram) GetBuffer(ctx context.Context, path string, query url.Val
499
499
}
500
500
501
501
// PostJSON POST请求JSON数据
502
- func (mp * MiniProgram ) PostJSON (ctx context.Context , path string , params internal. X ) (gjson.Result , error ) {
502
+ func (mp * MiniProgram ) PostJSON (ctx context.Context , path string , params X ) (gjson.Result , error ) {
503
503
token , err := mp .getToken ()
504
504
if err != nil {
505
505
return internal .Fail (err )
@@ -523,7 +523,7 @@ func (mp *MiniProgram) PostJSON(ctx context.Context, path string, params interna
523
523
}
524
524
525
525
// PostBuffer POST请求获取buffer (如:获取二维码)
526
- func (mp * MiniProgram ) PostBuffer (ctx context.Context , path string , params internal. X ) ([]byte , error ) {
526
+ func (mp * MiniProgram ) PostBuffer (ctx context.Context , path string , params X ) ([]byte , error ) {
527
527
token , err := mp .getToken ()
528
528
if err != nil {
529
529
return nil , err
@@ -550,7 +550,7 @@ func (mp *MiniProgram) PostBuffer(ctx context.Context, path string, params inter
550
550
//
551
551
// [安全鉴权模式](https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/getting_started/api_signature.html)
552
552
// [支持的API](https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc)
553
- func (mp * MiniProgram ) SafePostJSON (ctx context.Context , path string , params internal. X ) (gjson.Result , error ) {
553
+ func (mp * MiniProgram ) SafePostJSON (ctx context.Context , path string , params X ) (gjson.Result , error ) {
554
554
token , err := mp .getToken ()
555
555
if err != nil {
556
556
return internal .Fail (err )
@@ -574,7 +574,7 @@ func (mp *MiniProgram) SafePostJSON(ctx context.Context, path string, params int
574
574
//
575
575
// [安全鉴权模式](https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/getting_started/api_signature.html)
576
576
// [支持的API](https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc)
577
- func (mp * MiniProgram ) SafePostBuffer (ctx context.Context , path string , params internal. X ) ([]byte , error ) {
577
+ func (mp * MiniProgram ) SafePostBuffer (ctx context.Context , path string , params X ) ([]byte , error ) {
578
578
token , err := mp .getToken ()
579
579
if err != nil {
580
580
return nil , err
@@ -595,7 +595,7 @@ func (mp *MiniProgram) SafePostBuffer(ctx context.Context, path string, params i
595
595
}
596
596
597
597
// Upload 上传媒体资源
598
- func (mp * MiniProgram ) Upload (ctx context.Context , reqPath , fieldName , filePath string , formData internal. Form , query url.Values ) (gjson.Result , error ) {
598
+ func (mp * MiniProgram ) Upload (ctx context.Context , reqPath , fieldName , filePath string , formData Form , query url.Values ) (gjson.Result , error ) {
599
599
token , err := mp .getToken ()
600
600
if err != nil {
601
601
return internal .Fail (err )
@@ -635,7 +635,7 @@ func (mp *MiniProgram) Upload(ctx context.Context, reqPath, fieldName, filePath
635
635
}
636
636
637
637
// UploadWithReader 上传媒体资源
638
- func (mp * MiniProgram ) UploadWithReader (ctx context.Context , reqPath , fieldName , fileName string , reader io.Reader , formData internal. Form , query url.Values ) (gjson.Result , error ) {
638
+ func (mp * MiniProgram ) UploadWithReader (ctx context.Context , reqPath , fieldName , fileName string , reader io.Reader , formData Form , query url.Values ) (gjson.Result , error ) {
639
639
token , err := mp .getToken ()
640
640
if err != nil {
641
641
return internal .Fail (err )
0 commit comments