2021-06-30 17:53:06 +03:00
|
|
|
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
2021-10-27 01:24:35 +03:00
|
|
|
// protoc-gen-go-micro version: v3.5.3
|
2021-01-19 04:15:57 +03:00
|
|
|
// source: github.proto
|
2021-06-30 17:53:06 +03:00
|
|
|
|
2021-01-19 04:15:57 +03:00
|
|
|
package pb
|
|
|
|
|
|
|
|
import (
|
2021-02-27 13:51:39 +03:00
|
|
|
context "context"
|
2021-10-27 01:24:35 +03:00
|
|
|
v3 "go.unistack.org/micro-client-http/v3"
|
|
|
|
api "go.unistack.org/micro/v3/api"
|
|
|
|
client "go.unistack.org/micro/v3/client"
|
|
|
|
server "go.unistack.org/micro/v3/server"
|
2022-03-03 18:01:37 +03:00
|
|
|
http "net/http"
|
2021-01-19 04:15:57 +03:00
|
|
|
)
|
|
|
|
|
2021-02-27 13:51:39 +03:00
|
|
|
type githubClient struct {
|
|
|
|
c client.Client
|
2021-01-19 04:15:57 +03:00
|
|
|
name string
|
|
|
|
}
|
|
|
|
|
2021-02-27 13:51:39 +03:00
|
|
|
func NewGithubClient(name string, c client.Client) GithubClient {
|
|
|
|
return &githubClient{c: c, name: name}
|
2021-01-19 04:15:57 +03:00
|
|
|
}
|
|
|
|
|
2021-02-27 13:51:39 +03:00
|
|
|
func (c *githubClient) LookupUser(ctx context.Context, req *LookupUserReq, opts ...client.CallOption) (*LookupUserRsp, error) {
|
2022-03-03 18:01:37 +03:00
|
|
|
errmap := make(map[string]interface{}, 1)
|
|
|
|
errmap["default"] = &Error{}
|
|
|
|
opts = append(opts,
|
|
|
|
v3.ErrorMap(errmap),
|
|
|
|
)
|
2021-03-22 00:10:15 +03:00
|
|
|
opts = append(opts,
|
2021-03-30 18:34:04 +03:00
|
|
|
v3.Method(http.MethodGet),
|
2021-02-27 13:51:39 +03:00
|
|
|
v3.Path("/users/{username}"),
|
2021-01-19 04:15:57 +03:00
|
|
|
)
|
|
|
|
rsp := &LookupUserRsp{}
|
2021-02-27 13:51:39 +03:00
|
|
|
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Github.LookupUser", req), rsp, opts...)
|
2021-01-19 04:15:57 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return rsp, nil
|
|
|
|
}
|
|
|
|
|
2021-03-30 18:34:04 +03:00
|
|
|
func (c *githubClient) LookupUserWithoutPath(ctx context.Context, req *LookupUserReq, opts ...client.CallOption) (*LookupUserRsp, error) {
|
2022-03-03 18:01:37 +03:00
|
|
|
errmap := make(map[string]interface{}, 1)
|
|
|
|
errmap["default"] = &Error{}
|
|
|
|
opts = append(opts,
|
|
|
|
v3.ErrorMap(errmap),
|
|
|
|
)
|
2021-03-30 18:34:04 +03:00
|
|
|
opts = append(opts,
|
|
|
|
v3.Method(http.MethodGet),
|
|
|
|
v3.Path("/{username}"),
|
|
|
|
)
|
|
|
|
rsp := &LookupUserRsp{}
|
|
|
|
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Github.LookupUserWithoutPath", req), rsp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return rsp, nil
|
|
|
|
}
|
|
|
|
|
2021-02-27 13:51:39 +03:00
|
|
|
type githubServer struct {
|
|
|
|
GithubServer
|
2021-01-19 04:15:57 +03:00
|
|
|
}
|
|
|
|
|
2021-02-27 13:51:39 +03:00
|
|
|
func (h *githubServer) LookupUser(ctx context.Context, req *LookupUserReq, rsp *LookupUserRsp) error {
|
|
|
|
return h.GithubServer.LookupUser(ctx, req, rsp)
|
2021-01-19 04:15:57 +03:00
|
|
|
}
|
|
|
|
|
2021-03-30 18:34:04 +03:00
|
|
|
func (h *githubServer) LookupUserWithoutPath(ctx context.Context, req *LookupUserReq, rsp *LookupUserRsp) error {
|
|
|
|
return h.GithubServer.LookupUserWithoutPath(ctx, req, rsp)
|
|
|
|
}
|
|
|
|
|
2021-02-27 13:51:39 +03:00
|
|
|
func RegisterGithubServer(s server.Server, sh GithubServer, opts ...server.HandlerOption) error {
|
|
|
|
type github interface {
|
|
|
|
LookupUser(ctx context.Context, req *LookupUserReq, rsp *LookupUserRsp) error
|
2021-03-30 18:34:04 +03:00
|
|
|
LookupUserWithoutPath(ctx context.Context, req *LookupUserReq, rsp *LookupUserRsp) error
|
2021-02-27 13:51:39 +03:00
|
|
|
}
|
|
|
|
type Github struct {
|
|
|
|
github
|
|
|
|
}
|
|
|
|
h := &githubServer{sh}
|
2021-03-30 18:34:04 +03:00
|
|
|
var nopts []server.HandlerOption
|
2021-06-30 17:53:06 +03:00
|
|
|
for _, endpoint := range GithubEndpoints {
|
|
|
|
nopts = append(nopts, api.WithEndpoint(&endpoint))
|
2021-02-27 13:51:39 +03:00
|
|
|
}
|
2021-03-30 18:34:04 +03:00
|
|
|
return s.Handle(s.NewHandler(&Github{h}, append(nopts, opts...)...))
|
2021-01-19 04:15:57 +03:00
|
|
|
}
|