-
Notifications
You must be signed in to change notification settings - Fork 2
/
catalogclientserver.go
105 lines (84 loc) · 4.2 KB
/
catalogclientserver.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Code generated by goctl. DO NOT EDIT!
// Source: catalog.proto
package server
import (
"context"
"github.com/k8scommerce/k8scommerce/services/rpc/catalog/internal/logic"
"github.com/k8scommerce/k8scommerce/services/rpc/catalog/internal/svc"
"github.com/k8scommerce/k8scommerce/services/rpc/catalog/pb/catalog"
)
type CatalogClientServer struct {
svcCtx *svc.ServiceContext
catalog.UnimplementedCatalogClientServer
}
func NewCatalogClientServer(svcCtx *svc.ServiceContext) *CatalogClientServer {
return &CatalogClientServer{
svcCtx: svcCtx,
}
}
// categories
func (s *CatalogClientServer) GetAllCategories(ctx context.Context, in *catalog.GetAllCategoriesRequest) (*catalog.GetAllCategoriesResponse, error) {
l := logic.NewGetAllCategoriesLogic(ctx, s.svcCtx)
return l.GetAllCategories(in)
}
func (s *CatalogClientServer) GetCategoryBySlug(ctx context.Context, in *catalog.GetCategoryBySlugRequest) (*catalog.GetCategoryBySlugResponse, error) {
l := logic.NewGetCategoryBySlugLogic(ctx, s.svcCtx)
return l.GetCategoryBySlug(in)
}
func (s *CatalogClientServer) GetCategoryById(ctx context.Context, in *catalog.GetCategoryByIdRequest) (*catalog.GetCategoryByIdResponse, error) {
l := logic.NewGetCategoryByIdLogic(ctx, s.svcCtx)
return l.GetCategoryById(in)
}
func (s *CatalogClientServer) CreateCategory(ctx context.Context, in *catalog.CreateCategoryRequest) (*catalog.CreateCategoryResponse, error) {
l := logic.NewCreateCategoryLogic(ctx, s.svcCtx)
return l.CreateCategory(in)
}
func (s *CatalogClientServer) UpdateCategory(ctx context.Context, in *catalog.UpdateCategoryRequest) (*catalog.UpdateCategoryResponse, error) {
l := logic.NewUpdateCategoryLogic(ctx, s.svcCtx)
return l.UpdateCategory(in)
}
func (s *CatalogClientServer) DeleteCategory(ctx context.Context, in *catalog.DeleteCategoryRequest) (*catalog.DeleteCategoryResponse, error) {
l := logic.NewDeleteCategoryLogic(ctx, s.svcCtx)
return l.DeleteCategory(in)
}
// products
func (s *CatalogClientServer) GetProductBySku(ctx context.Context, in *catalog.GetProductBySkuRequest) (*catalog.GetProductBySkuResponse, error) {
l := logic.NewGetProductBySkuLogic(ctx, s.svcCtx)
return l.GetProductBySku(in)
}
func (s *CatalogClientServer) GetProductBySlug(ctx context.Context, in *catalog.GetProductBySlugRequest) (*catalog.GetProductBySlugResponse, error) {
l := logic.NewGetProductBySlugLogic(ctx, s.svcCtx)
return l.GetProductBySlug(in)
}
func (s *CatalogClientServer) GetProductById(ctx context.Context, in *catalog.GetProductByIdRequest) (*catalog.GetProductByIdResponse, error) {
l := logic.NewGetProductByIdLogic(ctx, s.svcCtx)
return l.GetProductById(in)
}
func (s *CatalogClientServer) GetProductsByCategoryId(ctx context.Context, in *catalog.GetProductsByCategoryIdRequest) (*catalog.GetProductsByCategoryIdResponse, error) {
l := logic.NewGetProductsByCategoryIdLogic(ctx, s.svcCtx)
return l.GetProductsByCategoryId(in)
}
func (s *CatalogClientServer) GetProductsByCategorySlug(ctx context.Context, in *catalog.GetProductsByCategorySlugRequest) (*catalog.GetProductsByCategorySlugResponse, error) {
l := logic.NewGetProductsByCategorySlugLogic(ctx, s.svcCtx)
return l.GetProductsByCategorySlug(in)
}
func (s *CatalogClientServer) GetAllProducts(ctx context.Context, in *catalog.GetAllProductsRequest) (*catalog.GetAllProductsResponse, error) {
l := logic.NewGetAllProductsLogic(ctx, s.svcCtx)
return l.GetAllProducts(in)
}
func (s *CatalogClientServer) CreateProduct(ctx context.Context, in *catalog.CreateProductRequest) (*catalog.CreateProductResponse, error) {
l := logic.NewCreateProductLogic(ctx, s.svcCtx)
return l.CreateProduct(in)
}
func (s *CatalogClientServer) UpdateProduct(ctx context.Context, in *catalog.UpdateProductRequest) (*catalog.UpdateProductResponse, error) {
l := logic.NewUpdateProductLogic(ctx, s.svcCtx)
return l.UpdateProduct(in)
}
func (s *CatalogClientServer) DeleteProduct(ctx context.Context, in *catalog.DeleteProductRequest) (*catalog.DeleteProductResponse, error) {
l := logic.NewDeleteProductLogic(ctx, s.svcCtx)
return l.DeleteProduct(in)
}
func (s *CatalogClientServer) UploadAsset(stream catalog.CatalogClient_UploadAssetServer) error {
l := logic.NewUploadAssetLogic(stream.Context(), s.svcCtx)
return l.UploadAsset(stream)
}