當前位置: 首頁>>代碼示例>>Golang>>正文


Golang httpreq.NewClient函數代碼示例

本文整理匯總了Golang中github.com/lixiangzhong/httpreq.NewClient函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewClient函數的具體用法?Golang NewClient怎麽用?Golang NewClient使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewClient函數的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Upgrade

func (a *Account) Upgrade(Domain, months, serviceID string) (ReturnValue, error) {
	apiurl := "/upgrade/"
	client := httpreq.NewClient()
	client.SetTimeout(15 * time.Second)
	rv := ReturnValue{}
	v := url.Values{}
	v.Add("apiKey", a.apiKey)
	v.Add("domain", Domain)
	if months != "" {
		v.Add("months", months)
	}
	v.Add("serviceID", serviceID)
	v.Add("timestamp", timestamp())
	v.Add("hash", hashmd5(v, a.apiSecret))
	req := httpreq.PostForm(apihost+apiurl, v)
	res, err := client.Do(req)
	if err != nil {
		return rv, err
	}
	err = json.Unmarshal(res.Byte(), &rv)
	if err != nil {
		return rv, err
	}
	return rv, nil
}
開發者ID:lixiangzhong,項目名稱:dns.com,代碼行數:25,代碼來源:domain.go

示例2: Create

func (a *Account) Create(domainID, Type, viewID, host, value, ttl, mx string) (ReturnValue, error) {
	apiurl := "/create/"
	client := httpreq.NewClient()
	client.SetTimeout(15 * time.Second)
	rv := ReturnValue{}
	v := url.Values{}
	v.Add("apiKey", a.apiKey)
	v.Add("domainID", domainID)
	if Type != "" {
		v.Add("Type", Type)
	}
	if viewID != "" {
		v.Add("viewID", viewID)
	}
	if host != "" {
		v.Add("host", host)
	}
	v.Add("ttl", ttl)
	v.Add("mx", mx)
	v.Add("timestamp", timestamp())
	v.Add("hash", hashmd5(v, a.apiSecret))
	req := httpreq.PostForm(apihost+apiurl, v)
	res, err := client.Do(req)
	if err != nil {
		return rv, err
	}
	err = json.Unmarshal(res.Byte(), &rv)
	if err != nil {
		return rv, err
	}
	return rv, nil
}
開發者ID:lixiangzhong,項目名稱:dns.com,代碼行數:32,代碼來源:record.go

示例3: Urlredirect

func (a *Account) Urlredirect(recordID, status, domain, URL,
	page, pageSize string) (ReturnValue, error) {
	apiurl := "/urlredirect/"
	client := httpreq.NewClient()
	client.SetTimeout(15 * time.Second)
	rv := ReturnValue{}
	v := url.Values{}
	v.Add("apiKey", a.apiKey)
	v.Add("recordID", recordID)
	v.Add("status", status)
	v.Add("domain", domain)
	v.Add("url", URL)
	v.Add("page", page)
	v.Add("pageSize", pageSize)
	v.Add("timestamp", timestamp())
	v.Add("hash", hashmd5(v, a.apiSecret))
	req := httpreq.PostForm(apihost+apiurl, v)
	res, err := client.Do(req)
	if err != nil {
		return rv, err
	}
	err = json.Unmarshal(res.Byte(), &rv)
	if err != nil {
		return rv, err
	}
	return rv, nil
}
開發者ID:lixiangzhong,項目名稱:dns.com,代碼行數:27,代碼來源:record.go

示例4: Search

func (a *Account) Search(domainID, host, Type, viewID,
	value, page, pageSize string) (ReturnValue, error) {
	apiurl := "/search/"
	client := httpreq.NewClient()
	client.SetTimeout(15 * time.Second)
	rv := ReturnValue{}
	v := url.Values{}
	v.Add("apiKey", a.apiKey)
	v.Add("domainID", domainID)
	v.Add("page", page)
	v.Add("pageSize", pageSize)
	v.Add("host", host)
	v.Add("type", Type)
	v.Add("viewID", viewID)
	v.Add("value", value)
	v.Add("timestamp", timestamp())
	v.Add("hash", hashmd5(v, a.apiSecret))
	req := httpreq.PostForm(apihost+apiurl, v)
	res, err := client.Do(req)
	if err != nil {
		return rv, err
	}
	err = json.Unmarshal(res.Byte(), &rv)
	if err != nil {
		return rv, err
	}
	return rv, nil
}
開發者ID:lixiangzhong,項目名稱:dns.com,代碼行數:28,代碼來源:record.go

