Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-12-11 02:00:29 +03:00
parent e7e1ff15f4
commit 1aa324c17f
63 changed files with 2488 additions and 1165 deletions

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.21.12
// protoc v5.28.3
// source: github.proto
package pb

View File

@@ -1,38 +1,19 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.10.2
// - protoc v3.21.12
// - protoc-gen-go-micro v3.10.4
// - protoc v5.28.3
// source: github.proto
package pb
import (
context "context"
v3 "go.unistack.org/micro-server-http/v3"
client "go.unistack.org/micro/v3/client"
)
var (
GithubName = "Github"
)
var (
GithubServerEndpoints = []v3.EndpointMetadata{
{
Name: "Github.LookupUser",
Path: "/users/{username}",
Method: "GET",
Body: "",
Stream: false,
},
{
Name: "Github.LookupUserWithoutPath",
Path: "/{username}",
Method: "GET",
Body: "",
Stream: false,
},
}
)
type GithubClient interface {
LookupUser(ctx context.Context, req *LookupUserReq, opts ...client.CallOption) (*LookupUserRsp, error)

View File

@@ -1,18 +1,37 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.2
// protoc-gen-go-micro version: v3.10.4
// source: github.proto
package pb
import (
context "context"
v3 "go.unistack.org/micro-client-http/v3"
v31 "go.unistack.org/micro-server-http/v3"
v31 "go.unistack.org/micro-client-http/v3"
v3 "go.unistack.org/micro-server-http/v3"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
http "net/http"
)
var (
GithubServerEndpoints = []v3.EndpointMetadata{
{
Name: "Github.LookupUser",
Path: "/users/{username}",
Method: "GET",
Body: "",
Stream: false,
},
{
Name: "Github.LookupUserWithoutPath",
Path: "/{username}",
Method: "GET",
Body: "",
Stream: false,
},
}
)
type githubClient struct {
c client.Client
name string
@@ -26,11 +45,11 @@ func (c *githubClient) LookupUser(ctx context.Context, req *LookupUserReq, opts
errmap := make(map[string]interface{}, 1)
errmap["default"] = &Error{}
opts = append(opts,
v3.ErrorMap(errmap),
v31.ErrorMap(errmap),
)
opts = append(opts,
v3.Method(http.MethodGet),
v3.Path("/users/{username}"),
v31.Method(http.MethodGet),
v31.Path("/users/{username}"),
)
rsp := &LookupUserRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Github.LookupUser", req), rsp, opts...)
@@ -44,11 +63,11 @@ func (c *githubClient) LookupUserWithoutPath(ctx context.Context, req *LookupUse
errmap := make(map[string]interface{}, 1)
errmap["default"] = &Error{}
opts = append(opts,
v3.ErrorMap(errmap),
v31.ErrorMap(errmap),
)
opts = append(opts,
v3.Method(http.MethodGet),
v3.Path("/{username}"),
v31.Method(http.MethodGet),
v31.Path("/{username}"),
)
rsp := &LookupUserRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Github.LookupUserWithoutPath", req), rsp, opts...)
@@ -80,6 +99,6 @@ func RegisterGithubServer(s server.Server, sh GithubServer, opts ...server.Handl
}
h := &githubServer{sh}
var nopts []server.HandlerOption
nopts = append(nopts, v31.HandlerEndpoints(GithubServerEndpoints))
nopts = append(nopts, v3.HandlerEndpoints(GithubServerEndpoints))
return s.Handle(s.NewHandler(&Github{h}, append(nopts, opts...)...))
}

View File

@@ -0,0 +1,17 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.4
package pb
import (
protojson "google.golang.org/protobuf/encoding/protojson"
)
var (
marshaler = protojson.MarshalOptions{}
)
func (m *Error) Error() string {
buf, _ := marshaler.Marshal(m)
return string(buf)
}