41 lines
1.9 KiB
Go
41 lines
1.9 KiB
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
|
|
"google.golang.org/grpc"
|
|
activityv1 "hyapp.local/api/proto/activity/v1"
|
|
)
|
|
|
|
// GrowthLevelClient abstracts App level reads from activity-service.
|
|
type GrowthLevelClient interface {
|
|
GetMyLevelOverview(ctx context.Context, req *activityv1.GetMyLevelOverviewRequest) (*activityv1.GetMyLevelOverviewResponse, error)
|
|
GetLevelTrack(ctx context.Context, req *activityv1.GetLevelTrackRequest) (*activityv1.GetLevelTrackResponse, error)
|
|
BatchGetUserLevelDisplayProfiles(ctx context.Context, req *activityv1.BatchGetUserLevelDisplayProfilesRequest) (*activityv1.BatchGetUserLevelDisplayProfilesResponse, error)
|
|
ListLevelRewards(ctx context.Context, req *activityv1.ListLevelRewardsRequest) (*activityv1.ListLevelRewardsResponse, error)
|
|
}
|
|
|
|
type grpcGrowthLevelClient struct {
|
|
client activityv1.GrowthLevelServiceClient
|
|
}
|
|
|
|
func NewGRPCGrowthLevelClient(conn *grpc.ClientConn) GrowthLevelClient {
|
|
return &grpcGrowthLevelClient{client: activityv1.NewGrowthLevelServiceClient(conn)}
|
|
}
|
|
|
|
func (c *grpcGrowthLevelClient) GetMyLevelOverview(ctx context.Context, req *activityv1.GetMyLevelOverviewRequest) (*activityv1.GetMyLevelOverviewResponse, error) {
|
|
return c.client.GetMyLevelOverview(ctx, req)
|
|
}
|
|
|
|
func (c *grpcGrowthLevelClient) GetLevelTrack(ctx context.Context, req *activityv1.GetLevelTrackRequest) (*activityv1.GetLevelTrackResponse, error) {
|
|
return c.client.GetLevelTrack(ctx, req)
|
|
}
|
|
|
|
func (c *grpcGrowthLevelClient) BatchGetUserLevelDisplayProfiles(ctx context.Context, req *activityv1.BatchGetUserLevelDisplayProfilesRequest) (*activityv1.BatchGetUserLevelDisplayProfilesResponse, error) {
|
|
return c.client.BatchGetUserLevelDisplayProfiles(ctx, req)
|
|
}
|
|
|
|
func (c *grpcGrowthLevelClient) ListLevelRewards(ctx context.Context, req *activityv1.ListLevelRewardsRequest) (*activityv1.ListLevelRewardsResponse, error) {
|
|
return c.client.ListLevelRewards(ctx, req)
|
|
}
|