grpc_client icon indicating copy to clipboard operation
grpc_client copied to clipboard

Fixes for Issue 1 and Issue 3

Open vasu-dasari opened this issue 8 years ago • 1 comments

The module which deals with records needs to be given as input to unary RPC call. This can be presented as a tuple to the Options list that is passed to grpc_client:unary().

{msgs_as_records,ModuleName}.

And the user is expected to generate records based header file using gpb. This can be out of the scope of grpc_client API.

For example for our route_guide example:

Point = #'Point'{
    latitude = 409146138,
    longitude = -746188906
},
Return = route_guide_client:'GetFeature'(Connection, Point, [{msgs_as_records,route_guide_pb}]).

Return will also be presented to caller as a record:

{ok,#{grpc_status => 0,
      headers => #{<<":status">> => <<"200">>},
      http_status => 200,
      result =>
          {'Feature',<<"Berkshire Valley Management Area Trail, Jefferson, NJ, USA">>,
                     {'Point',409146138,-746188906}},
      status_message => <<>>,
      trailers => #{<<"grpc-status">> => <<"0">>}}}

vasu-dasari avatar Oct 27 '17 18:10 vasu-dasari

@cmullaparthi Updated the code as recommended. Let me know if more needs to be done.

vasu-dasari avatar Jun 13 '18 13:06 vasu-dasari