package client import ( "encoding/json" "errors" "git.selly.red/Selly-Modules/natsio" "git.selly.red/Selly-Modules/natsio/model" "git.selly.red/Selly-Modules/natsio/subject" ) // Staff ... type Staff struct{} func GetStaff() Staff { return Staff{} } // GetListStaffInfoByIds ... func (s Staff) GetListStaffInfoByIds(p model.GetListStaffRequest) (*model.ResponseListStaffInfo, error) { msg, err := natsio.GetServer().Request(subject.Staff.GetListStaffInfo, toBytes(p)) if err != nil { return nil, err } var r struct { Data *model.ResponseListStaffInfo `json:"data"` Error string `json:"error"` } if err := json.Unmarshal(msg.Data, &r); err != nil { return nil, err } if r.Error != "" { return nil, errors.New(r.Error) } return r.Data, nil }