示例5: Lock

func (a *Account) Lock() (ReturnValue, error) {
	apiurl := "/lock/"
	client := httpreq.NewClient()
	client.SetTimeout(15 * time.Second)
	rv := ReturnValue{}
	v := url.Values{}
	v.Add("apiKey", a.apiKey)
	v.Add("timestamp", timestamp())
	v.Add("hash", hashmd5(v, a.apiSecret))
	req := httpreq.PostForm(apihost+apiurl, v)
	res, err := client.Do(req)
	if err != nil {
		return rv, err
	}
	err = json.Unmarshal(res.Byte(), &rv)
	if err != nil {
		return rv, err
	}
	return rv, nil
}
開發者ID:lixiangzhong,項目名稱:dns.com,代碼行數:20,代碼來源:lock.go

示例6: Register

func Register(email, password, passwordCfm string) (ReturnValue, error) {
	apiurl := "/register/"
	client := httpreq.NewClient()
	client.SetTimeout(15 * time.Second)
	rv := ReturnValue{}
	v := url.Values{}
	v.Add("email", email)
	v.Add("password", password)
	v.Add("passwordCfm", passwordCfm)
	req := httpreq.PostForm(apihost+apiurl, v)
	res, err := client.Do(req)
	if err != nil {
		return rv, err
	}
	err = json.Unmarshal(res.Byte(), &rv)
	if err != nil {
		return rv, err
	}
	return rv, nil
}
開發者ID:lixiangzhong,項目名稱:dns.com,代碼行數:20,代碼來源:register.go

示例7: Modify

func (a *Account) Modify(domainID, recordID, newhost, newtype, newvalue, newttl, newmx, newviewID string) (ReturnValue, error) {
	apiurl := "/modify/"
	client := httpreq.NewClient()
	client.SetTimeout(15 * time.Second)
	rv := ReturnValue{}
	v := url.Values{}
	v.Add("apiKey", a.apiKey)
	v.Add("domainID", domainID)
	if newhost != "" {
		v.Add("newhost", newhost)
	}
	if newmx != "" {
		v.Add("newmx", newmx)
	}
	if newttl != "" {
		v.Add("newttl", newttl)
	}
	if newtype != "" {
		v.Add("newtype", newtype)
	}
	if newviewID != "" {
		v.Add("newviewID", newviewID)
	}
	if newvalue != "" {
		v.Add("newvalue", newvalue)
	}
	v.Add("recordID", recordID)
	v.Add("timestamp", timestamp())
	v.Add("hash", hashmd5(v, a.apiSecret))
	req := httpreq.PostForm(apihost+apiurl, v)
	res, err := client.Do(req)
	if err != nil {
		return rv, err
	}
	err = json.Unmarshal(res.Byte(), &rv)
	if err != nil {
		return rv, err
	}
	return rv, nil
}
開發者ID:lixiangzhong,項目名稱:dns.com,代碼行數:40,代碼來源:record.go

示例8: Batchdelete

func (a *Account) Batchdelete(domainID, recordsID string) (ReturnValue, error) {
	apiurl := "/batchdelete/"
	client := httpreq.NewClient()
	client.SetTimeout(15 * time.Second)
	rv := ReturnValue{}
	v := url.Values{}
	v.Add("apiKey", a.apiKey)
	v.Add("domainID", domainID)
	v.Add("recordID", recordsID)
	v.Add("timestamp", timestamp())
	v.Add("hash", hashmd5(v, a.apiSecret))
	req := httpreq.PostForm(apihost+apiurl, v)
	res, err := client.Do(req)
	if err != nil {
		return rv, err
	}
	err = json.Unmarshal(res.Byte(), &rv)
	if err != nil {
		return rv, err
	}
	return rv, nil
}
開發者ID:lixiangzhong,項目名稱:dns.com,代碼行數:22,代碼來源:record.go

