package pluginname import ( "context" "git.optclblast.xyz/draincloud/draincloud-core/internal/common" "github.com/gin-gonic/gin" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) const ( PluginNameResolverName = "plugin_name" ) type PluginNameResolver struct{} func (p *PluginNameResolver) Resolve(ctx context.Context, req *common.Request, rawReq any) error { ginCtx, ok := rawReq.(*gin.Context) if !ok { return status.Errorf(codes.Internal, "invalid request type") } pluginName := ginCtx.Param("plugin_name") if pluginName == "" { return status.Error(codes.InvalidArgument, "plugin name is empty") } req.ResolveValues.Store(PluginNameResolverName, pluginName) return nil } func (p *PluginNameResolver) GetRequiredResolveParams() []string { return nil }