package SafeLine import ( "encoding/json" ) type UpdateReq struct { Acme struct { Domains []string `json:"domains"` Email string `json:"email"` } `json:"acme"` Id int `json:"id"` Manual struct { Crt string `json:"crt"` Key string `json:"key"` } `json:"manual"` Type int `json:"type"` } func (updateReq *UpdateReq) Create(Certificate, PrivateKey []byte, domains []string, email string, id, Type int) { updateReq.Acme.Domains = domains updateReq.Acme.Email = email updateReq.Manual.Crt = string(Certificate) updateReq.Manual.Key = string(PrivateKey) updateReq.Id = id updateReq.Type = Type } func (updateReq *UpdateReq) Marshal() []byte { data, _ := json.Marshal(updateReq) return data } type UpdateResp struct { Data int `json:"data"` Err interface{} `json:"err"` Msg string `json:"msg"` } func (updateResp *UpdateResp) Unmarshal(data []byte) { _ = json.Unmarshal(data, &updateResp) }