frostfs-api-go-pogpp/v2/refs/json.go
Leonard Lyubich 1031f3122e [#263] v2: Support new rpc library
Implement `message.Message` interface on all structures and use new methods
for conversion instead of functions. make `Unmarshal` and JSON methods to
use encoding functions from `message` library. Remove all per-service
clients and implement `rpc` library of the functions which execute NeoFS API
RPC through new RPC client. Remove no longer used gRPC per-service clients.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-03-17 14:03:49 +03:00

62 lines
1.5 KiB
Go

package refs
import (
"github.com/nspcc-dev/neofs-api-go/rpc/message"
refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
)
func (a *Address) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(a)
}
func (a *Address) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(a, data, new(refs.Address))
}
func (o *ObjectID) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(o)
}
func (o *ObjectID) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(o, data, new(refs.ObjectID))
}
func (c *ContainerID) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(c)
}
func (c *ContainerID) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(c, data, new(refs.ContainerID))
}
func (o *OwnerID) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(o)
}
func (o *OwnerID) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(o, data, new(refs.OwnerID))
}
func (v *Version) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(v)
}
func (v *Version) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(v, data, new(refs.Version))
}
func (s *Signature) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(s)
}
func (s *Signature) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(s, data, new(refs.Signature))
}
func (c *Checksum) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(c)
}
func (c *Checksum) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(c, data, new(refs.Checksum))
}