OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library modules_service; |
| 6 |
| 7 import 'dart:async'; |
| 8 |
| 9 import 'package:protobuf/protobuf.dart'; |
| 10 |
| 11 import '../../api/errors.dart'; |
| 12 import '../protobuf_api/internal/modules_service.pb.dart' as pb; |
| 13 import 'rpc/rpc_service.dart'; |
| 14 |
| 15 class ModulesServiceClientRPCStub { |
| 16 final RPCService _rpcService; |
| 17 final String _ticket; |
| 18 |
| 19 ModulesServiceClientRPCStub(this._rpcService, this._ticket); |
| 20 |
| 21 Future<pb.GetDefaultVersionResponse> |
| 22 GetDefaultVersion(pb.GetDefaultVersionRequest request) { |
| 23 return _rpcService.call('modules', 'GetDefaultVersion', |
| 24 request.writeToBuffer(), ticket: _ticket) |
| 25 .then((List<int> response) { |
| 26 try { |
| 27 return new pb.GetDefaultVersionResponse.fromBuffer(response); |
| 28 } on InvalidProtocolBufferException catch (error) { |
| 29 throw ProtocolError.INVALID_RESPONSE; |
| 30 } |
| 31 }); |
| 32 } |
| 33 |
| 34 Future<pb.GetModulesResponse> |
| 35 GetModules(pb.GetModulesRequest request) { |
| 36 return _rpcService.call( |
| 37 'modules', 'GetModules', request.writeToBuffer(), ticket: _ticket) |
| 38 .then((List<int> response) { |
| 39 try { |
| 40 return new pb.GetModulesResponse.fromBuffer(response); |
| 41 } on InvalidProtocolBufferException catch (error) { |
| 42 throw ProtocolError.INVALID_RESPONSE; |
| 43 } |
| 44 }); |
| 45 } |
| 46 |
| 47 Future<pb.GetVersionsResponse> |
| 48 GetVersions(pb.GetVersionsRequest request) { |
| 49 return _rpcService.call( |
| 50 'modules', 'GetVersions', request.writeToBuffer(), ticket: _ticket) |
| 51 .then((List<int> response) { |
| 52 try { |
| 53 return new pb.GetVersionsResponse.fromBuffer(response); |
| 54 } on InvalidProtocolBufferException catch (error) { |
| 55 throw ProtocolError.INVALID_RESPONSE; |
| 56 } |
| 57 }); |
| 58 } |
| 59 |
| 60 Future<pb.GetHostnameResponse> |
| 61 GetHostname(pb.GetHostnameRequest request) { |
| 62 return _rpcService.call( |
| 63 'modules', 'GetHostname', request.writeToBuffer(), ticket: _ticket) |
| 64 .then((List<int> response) { |
| 65 try { |
| 66 return new pb.GetHostnameResponse.fromBuffer(response); |
| 67 } on InvalidProtocolBufferException catch (error) { |
| 68 throw ProtocolError.INVALID_RESPONSE; |
| 69 } |
| 70 }); |
| 71 } |
| 72 } |
OLD | NEW |