2020-11-13 16:40:00 +03:00
|
|
|
package session
|
|
|
|
|
|
|
|
import (
|
2021-03-12 15:57:23 +03:00
|
|
|
"github.com/nspcc-dev/neofs-api-go/rpc/message"
|
2020-11-13 16:40:00 +03:00
|
|
|
session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc"
|
|
|
|
"google.golang.org/protobuf/encoding/protojson"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (c *ObjectSessionContext) MarshalJSON() ([]byte, error) {
|
2021-03-12 15:57:23 +03:00
|
|
|
return message.MarshalJSON(c)
|
2020-11-13 16:40:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *ObjectSessionContext) UnmarshalJSON(data []byte) error {
|
2021-03-12 15:57:23 +03:00
|
|
|
return message.UnmarshalJSON(c, data, new(session.ObjectSessionContext))
|
2020-11-13 16:40:00 +03:00
|
|
|
}
|
2020-11-13 16:43:54 +03:00
|
|
|
|
|
|
|
func (l *TokenLifetime) MarshalJSON() ([]byte, error) {
|
2021-03-12 15:57:23 +03:00
|
|
|
return message.MarshalJSON(l)
|
2020-11-13 16:43:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (l *TokenLifetime) UnmarshalJSON(data []byte) error {
|
2021-03-12 15:57:23 +03:00
|
|
|
return message.UnmarshalJSON(l, data, new(session.SessionToken_Body_TokenLifetime))
|
2020-11-13 16:43:54 +03:00
|
|
|
}
|
2020-11-13 16:49:46 +03:00
|
|
|
|
|
|
|
func (t *SessionTokenBody) MarshalJSON() ([]byte, error) {
|
2021-03-12 15:57:23 +03:00
|
|
|
return message.MarshalJSON(t)
|
2020-11-13 16:49:46 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *SessionTokenBody) UnmarshalJSON(data []byte) error {
|
|
|
|
msg := new(session.SessionToken_Body)
|
|
|
|
|
|
|
|
if err := protojson.Unmarshal(data, msg); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-12 15:57:23 +03:00
|
|
|
return t.FromGRPCMessage(msg)
|
2020-11-13 16:49:46 +03:00
|
|
|
}
|
2020-11-13 16:53:42 +03:00
|
|
|
|
|
|
|
func (t *SessionToken) MarshalJSON() ([]byte, error) {
|
2021-03-12 15:57:23 +03:00
|
|
|
return message.MarshalJSON(t)
|
2020-11-13 16:53:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *SessionToken) UnmarshalJSON(data []byte) error {
|
|
|
|
msg := new(session.SessionToken)
|
|
|
|
|
|
|
|
if err := protojson.Unmarshal(data, msg); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-12 15:57:23 +03:00
|
|
|
return t.FromGRPCMessage(msg)
|
2020-11-13 16:53:42 +03:00
|
|
|
}
|
2020-11-13 16:58:08 +03:00
|
|
|
|
|
|
|
func (x *XHeader) MarshalJSON() ([]byte, error) {
|
2021-03-12 15:57:23 +03:00
|
|
|
return message.MarshalJSON(x)
|
2020-11-13 16:58:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (x *XHeader) UnmarshalJSON(data []byte) error {
|
|
|
|
msg := new(session.XHeader)
|
|
|
|
|
|
|
|
if err := protojson.Unmarshal(data, msg); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-12 15:57:23 +03:00
|
|
|
return x.FromGRPCMessage(msg)
|
2020-11-13 16:58:08 +03:00
|
|
|
}
|
2020-11-13 17:02:30 +03:00
|
|
|
|
|
|
|
func (r *RequestMetaHeader) MarshalJSON() ([]byte, error) {
|
2021-03-12 15:57:23 +03:00
|
|
|
return message.MarshalJSON(r)
|
2020-11-13 17:02:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *RequestMetaHeader) UnmarshalJSON(data []byte) error {
|
|
|
|
msg := new(session.RequestMetaHeader)
|
|
|
|
|
|
|
|
if err := protojson.Unmarshal(data, msg); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-12 15:57:23 +03:00
|
|
|
return r.FromGRPCMessage(msg)
|
2020-11-13 17:02:30 +03:00
|
|
|
}
|
2020-11-13 17:07:49 +03:00
|
|
|
|
|
|
|
func (r *RequestVerificationHeader) MarshalJSON() ([]byte, error) {
|
2021-03-12 15:57:23 +03:00
|
|
|
return message.MarshalJSON(r)
|
2020-11-13 17:07:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *RequestVerificationHeader) UnmarshalJSON(data []byte) error {
|
|
|
|
msg := new(session.RequestVerificationHeader)
|
|
|
|
|
|
|
|
if err := protojson.Unmarshal(data, msg); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-12 15:57:23 +03:00
|
|
|
return r.FromGRPCMessage(msg)
|
2020-11-13 17:07:49 +03:00
|
|
|
}
|
2020-11-13 17:11:09 +03:00
|
|
|
|
|
|
|
func (r *ResponseMetaHeader) MarshalJSON() ([]byte, error) {
|
2021-03-12 15:57:23 +03:00
|
|
|
return message.MarshalJSON(r)
|
2020-11-13 17:11:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *ResponseMetaHeader) UnmarshalJSON(data []byte) error {
|
|
|
|
msg := new(session.ResponseMetaHeader)
|
|
|
|
|
|
|
|
if err := protojson.Unmarshal(data, msg); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-12 15:57:23 +03:00
|
|
|
return r.FromGRPCMessage(msg)
|
2020-11-13 17:11:09 +03:00
|
|
|
}
|
2020-11-13 17:14:43 +03:00
|
|
|
|
|
|
|
func (r *ResponseVerificationHeader) MarshalJSON() ([]byte, error) {
|
2021-03-12 15:57:23 +03:00
|
|
|
return message.MarshalJSON(r)
|
2020-11-13 17:14:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *ResponseVerificationHeader) UnmarshalJSON(data []byte) error {
|
|
|
|
msg := new(session.ResponseVerificationHeader)
|
|
|
|
|
|
|
|
if err := protojson.Unmarshal(data, msg); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-12 15:57:23 +03:00
|
|
|
return r.FromGRPCMessage(msg)
|
2020-11-13 17:14:43 +03:00
|
|
|
}
|
2021-05-24 17:46:39 +03:00
|
|
|
|
|
|
|
func (x *ContainerSessionContext) MarshalJSON() ([]byte, error) {
|
|
|
|
return message.MarshalJSON(x)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *ContainerSessionContext) UnmarshalJSON(data []byte) error {
|
|
|
|
return message.UnmarshalJSON(x, data, new(session.ContainerSessionContext))
|
|
|
|
}
|