2021-07-14 11:48:20 +03:00
|
|
|
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
2023-03-05 15:03:48 +03:00
|
|
|
// protoc-gen-go-micro version: v3.10.2
|
2021-07-14 11:48:20 +03:00
|
|
|
// source: test.proto
|
|
|
|
|
|
|
|
package pb
|
|
|
|
|
|
|
|
import (
|
|
|
|
context "context"
|
2021-10-27 01:24:35 +03:00
|
|
|
v3 "go.unistack.org/micro-client-http/v3"
|
2023-02-22 00:12:01 +03:00
|
|
|
v31 "go.unistack.org/micro-server-http/v3"
|
2021-10-27 01:24:35 +03:00
|
|
|
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"
|
|
|
|
time "time"
|
2021-07-14 11:48:20 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
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) {
|
2022-03-03 18:01:37 +03:00
|
|
|
errmap := make(map[string]interface{}, 1)
|
|
|
|
errmap["default"] = &Error{}
|
|
|
|
opts = append(opts,
|
|
|
|
v3.ErrorMap(errmap),
|
|
|
|
)
|
2021-07-14 11:48:20 +03:00
|
|
|
opts = append(opts,
|
|
|
|
v3.Method(http.MethodGet),
|
2021-07-16 00:41:10 +03:00
|
|
|
v3.Path("/v1/user/{name}"),
|
2021-07-14 11:48:20 +03:00
|
|
|
)
|
2023-01-07 19:16:48 +03:00
|
|
|
td := time.Duration(5000000000)
|
|
|
|
opts = append(opts, client.WithRequestTimeout(td))
|
2021-07-14 11:48:20 +03:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2021-07-16 00:41:10 +03:00
|
|
|
func (c *testServiceClient) UpdateUser(ctx context.Context, req *UpdateUserReq, opts ...client.CallOption) (*UpdateUserRsp, 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-07-16 00:41:10 +03:00
|
|
|
opts = append(opts,
|
|
|
|
v3.Method(http.MethodPut),
|
|
|
|
v3.Path("/v1/user/{name}"),
|
|
|
|
v3.Body("*"),
|
|
|
|
)
|
2023-01-07 19:16:48 +03:00
|
|
|
td := time.Duration(5000000000)
|
|
|
|
opts = append(opts, client.WithRequestTimeout(td))
|
2021-07-16 00:41:10 +03:00
|
|
|
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) {
|
2022-03-03 18:01:37 +03:00
|
|
|
errmap := make(map[string]interface{}, 1)
|
|
|
|
errmap["default"] = &Error{}
|
|
|
|
opts = append(opts,
|
|
|
|
v3.ErrorMap(errmap),
|
|
|
|
)
|
2021-07-16 00:41:10 +03:00
|
|
|
opts = append(opts,
|
|
|
|
v3.Method(http.MethodDelete),
|
|
|
|
v3.Path("/v1/user/{name}"),
|
|
|
|
)
|
2023-01-07 19:16:48 +03:00
|
|
|
td := time.Duration(5000000000)
|
|
|
|
opts = append(opts, client.WithRequestTimeout(td))
|
2021-07-16 00:41:10 +03:00
|
|
|
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) {
|
2022-03-03 18:01:37 +03:00
|
|
|
errmap := make(map[string]interface{}, 1)
|
|
|
|
errmap["default"] = &Error{}
|
|
|
|
opts = append(opts,
|
|
|
|
v3.ErrorMap(errmap),
|
|
|
|
)
|
2021-07-16 00:41:10 +03:00
|
|
|
opts = append(opts,
|
|
|
|
v3.Method(http.MethodPost),
|
|
|
|
v3.Path("/v1/user/{name}/mail"),
|
|
|
|
v3.Body("*"),
|
|
|
|
)
|
2023-01-07 19:16:48 +03:00
|
|
|
td := time.Duration(5000000000)
|
|
|
|
opts = append(opts, client.WithRequestTimeout(td))
|
2021-07-16 00:41:10 +03:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2021-07-14 11:48:20 +03:00
|
|
|
type testServiceServer struct {
|
|
|
|
TestServiceServer
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *testServiceServer) LookupUser(ctx context.Context, req *LookupUserReq, rsp *LookupUserRsp) error {
|
|
|
|
var cancel context.CancelFunc
|
2023-01-07 19:16:48 +03:00
|
|
|
td := time.Duration(5000000000)
|
|
|
|
ctx, cancel = context.WithTimeout(ctx, td)
|
2021-07-14 11:48:20 +03:00
|
|
|
defer cancel()
|
|
|
|
return h.TestServiceServer.LookupUser(ctx, req, rsp)
|
|
|
|
}
|
|
|
|
|
2021-07-16 00:41:10 +03:00
|
|
|
func (h *testServiceServer) UpdateUser(ctx context.Context, req *UpdateUserReq, rsp *UpdateUserRsp) error {
|
|
|
|
var cancel context.CancelFunc
|
2023-01-07 19:16:48 +03:00
|
|
|
td := time.Duration(5000000000)
|
|
|
|
ctx, cancel = context.WithTimeout(ctx, td)
|
2021-07-16 00:41:10 +03:00
|
|
|
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
|
2023-01-07 19:16:48 +03:00
|
|
|
td := time.Duration(5000000000)
|
|
|
|
ctx, cancel = context.WithTimeout(ctx, td)
|
2021-07-16 00:41:10 +03:00
|
|
|
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
|
2023-01-07 19:16:48 +03:00
|
|
|
td := time.Duration(5000000000)
|
|
|
|
ctx, cancel = context.WithTimeout(ctx, td)
|
2021-07-16 00:41:10 +03:00
|
|
|
defer cancel()
|
|
|
|
return h.TestServiceServer.MailUser(ctx, req, rsp)
|
|
|
|
}
|
|
|
|
|
2021-07-14 11:48:20 +03:00
|
|
|
func RegisterTestServiceServer(s server.Server, sh TestServiceServer, opts ...server.HandlerOption) error {
|
|
|
|
type testService interface {
|
|
|
|
LookupUser(ctx context.Context, req *LookupUserReq, rsp *LookupUserRsp) error
|
2021-07-16 00:41:10 +03:00
|
|
|
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
|
2021-07-14 11:48:20 +03:00
|
|
|
}
|
|
|
|
type TestService struct {
|
|
|
|
testService
|
|
|
|
}
|
|
|
|
h := &testServiceServer{sh}
|
|
|
|
var nopts []server.HandlerOption
|
2023-02-22 00:12:01 +03:00
|
|
|
nopts = append(nopts, v31.HandlerEndpoints(TestServiceServerEndpoints))
|
2021-07-14 11:48:20 +03:00
|
|
|
return s.Handle(s.NewHandler(&TestService{h}, append(nopts, opts...)...))
|
|
|
|
}
|