update after protoc-gen-micro changes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -3,45 +3,36 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
micro_api "github.com/unistack-org/micro/v3/api"
|
||||
micro_client "github.com/unistack-org/micro/v3/client"
|
||||
context "context"
|
||||
api "github.com/unistack-org/micro/v3/api"
|
||||
client "github.com/unistack-org/micro/v3/client"
|
||||
)
|
||||
|
||||
// NewTestEndpoints provides api endpoints metdata for Test service
|
||||
func NewTestEndpoints() []*micro_api.Endpoint {
|
||||
endpoints := make([]*micro_api.Endpoint, 0, 2)
|
||||
var endpoint *micro_api.Endpoint
|
||||
endpoint = µ_api.Endpoint{
|
||||
Name: "Test.Call",
|
||||
Path: []string{"/v1/test/call/{name}"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
func NewTestEndpoints() []*api.Endpoint {
|
||||
return []*api.Endpoint{
|
||||
&api.Endpoint{
|
||||
Name: "Test.Call",
|
||||
Path: []string{"/v1/test/call/{name}"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
&api.Endpoint{
|
||||
Name: "Test.CallError",
|
||||
Path: []string{"/v1/test/callerror/{name}"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
}
|
||||
endpoints = append(endpoints, endpoint)
|
||||
endpoint = µ_api.Endpoint{
|
||||
Name: "Test.CallError",
|
||||
Path: []string{"/v1/test/callerror/{name}"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}
|
||||
endpoints = append(endpoints, endpoint)
|
||||
return endpoints
|
||||
}
|
||||
|
||||
// TestService interface
|
||||
type TestService interface {
|
||||
Call(context.Context, *CallReq, ...micro_client.CallOption) (*CallRsp, error)
|
||||
CallError(context.Context, *CallReq1, ...micro_client.CallOption) (*CallRsp1, error)
|
||||
type TestClient interface {
|
||||
Call(ctx context.Context, req *CallReq, opts ...client.CallOption) (*CallRsp, error)
|
||||
CallError(ctx context.Context, req *CallReq1, opts ...client.CallOption) (*CallRsp1, error)
|
||||
}
|
||||
|
||||
// Micro server stuff
|
||||
|
||||
// TestHandler server handler
|
||||
type TestHandler interface {
|
||||
Call(context.Context, *CallReq, *CallRsp) error
|
||||
CallError(context.Context, *CallReq1, *CallRsp1) error
|
||||
type TestServer interface {
|
||||
Call(ctx context.Context, req *CallReq, rsp *CallRsp) error
|
||||
CallError(ctx context.Context, req *CallReq1, rsp *CallRsp1) error
|
||||
}
|
||||
|
Reference in New Issue
Block a user