示例9: DeviceToken

func (a *Account) DeviceToken(deviceToken, theme, Type string) (ReturnValue, error) {
	apiurl := "/deviceToken/"
	client := httpreq.NewClient()
	client.SetTimeout(15 * time.Second)
	rv := ReturnValue{}
	v := url.Values{}
	v.Add("apiKey", a.apiKey)
	v.Add("deviceToken", deviceToken)
	v.Add("theme", theme)
	v.Add("timestamp", timestamp())
	v.Add("type", Type)
	v.Add("hash", hashmd5(v, a.apiSecret))
	req := httpreq.PostForm(apihost+apiurl, v)
	res, err := client.Do(req)
	if err != nil {
		return rv, err
	}
	err = json.Unmarshal(res.Byte(), &rv)
	if err != nil {
		return rv, err
	}
	return rv, nil
}
開發者ID:lixiangzhong,項目名稱:dns.com,代碼行數:23,代碼來源:deviceToken.go

示例10: Editgroup

func (a *Account) Editgroup(displayOrder, groupID, groupName string) (ReturnValue, error) {
	apiurl := "/editgroup/"
	client := httpreq.NewClient()
	client.SetTimeout(15 * time.Second)
	rv := ReturnValue{}
	v := url.Values{}
	v.Add("apiKey", a.apiKey)
	v.Add("displayOrder", displayOrder)
	v.Add("groupID", groupID)
	v.Add("groupName", groupName)
	v.Add("timestamp", timestamp())
	v.Add("hash", hashmd5(v, a.apiSecret))
	req := httpreq.PostForm(apihost+apiurl, v)
	res, err := client.Do(req)
	if err != nil {
		return rv, err
	}
	err = json.Unmarshal(res.Byte(), &rv)
	if err != nil {
		return rv, err
	}
	return rv, nil
}
開發者ID:lixiangzhong,項目名稱:dns.com,代碼行數:23,代碼來源:group.go

示例11: Verify

func (a *Account) Verify(email, password, reset, Type string) (ReturnValue, error) {
	apiurl := "/verify/"
	client := httpreq.NewClient()
	client.SetTimeout(15 * time.Second)
	rv := ReturnValue{}
	v := url.Values{}
	v.Add("email", email)
	v.Add("password", password)
	v.Add("timestamp", timestamp())
	v.Add("reset", reset)
	v.Add("type", Type)
	req := httpreq.PostForm(apihost+apiurl, v)
	res, err := client.Do(req)
	if err != nil {
		return rv, err
	}
	err = json.Unmarshal(res.Byte(), &rv)
	if err != nil {
		return rv, err
	}
	a.apiKey = rv.Data["apiKey"].(string)
	a.apiSecret = rv.Data["apiSecret"].(string)
	return rv, nil
}
開發者ID:lixiangzhong,項目名稱:dns.com,代碼行數:24,代碼來源:register.go

示例12: Message

func (a *Account) Message(state, title, page, pageSize string) (ReturnValue, error) {
	apiurl := "/message/"
	client := httpreq.NewClient()
	client.SetTimeout(15 * time.Second)
	rv := ReturnValue{}
	v := url.Values{}
	v.Add("apiKey", a.apiKey)
	v.Add("page", page)
	v.Add("pageSize", pageSize)
	v.Add("state", state)
	v.Add("timestamp", timestamp())
	v.Add("title", title)
	v.Add("hash", hashmd5(v, a.apiSecret))
	req := httpreq.PostForm(apihost+apiurl, v)
	res, err := client.Do(req)
	if err != nil {
		return rv, err
	}
	err = json.Unmarshal(res.Byte(), &rv)
	if err != nil {
		return rv, err
	}
	return rv, nil
}
開發者ID:lixiangzhong,項目名稱:dns.com,代碼行數:24,代碼來源:message.go


注:本文中的github.com/lixiangzhong/httpreq.NewClient函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。