// Code generated by protoc-gen-go-micro. DO NOT EDIT. // protoc-gen-go-micro version: v3.10.2 // source: test.proto package pb import ( context "context" v3 "go.unistack.org/micro-client-http/v3" v31 "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" ) 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, v3.ErrorMap(errmap), ) opts = append(opts, v3.Method(http.MethodGet), v3.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, v3.ErrorMap(errmap), ) opts = append(opts, v3.Method(http.MethodPut), v3.Path("/v1/user/{name}"), v3.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, v3.ErrorMap(errmap), ) opts = append(opts, v3.Method(http.MethodDelete), v3.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, v3.ErrorMap(errmap), ) opts = append(opts, v3.Method(http.MethodPost), v3.Path("/v1/user/{name}/mail"), v3.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, v31.HandlerEndpoints(TestServiceServerEndpoints)) return s.Handle(s.NewHandler(&TestService{h}, append(nopts, opts...)...)) }