diff --git a/v2/accounting/convert.go b/v2/accounting/convert.go index 9f04943..74d96c5 100644 --- a/v2/accounting/convert.go +++ b/v2/accounting/convert.go @@ -4,7 +4,6 @@ import ( accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/service" - grpcService "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" ) func BalanceRequestBodyToGRPCMessage(b *BalanceRequestBody) *accounting.BalanceRequest_Body { @@ -35,44 +34,6 @@ func BalanceRequestBodyFromGRPCMessage(m *accounting.BalanceRequest_Body) *Balan return b } -func headersToGRPC( - src interface { - GetRequestMetaHeader() *service.RequestMetaHeader - GetRequestVerificationHeader() *service.RequestVerificationHeader - }, - dst interface { - SetMetaHeader(*grpcService.RequestMetaHeader) - SetVerifyHeader(*grpcService.RequestVerificationHeader) - }, -) { - dst.SetMetaHeader( - service.RequestMetaHeaderToGRPCMessage(src.GetRequestMetaHeader()), - ) - - dst.SetVerifyHeader( - service.RequestVerificationHeaderToGRPCMessage(src.GetRequestVerificationHeader()), - ) -} - -func headersFromGRPC( - src interface { - GetMetaHeader() *grpcService.RequestMetaHeader - GetVerifyHeader() *grpcService.RequestVerificationHeader - }, - dst interface { - SetRequestMetaHeader(*service.RequestMetaHeader) - SetRequestVerificationHeader(*service.RequestVerificationHeader) - }, -) { - dst.SetRequestMetaHeader( - service.RequestMetaHeaderFromGRPCMessage(src.GetMetaHeader()), - ) - - dst.SetRequestVerificationHeader( - service.RequestVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), - ) -} - func BalanceRequestToGRPCMessage(b *BalanceRequest) *accounting.BalanceRequest { if b == nil { return nil @@ -84,7 +45,7 @@ func BalanceRequestToGRPCMessage(b *BalanceRequest) *accounting.BalanceRequest { BalanceRequestBodyToGRPCMessage(b.GetBody()), ) - headersToGRPC(b, m) + service.RequestHeadersToGRPC(b, m) return m } @@ -100,7 +61,7 @@ func BalanceRequestFromGRPCMessage(m *accounting.BalanceRequest) *BalanceRequest BalanceRequestBodyFromGRPCMessage(m.GetBody()), ) - headersFromGRPC(m, b) + service.RequestHeadersFromGRPC(m, b) return b } diff --git a/v2/service/convert.go b/v2/service/convert.go index eb8a10a..c3306f3 100644 --- a/v2/service/convert.go +++ b/v2/service/convert.go @@ -325,3 +325,41 @@ func BearerTokenBodyFromGRPCMessage(m *service.BearerToken_Body) *BearerTokenBod return bt } + +func RequestHeadersToGRPC( + src interface { + GetRequestMetaHeader() *RequestMetaHeader + GetRequestVerificationHeader() *RequestVerificationHeader + }, + dst interface { + SetMetaHeader(*service.RequestMetaHeader) + SetVerifyHeader(*service.RequestVerificationHeader) + }, +) { + dst.SetMetaHeader( + RequestMetaHeaderToGRPCMessage(src.GetRequestMetaHeader()), + ) + + dst.SetVerifyHeader( + RequestVerificationHeaderToGRPCMessage(src.GetRequestVerificationHeader()), + ) +} + +func RequestHeadersFromGRPC( + src interface { + GetMetaHeader() *service.RequestMetaHeader + GetVerifyHeader() *service.RequestVerificationHeader + }, + dst interface { + SetRequestMetaHeader(*RequestMetaHeader) + SetRequestVerificationHeader(*RequestVerificationHeader) + }, +) { + dst.SetRequestMetaHeader( + RequestMetaHeaderFromGRPCMessage(src.GetMetaHeader()), + ) + + dst.SetRequestVerificationHeader( + RequestVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), + ) +}