-
Notifications
You must be signed in to change notification settings - Fork 7
/
区域仓库-获取.go
executable file
·59 lines (50 loc) · 1.32 KB
/
区域仓库-获取.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
package apis
import (
"encoding/json"
)
// 获取
// 文档:https://developers.weixin.qq.com/doc/channels/API/warehouse/get.html
type ReqWarehouseGet struct {
OutWarehouseID string `json:"out_warehouse_id"`
}
var _ bodyer = ReqWarehouseGet{}
func (x ReqWarehouseGet) intoBody() ([]byte, error) {
result, err := json.Marshal(x)
if err != nil {
return nil, err
}
return result, nil
}
type RespWarehouseGet struct {
Data struct {
CoverLocations []struct {
AddressID1 int `json:"address_id1"`
AddressID2 int `json:"address_id2"`
AddressID3 int `json:"address_id3"`
AddressID4 int `json:"address_id4"`
} `json:"cover_locations"`
Intro string `json:"intro"`
Name string `json:"name"`
OutWarehouseID string `json:"out_warehouse_id"`
} `json:"data"`
CommonResp
}
var _ bodyer = RespWarehouseGet{}
func (x RespWarehouseGet) intoBody() ([]byte, error) {
result, err := json.Marshal(x)
if err != nil {
return nil, err
}
return result, nil
}
func (c *ApiClient) ExecWarehouseGet(req ReqWarehouseGet) (RespWarehouseGet, error) {
var resp RespWarehouseGet
err := c.executeWXApiPost("/channels/ec/warehouse/get", req, &resp, true)
if err != nil {
return RespWarehouseGet{}, err
}
if bizErr := resp.TryIntoErr(); bizErr != nil {
return RespWarehouseGet{}, bizErr
}
return resp, nil
}