[#265] reputation: Implement converters and encoding methods on messages

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-04-01 17:53:14 +03:00 committed by Leonard Lyubich
parent 8ce1c5efcc
commit ccae5a40ba
4 changed files with 517 additions and 4 deletions

View file

@ -5,6 +5,14 @@ import (
reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc"
)
func (x *PeerID) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(x)
}
func (x *PeerID) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(x, data, new(reputation.PeerID))
}
func (x *Trust) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(x)
}
@ -12,3 +20,11 @@ func (x *Trust) MarshalJSON() ([]byte, error) {
func (x *Trust) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(x, data, new(reputation.Trust))
}
func (x *GlobalTrust) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(x)
}
func (x *GlobalTrust) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(x, data, new(reputation.GlobalTrust))
}