Permalink
Browse files

Update

  • Loading branch information...
peter-edge committed Dec 3, 2017
1 parent 2ca31ef commit 3ed6327f4d7493994b28c5df0a8ae24b1151a7f6
Showing with 60 additions and 44 deletions.
  1. +7 −6 api_server.go
  2. +4 −4 client.go
  3. +6 −5 local_api_client.go
  4. +3 −4 openflights.pb.go
  5. +40 −25 openflights.pb.gw.go
@@ -1,7 +1,8 @@
package openflights

import (
"go.pedge.io/pb/go/google/protobuf"
"github.com/golang/protobuf/ptypes/empty"
"github.com/golang/protobuf/ptypes/wrappers"
"golang.org/x/net/context"
)

@@ -13,7 +14,7 @@ func newAPIServer(client Client) *apiServer {
return &apiServer{client}
}

func (a *apiServer) GetAllAirports(request *google_protobuf.Empty, server API_GetAllAirportsServer) error {
func (a *apiServer) GetAllAirports(request *empty.Empty, server API_GetAllAirportsServer) error {
out, cancel, callbackErr, err := a.client.GetAllAirports()
if err != nil {
return err
@@ -40,7 +41,7 @@ func (a *apiServer) GetAllAirports(request *google_protobuf.Empty, server API_Ge
}
}

func (a *apiServer) GetAllAirlines(request *google_protobuf.Empty, server API_GetAllAirlinesServer) error {
func (a *apiServer) GetAllAirlines(request *empty.Empty, server API_GetAllAirlinesServer) error {
out, cancel, callbackErr, err := a.client.GetAllAirlines()
if err != nil {
return err
@@ -67,7 +68,7 @@ func (a *apiServer) GetAllAirlines(request *google_protobuf.Empty, server API_Ge
}
}

func (a *apiServer) GetAllRoutes(request *google_protobuf.Empty, server API_GetAllRoutesServer) error {
func (a *apiServer) GetAllRoutes(request *empty.Empty, server API_GetAllRoutesServer) error {
out, cancel, callbackErr, err := a.client.GetAllRoutes()
if err != nil {
return err
@@ -112,12 +113,12 @@ func (a *apiServer) GetRoutes(_ context.Context, request *GetRoutesRequest) (res
}, nil
}

func (a *apiServer) GetDistance(_ context.Context, request *GetDistanceRequest) (response *google_protobuf.UInt32Value, err error) {
func (a *apiServer) GetDistance(_ context.Context, request *GetDistanceRequest) (response *wrappers.UInt32Value, err error) {
distance, err := a.client.GetDistance(request.SourceAirportId, request.DestinationAirportId)
if err != nil {
return nil, err
}
return &google_protobuf.UInt32Value{
return &wrappers.UInt32Value{
Value: distance,
}, nil
}
@@ -6,7 +6,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"

"go.pedge.io/pb/go/google/protobuf"
"github.com/golang/protobuf/ptypes/empty"
"golang.org/x/net/context"
)

@@ -23,7 +23,7 @@ func (c *client) GetAllAirports() (<-chan *Airport, chan<- bool, <-chan error, e
cancel := make(chan bool, 1)
callbackErr := make(chan error, 1)
ctx, ctxCancel := context.WithCancel(context.Background())
client, err := c.apiClient.GetAllAirports(ctx, google_protobuf.EmptyInstance)
client, err := c.apiClient.GetAllAirports(ctx, &empty.Empty{})
if err != nil {
return nil, nil, nil, err
}
@@ -54,7 +54,7 @@ func (c *client) GetAllAirlines() (<-chan *Airline, chan<- bool, <-chan error, e
cancel := make(chan bool, 1)
callbackErr := make(chan error, 1)
ctx, ctxCancel := context.WithCancel(context.Background())
client, err := c.apiClient.GetAllAirlines(ctx, google_protobuf.EmptyInstance)
client, err := c.apiClient.GetAllAirlines(ctx, &empty.Empty{})
if err != nil {
return nil, nil, nil, err
}
@@ -85,7 +85,7 @@ func (c *client) GetAllRoutes() (<-chan *Route, chan<- bool, <-chan error, error
cancel := make(chan bool, 1)
callbackErr := make(chan error, 1)
ctx, ctxCancel := context.WithCancel(context.Background())
client, err := c.apiClient.GetAllRoutes(ctx, google_protobuf.EmptyInstance)
client, err := c.apiClient.GetAllRoutes(ctx, &empty.Empty{})
if err != nil {
return nil, nil, nil, err
}
@@ -3,7 +3,8 @@ package openflights
import (
"io"

"go.pedge.io/pb/go/google/protobuf"
"github.com/golang/protobuf/ptypes/empty"
"github.com/golang/protobuf/ptypes/wrappers"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
@@ -17,7 +18,7 @@ func newLocalAPIClient(apiServer APIServer) *localAPIClient {
return &localAPIClient{apiServer}
}

func (a *localAPIClient) GetAllAirports(ctx context.Context, request *google_protobuf.Empty, _ ...grpc.CallOption) (API_GetAllAirportsClient, error) {
func (a *localAPIClient) GetAllAirports(ctx context.Context, request *empty.Empty, _ ...grpc.CallOption) (API_GetAllAirportsClient, error) {
relayer := newLocalAPIGetAllAirportsRelayer(ctx)
go func() {
// TODO(pedge): what to do with the error?
@@ -69,7 +70,7 @@ func (r *localAPIGetAllAirportsRelayer) CloseSend() error { return n
func (r *localAPIGetAllAirportsRelayer) SendMsg(m interface{}) error { return nil }
func (r *localAPIGetAllAirportsRelayer) RecvMsg(m interface{}) error { return nil }

func (a *localAPIClient) GetAllAirlines(ctx context.Context, request *google_protobuf.Empty, _ ...grpc.CallOption) (API_GetAllAirlinesClient, error) {
func (a *localAPIClient) GetAllAirlines(ctx context.Context, request *empty.Empty, _ ...grpc.CallOption) (API_GetAllAirlinesClient, error) {
relayer := newLocalAPIGetAllAirlinesRelayer(ctx)
go func() {
// TODO(pedge): what to do with the error?
@@ -121,7 +122,7 @@ func (r *localAPIGetAllAirlinesRelayer) CloseSend() error { return n
func (r *localAPIGetAllAirlinesRelayer) SendMsg(m interface{}) error { return nil }
func (r *localAPIGetAllAirlinesRelayer) RecvMsg(m interface{}) error { return nil }

func (a *localAPIClient) GetAllRoutes(ctx context.Context, request *google_protobuf.Empty, _ ...grpc.CallOption) (API_GetAllRoutesClient, error) {
func (a *localAPIClient) GetAllRoutes(ctx context.Context, request *empty.Empty, _ ...grpc.CallOption) (API_GetAllRoutesClient, error) {
relayer := newLocalAPIGetAllRoutesRelayer(ctx)
go func() {
// TODO(pedge): what to do with the error?
@@ -185,7 +186,7 @@ func (a *localAPIClient) GetRoutes(ctx context.Context, request *GetRoutesReques
return a.apiServer.GetRoutes(ctx, request)
}

func (a *localAPIClient) GetDistance(ctx context.Context, request *GetDistanceRequest, _ ...grpc.CallOption) (*google_protobuf.UInt32Value, error) {
func (a *localAPIClient) GetDistance(ctx context.Context, request *GetDistanceRequest, _ ...grpc.CallOption) (*wrappers.UInt32Value, error) {
return a.apiServer.GetDistance(ctx, request)
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 3ed6327

Please sign in to comment.