func (c Client) GetHotels(ctx context.Context, hotelIDs []int32) ([]*pb.Hotel, error) { md, _ := metadata.FromContext(ctx) t := trace.Tracer{TraceID: md["traceID"]} t.Req(md["from"], "service.profile", "GetHotels") defer t.Rep("service.profile", md["from"], time.Now()) args := &pb.Args{HotelIds: hotelIDs} reply, err := c.client.GetHotels(ctx, args) if err != nil { return []*pb.Hotel{}, err } return reply.Hotels, nil }
func (c Client) VerifyToken(ctx context.Context, serverName string, authToken string) error { md, _ := metadata.FromContext(ctx) t := trace.Tracer{TraceID: md["traceID"]} t.Req(md["from"], "service.auth", "VerifyToken") defer t.Rep("service.auth", md["from"], time.Now()) args := &auth.Args{ From: serverName, AuthToken: authToken, } if _, err := c.client.VerifyToken(ctx, args); err != nil { return err } return nil }
func (c Client) GetRatePlans(ctx context.Context, hotelIDs []int32, inDate string, outDate string) ([]*pb.RatePlan, error) { md, _ := metadata.FromContext(ctx) t := trace.Tracer{TraceID: md["traceID"]} t.Req(md["from"], "service.rate", "GetRatePlans") defer t.Rep("service.rate", md["from"], time.Now()) args := &pb.Args{ HotelIds: hotelIDs, InDate: inDate, OutDate: outDate, } reply, err := c.client.GetRates(ctx, args) if err != nil { return []*pb.RatePlan{}, err } return reply.RatePlans, nil }
func (c Client) HotelsWithinBoundedBox(ctx context.Context, latitude int32, longitude int32) ([]int32, error) { md, _ := metadata.FromContext(ctx) t := trace.Tracer{TraceID: md["traceID"]} t.Req(md["from"], "service.geo", "BoundedBox") defer t.Rep("service.geo", md["from"], time.Now()) rect := &pb.Rectangle{ Lo: &pb.Point{Latitude: 400000000, Longitude: -750000000}, Hi: &pb.Point{Latitude: 420000000, Longitude: -730000000}, } reply, err := c.client.BoundedBox(ctx, rect) if err != nil { return []int32{}, err } return reply.HotelIds, nil }