route_guide_grpc_pb.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. // GENERATED CODE -- DO NOT EDIT!
  2. // Original file comments:
  3. // Copyright 2015 gRPC authors.
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License");
  6. // you may not use this file except in compliance with the License.
  7. // You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. //
  17. 'use strict';
  18. var grpc = require('@grpc/grpc-js');
  19. var route_guide_pb = require('./route_guide_pb.js');
  20. function serialize_routeguide_Feature(arg) {
  21. if (!(arg instanceof route_guide_pb.Feature)) {
  22. throw new Error('Expected argument of type routeguide.Feature');
  23. }
  24. return Buffer.from(arg.serializeBinary());
  25. }
  26. function deserialize_routeguide_Feature(buffer_arg) {
  27. return route_guide_pb.Feature.deserializeBinary(new Uint8Array(buffer_arg));
  28. }
  29. function serialize_routeguide_Point(arg) {
  30. if (!(arg instanceof route_guide_pb.Point)) {
  31. throw new Error('Expected argument of type routeguide.Point');
  32. }
  33. return Buffer.from(arg.serializeBinary());
  34. }
  35. function deserialize_routeguide_Point(buffer_arg) {
  36. return route_guide_pb.Point.deserializeBinary(new Uint8Array(buffer_arg));
  37. }
  38. function serialize_routeguide_Rectangle(arg) {
  39. if (!(arg instanceof route_guide_pb.Rectangle)) {
  40. throw new Error('Expected argument of type routeguide.Rectangle');
  41. }
  42. return Buffer.from(arg.serializeBinary());
  43. }
  44. function deserialize_routeguide_Rectangle(buffer_arg) {
  45. return route_guide_pb.Rectangle.deserializeBinary(new Uint8Array(buffer_arg));
  46. }
  47. function serialize_routeguide_RouteNote(arg) {
  48. if (!(arg instanceof route_guide_pb.RouteNote)) {
  49. throw new Error('Expected argument of type routeguide.RouteNote');
  50. }
  51. return Buffer.from(arg.serializeBinary());
  52. }
  53. function deserialize_routeguide_RouteNote(buffer_arg) {
  54. return route_guide_pb.RouteNote.deserializeBinary(new Uint8Array(buffer_arg));
  55. }
  56. function serialize_routeguide_RouteSummary(arg) {
  57. if (!(arg instanceof route_guide_pb.RouteSummary)) {
  58. throw new Error('Expected argument of type routeguide.RouteSummary');
  59. }
  60. return Buffer.from(arg.serializeBinary());
  61. }
  62. function deserialize_routeguide_RouteSummary(buffer_arg) {
  63. return route_guide_pb.RouteSummary.deserializeBinary(new Uint8Array(buffer_arg));
  64. }
  65. // Interface exported by the server.
  66. var RouteGuideService = exports.RouteGuideService = {
  67. // A simple RPC.
  68. //
  69. // Obtains the feature at a given position.
  70. //
  71. // A feature with an empty name is returned if there's no feature at the given
  72. // position.
  73. getFeature: {
  74. path: '/routeguide.RouteGuide/GetFeature',
  75. requestStream: false,
  76. responseStream: false,
  77. requestType: route_guide_pb.Point,
  78. responseType: route_guide_pb.Feature,
  79. requestSerialize: serialize_routeguide_Point,
  80. requestDeserialize: deserialize_routeguide_Point,
  81. responseSerialize: serialize_routeguide_Feature,
  82. responseDeserialize: deserialize_routeguide_Feature,
  83. },
  84. // A server-to-client streaming RPC.
  85. //
  86. // Obtains the Features available within the given Rectangle. Results are
  87. // streamed rather than returned at once (e.g. in a response message with a
  88. // repeated field), as the rectangle may cover a large area and contain a
  89. // huge number of features.
  90. listFeatures: {
  91. path: '/routeguide.RouteGuide/ListFeatures',
  92. requestStream: false,
  93. responseStream: true,
  94. requestType: route_guide_pb.Rectangle,
  95. responseType: route_guide_pb.Feature,
  96. requestSerialize: serialize_routeguide_Rectangle,
  97. requestDeserialize: deserialize_routeguide_Rectangle,
  98. responseSerialize: serialize_routeguide_Feature,
  99. responseDeserialize: deserialize_routeguide_Feature,
  100. },
  101. // A client-to-server streaming RPC.
  102. //
  103. // Accepts a stream of Points on a route being traversed, returning a
  104. // RouteSummary when traversal is completed.
  105. recordRoute: {
  106. path: '/routeguide.RouteGuide/RecordRoute',
  107. requestStream: true,
  108. responseStream: false,
  109. requestType: route_guide_pb.Point,
  110. responseType: route_guide_pb.RouteSummary,
  111. requestSerialize: serialize_routeguide_Point,
  112. requestDeserialize: deserialize_routeguide_Point,
  113. responseSerialize: serialize_routeguide_RouteSummary,
  114. responseDeserialize: deserialize_routeguide_RouteSummary,
  115. },
  116. // A Bidirectional streaming RPC.
  117. //
  118. // Accepts a stream of RouteNotes sent while a route is being traversed,
  119. // while receiving other RouteNotes (e.g. from other users).
  120. routeChat: {
  121. path: '/routeguide.RouteGuide/RouteChat',
  122. requestStream: true,
  123. responseStream: true,
  124. requestType: route_guide_pb.RouteNote,
  125. responseType: route_guide_pb.RouteNote,
  126. requestSerialize: serialize_routeguide_RouteNote,
  127. requestDeserialize: deserialize_routeguide_RouteNote,
  128. responseSerialize: serialize_routeguide_RouteNote,
  129. responseDeserialize: deserialize_routeguide_RouteNote,
  130. },
  131. };
  132. exports.RouteGuideClient = grpc.makeGenericClientConstructor(RouteGuideService);