-
Notifications
You must be signed in to change notification settings - Fork 7
/
区域仓库-创建.go
executable file
·56 lines (47 loc) · 1.27 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
package apis
import (
"encoding/json"
)
// 创建
// 文档:https://developers.weixin.qq.com/doc/channels/API/warehouse/create.html
type ReqWarehouseCreate 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"`
}
var _ bodyer = ReqWarehouseCreate{}
func (x ReqWarehouseCreate) intoBody() ([]byte, error) {
result, err := json.Marshal(x)
if err != nil {
return nil, err
}
return result, nil
}
type RespWarehouseCreate struct {
CommonResp
}
var _ bodyer = RespWarehouseCreate{}
func (x RespWarehouseCreate) intoBody() ([]byte, error) {
result, err := json.Marshal(x)
if err != nil {
return nil, err
}
return result, nil
}
func (c *ApiClient) ExecWarehouseCreate(req ReqWarehouseCreate) (RespWarehouseCreate, error) {
var resp RespWarehouseCreate
err := c.executeWXApiPost("/channels/ec/warehouse/create", req, &resp, true)
if err != nil {
return RespWarehouseCreate{}, err
}
if bizErr := resp.TryIntoErr(); bizErr != nil {
return RespWarehouseCreate{}, bizErr
}
return resp, nil
}