trpc.group/trpc-go/trpc-go@v1.0.3/testdata/restful/bookstore/bookstore.trpc.go (about)

     1  //
     2  //
     3  // Tencent is pleased to support the open source community by making tRPC available.
     4  //
     5  // Copyright (C) 2023 THL A29 Limited, a Tencent company.
     6  // All rights reserved.
     7  //
     8  // If you have downloaded a copy of the tRPC source code from Tencent,
     9  // please note that tRPC source code is licensed under the  Apache 2.0 License,
    10  // A copy of the Apache 2.0 License is included in this file.
    11  //
    12  //
    13  
    14  // Code generated by trpc-go/trpc-cmdline v2.0.13. DO NOT EDIT.
    15  // source: bookstore.proto
    16  
    17  package bookstore
    18  
    19  import (
    20  	"context"
    21  	"fmt"
    22  
    23  	emptypb "google.golang.org/protobuf/types/known/emptypb"
    24  	_ "trpc.group/trpc-go/trpc-go"
    25  	"trpc.group/trpc-go/trpc-go/client"
    26  	"trpc.group/trpc-go/trpc-go/codec"
    27  	_ "trpc.group/trpc-go/trpc-go/http"
    28  	"trpc.group/trpc-go/trpc-go/restful"
    29  	"trpc.group/trpc-go/trpc-go/server"
    30  )
    31  
    32  /* ************************************ Service Definition ************************************ */
    33  
    34  // BookstoreService defines service
    35  type BookstoreService interface {
    36  
    37  	// ListShelves 获取所有的书柜
    38  	ListShelves(ctx context.Context, req *emptypb.Empty) (*ListShelvesResponse, error)
    39  	// CreateShelf 创建一个书柜
    40  	CreateShelf(ctx context.Context, req *CreateShelfRequest) (*Shelf, error)
    41  	// GetShelf 获取一个书柜
    42  	GetShelf(ctx context.Context, req *GetShelfRequest) (*Shelf, error)
    43  	// DeleteShelf 删除一个书柜
    44  	DeleteShelf(ctx context.Context, req *DeleteShelfRequest) (*emptypb.Empty, error)
    45  	// ListBooks 获取所有的书
    46  	ListBooks(ctx context.Context, req *ListBooksRequest) (*ListBooksResponse, error)
    47  	// CreateBook 创建一本书
    48  	CreateBook(ctx context.Context, req *CreateBookRequest) (*Book, error)
    49  	// GetBook 获取一本书
    50  	GetBook(ctx context.Context, req *GetBookRequest) (*Book, error)
    51  	// DeleteBook 删除一本书
    52  	DeleteBook(ctx context.Context, req *DeleteBookRequest) (*emptypb.Empty, error)
    53  	// UpdateBook 更新一本书
    54  	UpdateBook(ctx context.Context, req *UpdateBookRequest) (*Book, error)
    55  
    56  	UpdateBooks(ctx context.Context, req *UpdateBooksRequest) (*ListBooksResponse, error)
    57  }
    58  
    59  func BookstoreService_ListShelves_Handler(svr interface{}, ctx context.Context, f server.FilterFunc) (interface{}, error) {
    60  	req := &emptypb.Empty{}
    61  	filters, err := f(req)
    62  	if err != nil {
    63  		return nil, err
    64  	}
    65  	handleFunc := func(ctx context.Context, reqBody interface{}) (interface{}, error) {
    66  		return svr.(BookstoreService).ListShelves(ctx, reqBody.(*emptypb.Empty))
    67  	}
    68  
    69  	var rsp interface{}
    70  	rsp, err = filters.Filter(ctx, req, handleFunc)
    71  	if err != nil {
    72  		return nil, err
    73  	}
    74  	return rsp, nil
    75  }
    76  
    77  func BookstoreService_CreateShelf_Handler(svr interface{}, ctx context.Context, f server.FilterFunc) (interface{}, error) {
    78  	req := &CreateShelfRequest{}
    79  	filters, err := f(req)
    80  	if err != nil {
    81  		return nil, err
    82  	}
    83  	handleFunc := func(ctx context.Context, reqBody interface{}) (interface{}, error) {
    84  		return svr.(BookstoreService).CreateShelf(ctx, reqBody.(*CreateShelfRequest))
    85  	}
    86  
    87  	var rsp interface{}
    88  	rsp, err = filters.Filter(ctx, req, handleFunc)
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	return rsp, nil
    93  }
    94  
    95  func BookstoreService_GetShelf_Handler(svr interface{}, ctx context.Context, f server.FilterFunc) (interface{}, error) {
    96  	req := &GetShelfRequest{}
    97  	filters, err := f(req)
    98  	if err != nil {
    99  		return nil, err
   100  	}
   101  	handleFunc := func(ctx context.Context, reqBody interface{}) (interface{}, error) {
   102  		return svr.(BookstoreService).GetShelf(ctx, reqBody.(*GetShelfRequest))
   103  	}
   104  
   105  	var rsp interface{}
   106  	rsp, err = filters.Filter(ctx, req, handleFunc)
   107  	if err != nil {
   108  		return nil, err
   109  	}
   110  	return rsp, nil
   111  }
   112  
   113  func BookstoreService_DeleteShelf_Handler(svr interface{}, ctx context.Context, f server.FilterFunc) (interface{}, error) {
   114  	req := &DeleteShelfRequest{}
   115  	filters, err := f(req)
   116  	if err != nil {
   117  		return nil, err
   118  	}
   119  	handleFunc := func(ctx context.Context, reqBody interface{}) (interface{}, error) {
   120  		return svr.(BookstoreService).DeleteShelf(ctx, reqBody.(*DeleteShelfRequest))
   121  	}
   122  
   123  	var rsp interface{}
   124  	rsp, err = filters.Filter(ctx, req, handleFunc)
   125  	if err != nil {
   126  		return nil, err
   127  	}
   128  	return rsp, nil
   129  }
   130  
   131  func BookstoreService_ListBooks_Handler(svr interface{}, ctx context.Context, f server.FilterFunc) (interface{}, error) {
   132  	req := &ListBooksRequest{}
   133  	filters, err := f(req)
   134  	if err != nil {
   135  		return nil, err
   136  	}
   137  	handleFunc := func(ctx context.Context, reqBody interface{}) (interface{}, error) {
   138  		return svr.(BookstoreService).ListBooks(ctx, reqBody.(*ListBooksRequest))
   139  	}
   140  
   141  	var rsp interface{}
   142  	rsp, err = filters.Filter(ctx, req, handleFunc)
   143  	if err != nil {
   144  		return nil, err
   145  	}
   146  	return rsp, nil
   147  }
   148  
   149  func BookstoreService_CreateBook_Handler(svr interface{}, ctx context.Context, f server.FilterFunc) (interface{}, error) {
   150  	req := &CreateBookRequest{}
   151  	filters, err := f(req)
   152  	if err != nil {
   153  		return nil, err
   154  	}
   155  	handleFunc := func(ctx context.Context, reqBody interface{}) (interface{}, error) {
   156  		return svr.(BookstoreService).CreateBook(ctx, reqBody.(*CreateBookRequest))
   157  	}
   158  
   159  	var rsp interface{}
   160  	rsp, err = filters.Filter(ctx, req, handleFunc)
   161  	if err != nil {
   162  		return nil, err
   163  	}
   164  	return rsp, nil
   165  }
   166  
   167  func BookstoreService_GetBook_Handler(svr interface{}, ctx context.Context, f server.FilterFunc) (interface{}, error) {
   168  	req := &GetBookRequest{}
   169  	filters, err := f(req)
   170  	if err != nil {
   171  		return nil, err
   172  	}
   173  	handleFunc := func(ctx context.Context, reqBody interface{}) (interface{}, error) {
   174  		return svr.(BookstoreService).GetBook(ctx, reqBody.(*GetBookRequest))
   175  	}
   176  
   177  	var rsp interface{}
   178  	rsp, err = filters.Filter(ctx, req, handleFunc)
   179  	if err != nil {
   180  		return nil, err
   181  	}
   182  	return rsp, nil
   183  }
   184  
   185  func BookstoreService_DeleteBook_Handler(svr interface{}, ctx context.Context, f server.FilterFunc) (interface{}, error) {
   186  	req := &DeleteBookRequest{}
   187  	filters, err := f(req)
   188  	if err != nil {
   189  		return nil, err
   190  	}
   191  	handleFunc := func(ctx context.Context, reqBody interface{}) (interface{}, error) {
   192  		return svr.(BookstoreService).DeleteBook(ctx, reqBody.(*DeleteBookRequest))
   193  	}
   194  
   195  	var rsp interface{}
   196  	rsp, err = filters.Filter(ctx, req, handleFunc)
   197  	if err != nil {
   198  		return nil, err
   199  	}
   200  	return rsp, nil
   201  }
   202  
   203  func BookstoreService_UpdateBook_Handler(svr interface{}, ctx context.Context, f server.FilterFunc) (interface{}, error) {
   204  	req := &UpdateBookRequest{}
   205  	filters, err := f(req)
   206  	if err != nil {
   207  		return nil, err
   208  	}
   209  	handleFunc := func(ctx context.Context, reqBody interface{}) (interface{}, error) {
   210  		return svr.(BookstoreService).UpdateBook(ctx, reqBody.(*UpdateBookRequest))
   211  	}
   212  
   213  	var rsp interface{}
   214  	rsp, err = filters.Filter(ctx, req, handleFunc)
   215  	if err != nil {
   216  		return nil, err
   217  	}
   218  	return rsp, nil
   219  }
   220  
   221  func BookstoreService_UpdateBooks_Handler(svr interface{}, ctx context.Context, f server.FilterFunc) (interface{}, error) {
   222  	req := &UpdateBooksRequest{}
   223  	filters, err := f(req)
   224  	if err != nil {
   225  		return nil, err
   226  	}
   227  	handleFunc := func(ctx context.Context, reqBody interface{}) (interface{}, error) {
   228  		return svr.(BookstoreService).UpdateBooks(ctx, reqBody.(*UpdateBooksRequest))
   229  	}
   230  
   231  	var rsp interface{}
   232  	rsp, err = filters.Filter(ctx, req, handleFunc)
   233  	if err != nil {
   234  		return nil, err
   235  	}
   236  	return rsp, nil
   237  }
   238  
   239  // responseBodyBookstoreServiceListShelvesRESTfulPath0 GET: /shelves
   240  type responseBodyBookstoreServiceListShelvesRESTfulPath0 struct{}
   241  
   242  func (responseBodyBookstoreServiceListShelvesRESTfulPath0) Locate(message restful.ProtoMessage) interface{} {
   243  	x := message.(*ListShelvesResponse)
   244  	return &x.Shelves
   245  }
   246  
   247  func (responseBodyBookstoreServiceListShelvesRESTfulPath0) ResponseBody() string {
   248  	return "shelves"
   249  }
   250  
   251  // requestBodyBookstoreServiceCreateShelfRESTfulPath0 POST: /shelf
   252  type requestBodyBookstoreServiceCreateShelfRESTfulPath0 struct{}
   253  
   254  func (requestBodyBookstoreServiceCreateShelfRESTfulPath0) Locate(message restful.ProtoMessage) interface{} {
   255  	x := message.(*CreateShelfRequest)
   256  	return x
   257  }
   258  
   259  func (requestBodyBookstoreServiceCreateShelfRESTfulPath0) Body() string {
   260  	return "*"
   261  }
   262  
   263  // requestBodyBookstoreServiceCreateBookRESTfulPath0 POST: /book/shelf/{shelf}
   264  type requestBodyBookstoreServiceCreateBookRESTfulPath0 struct{}
   265  
   266  func (requestBodyBookstoreServiceCreateBookRESTfulPath0) Locate(message restful.ProtoMessage) interface{} {
   267  	x := message.(*CreateBookRequest)
   268  	return &x.Book
   269  }
   270  
   271  func (requestBodyBookstoreServiceCreateBookRESTfulPath0) Body() string {
   272  	return "book"
   273  }
   274  
   275  // requestBodyBookstoreServiceUpdateBookRESTfulPath0 PATCH: /book/shelfid/{shelf}/bookid/{book.id}
   276  type requestBodyBookstoreServiceUpdateBookRESTfulPath0 struct{}
   277  
   278  func (requestBodyBookstoreServiceUpdateBookRESTfulPath0) Locate(message restful.ProtoMessage) interface{} {
   279  	x := message.(*UpdateBookRequest)
   280  	return &x.Book
   281  }
   282  
   283  func (requestBodyBookstoreServiceUpdateBookRESTfulPath0) Body() string {
   284  	return "book"
   285  }
   286  
   287  // requestBodyBookstoreServiceUpdateBooksRESTfulPath0 PATCH: /book/shelfid/{shelf}
   288  type requestBodyBookstoreServiceUpdateBooksRESTfulPath0 struct{}
   289  
   290  func (requestBodyBookstoreServiceUpdateBooksRESTfulPath0) Locate(message restful.ProtoMessage) interface{} {
   291  	x := message.(*UpdateBooksRequest)
   292  	return &x.Books
   293  }
   294  
   295  func (requestBodyBookstoreServiceUpdateBooksRESTfulPath0) Body() string {
   296  	return "books"
   297  }
   298  
   299  // BookstoreServer_ServiceDesc descriptor for server.RegisterService
   300  var BookstoreServer_ServiceDesc = server.ServiceDesc{
   301  	ServiceName: "trpc.examples.restful.bookstore.Bookstore",
   302  	HandlerType: ((*BookstoreService)(nil)),
   303  	Methods: []server.Method{
   304  		{
   305  			Name: "/trpc.examples.restful.bookstore.Bookstore/ListShelves",
   306  			Func: BookstoreService_ListShelves_Handler,
   307  			Bindings: []*restful.Binding{{
   308  				Name:  "/trpc.examples.restful.bookstore.Bookstore/ListShelves",
   309  				Input: func() restful.ProtoMessage { return new(emptypb.Empty) },
   310  				Filter: func(svc interface{}, ctx context.Context, reqBody interface{}) (interface{}, error) {
   311  					return svc.(BookstoreService).ListShelves(ctx, reqBody.(*emptypb.Empty))
   312  				},
   313  				HTTPMethod:   "GET",
   314  				Pattern:      restful.Enforce("/shelves"),
   315  				Body:         nil,
   316  				ResponseBody: responseBodyBookstoreServiceListShelvesRESTfulPath0{},
   317  			}},
   318  		},
   319  		{
   320  			Name: "/trpc.examples.restful.bookstore.Bookstore/CreateShelf",
   321  			Func: BookstoreService_CreateShelf_Handler,
   322  			Bindings: []*restful.Binding{{
   323  				Name:  "/trpc.examples.restful.bookstore.Bookstore/CreateShelf",
   324  				Input: func() restful.ProtoMessage { return new(CreateShelfRequest) },
   325  				Filter: func(svc interface{}, ctx context.Context, reqBody interface{}) (interface{}, error) {
   326  					return svc.(BookstoreService).CreateShelf(ctx, reqBody.(*CreateShelfRequest))
   327  				},
   328  				HTTPMethod:   "POST",
   329  				Pattern:      restful.Enforce("/shelf"),
   330  				Body:         requestBodyBookstoreServiceCreateShelfRESTfulPath0{},
   331  				ResponseBody: nil,
   332  			}, {
   333  				Name:  "/trpc.examples.restful.bookstore.Bookstore/CreateShelf",
   334  				Input: func() restful.ProtoMessage { return new(CreateShelfRequest) },
   335  				Filter: func(svc interface{}, ctx context.Context, reqBody interface{}) (interface{}, error) {
   336  					return svc.(BookstoreService).CreateShelf(ctx, reqBody.(*CreateShelfRequest))
   337  				},
   338  				HTTPMethod:   "POST",
   339  				Pattern:      restful.Enforce("/shelf/theme/{shelf.theme}"),
   340  				Body:         nil,
   341  				ResponseBody: nil,
   342  			}},
   343  		},
   344  		{
   345  			Name: "/trpc.examples.restful.bookstore.Bookstore/GetShelf",
   346  			Func: BookstoreService_GetShelf_Handler,
   347  			Bindings: []*restful.Binding{{
   348  				Name:  "/trpc.examples.restful.bookstore.Bookstore/GetShelf",
   349  				Input: func() restful.ProtoMessage { return new(GetShelfRequest) },
   350  				Filter: func(svc interface{}, ctx context.Context, reqBody interface{}) (interface{}, error) {
   351  					return svc.(BookstoreService).GetShelf(ctx, reqBody.(*GetShelfRequest))
   352  				},
   353  				HTTPMethod:   "GET",
   354  				Pattern:      restful.Enforce("/shelf/{shelf}"),
   355  				Body:         nil,
   356  				ResponseBody: nil,
   357  			}},
   358  		},
   359  		{
   360  			Name: "/trpc.examples.restful.bookstore.Bookstore/DeleteShelf",
   361  			Func: BookstoreService_DeleteShelf_Handler,
   362  			Bindings: []*restful.Binding{{
   363  				Name:  "/trpc.examples.restful.bookstore.Bookstore/DeleteShelf",
   364  				Input: func() restful.ProtoMessage { return new(DeleteShelfRequest) },
   365  				Filter: func(svc interface{}, ctx context.Context, reqBody interface{}) (interface{}, error) {
   366  					return svc.(BookstoreService).DeleteShelf(ctx, reqBody.(*DeleteShelfRequest))
   367  				},
   368  				HTTPMethod:   "DELETE",
   369  				Pattern:      restful.Enforce("/shelf/{shelf}"),
   370  				Body:         nil,
   371  				ResponseBody: nil,
   372  			}},
   373  		},
   374  		{
   375  			Name: "/trpc.examples.restful.bookstore.Bookstore/ListBooks",
   376  			Func: BookstoreService_ListBooks_Handler,
   377  			Bindings: []*restful.Binding{{
   378  				Name:  "/trpc.examples.restful.bookstore.Bookstore/ListBooks",
   379  				Input: func() restful.ProtoMessage { return new(ListBooksRequest) },
   380  				Filter: func(svc interface{}, ctx context.Context, reqBody interface{}) (interface{}, error) {
   381  					return svc.(BookstoreService).ListBooks(ctx, reqBody.(*ListBooksRequest))
   382  				},
   383  				HTTPMethod:   "GET",
   384  				Pattern:      restful.Enforce("/books/shelf/{shelf}"),
   385  				Body:         nil,
   386  				ResponseBody: nil,
   387  			}},
   388  		},
   389  		{
   390  			Name: "/trpc.examples.restful.bookstore.Bookstore/CreateBook",
   391  			Func: BookstoreService_CreateBook_Handler,
   392  			Bindings: []*restful.Binding{{
   393  				Name:  "/trpc.examples.restful.bookstore.Bookstore/CreateBook",
   394  				Input: func() restful.ProtoMessage { return new(CreateBookRequest) },
   395  				Filter: func(svc interface{}, ctx context.Context, reqBody interface{}) (interface{}, error) {
   396  					return svc.(BookstoreService).CreateBook(ctx, reqBody.(*CreateBookRequest))
   397  				},
   398  				HTTPMethod:   "POST",
   399  				Pattern:      restful.Enforce("/book/shelf/{shelf}"),
   400  				Body:         requestBodyBookstoreServiceCreateBookRESTfulPath0{},
   401  				ResponseBody: nil,
   402  			}},
   403  		},
   404  		{
   405  			Name: "/trpc.examples.restful.bookstore.Bookstore/GetBook",
   406  			Func: BookstoreService_GetBook_Handler,
   407  			Bindings: []*restful.Binding{{
   408  				Name:  "/trpc.examples.restful.bookstore.Bookstore/GetBook",
   409  				Input: func() restful.ProtoMessage { return new(GetBookRequest) },
   410  				Filter: func(svc interface{}, ctx context.Context, reqBody interface{}) (interface{}, error) {
   411  					return svc.(BookstoreService).GetBook(ctx, reqBody.(*GetBookRequest))
   412  				},
   413  				HTTPMethod:   "GET",
   414  				Pattern:      restful.Enforce("/book/shelfid/{shelf}/bookid/{book}"),
   415  				Body:         nil,
   416  				ResponseBody: nil,
   417  			}},
   418  		},
   419  		{
   420  			Name: "/trpc.examples.restful.bookstore.Bookstore/DeleteBook",
   421  			Func: BookstoreService_DeleteBook_Handler,
   422  			Bindings: []*restful.Binding{{
   423  				Name:  "/trpc.examples.restful.bookstore.Bookstore/DeleteBook",
   424  				Input: func() restful.ProtoMessage { return new(DeleteBookRequest) },
   425  				Filter: func(svc interface{}, ctx context.Context, reqBody interface{}) (interface{}, error) {
   426  					return svc.(BookstoreService).DeleteBook(ctx, reqBody.(*DeleteBookRequest))
   427  				},
   428  				HTTPMethod:   "DELETE",
   429  				Pattern:      restful.Enforce("/book/shelfid/{shelf}/bookid/{book}"),
   430  				Body:         nil,
   431  				ResponseBody: nil,
   432  			}},
   433  		},
   434  		{
   435  			Name: "/trpc.examples.restful.bookstore.Bookstore/UpdateBook",
   436  			Func: BookstoreService_UpdateBook_Handler,
   437  			Bindings: []*restful.Binding{{
   438  				Name:  "/trpc.examples.restful.bookstore.Bookstore/UpdateBook",
   439  				Input: func() restful.ProtoMessage { return new(UpdateBookRequest) },
   440  				Filter: func(svc interface{}, ctx context.Context, reqBody interface{}) (interface{}, error) {
   441  					return svc.(BookstoreService).UpdateBook(ctx, reqBody.(*UpdateBookRequest))
   442  				},
   443  				HTTPMethod:   "PATCH",
   444  				Pattern:      restful.Enforce("/book/shelfid/{shelf}/bookid/{book.id}"),
   445  				Body:         requestBodyBookstoreServiceUpdateBookRESTfulPath0{},
   446  				ResponseBody: nil,
   447  			}},
   448  		},
   449  		{
   450  			Name: "/trpc.examples.restful.bookstore.Bookstore/UpdateBooks",
   451  			Func: BookstoreService_UpdateBooks_Handler,
   452  			Bindings: []*restful.Binding{{
   453  				Name:  "/trpc.examples.restful.bookstore.Bookstore/UpdateBooks",
   454  				Input: func() restful.ProtoMessage { return new(UpdateBooksRequest) },
   455  				Filter: func(svc interface{}, ctx context.Context, reqBody interface{}) (interface{}, error) {
   456  					return svc.(BookstoreService).UpdateBooks(ctx, reqBody.(*UpdateBooksRequest))
   457  				},
   458  				HTTPMethod:   "PATCH",
   459  				Pattern:      restful.Enforce("/book/shelfid/{shelf}"),
   460  				Body:         requestBodyBookstoreServiceUpdateBooksRESTfulPath0{},
   461  				ResponseBody: nil,
   462  			}},
   463  		},
   464  	},
   465  }
   466  
   467  // RegisterBookstoreService register service
   468  func RegisterBookstoreService(s server.Service, svr BookstoreService) {
   469  	if err := s.Register(&BookstoreServer_ServiceDesc, svr); err != nil {
   470  		panic(fmt.Sprintf("Bookstore register error:%v", err))
   471  	}
   472  }
   473  
   474  /* ************************************ Client Definition ************************************ */
   475  
   476  // BookstoreClientProxy defines service client proxy
   477  type BookstoreClientProxy interface { // ListShelves 获取所有的书柜
   478  	ListShelves(ctx context.Context, req *emptypb.Empty, opts ...client.Option) (rsp *ListShelvesResponse, err error) // CreateShelf 创建一个书柜
   479  	CreateShelf(ctx context.Context, req *CreateShelfRequest, opts ...client.Option) (rsp *Shelf, err error)          // GetShelf 获取一个书柜
   480  	GetShelf(ctx context.Context, req *GetShelfRequest, opts ...client.Option) (rsp *Shelf, err error)                // DeleteShelf 删除一个书柜
   481  	DeleteShelf(ctx context.Context, req *DeleteShelfRequest, opts ...client.Option) (rsp *emptypb.Empty, err error)  // ListBooks 获取所有的书
   482  	ListBooks(ctx context.Context, req *ListBooksRequest, opts ...client.Option) (rsp *ListBooksResponse, err error)  // CreateBook 创建一本书
   483  	CreateBook(ctx context.Context, req *CreateBookRequest, opts ...client.Option) (rsp *Book, err error)             // GetBook 获取一本书
   484  	GetBook(ctx context.Context, req *GetBookRequest, opts ...client.Option) (rsp *Book, err error)                   // DeleteBook 删除一本书
   485  	DeleteBook(ctx context.Context, req *DeleteBookRequest, opts ...client.Option) (rsp *emptypb.Empty, err error)    // UpdateBook 更新一本书
   486  	UpdateBook(ctx context.Context, req *UpdateBookRequest, opts ...client.Option) (rsp *Book, err error)
   487  	UpdateBooks(ctx context.Context, req *UpdateBooksRequest, opts ...client.Option) (rsp *ListBooksResponse, err error)
   488  }
   489  
   490  type BookstoreClientProxyImpl struct {
   491  	client client.Client
   492  	opts   []client.Option
   493  }
   494  
   495  var NewBookstoreClientProxy = func(opts ...client.Option) BookstoreClientProxy {
   496  	return &BookstoreClientProxyImpl{client: client.DefaultClient, opts: opts}
   497  }
   498  
   499  func (c *BookstoreClientProxyImpl) ListShelves(ctx context.Context, req *emptypb.Empty, opts ...client.Option) (*ListShelvesResponse, error) {
   500  	ctx, msg := codec.WithCloneMessage(ctx)
   501  	defer codec.PutBackMessage(msg)
   502  	msg.WithClientRPCName("/trpc.examples.restful.bookstore.Bookstore/ListShelves")
   503  	msg.WithCalleeServiceName(BookstoreServer_ServiceDesc.ServiceName)
   504  	msg.WithCalleeApp("")
   505  	msg.WithCalleeServer("")
   506  	msg.WithCalleeService("Bookstore")
   507  	msg.WithCalleeMethod("ListShelves")
   508  	msg.WithSerializationType(codec.SerializationTypePB)
   509  	callopts := make([]client.Option, 0, len(c.opts)+len(opts))
   510  	callopts = append(callopts, c.opts...)
   511  	callopts = append(callopts, opts...)
   512  	rsp := &ListShelvesResponse{}
   513  	if err := c.client.Invoke(ctx, req, rsp, callopts...); err != nil {
   514  		return nil, err
   515  	}
   516  	return rsp, nil
   517  }
   518  
   519  func (c *BookstoreClientProxyImpl) CreateShelf(ctx context.Context, req *CreateShelfRequest, opts ...client.Option) (*Shelf, error) {
   520  	ctx, msg := codec.WithCloneMessage(ctx)
   521  	defer codec.PutBackMessage(msg)
   522  	msg.WithClientRPCName("/trpc.examples.restful.bookstore.Bookstore/CreateShelf")
   523  	msg.WithCalleeServiceName(BookstoreServer_ServiceDesc.ServiceName)
   524  	msg.WithCalleeApp("")
   525  	msg.WithCalleeServer("")
   526  	msg.WithCalleeService("Bookstore")
   527  	msg.WithCalleeMethod("CreateShelf")
   528  	msg.WithSerializationType(codec.SerializationTypePB)
   529  	callopts := make([]client.Option, 0, len(c.opts)+len(opts))
   530  	callopts = append(callopts, c.opts...)
   531  	callopts = append(callopts, opts...)
   532  	rsp := &Shelf{}
   533  	if err := c.client.Invoke(ctx, req, rsp, callopts...); err != nil {
   534  		return nil, err
   535  	}
   536  	return rsp, nil
   537  }
   538  
   539  func (c *BookstoreClientProxyImpl) GetShelf(ctx context.Context, req *GetShelfRequest, opts ...client.Option) (*Shelf, error) {
   540  	ctx, msg := codec.WithCloneMessage(ctx)
   541  	defer codec.PutBackMessage(msg)
   542  	msg.WithClientRPCName("/trpc.examples.restful.bookstore.Bookstore/GetShelf")
   543  	msg.WithCalleeServiceName(BookstoreServer_ServiceDesc.ServiceName)
   544  	msg.WithCalleeApp("")
   545  	msg.WithCalleeServer("")
   546  	msg.WithCalleeService("Bookstore")
   547  	msg.WithCalleeMethod("GetShelf")
   548  	msg.WithSerializationType(codec.SerializationTypePB)
   549  	callopts := make([]client.Option, 0, len(c.opts)+len(opts))
   550  	callopts = append(callopts, c.opts...)
   551  	callopts = append(callopts, opts...)
   552  	rsp := &Shelf{}
   553  	if err := c.client.Invoke(ctx, req, rsp, callopts...); err != nil {
   554  		return nil, err
   555  	}
   556  	return rsp, nil
   557  }
   558  
   559  func (c *BookstoreClientProxyImpl) DeleteShelf(ctx context.Context, req *DeleteShelfRequest, opts ...client.Option) (*emptypb.Empty, error) {
   560  	ctx, msg := codec.WithCloneMessage(ctx)
   561  	defer codec.PutBackMessage(msg)
   562  	msg.WithClientRPCName("/trpc.examples.restful.bookstore.Bookstore/DeleteShelf")
   563  	msg.WithCalleeServiceName(BookstoreServer_ServiceDesc.ServiceName)
   564  	msg.WithCalleeApp("")
   565  	msg.WithCalleeServer("")
   566  	msg.WithCalleeService("Bookstore")
   567  	msg.WithCalleeMethod("DeleteShelf")
   568  	msg.WithSerializationType(codec.SerializationTypePB)
   569  	callopts := make([]client.Option, 0, len(c.opts)+len(opts))
   570  	callopts = append(callopts, c.opts...)
   571  	callopts = append(callopts, opts...)
   572  	rsp := &emptypb.Empty{}
   573  	if err := c.client.Invoke(ctx, req, rsp, callopts...); err != nil {
   574  		return nil, err
   575  	}
   576  	return rsp, nil
   577  }
   578  
   579  func (c *BookstoreClientProxyImpl) ListBooks(ctx context.Context, req *ListBooksRequest, opts ...client.Option) (*ListBooksResponse, error) {
   580  	ctx, msg := codec.WithCloneMessage(ctx)
   581  	defer codec.PutBackMessage(msg)
   582  	msg.WithClientRPCName("/trpc.examples.restful.bookstore.Bookstore/ListBooks")
   583  	msg.WithCalleeServiceName(BookstoreServer_ServiceDesc.ServiceName)
   584  	msg.WithCalleeApp("")
   585  	msg.WithCalleeServer("")
   586  	msg.WithCalleeService("Bookstore")
   587  	msg.WithCalleeMethod("ListBooks")
   588  	msg.WithSerializationType(codec.SerializationTypePB)
   589  	callopts := make([]client.Option, 0, len(c.opts)+len(opts))
   590  	callopts = append(callopts, c.opts...)
   591  	callopts = append(callopts, opts...)
   592  	rsp := &ListBooksResponse{}
   593  	if err := c.client.Invoke(ctx, req, rsp, callopts...); err != nil {
   594  		return nil, err
   595  	}
   596  	return rsp, nil
   597  }
   598  
   599  func (c *BookstoreClientProxyImpl) CreateBook(ctx context.Context, req *CreateBookRequest, opts ...client.Option) (*Book, error) {
   600  	ctx, msg := codec.WithCloneMessage(ctx)
   601  	defer codec.PutBackMessage(msg)
   602  	msg.WithClientRPCName("/trpc.examples.restful.bookstore.Bookstore/CreateBook")
   603  	msg.WithCalleeServiceName(BookstoreServer_ServiceDesc.ServiceName)
   604  	msg.WithCalleeApp("")
   605  	msg.WithCalleeServer("")
   606  	msg.WithCalleeService("Bookstore")
   607  	msg.WithCalleeMethod("CreateBook")
   608  	msg.WithSerializationType(codec.SerializationTypePB)
   609  	callopts := make([]client.Option, 0, len(c.opts)+len(opts))
   610  	callopts = append(callopts, c.opts...)
   611  	callopts = append(callopts, opts...)
   612  	rsp := &Book{}
   613  	if err := c.client.Invoke(ctx, req, rsp, callopts...); err != nil {
   614  		return nil, err
   615  	}
   616  	return rsp, nil
   617  }
   618  
   619  func (c *BookstoreClientProxyImpl) GetBook(ctx context.Context, req *GetBookRequest, opts ...client.Option) (*Book, error) {
   620  	ctx, msg := codec.WithCloneMessage(ctx)
   621  	defer codec.PutBackMessage(msg)
   622  	msg.WithClientRPCName("/trpc.examples.restful.bookstore.Bookstore/GetBook")
   623  	msg.WithCalleeServiceName(BookstoreServer_ServiceDesc.ServiceName)
   624  	msg.WithCalleeApp("")
   625  	msg.WithCalleeServer("")
   626  	msg.WithCalleeService("Bookstore")
   627  	msg.WithCalleeMethod("GetBook")
   628  	msg.WithSerializationType(codec.SerializationTypePB)
   629  	callopts := make([]client.Option, 0, len(c.opts)+len(opts))
   630  	callopts = append(callopts, c.opts...)
   631  	callopts = append(callopts, opts...)
   632  	rsp := &Book{}
   633  	if err := c.client.Invoke(ctx, req, rsp, callopts...); err != nil {
   634  		return nil, err
   635  	}
   636  	return rsp, nil
   637  }
   638  
   639  func (c *BookstoreClientProxyImpl) DeleteBook(ctx context.Context, req *DeleteBookRequest, opts ...client.Option) (*emptypb.Empty, error) {
   640  	ctx, msg := codec.WithCloneMessage(ctx)
   641  	defer codec.PutBackMessage(msg)
   642  	msg.WithClientRPCName("/trpc.examples.restful.bookstore.Bookstore/DeleteBook")
   643  	msg.WithCalleeServiceName(BookstoreServer_ServiceDesc.ServiceName)
   644  	msg.WithCalleeApp("")
   645  	msg.WithCalleeServer("")
   646  	msg.WithCalleeService("Bookstore")
   647  	msg.WithCalleeMethod("DeleteBook")
   648  	msg.WithSerializationType(codec.SerializationTypePB)
   649  	callopts := make([]client.Option, 0, len(c.opts)+len(opts))
   650  	callopts = append(callopts, c.opts...)
   651  	callopts = append(callopts, opts...)
   652  	rsp := &emptypb.Empty{}
   653  	if err := c.client.Invoke(ctx, req, rsp, callopts...); err != nil {
   654  		return nil, err
   655  	}
   656  	return rsp, nil
   657  }
   658  
   659  func (c *BookstoreClientProxyImpl) UpdateBook(ctx context.Context, req *UpdateBookRequest, opts ...client.Option) (*Book, error) {
   660  	ctx, msg := codec.WithCloneMessage(ctx)
   661  	defer codec.PutBackMessage(msg)
   662  	msg.WithClientRPCName("/trpc.examples.restful.bookstore.Bookstore/UpdateBook")
   663  	msg.WithCalleeServiceName(BookstoreServer_ServiceDesc.ServiceName)
   664  	msg.WithCalleeApp("")
   665  	msg.WithCalleeServer("")
   666  	msg.WithCalleeService("Bookstore")
   667  	msg.WithCalleeMethod("UpdateBook")
   668  	msg.WithSerializationType(codec.SerializationTypePB)
   669  	callopts := make([]client.Option, 0, len(c.opts)+len(opts))
   670  	callopts = append(callopts, c.opts...)
   671  	callopts = append(callopts, opts...)
   672  	rsp := &Book{}
   673  	if err := c.client.Invoke(ctx, req, rsp, callopts...); err != nil {
   674  		return nil, err
   675  	}
   676  	return rsp, nil
   677  }
   678  
   679  func (c *BookstoreClientProxyImpl) UpdateBooks(ctx context.Context, req *UpdateBooksRequest, opts ...client.Option) (*ListBooksResponse, error) {
   680  	ctx, msg := codec.WithCloneMessage(ctx)
   681  	defer codec.PutBackMessage(msg)
   682  	msg.WithClientRPCName("/trpc.examples.restful.bookstore.Bookstore/UpdateBooks")
   683  	msg.WithCalleeServiceName(BookstoreServer_ServiceDesc.ServiceName)
   684  	msg.WithCalleeApp("")
   685  	msg.WithCalleeServer("")
   686  	msg.WithCalleeService("Bookstore")
   687  	msg.WithCalleeMethod("UpdateBooks")
   688  	msg.WithSerializationType(codec.SerializationTypePB)
   689  	callopts := make([]client.Option, 0, len(c.opts)+len(opts))
   690  	callopts = append(callopts, c.opts...)
   691  	callopts = append(callopts, opts...)
   692  	rsp := &ListBooksResponse{}
   693  	if err := c.client.Invoke(ctx, req, rsp, callopts...); err != nil {
   694  		return nil, err
   695  	}
   696  	return rsp, nil
   697  }