forked from TrueCloudLab/frostfs-api-go
Evgenii Stratonikov
29f2157563
In protobuf 3.12 they have added an support for `optional` keyword, which has made it into the main branch in 3.15. https://github.com/protocolbuffers/protobuf/blob/main/docs/implementing_proto3_presence.md https://github.com/protocolbuffers/protobuf/blob/v3.12.0/docs/field_presence.md#presence-in-proto3-apis This means that without an explicit `optional` keyword field presence for scalars is not tracked, thus empty string in JSON should be unmarshaled to a nil byte slice. Relevant decoding code and tests from protojson:fb995f184a/internal/impl/message_reflect_field.go (L327)
fb995f184a/encoding/protojson/decode_test.go (L134)
fb995f184a/encoding/protojson/decode_test.go (L156)
We do not support `optional` keyword and the generator will fail if it sees on. So only implement the default behaviour. Refs #122 Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2337 lines
56 KiB
Go
Generated
2337 lines
56 KiB
Go
Generated
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
|
|
|
|
package apemanager
|
|
|
|
import (
|
|
json "encoding/json"
|
|
fmt "fmt"
|
|
grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
|
|
grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
|
|
pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool"
|
|
proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"
|
|
encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding"
|
|
easyproto "github.com/VictoriaMetrics/easyproto"
|
|
jlexer "github.com/mailru/easyjson/jlexer"
|
|
jwriter "github.com/mailru/easyjson/jwriter"
|
|
)
|
|
|
|
type AddChainRequest_Body struct {
|
|
Target *grpc.ChainTarget `json:"target"`
|
|
Chain *grpc.Chain `json:"chain"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*AddChainRequest_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*AddChainRequest_Body)(nil)
|
|
_ json.Marshaler = (*AddChainRequest_Body)(nil)
|
|
_ json.Unmarshaler = (*AddChainRequest_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *AddChainRequest_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Target)
|
|
size += proto.NestedStructureSize(2, x.Chain)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *AddChainRequest_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *AddChainRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Target != nil {
|
|
x.Target.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.Chain != nil {
|
|
x.Chain.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *AddChainRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "AddChainRequest_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Target
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Target")
|
|
}
|
|
x.Target = new(grpc.ChainTarget)
|
|
if err := x.Target.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // Chain
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Chain")
|
|
}
|
|
x.Chain = new(grpc.Chain)
|
|
if err := x.Chain.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *AddChainRequest_Body) GetTarget() *grpc.ChainTarget {
|
|
if x != nil {
|
|
return x.Target
|
|
}
|
|
return nil
|
|
}
|
|
func (x *AddChainRequest_Body) SetTarget(v *grpc.ChainTarget) {
|
|
x.Target = v
|
|
}
|
|
func (x *AddChainRequest_Body) GetChain() *grpc.Chain {
|
|
if x != nil {
|
|
return x.Chain
|
|
}
|
|
return nil
|
|
}
|
|
func (x *AddChainRequest_Body) SetChain(v *grpc.Chain) {
|
|
x.Chain = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *AddChainRequest_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *AddChainRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
first := true
|
|
out.RawByte('{')
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"target\":"
|
|
out.RawString(prefix)
|
|
x.Target.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"chain\":"
|
|
out.RawString(prefix)
|
|
x.Chain.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *AddChainRequest_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *AddChainRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "target":
|
|
{
|
|
var f *grpc.ChainTarget
|
|
f = new(grpc.ChainTarget)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Target = f
|
|
}
|
|
case "chain":
|
|
{
|
|
var f *grpc.Chain
|
|
f = new(grpc.Chain)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Chain = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type AddChainRequest struct {
|
|
Body *AddChainRequest_Body `json:"body"`
|
|
MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*AddChainRequest)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*AddChainRequest)(nil)
|
|
_ json.Marshaler = (*AddChainRequest)(nil)
|
|
_ json.Unmarshaler = (*AddChainRequest)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *AddChainRequest) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *AddChainRequest) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *AddChainRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *AddChainRequest) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *AddChainRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *AddChainRequest) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "AddChainRequest")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(AddChainRequest_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.RequestMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.RequestVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *AddChainRequest) GetBody() *AddChainRequest_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *AddChainRequest) SetBody(v *AddChainRequest_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *AddChainRequest) GetMetaHeader() *grpc1.RequestMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *AddChainRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *AddChainRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *AddChainRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *AddChainRequest) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *AddChainRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
first := true
|
|
out.RawByte('{')
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"body\":"
|
|
out.RawString(prefix)
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *AddChainRequest) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *AddChainRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *AddChainRequest_Body
|
|
f = new(AddChainRequest_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.RequestMetaHeader
|
|
f = new(grpc1.RequestMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.RequestVerificationHeader
|
|
f = new(grpc1.RequestVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type AddChainResponse_Body struct {
|
|
ChainId []byte `json:"chainId"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*AddChainResponse_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*AddChainResponse_Body)(nil)
|
|
_ json.Marshaler = (*AddChainResponse_Body)(nil)
|
|
_ json.Unmarshaler = (*AddChainResponse_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *AddChainResponse_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.BytesSize(1, x.ChainId)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *AddChainResponse_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *AddChainResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if len(x.ChainId) != 0 {
|
|
mm.AppendBytes(1, x.ChainId)
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *AddChainResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "AddChainResponse_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // ChainId
|
|
data, ok := fc.Bytes()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "ChainId")
|
|
}
|
|
x.ChainId = data
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *AddChainResponse_Body) GetChainId() []byte {
|
|
if x != nil {
|
|
return x.ChainId
|
|
}
|
|
return nil
|
|
}
|
|
func (x *AddChainResponse_Body) SetChainId(v []byte) {
|
|
x.ChainId = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *AddChainResponse_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *AddChainResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
first := true
|
|
out.RawByte('{')
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"chainId\":"
|
|
out.RawString(prefix)
|
|
if x.ChainId != nil {
|
|
out.Base64Bytes(x.ChainId)
|
|
} else {
|
|
out.String("")
|
|
}
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *AddChainResponse_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *AddChainResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "chainId":
|
|
{
|
|
var f []byte
|
|
{
|
|
tmp := in.Bytes()
|
|
if len(tmp) == 0 {
|
|
tmp = nil
|
|
}
|
|
f = tmp
|
|
}
|
|
x.ChainId = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type AddChainResponse struct {
|
|
Body *AddChainResponse_Body `json:"body"`
|
|
MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*AddChainResponse)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*AddChainResponse)(nil)
|
|
_ json.Marshaler = (*AddChainResponse)(nil)
|
|
_ json.Unmarshaler = (*AddChainResponse)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *AddChainResponse) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *AddChainResponse) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *AddChainResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *AddChainResponse) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *AddChainResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *AddChainResponse) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "AddChainResponse")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(AddChainResponse_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.ResponseMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.ResponseVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *AddChainResponse) GetBody() *AddChainResponse_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *AddChainResponse) SetBody(v *AddChainResponse_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *AddChainResponse) GetMetaHeader() *grpc1.ResponseMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *AddChainResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *AddChainResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *AddChainResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *AddChainResponse) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *AddChainResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
first := true
|
|
out.RawByte('{')
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"body\":"
|
|
out.RawString(prefix)
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *AddChainResponse) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *AddChainResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *AddChainResponse_Body
|
|
f = new(AddChainResponse_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.ResponseMetaHeader
|
|
f = new(grpc1.ResponseMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.ResponseVerificationHeader
|
|
f = new(grpc1.ResponseVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type RemoveChainRequest_Body struct {
|
|
Target *grpc.ChainTarget `json:"target"`
|
|
ChainId []byte `json:"chainId"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*RemoveChainRequest_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*RemoveChainRequest_Body)(nil)
|
|
_ json.Marshaler = (*RemoveChainRequest_Body)(nil)
|
|
_ json.Unmarshaler = (*RemoveChainRequest_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *RemoveChainRequest_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Target)
|
|
size += proto.BytesSize(2, x.ChainId)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *RemoveChainRequest_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *RemoveChainRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Target != nil {
|
|
x.Target.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if len(x.ChainId) != 0 {
|
|
mm.AppendBytes(2, x.ChainId)
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *RemoveChainRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "RemoveChainRequest_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Target
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Target")
|
|
}
|
|
x.Target = new(grpc.ChainTarget)
|
|
if err := x.Target.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // ChainId
|
|
data, ok := fc.Bytes()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "ChainId")
|
|
}
|
|
x.ChainId = data
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *RemoveChainRequest_Body) GetTarget() *grpc.ChainTarget {
|
|
if x != nil {
|
|
return x.Target
|
|
}
|
|
return nil
|
|
}
|
|
func (x *RemoveChainRequest_Body) SetTarget(v *grpc.ChainTarget) {
|
|
x.Target = v
|
|
}
|
|
func (x *RemoveChainRequest_Body) GetChainId() []byte {
|
|
if x != nil {
|
|
return x.ChainId
|
|
}
|
|
return nil
|
|
}
|
|
func (x *RemoveChainRequest_Body) SetChainId(v []byte) {
|
|
x.ChainId = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *RemoveChainRequest_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *RemoveChainRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
first := true
|
|
out.RawByte('{')
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"target\":"
|
|
out.RawString(prefix)
|
|
x.Target.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"chainId\":"
|
|
out.RawString(prefix)
|
|
if x.ChainId != nil {
|
|
out.Base64Bytes(x.ChainId)
|
|
} else {
|
|
out.String("")
|
|
}
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *RemoveChainRequest_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *RemoveChainRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "target":
|
|
{
|
|
var f *grpc.ChainTarget
|
|
f = new(grpc.ChainTarget)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Target = f
|
|
}
|
|
case "chainId":
|
|
{
|
|
var f []byte
|
|
{
|
|
tmp := in.Bytes()
|
|
if len(tmp) == 0 {
|
|
tmp = nil
|
|
}
|
|
f = tmp
|
|
}
|
|
x.ChainId = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type RemoveChainRequest struct {
|
|
Body *RemoveChainRequest_Body `json:"body"`
|
|
MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*RemoveChainRequest)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*RemoveChainRequest)(nil)
|
|
_ json.Marshaler = (*RemoveChainRequest)(nil)
|
|
_ json.Unmarshaler = (*RemoveChainRequest)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *RemoveChainRequest) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *RemoveChainRequest) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *RemoveChainRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *RemoveChainRequest) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *RemoveChainRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *RemoveChainRequest) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "RemoveChainRequest")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(RemoveChainRequest_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.RequestMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.RequestVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *RemoveChainRequest) GetBody() *RemoveChainRequest_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *RemoveChainRequest) SetBody(v *RemoveChainRequest_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *RemoveChainRequest) GetMetaHeader() *grpc1.RequestMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *RemoveChainRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *RemoveChainRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *RemoveChainRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *RemoveChainRequest) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *RemoveChainRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
first := true
|
|
out.RawByte('{')
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"body\":"
|
|
out.RawString(prefix)
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *RemoveChainRequest) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *RemoveChainRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *RemoveChainRequest_Body
|
|
f = new(RemoveChainRequest_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.RequestMetaHeader
|
|
f = new(grpc1.RequestMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.RequestVerificationHeader
|
|
f = new(grpc1.RequestVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type RemoveChainResponse_Body struct {
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*RemoveChainResponse_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*RemoveChainResponse_Body)(nil)
|
|
_ json.Marshaler = (*RemoveChainResponse_Body)(nil)
|
|
_ json.Unmarshaler = (*RemoveChainResponse_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *RemoveChainResponse_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *RemoveChainResponse_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *RemoveChainResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *RemoveChainResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "RemoveChainResponse_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *RemoveChainResponse_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *RemoveChainResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *RemoveChainResponse_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *RemoveChainResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type RemoveChainResponse struct {
|
|
Body *RemoveChainResponse_Body `json:"body"`
|
|
MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*RemoveChainResponse)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*RemoveChainResponse)(nil)
|
|
_ json.Marshaler = (*RemoveChainResponse)(nil)
|
|
_ json.Unmarshaler = (*RemoveChainResponse)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *RemoveChainResponse) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *RemoveChainResponse) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *RemoveChainResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *RemoveChainResponse) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *RemoveChainResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *RemoveChainResponse) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "RemoveChainResponse")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(RemoveChainResponse_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.ResponseMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.ResponseVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *RemoveChainResponse) GetBody() *RemoveChainResponse_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *RemoveChainResponse) SetBody(v *RemoveChainResponse_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *RemoveChainResponse) GetMetaHeader() *grpc1.ResponseMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *RemoveChainResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *RemoveChainResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *RemoveChainResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *RemoveChainResponse) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *RemoveChainResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
first := true
|
|
out.RawByte('{')
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"body\":"
|
|
out.RawString(prefix)
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *RemoveChainResponse) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *RemoveChainResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *RemoveChainResponse_Body
|
|
f = new(RemoveChainResponse_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.ResponseMetaHeader
|
|
f = new(grpc1.ResponseMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.ResponseVerificationHeader
|
|
f = new(grpc1.ResponseVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type ListChainsRequest_Body struct {
|
|
Target *grpc.ChainTarget `json:"target"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*ListChainsRequest_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*ListChainsRequest_Body)(nil)
|
|
_ json.Marshaler = (*ListChainsRequest_Body)(nil)
|
|
_ json.Unmarshaler = (*ListChainsRequest_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *ListChainsRequest_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Target)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *ListChainsRequest_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *ListChainsRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Target != nil {
|
|
x.Target.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *ListChainsRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "ListChainsRequest_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Target
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Target")
|
|
}
|
|
x.Target = new(grpc.ChainTarget)
|
|
if err := x.Target.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *ListChainsRequest_Body) GetTarget() *grpc.ChainTarget {
|
|
if x != nil {
|
|
return x.Target
|
|
}
|
|
return nil
|
|
}
|
|
func (x *ListChainsRequest_Body) SetTarget(v *grpc.ChainTarget) {
|
|
x.Target = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *ListChainsRequest_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *ListChainsRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
first := true
|
|
out.RawByte('{')
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"target\":"
|
|
out.RawString(prefix)
|
|
x.Target.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *ListChainsRequest_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *ListChainsRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "target":
|
|
{
|
|
var f *grpc.ChainTarget
|
|
f = new(grpc.ChainTarget)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Target = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type ListChainsRequest struct {
|
|
Body *ListChainsRequest_Body `json:"body"`
|
|
MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*ListChainsRequest)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*ListChainsRequest)(nil)
|
|
_ json.Marshaler = (*ListChainsRequest)(nil)
|
|
_ json.Unmarshaler = (*ListChainsRequest)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *ListChainsRequest) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *ListChainsRequest) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *ListChainsRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *ListChainsRequest) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *ListChainsRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *ListChainsRequest) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "ListChainsRequest")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(ListChainsRequest_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.RequestMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.RequestVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *ListChainsRequest) GetBody() *ListChainsRequest_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *ListChainsRequest) SetBody(v *ListChainsRequest_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *ListChainsRequest) GetMetaHeader() *grpc1.RequestMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *ListChainsRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *ListChainsRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *ListChainsRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *ListChainsRequest) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *ListChainsRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
first := true
|
|
out.RawByte('{')
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"body\":"
|
|
out.RawString(prefix)
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *ListChainsRequest) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *ListChainsRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *ListChainsRequest_Body
|
|
f = new(ListChainsRequest_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.RequestMetaHeader
|
|
f = new(grpc1.RequestMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.RequestVerificationHeader
|
|
f = new(grpc1.RequestVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type ListChainsResponse_Body struct {
|
|
Chains []grpc.Chain `json:"chains"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*ListChainsResponse_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*ListChainsResponse_Body)(nil)
|
|
_ json.Marshaler = (*ListChainsResponse_Body)(nil)
|
|
_ json.Unmarshaler = (*ListChainsResponse_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *ListChainsResponse_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
for i := range x.Chains {
|
|
size += proto.NestedStructureSizeUnchecked(1, &x.Chains[i])
|
|
}
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *ListChainsResponse_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *ListChainsResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
for i := range x.Chains {
|
|
x.Chains[i].EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *ListChainsResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "ListChainsResponse_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Chains
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Chains")
|
|
}
|
|
x.Chains = append(x.Chains, grpc.Chain{})
|
|
ff := &x.Chains[len(x.Chains)-1]
|
|
if err := ff.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *ListChainsResponse_Body) GetChains() []grpc.Chain {
|
|
if x != nil {
|
|
return x.Chains
|
|
}
|
|
return nil
|
|
}
|
|
func (x *ListChainsResponse_Body) SetChains(v []grpc.Chain) {
|
|
x.Chains = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *ListChainsResponse_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *ListChainsResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
first := true
|
|
out.RawByte('{')
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"chains\":"
|
|
out.RawString(prefix)
|
|
out.RawByte('[')
|
|
for i := range x.Chains {
|
|
if i != 0 {
|
|
out.RawByte(',')
|
|
}
|
|
x.Chains[i].MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte(']')
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *ListChainsResponse_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *ListChainsResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "chains":
|
|
{
|
|
var f grpc.Chain
|
|
var list []grpc.Chain
|
|
in.Delim('[')
|
|
for !in.IsDelim(']') {
|
|
f = grpc.Chain{}
|
|
f.UnmarshalEasyJSON(in)
|
|
list = append(list, f)
|
|
in.WantComma()
|
|
}
|
|
x.Chains = list
|
|
in.Delim(']')
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type ListChainsResponse struct {
|
|
Body *ListChainsResponse_Body `json:"body"`
|
|
MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*ListChainsResponse)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*ListChainsResponse)(nil)
|
|
_ json.Marshaler = (*ListChainsResponse)(nil)
|
|
_ json.Unmarshaler = (*ListChainsResponse)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *ListChainsResponse) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *ListChainsResponse) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *ListChainsResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *ListChainsResponse) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *ListChainsResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *ListChainsResponse) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "ListChainsResponse")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(ListChainsResponse_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.ResponseMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.ResponseVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *ListChainsResponse) GetBody() *ListChainsResponse_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *ListChainsResponse) SetBody(v *ListChainsResponse_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *ListChainsResponse) GetMetaHeader() *grpc1.ResponseMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *ListChainsResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *ListChainsResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *ListChainsResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *ListChainsResponse) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *ListChainsResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
first := true
|
|
out.RawByte('{')
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"body\":"
|
|
out.RawString(prefix)
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
if !first {
|
|
out.RawByte(',')
|
|
} else {
|
|
first = false
|
|
}
|
|
const prefix string = "\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *ListChainsResponse) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *ListChainsResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *ListChainsResponse_Body
|
|
f = new(ListChainsResponse_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.ResponseMetaHeader
|
|
f = new(grpc1.ResponseMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.ResponseVerificationHeader
|
|
f = new(grpc1.ResponseVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|