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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }