本文整理汇总了Golang中github.com/lixiangzhong/httpreq.PostForm函数的典型用法代码示例。如果您正苦于以下问题:Golang PostForm函数的具体用法?Golang PostForm怎么用?Golang PostForm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PostForm函数的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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}