// Code generated by protoc-gen-go-micro. DO NOT EDIT. // protoc-gen-go-micro version: v3.10.4 // source: service.proto package servicepb import ( context "context" v41 "go.unistack.org/micro-client-http/v4" proto "go.unistack.org/micro-config-service/v4/proto" v4 "go.unistack.org/micro-server-http/v4" client "go.unistack.org/micro/v4/client" server "go.unistack.org/micro/v4/server" http "net/http" ) var ( ConfigServerEndpoints = []v4.EndpointMetadata{ { Name: "Config.Load", Path: "/load", Method: "GET", Body: "", Stream: false, }, { Name: "Config.Save", Path: "/save", Method: "POST", Body: "*", Stream: false, }, } ) type configClient struct { c client.Client name string } func NewConfigClient(name string, c client.Client) proto.ConfigClient { return &configClient{c: c, name: name} } func (c *configClient) Load(ctx context.Context, req *proto.LoadRequest, opts ...client.CallOption) (*proto.LoadResponse, error) { errmap := make(map[string]interface{}, 1) errmap["default"] = &proto.Error{} opts = append(opts, v41.ErrorMap(errmap), ) opts = append(opts, v41.Method(http.MethodGet), v41.Path("/load"), ) rsp := &proto.LoadResponse{} err := c.c.Call(ctx, c.c.NewRequest(c.name, "Config.Load", req), rsp, opts...) if err != nil { return nil, err } return rsp, nil } func (c *configClient) Save(ctx context.Context, req *proto.SaveRequest, opts ...client.CallOption) (*proto.SaveResponse, error) { errmap := make(map[string]interface{}, 1) errmap["default"] = &proto.Error{} opts = append(opts, v41.ErrorMap(errmap), ) opts = append(opts, v41.Method(http.MethodPost), v41.Path("/save"), v41.Body("*"), ) rsp := &proto.SaveResponse{} err := c.c.Call(ctx, c.c.NewRequest(c.name, "Config.Save", req), rsp, opts...) if err != nil { return nil, err } return rsp, nil } type configServer struct { proto.ConfigServer } func (h *configServer) Load(ctx context.Context, req *proto.LoadRequest, rsp *proto.LoadResponse) error { return h.ConfigServer.Load(ctx, req, rsp) } func (h *configServer) Save(ctx context.Context, req *proto.SaveRequest, rsp *proto.SaveResponse) error { return h.ConfigServer.Save(ctx, req, rsp) } func RegisterConfigServer(s server.Server, sh proto.ConfigServer, opts ...server.HandlerOption) error { type config interface { Load(ctx context.Context, req *proto.LoadRequest, rsp *proto.LoadResponse) error Save(ctx context.Context, req *proto.SaveRequest, rsp *proto.SaveResponse) error } type Config struct { config } h := &configServer{sh} opts = append(opts, v4.HandlerEndpoints(ConfigServerEndpoints)) return s.Handle(s.NewHandler(&Config{h}, opts...)) }