当前位置: 首页>>代码示例>>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;未经允许,请勿转载。