diff --git a/api/generated/v1/wb/products/products.pb.go b/api/generated/v1/wb/products/products.pb.go index d3fc69b..77799c9 100644 --- a/api/generated/v1/wb/products/products.pb.go +++ b/api/generated/v1/wb/products/products.pb.go @@ -66,13 +66,17 @@ func (x *GetProductsRequest) GetMarketplaceId() int64 { } type Product struct { - state protoimpl.MessageState `protogen:"open.v1"` - NmID int64 `protobuf:"varint,1,opt,name=nmID,proto3" json:"nmID,omitempty"` - SubjectID int64 `protobuf:"varint,2,opt,name=subjectID,proto3" json:"subjectID,omitempty"` - VendorCode string `protobuf:"bytes,3,opt,name=vendor_code,json=vendorCode,proto3" json:"vendor_code,omitempty"` - Sizes []*Product_Size `protobuf:"bytes,4,rep,name=sizes,proto3" json:"sizes,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + NmID int64 `protobuf:"varint,1,opt,name=nmID,proto3" json:"nmID,omitempty"` + SubjectID int64 `protobuf:"varint,2,opt,name=subjectID,proto3" json:"subjectID,omitempty"` + VendorCode string `protobuf:"bytes,3,opt,name=vendor_code,json=vendorCode,proto3" json:"vendor_code,omitempty"` + Sizes []*Product_Size `protobuf:"bytes,4,rep,name=sizes,proto3" json:"sizes,omitempty"` + Characteristics []*Product_Characteristic `protobuf:"bytes,5,rep,name=characteristics,proto3" json:"characteristics,omitempty"` + Photos []*Product_Photo `protobuf:"bytes,6,rep,name=photos,proto3" json:"photos,omitempty"` + Dimensions *Product_Dimensions `protobuf:"bytes,7,opt,name=dimensions,proto3" json:"dimensions,omitempty"` + Title string `protobuf:"bytes,8,opt,name=title,proto3" json:"title,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Product) Reset() { @@ -133,6 +137,34 @@ func (x *Product) GetSizes() []*Product_Size { return nil } +func (x *Product) GetCharacteristics() []*Product_Characteristic { + if x != nil { + return x.Characteristics + } + return nil +} + +func (x *Product) GetPhotos() []*Product_Photo { + if x != nil { + return x.Photos + } + return nil +} + +func (x *Product) GetDimensions() *Product_Dimensions { + if x != nil { + return x.Dimensions + } + return nil +} + +func (x *Product) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + type GetProductsResponse struct { state protoimpl.MessageState `protogen:"open.v1"` Products []*Product `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"` @@ -180,6 +212,9 @@ func (x *GetProductsResponse) GetProducts() []*Product { type Product_Size struct { state protoimpl.MessageState `protogen:"open.v1"` Skus []string `protobuf:"bytes,1,rep,name=skus,proto3" json:"skus,omitempty"` + ChrtID int64 `protobuf:"varint,2,opt,name=chrtID,proto3" json:"chrtID,omitempty"` + TechSize string `protobuf:"bytes,3,opt,name=techSize,proto3" json:"techSize,omitempty"` + WbSize string `protobuf:"bytes,4,opt,name=wbSize,proto3" json:"wbSize,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -221,21 +256,244 @@ func (x *Product_Size) GetSkus() []string { return nil } +func (x *Product_Size) GetChrtID() int64 { + if x != nil { + return x.ChrtID + } + return 0 +} + +func (x *Product_Size) GetTechSize() string { + if x != nil { + return x.TechSize + } + return "" +} + +func (x *Product_Size) GetWbSize() string { + if x != nil { + return x.WbSize + } + return "" +} + +type Product_Characteristic struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Product_Characteristic) Reset() { + *x = Product_Characteristic{} + mi := &file_wb_products_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Product_Characteristic) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Product_Characteristic) ProtoMessage() {} + +func (x *Product_Characteristic) ProtoReflect() protoreflect.Message { + mi := &file_wb_products_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Product_Characteristic.ProtoReflect.Descriptor instead. +func (*Product_Characteristic) Descriptor() ([]byte, []int) { + return file_wb_products_proto_rawDescGZIP(), []int{1, 1} +} + +func (x *Product_Characteristic) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Product_Characteristic) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Product_Characteristic) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type Product_Photo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Big string `protobuf:"bytes,1,opt,name=big,proto3" json:"big,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Product_Photo) Reset() { + *x = Product_Photo{} + mi := &file_wb_products_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Product_Photo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Product_Photo) ProtoMessage() {} + +func (x *Product_Photo) ProtoReflect() protoreflect.Message { + mi := &file_wb_products_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Product_Photo.ProtoReflect.Descriptor instead. +func (*Product_Photo) Descriptor() ([]byte, []int) { + return file_wb_products_proto_rawDescGZIP(), []int{1, 2} +} + +func (x *Product_Photo) GetBig() string { + if x != nil { + return x.Big + } + return "" +} + +type Product_Dimensions struct { + state protoimpl.MessageState `protogen:"open.v1"` + Length int64 `protobuf:"varint,1,opt,name=length,proto3" json:"length,omitempty"` + Width int64 `protobuf:"varint,2,opt,name=width,proto3" json:"width,omitempty"` + Height int64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` + WeightBrutto float32 `protobuf:"fixed32,4,opt,name=weightBrutto,proto3" json:"weightBrutto,omitempty"` + IsValid bool `protobuf:"varint,5,opt,name=isValid,proto3" json:"isValid,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Product_Dimensions) Reset() { + *x = Product_Dimensions{} + mi := &file_wb_products_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Product_Dimensions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Product_Dimensions) ProtoMessage() {} + +func (x *Product_Dimensions) ProtoReflect() protoreflect.Message { + mi := &file_wb_products_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Product_Dimensions.ProtoReflect.Descriptor instead. +func (*Product_Dimensions) Descriptor() ([]byte, []int) { + return file_wb_products_proto_rawDescGZIP(), []int{1, 3} +} + +func (x *Product_Dimensions) GetLength() int64 { + if x != nil { + return x.Length + } + return 0 +} + +func (x *Product_Dimensions) GetWidth() int64 { + if x != nil { + return x.Width + } + return 0 +} + +func (x *Product_Dimensions) GetHeight() int64 { + if x != nil { + return x.Height + } + return 0 +} + +func (x *Product_Dimensions) GetWeightBrutto() float32 { + if x != nil { + return x.WeightBrutto + } + return 0 +} + +func (x *Product_Dimensions) GetIsValid() bool { + if x != nil { + return x.IsValid + } + return false +} + var File_wb_products_proto protoreflect.FileDescriptor const file_wb_products_proto_rawDesc = "" + "\n" + "\x11wb/products.proto\x12\vwb.products\";\n" + "\x12GetProductsRequest\x12%\n" + - "\x0emarketplace_id\x18\x01 \x01(\x03R\rmarketplaceId\"\xa9\x01\n" + + "\x0emarketplace_id\x18\x01 \x01(\x03R\rmarketplaceId\"\xc9\x05\n" + "\aProduct\x12\x12\n" + "\x04nmID\x18\x01 \x01(\x03R\x04nmID\x12\x1c\n" + "\tsubjectID\x18\x02 \x01(\x03R\tsubjectID\x12\x1f\n" + "\vvendor_code\x18\x03 \x01(\tR\n" + "vendorCode\x12/\n" + - "\x05sizes\x18\x04 \x03(\v2\x19.wb.products.Product.SizeR\x05sizes\x1a\x1a\n" + + "\x05sizes\x18\x04 \x03(\v2\x19.wb.products.Product.SizeR\x05sizes\x12M\n" + + "\x0fcharacteristics\x18\x05 \x03(\v2#.wb.products.Product.CharacteristicR\x0fcharacteristics\x122\n" + + "\x06photos\x18\x06 \x03(\v2\x1a.wb.products.Product.PhotoR\x06photos\x12?\n" + + "\n" + + "dimensions\x18\a \x01(\v2\x1f.wb.products.Product.DimensionsR\n" + + "dimensions\x12\x14\n" + + "\x05title\x18\b \x01(\tR\x05title\x1af\n" + "\x04Size\x12\x12\n" + - "\x04skus\x18\x01 \x03(\tR\x04skus\"G\n" + + "\x04skus\x18\x01 \x03(\tR\x04skus\x12\x16\n" + + "\x06chrtID\x18\x02 \x01(\x03R\x06chrtID\x12\x1a\n" + + "\btechSize\x18\x03 \x01(\tR\btechSize\x12\x16\n" + + "\x06wbSize\x18\x04 \x01(\tR\x06wbSize\x1aJ\n" + + "\x0eCharacteristic\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x14\n" + + "\x05value\x18\x03 \x01(\fR\x05value\x1a\x19\n" + + "\x05Photo\x12\x10\n" + + "\x03big\x18\x01 \x01(\tR\x03big\x1a\x90\x01\n" + + "\n" + + "Dimensions\x12\x16\n" + + "\x06length\x18\x01 \x01(\x03R\x06length\x12\x14\n" + + "\x05width\x18\x02 \x01(\x03R\x05width\x12\x16\n" + + "\x06height\x18\x03 \x01(\x03R\x06height\x12\"\n" + + "\fweightBrutto\x18\x04 \x01(\x02R\fweightBrutto\x12\x18\n" + + "\aisValid\x18\x05 \x01(\bR\aisValid\"G\n" + "\x13GetProductsResponse\x120\n" + "\bproducts\x18\x01 \x03(\v2\x14.wb.products.ProductR\bproducts2e\n" + "\x0fProductsService\x12R\n" + @@ -253,23 +511,29 @@ func file_wb_products_proto_rawDescGZIP() []byte { return file_wb_products_proto_rawDescData } -var file_wb_products_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_wb_products_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_wb_products_proto_goTypes = []any{ - (*GetProductsRequest)(nil), // 0: wb.products.GetProductsRequest - (*Product)(nil), // 1: wb.products.Product - (*GetProductsResponse)(nil), // 2: wb.products.GetProductsResponse - (*Product_Size)(nil), // 3: wb.products.Product.Size + (*GetProductsRequest)(nil), // 0: wb.products.GetProductsRequest + (*Product)(nil), // 1: wb.products.Product + (*GetProductsResponse)(nil), // 2: wb.products.GetProductsResponse + (*Product_Size)(nil), // 3: wb.products.Product.Size + (*Product_Characteristic)(nil), // 4: wb.products.Product.Characteristic + (*Product_Photo)(nil), // 5: wb.products.Product.Photo + (*Product_Dimensions)(nil), // 6: wb.products.Product.Dimensions } var file_wb_products_proto_depIdxs = []int32{ 3, // 0: wb.products.Product.sizes:type_name -> wb.products.Product.Size - 1, // 1: wb.products.GetProductsResponse.products:type_name -> wb.products.Product - 0, // 2: wb.products.ProductsService.GetProducts:input_type -> wb.products.GetProductsRequest - 2, // 3: wb.products.ProductsService.GetProducts:output_type -> wb.products.GetProductsResponse - 3, // [3:4] is the sub-list for method output_type - 2, // [2:3] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 4, // 1: wb.products.Product.characteristics:type_name -> wb.products.Product.Characteristic + 5, // 2: wb.products.Product.photos:type_name -> wb.products.Product.Photo + 6, // 3: wb.products.Product.dimensions:type_name -> wb.products.Product.Dimensions + 1, // 4: wb.products.GetProductsResponse.products:type_name -> wb.products.Product + 0, // 5: wb.products.ProductsService.GetProducts:input_type -> wb.products.GetProductsRequest + 2, // 6: wb.products.ProductsService.GetProducts:output_type -> wb.products.GetProductsResponse + 6, // [6:7] is the sub-list for method output_type + 5, // [5:6] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_wb_products_proto_init() } @@ -283,7 +547,7 @@ func file_wb_products_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_wb_products_proto_rawDesc), len(file_wb_products_proto_rawDesc)), NumEnums: 0, - NumMessages: 4, + NumMessages: 7, NumExtensions: 0, NumServices: 1, }, diff --git a/api/proto/v1 b/api/proto/v1 index 2c4ca98..84924dc 160000 --- a/api/proto/v1 +++ b/api/proto/v1 @@ -1 +1 @@ -Subproject commit 2c4ca98d2d1c9809e1f49e423e20bba6dcdb3ff9 +Subproject commit 84924dc33f2aae71c77b0081eb25d723cfb55a9f diff --git a/go.mod b/go.mod index 07f9780..c3ff4a8 100755 --- a/go.mod +++ b/go.mod @@ -25,6 +25,7 @@ require ( require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/dave/jennifer v1.6.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dlclark/regexp2 v1.11.5 // indirect github.com/fatih/color v1.18.0 // indirect @@ -35,6 +36,7 @@ require ( github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect + github.com/jmattheis/goverter v1.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/redis/go-redis/v9 v9.7.0 // indirect @@ -48,11 +50,13 @@ require ( go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.38.0 // indirect golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 // indirect + golang.org/x/mod v0.24.0 // indirect golang.org/x/net v0.40.0 // indirect golang.org/x/sync v0.14.0 // indirect golang.org/x/sys v0.33.0 // indirect golang.org/x/text v0.25.0 // indirect golang.org/x/time v0.8.0 // indirect + golang.org/x/tools v0.33.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 4a88cd1..27b2aeb 100755 --- a/go.sum +++ b/go.sum @@ -6,6 +6,8 @@ github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/dave/jennifer v1.6.0 h1:MQ/6emI2xM7wt0tJzJzyUik2Q3Tcn2eE0vtYgh4GPVI= +github.com/dave/jennifer v1.6.0/go.mod h1:AxTG893FiZKqxy3FP1kL80VMshSMuz2G+EgvszgGRnk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -48,6 +50,8 @@ github.com/jackc/pgx/v5 v5.7.5 h1:JHGfMnQY+IEtGM63d+NGMjoRpysB2JBwDr5fsngwmJs= github.com/jackc/pgx/v5 v5.7.5/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M= github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jmattheis/goverter v1.9.0 h1:opB/9b5Wer/csEHKS8ujW+cLHSDGg4dD+7109Qgqml4= +github.com/jmattheis/goverter v1.9.0/go.mod h1:c8TVzpum2NThy2eJ/Wz3tyqRxzpElP2xDfoHOIDrNSQ= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -115,6 +119,8 @@ golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 h1:Di6/M8l0O2lCLc6VVRWhgCiApHV8MnQurBnFSHsQtNY= golang.org/x/exp v0.0.0-20230725093048-515e97ebf090/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= +golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= @@ -127,6 +133,8 @@ golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc= +golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI= google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a h1:51aaUVRocpvUOSQKM6Q7VuoaktNIaMCLuhZB6DKksq4= google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a/go.mod h1:uRxBH1mhmO8PGhU89cMcHaXKZqO+OfakD8QQO0oYwlQ= google.golang.org/grpc v1.72.2 h1:TdbGzwb82ty4OusHWepvFWGLgIbNo1/SUynEN0ssqv8= diff --git a/internal/wb/products/mapping/converter.go b/internal/wb/products/mapping/converter.go index 210d8ef..aef9606 100644 --- a/internal/wb/products/mapping/converter.go +++ b/internal/wb/products/mapping/converter.go @@ -1,28 +1,36 @@ package mapping -import wbclient "sipro-mps/pkg/api/wb/client" +import ( + proto "sipro-mps/api/generated/v1/wb/products" + internal "sipro-mps/pkg/api/wb/client" + wbclient "sipro-mps/pkg/api/wb/client" +) + +//go:generate go run github.com/jmattheis/goverter/cmd/goverter gen . + +// goverter:converter +// goverter:extend OptIntToInt64 OptStringToString WbDimensionsToProto +// goverter:ignoreUnexported yes +// goverter:matchIgnoreCase yes +type Converter interface { + ToProto(details *internal.ContentV2GetCardsListPostOKCardsItem) *proto.Product +} -// import ( -// -// proto "sipro-mps/api/generated/v1/wb/products" -// internal "sipro-mps/internal/wb/products" -// wbclient "sipro-mps/pkg/api/wb/client" -// -// ) -// -// //go:generate go run github.com/jmattheis/goverter/cmd/goverter gen -global "ignoreUnexported yes" . -// -// // goverter:converter -// // goverter:extend OptIntToInt64 OptStringToString -// -// type Converter interface { -// // goverter:ignore state sizeCache unknownFields -// -// ToProto(details *internal.WbProduct) *proto.Product -// } func OptIntToInt64(i wbclient.OptInt) int64 { return int64(i.Value) } func OptStringToString(s wbclient.OptString) string { return s.Value } +func WbDimensionsToProto(s wbclient.OptContentV2GetCardsListPostOKCardsItemDimensions) *proto.Product_Dimensions { + result := proto.Product_Dimensions{} + if !s.Set { + return &result + } + value := s.Value + result.Length = int64(value.Length.Value) + result.Width = int64(value.Width.Value) + result.WeightBrutto = float32(value.WeightBrutto.Value) + result.IsValid = value.IsValid.Value + return &result +}