// Code generated by protoc-gen-micro // source: github.proto package pb import ( context "context" v3 "github.com/unistack-org/micro-client-http/v3" api "github.com/unistack-org/micro/v3/api" client "github.com/unistack-org/micro/v3/client" server "github.com/unistack-org/micro/v3/server" ) type githubClient struct { c client.Client name string } func NewGithubClient(name string, c client.Client) GithubClient { return &githubClient{c: c, name: name} } func (c *githubClient) LookupUser(ctx context.Context, req *LookupUserReq, opts ...client.CallOption) (*LookupUserRsp, error) { errmap := make(map[string]interface{}, 1) errmap["default"] = &Error{} opts = append(opts, v3.ErrorMap(errmap), ) opts = append(opts, v3.Method("GET"), v3.Path("/users/{username}"), v3.Body(""), ) rsp := &LookupUserRsp{} err := c.c.Call(ctx, c.c.NewRequest(c.name, "Github.LookupUser", req), rsp, opts...) if err != nil { return nil, err } return rsp, nil } type githubServer struct { GithubServer } func (h *githubServer) LookupUser(ctx context.Context, req *LookupUserReq, rsp *LookupUserRsp) error { return h.GithubServer.LookupUser(ctx, req, rsp) } func RegisterGithubServer(s server.Server, sh GithubServer, opts ...server.HandlerOption) error { type github interface { LookupUser(ctx context.Context, req *LookupUserReq, rsp *LookupUserRsp) error } type Github struct { github } h := &githubServer{sh} for _, endpoint := range NewGithubEndpoints() { opts = append(opts, api.WithEndpoint(endpoint)) } return s.Handle(s.NewHandler(&Github{h}, opts...)) }