github.com/fastwego/offiaccount@v1.0.1/apis/store/express/express.go (about)

     1  // Copyright 2020 FastWeGo
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Package express 微信小店/邮费模板管理管理
    16  package express
    17  
    18  import (
    19  	"bytes"
    20  
    21  	"github.com/fastwego/offiaccount"
    22  )
    23  
    24  const (
    25  	apiAdd     = "/merchant/express/add"
    26  	apiDel     = "/merchant/express/del"
    27  	apiUpdate  = "/merchant/express/update"
    28  	apiGetById = "/merchant/express/getbyid"
    29  	apiGetAll  = "/merchant/express/getall"
    30  )
    31  
    32  /*
    33  增加邮费模板
    34  
    35  
    36  
    37  See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html
    38  
    39  POST https://api.weixin.qq.com/merchant/express/add?access_token=ACCESS_TOKEN
    40  */
    41  func Add(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error) {
    42  	return ctx.Client.HTTPPost(apiAdd, bytes.NewReader(payload), "application/json;charset=utf-8")
    43  }
    44  
    45  /*
    46  删除邮费模板
    47  
    48  
    49  
    50  See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html
    51  
    52  POST https://api.weixin.qq.com/merchant/express/del?access_token=ACCESS_TOKEN
    53  */
    54  func Del(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error) {
    55  	return ctx.Client.HTTPPost(apiDel, bytes.NewReader(payload), "application/json;charset=utf-8")
    56  }
    57  
    58  /*
    59  修改邮费模板
    60  
    61  
    62  
    63  See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html
    64  
    65  POST https://api.weixin.qq.com/merchant/express/update?access_token=ACCESS_TOKEN
    66  */
    67  func Update(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error) {
    68  	return ctx.Client.HTTPPost(apiUpdate, bytes.NewReader(payload), "application/json;charset=utf-8")
    69  }
    70  
    71  /*
    72  获取指定ID的邮费模板
    73  
    74  
    75  
    76  See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html
    77  
    78  POST https://api.weixin.qq.com/merchant/express/getbyid?access_token=ACCESS_TOKEN
    79  */
    80  func GetById(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error) {
    81  	return ctx.Client.HTTPPost(apiGetById, bytes.NewReader(payload), "application/json;charset=utf-8")
    82  }
    83  
    84  /*
    85  获取所有邮费模板
    86  
    87  
    88  
    89  See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html
    90  
    91  GET https://api.weixin.qq.com/merchant/express/getall?access_token=ACCESS_TOKEN
    92  */
    93  func GetAll(ctx *offiaccount.OffiAccount) (resp []byte, err error) {
    94  	return ctx.Client.HTTPGet(apiGetAll)
    95  }