// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. package accounting import ( json "encoding/json" fmt "fmt" grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" pool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool" proto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" encoding "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/encoding" easyproto "github.com/VictoriaMetrics/easyproto" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" ) type BalanceRequest_Body struct { OwnerId *grpc.OwnerID `json:"ownerId"` } var ( _ encoding.ProtoMarshaler = (*BalanceRequest_Body)(nil) _ encoding.ProtoUnmarshaler = (*BalanceRequest_Body)(nil) _ json.Marshaler = (*BalanceRequest_Body)(nil) _ json.Unmarshaler = (*BalanceRequest_Body)(nil) ) // StableSize returns the size of x in protobuf format. // // Structures with the same field values have the same binary size. func (x *BalanceRequest_Body) StableSize() (size int) { if x == nil { return 0 } size += proto.NestedStructureSize(1, x.OwnerId) return size } // MarshalProtobuf implements the encoding.ProtoMarshaler interface. func (x *BalanceRequest_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 *BalanceRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } if x.OwnerId != nil { x.OwnerId.EmitProtobuf(mm.AppendMessage(1)) } } // UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. func (x *BalanceRequest_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", "BalanceRequest_Body") } switch fc.FieldNum { case 1: // OwnerId data, ok := fc.MessageData() if !ok { return fmt.Errorf("cannot unmarshal field %s", "OwnerId") } x.OwnerId = new(grpc.OwnerID) if err := x.OwnerId.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } } } return nil } func (x *BalanceRequest_Body) GetOwnerId() *grpc.OwnerID { if x != nil { return x.OwnerId } return nil } func (x *BalanceRequest_Body) SetOwnerId(v *grpc.OwnerID) { x.OwnerId = v } // MarshalJSON implements the json.Marshaler interface. func (x *BalanceRequest_Body) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} x.MarshalEasyJSON(&w) return w.Buffer.BuildBytes(), w.Error } func (x *BalanceRequest_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 = "\"ownerId\":" out.RawString(prefix) x.OwnerId.MarshalEasyJSON(out) } out.RawByte('}') } // UnmarshalJSON implements the json.Unmarshaler interface. func (x *BalanceRequest_Body) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} x.UnmarshalEasyJSON(&r) return r.Error() } func (x *BalanceRequest_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 "ownerId": { var f *grpc.OwnerID f = new(grpc.OwnerID) f.UnmarshalEasyJSON(in) x.OwnerId = f } } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } type BalanceRequest struct { Body *BalanceRequest_Body `json:"body"` MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` } var ( _ encoding.ProtoMarshaler = (*BalanceRequest)(nil) _ encoding.ProtoUnmarshaler = (*BalanceRequest)(nil) _ json.Marshaler = (*BalanceRequest)(nil) _ json.Unmarshaler = (*BalanceRequest)(nil) ) // StableSize returns the size of x in protobuf format. // // Structures with the same field values have the same binary size. func (x *BalanceRequest) 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 *BalanceRequest) 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 *BalanceRequest) ReadSignedData(buf []byte) ([]byte, error) { return x.GetBody().MarshalProtobuf(buf), nil } // MarshalProtobuf implements the encoding.ProtoMarshaler interface. func (x *BalanceRequest) 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 *BalanceRequest) 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 *BalanceRequest) 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", "BalanceRequest") } switch fc.FieldNum { case 1: // Body data, ok := fc.MessageData() if !ok { return fmt.Errorf("cannot unmarshal field %s", "Body") } x.Body = new(BalanceRequest_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 *BalanceRequest) GetBody() *BalanceRequest_Body { if x != nil { return x.Body } return nil } func (x *BalanceRequest) SetBody(v *BalanceRequest_Body) { x.Body = v } func (x *BalanceRequest) GetMetaHeader() *grpc1.RequestMetaHeader { if x != nil { return x.MetaHeader } return nil } func (x *BalanceRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { x.MetaHeader = v } func (x *BalanceRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { if x != nil { return x.VerifyHeader } return nil } func (x *BalanceRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { x.VerifyHeader = v } // MarshalJSON implements the json.Marshaler interface. func (x *BalanceRequest) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} x.MarshalEasyJSON(&w) return w.Buffer.BuildBytes(), w.Error } func (x *BalanceRequest) 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 *BalanceRequest) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} x.UnmarshalEasyJSON(&r) return r.Error() } func (x *BalanceRequest) 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 *BalanceRequest_Body f = new(BalanceRequest_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 BalanceResponse_Body struct { Balance *Decimal `json:"balance"` } var ( _ encoding.ProtoMarshaler = (*BalanceResponse_Body)(nil) _ encoding.ProtoUnmarshaler = (*BalanceResponse_Body)(nil) _ json.Marshaler = (*BalanceResponse_Body)(nil) _ json.Unmarshaler = (*BalanceResponse_Body)(nil) ) // StableSize returns the size of x in protobuf format. // // Structures with the same field values have the same binary size. func (x *BalanceResponse_Body) StableSize() (size int) { if x == nil { return 0 } size += proto.NestedStructureSize(1, x.Balance) return size } // MarshalProtobuf implements the encoding.ProtoMarshaler interface. func (x *BalanceResponse_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 *BalanceResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } if x.Balance != nil { x.Balance.EmitProtobuf(mm.AppendMessage(1)) } } // UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. func (x *BalanceResponse_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", "BalanceResponse_Body") } switch fc.FieldNum { case 1: // Balance data, ok := fc.MessageData() if !ok { return fmt.Errorf("cannot unmarshal field %s", "Balance") } x.Balance = new(Decimal) if err := x.Balance.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } } } return nil } func (x *BalanceResponse_Body) GetBalance() *Decimal { if x != nil { return x.Balance } return nil } func (x *BalanceResponse_Body) SetBalance(v *Decimal) { x.Balance = v } // MarshalJSON implements the json.Marshaler interface. func (x *BalanceResponse_Body) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} x.MarshalEasyJSON(&w) return w.Buffer.BuildBytes(), w.Error } func (x *BalanceResponse_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 = "\"balance\":" out.RawString(prefix) x.Balance.MarshalEasyJSON(out) } out.RawByte('}') } // UnmarshalJSON implements the json.Unmarshaler interface. func (x *BalanceResponse_Body) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} x.UnmarshalEasyJSON(&r) return r.Error() } func (x *BalanceResponse_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 "balance": { var f *Decimal f = new(Decimal) f.UnmarshalEasyJSON(in) x.Balance = f } } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } type BalanceResponse struct { Body *BalanceResponse_Body `json:"body"` MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` } var ( _ encoding.ProtoMarshaler = (*BalanceResponse)(nil) _ encoding.ProtoUnmarshaler = (*BalanceResponse)(nil) _ json.Marshaler = (*BalanceResponse)(nil) _ json.Unmarshaler = (*BalanceResponse)(nil) ) // StableSize returns the size of x in protobuf format. // // Structures with the same field values have the same binary size. func (x *BalanceResponse) 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 *BalanceResponse) 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 *BalanceResponse) ReadSignedData(buf []byte) ([]byte, error) { return x.GetBody().MarshalProtobuf(buf), nil } // MarshalProtobuf implements the encoding.ProtoMarshaler interface. func (x *BalanceResponse) 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 *BalanceResponse) 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 *BalanceResponse) 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", "BalanceResponse") } switch fc.FieldNum { case 1: // Body data, ok := fc.MessageData() if !ok { return fmt.Errorf("cannot unmarshal field %s", "Body") } x.Body = new(BalanceResponse_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 *BalanceResponse) GetBody() *BalanceResponse_Body { if x != nil { return x.Body } return nil } func (x *BalanceResponse) SetBody(v *BalanceResponse_Body) { x.Body = v } func (x *BalanceResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { if x != nil { return x.MetaHeader } return nil } func (x *BalanceResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { x.MetaHeader = v } func (x *BalanceResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { if x != nil { return x.VerifyHeader } return nil } func (x *BalanceResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { x.VerifyHeader = v } // MarshalJSON implements the json.Marshaler interface. func (x *BalanceResponse) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} x.MarshalEasyJSON(&w) return w.Buffer.BuildBytes(), w.Error } func (x *BalanceResponse) 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 *BalanceResponse) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} x.UnmarshalEasyJSON(&r) return r.Error() } func (x *BalanceResponse) 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 *BalanceResponse_Body f = new(BalanceResponse_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() } }