You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: push.go
    path of file: ./repos/learning_tools/all_packaged_library/push/huawei
    
    the code of the file until where you have to start completion: package huawei

import (
	"encoding/json"
	"fmt"
	"github.com/patrickmn/go-cache"
	"io/ioutil"
	"net/http"
	"net/url"
	"strings"
	"time"
)

var c = cache.New(10*time.Minute, 15*time.Minute)

func NewHuaweiPush(tokenUrl, appId, appSecret, pushUrl string, auto bool) *HuaweiPush {
	return &HuaweiPush{tokenUrl, appId, appSecret, pushUrl, auto}
}

func (p *HuaweiPush) GetToken() (*ResToken, error) {
	var (
		req          http.Request
		bodyStr      string
		err          error
		res          *http.Response
		resToken     *ResToken
		resTokenByte []byte
	)
	req.ParseForm()
	req.Form.Add("grant_type", "client_credentials")
	req.Form.Add("client_secret", p.AppSecret)
	req.Form.Add("client_id", p.AppId)
	bodyStr = strings.TrimSpace(req.Form.Encode())
	if res, err =
    
func (p *HuaweiPush) GetToken() (*ResToken, error) {
	var (
		req          http.Request
		bodyStr      string
		err          error
		res          *http.Response
		resToken     *ResToken
		resTokenByte []byte
	)
	req.ParseForm()
	req.Form.Add("grant_type", "client_credentials")
	req.Form.Add("client_secret", p.AppSecret)
	req.Form.Add("client_id", p.AppId)
	bodyStr = strings.TrimSpace(req.Form.Encode())
	if res, err = http.Post(p.TokenUrl, "application/x-www-form-urlencoded", strings.NewReader(bodyStr)); err != nil {
		return nil, err
	}
	defer res.Body.Close()
	if resTokenByte, err = ioutil.ReadAll(res.Body); err != nil {
		return nil, err
	}
	if err = json.Unmarshal(resTokenByte, &resToken); err != nil {
		fmt.Println("GetToken: ", string(resTokenByte))
		return nil, err
	}
	if p.AutoCacheAccessToken {
		c.Set("AccessToken", resToken.AccessToken, time.Duration(resToken.ExpiresIn-100)*time.Second)
	}
	return resToken, nil
}