micro-tests/flow/proto/test_micro_http.pb.go
Vasiliy Tolstov 1aa324c17f cleanup
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-12-11 02:00:29 +03:00

192 lines
5.3 KiB
Go

// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.4
// source: test.proto
package pb
import (
context "context"
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"
time "time"
)
var (
TestServiceServerEndpoints = []v3.EndpointMetadata{
{
Name: "TestService.LookupUser",
Path: "/v1/user/{name}",
Method: "GET",
Body: "",
Stream: false,
},
{
Name: "TestService.UpdateUser",
Path: "/v1/user/{name}",
Method: "PUT",
Body: "*",
Stream: false,
},
{
Name: "TestService.DeleteUser",
Path: "/v1/user/{name}",
Method: "DELETE",
Body: "",
Stream: false,
},
{
Name: "TestService.MailUser",
Path: "/v1/user/{name}/mail",
Method: "POST",
Body: "*",
Stream: false,
},
}
)
type testServiceClient struct {
c client.Client
name string
}
func NewTestServiceClient(name string, c client.Client) TestServiceClient {
return &testServiceClient{c: c, name: name}
}
func (c *testServiceClient) LookupUser(ctx context.Context, req *LookupUserReq, opts ...client.CallOption) (*LookupUserRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &Error{}
opts = append(opts,
v31.ErrorMap(errmap),
)
opts = append(opts,
v31.Method(http.MethodGet),
v31.Path("/v1/user/{name}"),
)
td := time.Duration(5000000000)
opts = append(opts, client.WithRequestTimeout(td))
rsp := &LookupUserRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.LookupUser", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *testServiceClient) UpdateUser(ctx context.Context, req *UpdateUserReq, opts ...client.CallOption) (*UpdateUserRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &Error{}
opts = append(opts,
v31.ErrorMap(errmap),
)
opts = append(opts,
v31.Method(http.MethodPut),
v31.Path("/v1/user/{name}"),
v31.Body("*"),
)
td := time.Duration(5000000000)
opts = append(opts, client.WithRequestTimeout(td))
rsp := &UpdateUserRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.UpdateUser", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *testServiceClient) DeleteUser(ctx context.Context, req *DeleteUserReq, opts ...client.CallOption) (*DeleteUserRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &Error{}
opts = append(opts,
v31.ErrorMap(errmap),
)
opts = append(opts,
v31.Method(http.MethodDelete),
v31.Path("/v1/user/{name}"),
)
td := time.Duration(5000000000)
opts = append(opts, client.WithRequestTimeout(td))
rsp := &DeleteUserRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.DeleteUser", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *testServiceClient) MailUser(ctx context.Context, req *MailUserReq, opts ...client.CallOption) (*MailUserRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &Error{}
opts = append(opts,
v31.ErrorMap(errmap),
)
opts = append(opts,
v31.Method(http.MethodPost),
v31.Path("/v1/user/{name}/mail"),
v31.Body("*"),
)
td := time.Duration(5000000000)
opts = append(opts, client.WithRequestTimeout(td))
rsp := &MailUserRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.MailUser", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
type testServiceServer struct {
TestServiceServer
}
func (h *testServiceServer) LookupUser(ctx context.Context, req *LookupUserReq, rsp *LookupUserRsp) error {
var cancel context.CancelFunc
td := time.Duration(5000000000)
ctx, cancel = context.WithTimeout(ctx, td)
defer cancel()
return h.TestServiceServer.LookupUser(ctx, req, rsp)
}
func (h *testServiceServer) UpdateUser(ctx context.Context, req *UpdateUserReq, rsp *UpdateUserRsp) error {
var cancel context.CancelFunc
td := time.Duration(5000000000)
ctx, cancel = context.WithTimeout(ctx, td)
defer cancel()
return h.TestServiceServer.UpdateUser(ctx, req, rsp)
}
func (h *testServiceServer) DeleteUser(ctx context.Context, req *DeleteUserReq, rsp *DeleteUserRsp) error {
var cancel context.CancelFunc
td := time.Duration(5000000000)
ctx, cancel = context.WithTimeout(ctx, td)
defer cancel()
return h.TestServiceServer.DeleteUser(ctx, req, rsp)
}
func (h *testServiceServer) MailUser(ctx context.Context, req *MailUserReq, rsp *MailUserRsp) error {
var cancel context.CancelFunc
td := time.Duration(5000000000)
ctx, cancel = context.WithTimeout(ctx, td)
defer cancel()
return h.TestServiceServer.MailUser(ctx, req, rsp)
}
func RegisterTestServiceServer(s server.Server, sh TestServiceServer, opts ...server.HandlerOption) error {
type testService interface {
LookupUser(ctx context.Context, req *LookupUserReq, rsp *LookupUserRsp) error
UpdateUser(ctx context.Context, req *UpdateUserReq, rsp *UpdateUserRsp) error
DeleteUser(ctx context.Context, req *DeleteUserReq, rsp *DeleteUserRsp) error
MailUser(ctx context.Context, req *MailUserReq, rsp *MailUserRsp) error
}
type TestService struct {
testService
}
h := &testServiceServer{sh}
var nopts []server.HandlerOption
nopts = append(nopts, v3.HandlerEndpoints(TestServiceServerEndpoints))
return s.Handle(s.NewHandler(&TestService{h}, append(nopts, opts...)...))
}