compapi.go 344 B

12345678910111213141516171819
  1. package types
  2. import "encoding/json"
  3. func (me *CompApiReq) ToBytes() ([]byte, error) {
  4. return json.Marshal(me)
  5. }
  6. func (me *CompOpenApiResp) ToBytes() ([]byte, error) {
  7. return json.Marshal(me)
  8. }
  9. func (me *CompOpenApiResp) ToString() (string, error) {
  10. bs, err := me.ToBytes()
  11. if err != nil {
  12. return "", err
  13. }
  14. return string(bs), nil
  15. }