github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/service/server/grpc/proto/test.pb.micro.go (about)

     1  // Code generated by protoc-gen-micro. DO NOT EDIT.
     2  // source: server/grpc/proto/test.proto
     3  
     4  package test
     5  
     6  import (
     7  	fmt "fmt"
     8  	math "math"
     9  
    10  	proto "github.com/golang/protobuf/proto"
    11  	_ "google.golang.org/genproto/googleapis/api/annotations"
    12  
    13  	context "context"
    14  
    15  	api "github.com/tickoalcantara12/micro/v3/service/api"
    16  
    17  	client "github.com/tickoalcantara12/micro/v3/service/client"
    18  
    19  	server "github.com/tickoalcantara12/micro/v3/service/server"
    20  )
    21  
    22  // Reference imports to suppress errors if they are not otherwise used.
    23  var _ = proto.Marshal
    24  var _ = fmt.Errorf
    25  var _ = math.Inf
    26  
    27  // This is a compile-time assertion to ensure that this generated file
    28  // is compatible with the proto package it is being compiled against.
    29  // A compilation error at this line likely means your copy of the
    30  // proto package needs to be updated.
    31  const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
    32  
    33  // Reference imports to suppress errors if they are not otherwise used.
    34  var _ api.Endpoint
    35  var _ context.Context
    36  var _ client.Option
    37  var _ server.Option
    38  
    39  // Api Endpoints for Test service
    40  
    41  func NewTestEndpoints() []*api.Endpoint {
    42  	return []*api.Endpoint{
    43  		&api.Endpoint{
    44  			Name:    "Test.Call",
    45  			Path:    []string{"/api/v0/test/call/{uuid}"},
    46  			Method:  []string{"POST"},
    47  			Body:    "*",
    48  			Handler: "rpc",
    49  		},
    50  		&api.Endpoint{
    51  			Name:    "Test.CallPcre",
    52  			Path:    []string{"^/api/v0/test/call/pcre/?$"},
    53  			Method:  []string{"POST"},
    54  			Body:    "*",
    55  			Handler: "rpc",
    56  		},
    57  		&api.Endpoint{
    58  			Name:    "Test.CallPcreInvalid",
    59  			Path:    []string{"^/api/v0/test/call/pcre/invalid/?"},
    60  			Method:  []string{"POST"},
    61  			Body:    "*",
    62  			Handler: "rpc",
    63  		},
    64  	}
    65  }
    66  
    67  // Client API for Test service
    68  
    69  type TestService interface {
    70  	Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
    71  	CallPcre(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
    72  	CallPcreInvalid(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
    73  }
    74  
    75  type testService struct {
    76  	c    client.Client
    77  	name string
    78  }
    79  
    80  func NewTestService(name string, c client.Client) TestService {
    81  	return &testService{
    82  		c:    c,
    83  		name: name,
    84  	}
    85  }
    86  
    87  func (c *testService) Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) {
    88  	req := c.c.NewRequest(c.name, "Test.Call", in)
    89  	out := new(Response)
    90  	err := c.c.Call(ctx, req, out, opts...)
    91  	if err != nil {
    92  		return nil, err
    93  	}
    94  	return out, nil
    95  }
    96  
    97  func (c *testService) CallPcre(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) {
    98  	req := c.c.NewRequest(c.name, "Test.CallPcre", in)
    99  	out := new(Response)
   100  	err := c.c.Call(ctx, req, out, opts...)
   101  	if err != nil {
   102  		return nil, err
   103  	}
   104  	return out, nil
   105  }
   106  
   107  func (c *testService) CallPcreInvalid(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) {
   108  	req := c.c.NewRequest(c.name, "Test.CallPcreInvalid", in)
   109  	out := new(Response)
   110  	err := c.c.Call(ctx, req, out, opts...)
   111  	if err != nil {
   112  		return nil, err
   113  	}
   114  	return out, nil
   115  }
   116  
   117  // Server API for Test service
   118  
   119  type TestHandler interface {
   120  	Call(context.Context, *Request, *Response) error
   121  	CallPcre(context.Context, *Request, *Response) error
   122  	CallPcreInvalid(context.Context, *Request, *Response) error
   123  }
   124  
   125  func RegisterTestHandler(s server.Server, hdlr TestHandler, opts ...server.HandlerOption) error {
   126  	type test interface {
   127  		Call(ctx context.Context, in *Request, out *Response) error
   128  		CallPcre(ctx context.Context, in *Request, out *Response) error
   129  		CallPcreInvalid(ctx context.Context, in *Request, out *Response) error
   130  	}
   131  	type Test struct {
   132  		test
   133  	}
   134  	h := &testHandler{hdlr}
   135  	opts = append(opts, api.WithEndpoint(&api.Endpoint{
   136  		Name:    "Test.Call",
   137  		Path:    []string{"/api/v0/test/call/{uuid}"},
   138  		Method:  []string{"POST"},
   139  		Body:    "*",
   140  		Handler: "rpc",
   141  	}))
   142  	opts = append(opts, api.WithEndpoint(&api.Endpoint{
   143  		Name:    "Test.CallPcre",
   144  		Path:    []string{"^/api/v0/test/call/pcre/?$"},
   145  		Method:  []string{"POST"},
   146  		Body:    "*",
   147  		Handler: "rpc",
   148  	}))
   149  	opts = append(opts, api.WithEndpoint(&api.Endpoint{
   150  		Name:    "Test.CallPcreInvalid",
   151  		Path:    []string{"^/api/v0/test/call/pcre/invalid/?"},
   152  		Method:  []string{"POST"},
   153  		Body:    "*",
   154  		Handler: "rpc",
   155  	}))
   156  	return s.Handle(s.NewHandler(&Test{h}, opts...))
   157  }
   158  
   159  type testHandler struct {
   160  	TestHandler
   161  }
   162  
   163  func (h *testHandler) Call(ctx context.Context, in *Request, out *Response) error {
   164  	return h.TestHandler.Call(ctx, in, out)
   165  }
   166  
   167  func (h *testHandler) CallPcre(ctx context.Context, in *Request, out *Response) error {
   168  	return h.TestHandler.CallPcre(ctx, in, out)
   169  }
   170  
   171  func (h *testHandler) CallPcreInvalid(ctx context.Context, in *Request, out *Response) error {
   172  	return h.TestHandler.CallPcreInvalid(ctx, in, out)
   173  }