├── AUTHORS ├── pubspec.yaml ├── README.md ├── .gitignore ├── example ├── protos │ ├── empty.pb.dart │ └── pubsub.pb.dart └── pubsub.dart ├── PATENTS ├── LICENSE └── lib └── grpc_poc.dart /AUTHORS: -------------------------------------------------------------------------------- 1 | # Below is a list of people and organizations that have contributed 2 | # to the Dart project. Names should be added to the list like so: 3 | # 4 | # Name/Organization 5 | 6 | Google Inc. 7 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: grpc_poc 2 | version: 0.1.0 3 | description: A proof of concept for a gRPC client in dart. 4 | 5 | dependencies: 6 | googleapis_auth: ">=0.2.3 <0.3.0" 7 | http2: ">=0.1.1 <0.2.0" 8 | protobuf: ">=0.4.0 <0.5.0" 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Deprecated] Dart gRPC client proof-of-concept 2 | 3 | ***DEPRECATED***. Please see the https://github.com/dart-lang/grpc-dart Dart gRPC implementation. 4 | 5 | - - - 6 | 7 | This repository contains a hackisch implementation of a gRPC client in Dart. An 8 | example on how to use it can be seen under `example/pubsub.dart`. 9 | 10 | **Please Note** The `example/pubsub.dart` example needs to be modified to 11 | * point to a json service account file on disc 12 | * contain the name of a google cloud project (which has the pub/sub API 13 | enabled) 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://www.dartlang.org/tools/private-files.html 2 | 3 | # Files and directories created by pub 4 | .buildlog 5 | .packages 6 | .project 7 | .pub/ 8 | build/ 9 | **/packages/ 10 | 11 | # Files created by dart2js 12 | # (Most Dart developers will use pub build to compile Dart, use/modify these 13 | # rules if you intend to use dart2js directly 14 | # Convention is to use extension '.dart.js' for Dart compiled to Javascript to 15 | # differentiate from explicit Javascript files) 16 | *.dart.js 17 | *.part.js 18 | *.js.deps 19 | *.js.map 20 | *.info.json 21 | 22 | # Directory created by dartdoc 23 | doc/api/ 24 | 25 | # Don't commit pubspec lock file 26 | # (Library packages only! Remove pattern if developing an application package) 27 | pubspec.lock 28 | -------------------------------------------------------------------------------- /example/protos/empty.pb.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | /// 4 | library google.protobuf; 5 | 6 | import 'package:fixnum/fixnum.dart'; 7 | import 'package:protobuf/protobuf.dart'; 8 | 9 | class Empty extends GeneratedMessage { 10 | static final BuilderInfo _i = new BuilderInfo('Empty') 11 | ..hasRequiredFields = false 12 | ; 13 | 14 | Empty() : super(); 15 | Empty.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 16 | Empty.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 17 | Empty clone() => new Empty()..mergeFromMessage(this); 18 | BuilderInfo get info_ => _i; 19 | static Empty create() => new Empty(); 20 | static PbList createRepeated() => new PbList(); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Dart Project. 5 | 6 | Google hereby grants to you a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this 8 | section) patent license to make, have made, use, offer to sell, sell, 9 | import, transfer, and otherwise run, modify and propagate the contents 10 | of this implementation of Dart, where such license applies only to 11 | those patent claims, both currently owned by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by 13 | this implementation of Dart. This grant does not include claims that 14 | would be infringed only as a consequence of further modification of 15 | this implementation. If you or your agent or exclusive licensee 16 | institute or order or agree to the institution of patent litigation 17 | against any entity (including a cross-claim or counterclaim in a 18 | lawsuit) alleging that this implementation of Dart or any code 19 | incorporated within this implementation of Dart constitutes direct or 20 | contributory patent infringement, or inducement of patent 21 | infringement, then any patent rights granted to you under this License 22 | for this implementation of Dart shall terminate as of the date such 23 | litigation is filed. 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2015, the Dart project authors. All rights reserved. 2 | Redistribution and use in source and binary forms, with or without 3 | modification, are permitted provided that the following conditions are 4 | met: 5 | * Redistributions of source code must retain the above copyright 6 | notice, this list of conditions and the following disclaimer. 7 | * Redistributions in binary form must reproduce the above 8 | copyright notice, this list of conditions and the following 9 | disclaimer in the documentation and/or other materials provided 10 | with the distribution. 11 | * Neither the name of Google Inc. nor the names of its 12 | contributors may be used to endorse or promote products derived 13 | from this software without specific prior written permission. 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 18 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /example/pubsub.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015, 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 grpc_poc.example.pubsub; 6 | 7 | import 'dart:async'; 8 | import 'dart:io'; 9 | 10 | import 'package:grpc_poc/grpc_poc.dart'; 11 | 12 | import 'package:googleapis_auth/auth_io.dart' as auth; 13 | import 'package:http/http.dart' as http; 14 | 15 | import 'protos/pubsub.pb.dart'; 16 | 17 | main() async { 18 | // Need to setup a service account in the google developers console and save 19 | // the credentials file as a '*.json' file. 20 | const ServiceAccountFilename = '/path-to-service-account.json'; 21 | 22 | // Need to enable the Pub/Sub API in the google developers console and wait 23 | // until the changes have propagated. 24 | const GoogleCloudProject = 'cloud-project-name'; 25 | 26 | var accessToken = await obtainAccessToken(ServiceAccountFilename, PubSub.Scopes); 27 | var pubsub = await PubSub.connect(accessToken); 28 | 29 | var response; 30 | 31 | response = await pubsub.CreateTopic(GoogleCloudProject, 'my-topic'); 32 | print('Pub/Sub created topic: ${response.name}'); 33 | 34 | wait('Wait a little until topic was created.', 10); 35 | 36 | response = await pubsub.CreateSubscription(GoogleCloudProject, 'my-topic', 'my-sub'); 37 | print('Pub/Sub created subscription: ${response.name}'); 38 | 39 | wait('Wait a little until subscription was created.', 10); 40 | 41 | response = await pubsub.ListTopics(GoogleCloudProject); 42 | print('Pub/Sub topics: ${response.topics.map((t) => t.name).toList()}'); 43 | 44 | response = await pubsub.ListSubscriptions(GoogleCloudProject, 'my-topic'); 45 | print('Pub/Sub subs: ${response.subscriptions}'); 46 | 47 | response = await pubsub.Publish(GoogleCloudProject, 'my-topic', [1, 2, 3]); 48 | print('Pub/Sub published: ${response.messageIds}'); 49 | 50 | wait('Wait a little until published message is available for pulling.', 10); 51 | 52 | response = await pubsub.Pull(GoogleCloudProject, 'my-sub'); 53 | print('Pub/Sub pulled: ${response.receivedMessages[0].message.data}'); 54 | 55 | await pubsub.Close(); 56 | } 57 | 58 | class PubSub { 59 | static const String Hostname = 'pubsub.googleapis.com'; 60 | static const String ServicePublisher = 'google.pubsub.v1.Publisher'; 61 | static const String ServiceSubscriber = 'google.pubsub.v1.Subscriber'; 62 | 63 | static const List Scopes = const [ 64 | 'https://www.googleapis.com/auth/pubsub', 65 | 'https://www.googleapis.com/auth/cloud-platform', 66 | ]; 67 | 68 | final GrpcService _service; 69 | 70 | PubSub(this._service); 71 | 72 | static Future connect(String accessToken) async { 73 | var service = new GrpcService(Hostname, accessToken); 74 | await service.connect(); 75 | return new PubSub(service); 76 | } 77 | 78 | Future ListTopics(String project) async { 79 | var request = new ListTopicsRequest() 80 | ..project = 'projects/$project'; 81 | return await _service.invoke( 82 | ServicePublisher, 'ListTopics', request, new ListTopicsResponse()); 83 | } 84 | 85 | Future ListSubscriptions(String project, 86 | String topic) async { 87 | var request = new ListTopicSubscriptionsRequest() 88 | ..topic = 'projects/$project/topics/$topic'; 89 | return await _service.invoke( 90 | ServicePublisher, 'ListTopicSubscriptions', request, 91 | new ListTopicSubscriptionsResponse()); 92 | } 93 | 94 | Future CreateTopic(String project, String topic) async { 95 | var request = new Topic() 96 | ..name = 'projects/$project/topics/$topic'; 97 | return await _service.invoke( 98 | ServicePublisher, 'CreateTopic', request, new Topic()); 99 | } 100 | 101 | Future CreateSubscription(String project, 102 | String topic, 103 | String subscription) async { 104 | var request = new Subscription() 105 | ..topic = 'projects/$project/topics/$topic' 106 | ..name = 'projects/$project/subscriptions/$subscription'; 107 | return await _service.invoke( 108 | ServiceSubscriber, 'CreateSubscription', request, new Subscription()); 109 | } 110 | 111 | Future Publish(String project, String topic, List data) async { 112 | var request = new PublishRequest() 113 | ..topic = 'projects/$project/topics/$topic' 114 | ..messages.add(new PubsubMessage()..data = data); 115 | return await _service.invoke( 116 | ServicePublisher, 'Publish', request, new PublishResponse()); 117 | } 118 | 119 | Future Pull(String project, String subscription) async { 120 | var request = new PullRequest() 121 | ..subscription = 'projects/$project/subscriptions/$subscription' 122 | ..returnImmediately = true 123 | ..maxMessages = 1; 124 | return await _service.invoke( 125 | ServiceSubscriber, 'Pull', request, new PullResponse()); 126 | } 127 | 128 | Future Close() => _service.stop(); 129 | } 130 | 131 | Future obtainAccessToken(String serviceAccountFilename, 132 | List scopes) async { 133 | http.Client httpClient = new http.Client(); 134 | var content = new File(serviceAccountFilename).readAsStringSync(); 135 | var serviceAccount = new auth.ServiceAccountCredentials.fromJson(content); 136 | var credentials = await auth.obtainAccessCredentialsViaServiceAccount( 137 | serviceAccount, scopes, httpClient); 138 | await httpClient.close(); 139 | return credentials.accessToken.data; 140 | } 141 | 142 | Future wait(String message, int seconds) async { 143 | print(message); 144 | await new Future.delayed(new Duration(seconds: seconds)); 145 | } 146 | -------------------------------------------------------------------------------- /lib/grpc_poc.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015, 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 grpc_poc; 6 | 7 | import 'dart:async'; 8 | import 'dart:io'; 9 | import 'dart:convert'; 10 | 11 | import 'package:http2/transport.dart' as http2; 12 | import 'package:http2/src/testing/debug.dart' as http2_debug; 13 | import 'package:protobuf/protobuf.dart'; 14 | 15 | const bool Debug = false; 16 | const bool Verbose = false; 17 | 18 | class GrpcService { 19 | final String hostname; 20 | final String accessToken; 21 | 22 | GrpcService(this.hostname, this.accessToken); 23 | 24 | GrpcClientConnection _grpc; 25 | 26 | Future connect() async { 27 | var socket = await SecureSocket.connect( 28 | hostname, 443, supportedProtocols: ['h2']); 29 | 30 | var ins = socket; 31 | var outs = socket; 32 | if (Debug) { 33 | ins = http2_debug.decodeVerbose(socket, false, verbose: Verbose); 34 | outs = http2_debug.decodeOutgoingVerbose(socket, false, verbose: Verbose); 35 | } 36 | 37 | var connection = new http2.ClientTransportConnection.viaStreams(ins, outs); 38 | var authHeaders = []; 39 | if (accessToken != null) { 40 | authHeaders = [new http2.Header.ascii('authorization', 'Bearer $accessToken')]; 41 | } 42 | _grpc = new GrpcClientConnection('https', hostname, connection, authHeaders); 43 | } 44 | 45 | Future invoke(String service, 46 | String method, 47 | GeneratedMessage msg, 48 | GeneratedMessage result) { 49 | return _grpc.invoke(service, method, msg, result); 50 | } 51 | 52 | Future stop() => _grpc.stop(); 53 | } 54 | 55 | class GrpcClientConnection { 56 | final String scheme; 57 | final String authority; 58 | final http2.ClientTransportConnection connection; 59 | final List additionalHeaders; 60 | 61 | GrpcClientConnection(this.scheme, 62 | this.authority, 63 | this.connection, 64 | this.additionalHeaders); 65 | 66 | Future invoke(String service, 67 | String method, 68 | GeneratedMessage msg, 69 | GeneratedMessage result) async { 70 | var headers = [ 71 | new http2.Header.ascii(':method', 'POST'), 72 | new http2.Header.ascii(':scheme', scheme), 73 | new http2.Header.ascii(':path', '/$service/$method'), 74 | new http2.Header.ascii(':authority', authority), 75 | new http2.Header.ascii('grpc-timeout', '2S'), 76 | new http2.Header.ascii('content-type', 'application/grpc'), 77 | new http2.Header.ascii('te', 'trailers'), 78 | ]; 79 | headers.addAll(additionalHeaders); 80 | 81 | http2.TransportStream stream = connection.makeRequest(headers); 82 | fail(msg) { 83 | stream.terminate(); 84 | throw new Exception(msg); 85 | } 86 | 87 | // I) Sending request. 88 | 89 | var data = msg.writeToBuffer(); 90 | var len = data.length; 91 | stream.sendData([0 /* un-compressed */, 92 | (len >> 24) & 0xff, 93 | (len >> 16) & 0xff, 94 | (len >> 8) & 0xff, 95 | (len >> 0) & 0xff]); 96 | stream.sendData(data, endStream: true); 97 | 98 | // II) Start reading response. 99 | 100 | var messageIterator = new StreamIterator(stream.incomingMessages); 101 | Future readNextMessage({bool force: false}) async { 102 | bool hasMessage = await messageIterator.moveNext(); 103 | if (!hasMessage && force) { 104 | fail('Expected to get more HTTP/2 messages on grpc connection.'); 105 | } 106 | return hasMessage ? messageIterator.current : null; 107 | } 108 | 109 | // 1. Response headers message 110 | // Headers: { 111 | // ':status': '200', 112 | // 'content-type': 'application/grpc[+proto/json/...]', // optional 113 | // 'grpc-encoding': '[identity/gzip/defalte/...]', // optional 114 | // 'grpc-accept-encoding': '*[identity/gzip/...]', // optional 115 | // ... 116 | // } 117 | var message = await readNextMessage(force: true); 118 | if (message is! http2.HeadersStreamMessage) { 119 | fail('Expected response headers.'); 120 | } 121 | var responseHeaders = _headers2Map(message); 122 | var status = responseHeaders[':status']; 123 | var contentType = responseHeaders['content-type']; 124 | var grpcEncoding = responseHeaders['grpc-encoding']; 125 | if (status?.length != 1 || status[0] != '200') { 126 | fail('Expected status "200" (was: "$status")'); 127 | } 128 | if (contentType?.length != 1 || contentType[0] != 'application/grpc') { 129 | fail('Expected content-type "application/grpc" (was: "$contentType").'); 130 | } 131 | if (grpcEncoding != null) { 132 | grpcEncoding = grpcEncoding[0]; 133 | } 134 | 135 | // 2. Length-encoded messages (optionally compressed) 136 | var allBytes = new BytesBuilder(copy: false); 137 | message = await readNextMessage(force: true); 138 | while (message is http2.DataStreamMessage) { 139 | allBytes.add(message.bytes); 140 | message = await readNextMessage(force: false); 141 | } 142 | var responseData = allBytes.takeBytes(); 143 | 144 | // 3. Trailers 145 | // Headers: { 146 | // 'grpc-status': ..., 147 | // 'grpc-message': ..., 148 | // ... 149 | // } 150 | if (message is! http2.HeadersStreamMessage) { 151 | fail('Expected trailing headers'); 152 | } 153 | var trailingHeaders = _headers2Map(message); 154 | var grpcStatus = trailingHeaders['grpc-status']; 155 | var grpcMessage = trailingHeaders['grpc-message']; 156 | if (grpcStatus?.length != 1 || grpcStatus[0] != '0') { 157 | fail('Expected grpc-status of "0" ' 158 | '(was: "$grpcStatus", grpc-message was: "$grpcMessage")'); 159 | } 160 | 161 | // III) Decode message and return it. 162 | 163 | if (responseData.length < 5) { 164 | fail('Expected length-encoded message (bytes were: "$responseData")'); 165 | } 166 | 167 | bool compressed = responseData[0] == 1; 168 | if (compressed) { 169 | fail('Expected to get uncompressed message back, got compressed message' 170 | '(grpc encoding was: "$grpcEncoding"). No compression support yet!'); 171 | } 172 | 173 | var lengthBytes = responseData.sublist(1, 5); 174 | var length = lengthBytes[0] << 24 | 175 | lengthBytes[1] << 16 | 176 | lengthBytes[2] << 8 | 177 | lengthBytes[3]; 178 | if (length != (responseData.length - 5)) { 179 | fail('Expected exactly as many bytes as indicated in message header.'); 180 | } 181 | 182 | var realData = responseData.sublist(5); 183 | result.mergeFromBuffer(realData); 184 | return result; 185 | } 186 | 187 | Future stop() async { 188 | await connection.finish(); 189 | } 190 | } 191 | 192 | Map _headers2Map(http2.HeadersStreamMessage headers) { 193 | var headerMap = {}; 194 | for (var header in headers.headers) { 195 | headerMap.putIfAbsent(ASCII.decode(header.name), 196 | () => []).add(ASCII.decode(header.value)); 197 | } 198 | return headerMap; 199 | } 200 | -------------------------------------------------------------------------------- /example/protos/pubsub.pb.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | /// 4 | library google.pubsub.v1; 5 | 6 | import 'dart:async'; 7 | 8 | import 'package:fixnum/fixnum.dart'; 9 | import 'package:protobuf/protobuf.dart'; 10 | import 'empty.pb.dart' as google$protobuf; 11 | 12 | class Topic extends GeneratedMessage { 13 | static final BuilderInfo _i = new BuilderInfo('Topic') 14 | ..a(1, 'name', GeneratedMessage.OS) 15 | ..hasRequiredFields = false 16 | ; 17 | 18 | Topic() : super(); 19 | Topic.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 20 | Topic.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 21 | Topic clone() => new Topic()..mergeFromMessage(this); 22 | BuilderInfo get info_ => _i; 23 | static Topic create() => new Topic(); 24 | static PbList createRepeated() => new PbList(); 25 | 26 | String get name => getField(1); 27 | void set name(String v) { setField(1, v); } 28 | bool hasName() => hasField(1); 29 | void clearName() => clearField(1); 30 | } 31 | 32 | class PubsubMessage_AttributesEntry extends GeneratedMessage { 33 | static final BuilderInfo _i = new BuilderInfo('PubsubMessage_AttributesEntry') 34 | ..a(1, 'key', GeneratedMessage.OS) 35 | ..a(2, 'value', GeneratedMessage.OS) 36 | ..hasRequiredFields = false 37 | ; 38 | 39 | PubsubMessage_AttributesEntry() : super(); 40 | PubsubMessage_AttributesEntry.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 41 | PubsubMessage_AttributesEntry.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 42 | PubsubMessage_AttributesEntry clone() => new PubsubMessage_AttributesEntry()..mergeFromMessage(this); 43 | BuilderInfo get info_ => _i; 44 | static PubsubMessage_AttributesEntry create() => new PubsubMessage_AttributesEntry(); 45 | static PbList createRepeated() => new PbList(); 46 | 47 | String get key => getField(1); 48 | void set key(String v) { setField(1, v); } 49 | bool hasKey() => hasField(1); 50 | void clearKey() => clearField(1); 51 | 52 | String get value => getField(2); 53 | void set value(String v) { setField(2, v); } 54 | bool hasValue() => hasField(2); 55 | void clearValue() => clearField(2); 56 | } 57 | 58 | class PubsubMessage extends GeneratedMessage { 59 | static final BuilderInfo _i = new BuilderInfo('PubsubMessage') 60 | ..a(1, 'data', GeneratedMessage.OY) 61 | ..m(2, 'attributes', PubsubMessage_AttributesEntry.create, PubsubMessage_AttributesEntry.createRepeated) 62 | ..a(3, 'messageId', GeneratedMessage.OS) 63 | ..hasRequiredFields = false 64 | ; 65 | 66 | PubsubMessage() : super(); 67 | PubsubMessage.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 68 | PubsubMessage.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 69 | PubsubMessage clone() => new PubsubMessage()..mergeFromMessage(this); 70 | BuilderInfo get info_ => _i; 71 | static PubsubMessage create() => new PubsubMessage(); 72 | static PbList createRepeated() => new PbList(); 73 | 74 | List get data => getField(1); 75 | void set data(List v) { setField(1, v); } 76 | bool hasData() => hasField(1); 77 | void clearData() => clearField(1); 78 | 79 | List get attributes => getField(2); 80 | 81 | String get messageId => getField(3); 82 | void set messageId(String v) { setField(3, v); } 83 | bool hasMessageId() => hasField(3); 84 | void clearMessageId() => clearField(3); 85 | } 86 | 87 | class GetTopicRequest extends GeneratedMessage { 88 | static final BuilderInfo _i = new BuilderInfo('GetTopicRequest') 89 | ..a(1, 'topic', GeneratedMessage.OS) 90 | ..hasRequiredFields = false 91 | ; 92 | 93 | GetTopicRequest() : super(); 94 | GetTopicRequest.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 95 | GetTopicRequest.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 96 | GetTopicRequest clone() => new GetTopicRequest()..mergeFromMessage(this); 97 | BuilderInfo get info_ => _i; 98 | static GetTopicRequest create() => new GetTopicRequest(); 99 | static PbList createRepeated() => new PbList(); 100 | 101 | String get topic => getField(1); 102 | void set topic(String v) { setField(1, v); } 103 | bool hasTopic() => hasField(1); 104 | void clearTopic() => clearField(1); 105 | } 106 | 107 | class PublishRequest extends GeneratedMessage { 108 | static final BuilderInfo _i = new BuilderInfo('PublishRequest') 109 | ..a(1, 'topic', GeneratedMessage.OS) 110 | ..m(2, 'messages', PubsubMessage.create, PubsubMessage.createRepeated) 111 | ..hasRequiredFields = false 112 | ; 113 | 114 | PublishRequest() : super(); 115 | PublishRequest.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 116 | PublishRequest.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 117 | PublishRequest clone() => new PublishRequest()..mergeFromMessage(this); 118 | BuilderInfo get info_ => _i; 119 | static PublishRequest create() => new PublishRequest(); 120 | static PbList createRepeated() => new PbList(); 121 | 122 | String get topic => getField(1); 123 | void set topic(String v) { setField(1, v); } 124 | bool hasTopic() => hasField(1); 125 | void clearTopic() => clearField(1); 126 | 127 | List get messages => getField(2); 128 | } 129 | 130 | class PublishResponse extends GeneratedMessage { 131 | static final BuilderInfo _i = new BuilderInfo('PublishResponse') 132 | ..p(1, 'messageIds', GeneratedMessage.PS) 133 | ..hasRequiredFields = false 134 | ; 135 | 136 | PublishResponse() : super(); 137 | PublishResponse.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 138 | PublishResponse.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 139 | PublishResponse clone() => new PublishResponse()..mergeFromMessage(this); 140 | BuilderInfo get info_ => _i; 141 | static PublishResponse create() => new PublishResponse(); 142 | static PbList createRepeated() => new PbList(); 143 | 144 | List get messageIds => getField(1); 145 | } 146 | 147 | class ListTopicsRequest extends GeneratedMessage { 148 | static final BuilderInfo _i = new BuilderInfo('ListTopicsRequest') 149 | ..a(1, 'project', GeneratedMessage.OS) 150 | ..a(2, 'pageSize', GeneratedMessage.O3) 151 | ..a(3, 'pageToken', GeneratedMessage.OS) 152 | ..hasRequiredFields = false 153 | ; 154 | 155 | ListTopicsRequest() : super(); 156 | ListTopicsRequest.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 157 | ListTopicsRequest.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 158 | ListTopicsRequest clone() => new ListTopicsRequest()..mergeFromMessage(this); 159 | BuilderInfo get info_ => _i; 160 | static ListTopicsRequest create() => new ListTopicsRequest(); 161 | static PbList createRepeated() => new PbList(); 162 | 163 | String get project => getField(1); 164 | void set project(String v) { setField(1, v); } 165 | bool hasProject() => hasField(1); 166 | void clearProject() => clearField(1); 167 | 168 | int get pageSize => getField(2); 169 | void set pageSize(int v) { setField(2, v); } 170 | bool hasPageSize() => hasField(2); 171 | void clearPageSize() => clearField(2); 172 | 173 | String get pageToken => getField(3); 174 | void set pageToken(String v) { setField(3, v); } 175 | bool hasPageToken() => hasField(3); 176 | void clearPageToken() => clearField(3); 177 | } 178 | 179 | class ListTopicsResponse extends GeneratedMessage { 180 | static final BuilderInfo _i = new BuilderInfo('ListTopicsResponse') 181 | ..m(1, 'topics', Topic.create, Topic.createRepeated) 182 | ..a(2, 'nextPageToken', GeneratedMessage.OS) 183 | ..hasRequiredFields = false 184 | ; 185 | 186 | ListTopicsResponse() : super(); 187 | ListTopicsResponse.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 188 | ListTopicsResponse.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 189 | ListTopicsResponse clone() => new ListTopicsResponse()..mergeFromMessage(this); 190 | BuilderInfo get info_ => _i; 191 | static ListTopicsResponse create() => new ListTopicsResponse(); 192 | static PbList createRepeated() => new PbList(); 193 | 194 | List get topics => getField(1); 195 | 196 | String get nextPageToken => getField(2); 197 | void set nextPageToken(String v) { setField(2, v); } 198 | bool hasNextPageToken() => hasField(2); 199 | void clearNextPageToken() => clearField(2); 200 | } 201 | 202 | class ListTopicSubscriptionsRequest extends GeneratedMessage { 203 | static final BuilderInfo _i = new BuilderInfo('ListTopicSubscriptionsRequest') 204 | ..a(1, 'topic', GeneratedMessage.OS) 205 | ..a(2, 'pageSize', GeneratedMessage.O3) 206 | ..a(3, 'pageToken', GeneratedMessage.OS) 207 | ..hasRequiredFields = false 208 | ; 209 | 210 | ListTopicSubscriptionsRequest() : super(); 211 | ListTopicSubscriptionsRequest.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 212 | ListTopicSubscriptionsRequest.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 213 | ListTopicSubscriptionsRequest clone() => new ListTopicSubscriptionsRequest()..mergeFromMessage(this); 214 | BuilderInfo get info_ => _i; 215 | static ListTopicSubscriptionsRequest create() => new ListTopicSubscriptionsRequest(); 216 | static PbList createRepeated() => new PbList(); 217 | 218 | String get topic => getField(1); 219 | void set topic(String v) { setField(1, v); } 220 | bool hasTopic() => hasField(1); 221 | void clearTopic() => clearField(1); 222 | 223 | int get pageSize => getField(2); 224 | void set pageSize(int v) { setField(2, v); } 225 | bool hasPageSize() => hasField(2); 226 | void clearPageSize() => clearField(2); 227 | 228 | String get pageToken => getField(3); 229 | void set pageToken(String v) { setField(3, v); } 230 | bool hasPageToken() => hasField(3); 231 | void clearPageToken() => clearField(3); 232 | } 233 | 234 | class ListTopicSubscriptionsResponse extends GeneratedMessage { 235 | static final BuilderInfo _i = new BuilderInfo('ListTopicSubscriptionsResponse') 236 | ..p(1, 'subscriptions', GeneratedMessage.PS) 237 | ..a(2, 'nextPageToken', GeneratedMessage.OS) 238 | ..hasRequiredFields = false 239 | ; 240 | 241 | ListTopicSubscriptionsResponse() : super(); 242 | ListTopicSubscriptionsResponse.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 243 | ListTopicSubscriptionsResponse.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 244 | ListTopicSubscriptionsResponse clone() => new ListTopicSubscriptionsResponse()..mergeFromMessage(this); 245 | BuilderInfo get info_ => _i; 246 | static ListTopicSubscriptionsResponse create() => new ListTopicSubscriptionsResponse(); 247 | static PbList createRepeated() => new PbList(); 248 | 249 | List get subscriptions => getField(1); 250 | 251 | String get nextPageToken => getField(2); 252 | void set nextPageToken(String v) { setField(2, v); } 253 | bool hasNextPageToken() => hasField(2); 254 | void clearNextPageToken() => clearField(2); 255 | } 256 | 257 | class DeleteTopicRequest extends GeneratedMessage { 258 | static final BuilderInfo _i = new BuilderInfo('DeleteTopicRequest') 259 | ..a(1, 'topic', GeneratedMessage.OS) 260 | ..hasRequiredFields = false 261 | ; 262 | 263 | DeleteTopicRequest() : super(); 264 | DeleteTopicRequest.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 265 | DeleteTopicRequest.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 266 | DeleteTopicRequest clone() => new DeleteTopicRequest()..mergeFromMessage(this); 267 | BuilderInfo get info_ => _i; 268 | static DeleteTopicRequest create() => new DeleteTopicRequest(); 269 | static PbList createRepeated() => new PbList(); 270 | 271 | String get topic => getField(1); 272 | void set topic(String v) { setField(1, v); } 273 | bool hasTopic() => hasField(1); 274 | void clearTopic() => clearField(1); 275 | } 276 | 277 | class Subscription extends GeneratedMessage { 278 | static final BuilderInfo _i = new BuilderInfo('Subscription') 279 | ..a(1, 'name', GeneratedMessage.OS) 280 | ..a(2, 'topic', GeneratedMessage.OS) 281 | ..a(4, 'pushConfig', GeneratedMessage.OM, PushConfig.create, PushConfig.create) 282 | ..a(5, 'ackDeadlineSeconds', GeneratedMessage.O3) 283 | ..hasRequiredFields = false 284 | ; 285 | 286 | Subscription() : super(); 287 | Subscription.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 288 | Subscription.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 289 | Subscription clone() => new Subscription()..mergeFromMessage(this); 290 | BuilderInfo get info_ => _i; 291 | static Subscription create() => new Subscription(); 292 | static PbList createRepeated() => new PbList(); 293 | 294 | String get name => getField(1); 295 | void set name(String v) { setField(1, v); } 296 | bool hasName() => hasField(1); 297 | void clearName() => clearField(1); 298 | 299 | String get topic => getField(2); 300 | void set topic(String v) { setField(2, v); } 301 | bool hasTopic() => hasField(2); 302 | void clearTopic() => clearField(2); 303 | 304 | PushConfig get pushConfig => getField(4); 305 | void set pushConfig(PushConfig v) { setField(4, v); } 306 | bool hasPushConfig() => hasField(4); 307 | void clearPushConfig() => clearField(4); 308 | 309 | int get ackDeadlineSeconds => getField(5); 310 | void set ackDeadlineSeconds(int v) { setField(5, v); } 311 | bool hasAckDeadlineSeconds() => hasField(5); 312 | void clearAckDeadlineSeconds() => clearField(5); 313 | } 314 | 315 | class PushConfig_AttributesEntry extends GeneratedMessage { 316 | static final BuilderInfo _i = new BuilderInfo('PushConfig_AttributesEntry') 317 | ..a(1, 'key', GeneratedMessage.OS) 318 | ..a(2, 'value', GeneratedMessage.OS) 319 | ..hasRequiredFields = false 320 | ; 321 | 322 | PushConfig_AttributesEntry() : super(); 323 | PushConfig_AttributesEntry.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 324 | PushConfig_AttributesEntry.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 325 | PushConfig_AttributesEntry clone() => new PushConfig_AttributesEntry()..mergeFromMessage(this); 326 | BuilderInfo get info_ => _i; 327 | static PushConfig_AttributesEntry create() => new PushConfig_AttributesEntry(); 328 | static PbList createRepeated() => new PbList(); 329 | 330 | String get key => getField(1); 331 | void set key(String v) { setField(1, v); } 332 | bool hasKey() => hasField(1); 333 | void clearKey() => clearField(1); 334 | 335 | String get value => getField(2); 336 | void set value(String v) { setField(2, v); } 337 | bool hasValue() => hasField(2); 338 | void clearValue() => clearField(2); 339 | } 340 | 341 | class PushConfig extends GeneratedMessage { 342 | static final BuilderInfo _i = new BuilderInfo('PushConfig') 343 | ..a(1, 'pushEndpoint', GeneratedMessage.OS) 344 | ..m(2, 'attributes', PushConfig_AttributesEntry.create, PushConfig_AttributesEntry.createRepeated) 345 | ..hasRequiredFields = false 346 | ; 347 | 348 | PushConfig() : super(); 349 | PushConfig.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 350 | PushConfig.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 351 | PushConfig clone() => new PushConfig()..mergeFromMessage(this); 352 | BuilderInfo get info_ => _i; 353 | static PushConfig create() => new PushConfig(); 354 | static PbList createRepeated() => new PbList(); 355 | 356 | String get pushEndpoint => getField(1); 357 | void set pushEndpoint(String v) { setField(1, v); } 358 | bool hasPushEndpoint() => hasField(1); 359 | void clearPushEndpoint() => clearField(1); 360 | 361 | List get attributes => getField(2); 362 | } 363 | 364 | class ReceivedMessage extends GeneratedMessage { 365 | static final BuilderInfo _i = new BuilderInfo('ReceivedMessage') 366 | ..a(1, 'ackId', GeneratedMessage.OS) 367 | ..a(2, 'message', GeneratedMessage.OM, PubsubMessage.create, PubsubMessage.create) 368 | ..hasRequiredFields = false 369 | ; 370 | 371 | ReceivedMessage() : super(); 372 | ReceivedMessage.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 373 | ReceivedMessage.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 374 | ReceivedMessage clone() => new ReceivedMessage()..mergeFromMessage(this); 375 | BuilderInfo get info_ => _i; 376 | static ReceivedMessage create() => new ReceivedMessage(); 377 | static PbList createRepeated() => new PbList(); 378 | 379 | String get ackId => getField(1); 380 | void set ackId(String v) { setField(1, v); } 381 | bool hasAckId() => hasField(1); 382 | void clearAckId() => clearField(1); 383 | 384 | PubsubMessage get message => getField(2); 385 | void set message(PubsubMessage v) { setField(2, v); } 386 | bool hasMessage() => hasField(2); 387 | void clearMessage() => clearField(2); 388 | } 389 | 390 | class GetSubscriptionRequest extends GeneratedMessage { 391 | static final BuilderInfo _i = new BuilderInfo('GetSubscriptionRequest') 392 | ..a(1, 'subscription', GeneratedMessage.OS) 393 | ..hasRequiredFields = false 394 | ; 395 | 396 | GetSubscriptionRequest() : super(); 397 | GetSubscriptionRequest.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 398 | GetSubscriptionRequest.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 399 | GetSubscriptionRequest clone() => new GetSubscriptionRequest()..mergeFromMessage(this); 400 | BuilderInfo get info_ => _i; 401 | static GetSubscriptionRequest create() => new GetSubscriptionRequest(); 402 | static PbList createRepeated() => new PbList(); 403 | 404 | String get subscription => getField(1); 405 | void set subscription(String v) { setField(1, v); } 406 | bool hasSubscription() => hasField(1); 407 | void clearSubscription() => clearField(1); 408 | } 409 | 410 | class ListSubscriptionsRequest extends GeneratedMessage { 411 | static final BuilderInfo _i = new BuilderInfo('ListSubscriptionsRequest') 412 | ..a(1, 'project', GeneratedMessage.OS) 413 | ..a(2, 'pageSize', GeneratedMessage.O3) 414 | ..a(3, 'pageToken', GeneratedMessage.OS) 415 | ..hasRequiredFields = false 416 | ; 417 | 418 | ListSubscriptionsRequest() : super(); 419 | ListSubscriptionsRequest.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 420 | ListSubscriptionsRequest.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 421 | ListSubscriptionsRequest clone() => new ListSubscriptionsRequest()..mergeFromMessage(this); 422 | BuilderInfo get info_ => _i; 423 | static ListSubscriptionsRequest create() => new ListSubscriptionsRequest(); 424 | static PbList createRepeated() => new PbList(); 425 | 426 | String get project => getField(1); 427 | void set project(String v) { setField(1, v); } 428 | bool hasProject() => hasField(1); 429 | void clearProject() => clearField(1); 430 | 431 | int get pageSize => getField(2); 432 | void set pageSize(int v) { setField(2, v); } 433 | bool hasPageSize() => hasField(2); 434 | void clearPageSize() => clearField(2); 435 | 436 | String get pageToken => getField(3); 437 | void set pageToken(String v) { setField(3, v); } 438 | bool hasPageToken() => hasField(3); 439 | void clearPageToken() => clearField(3); 440 | } 441 | 442 | class ListSubscriptionsResponse extends GeneratedMessage { 443 | static final BuilderInfo _i = new BuilderInfo('ListSubscriptionsResponse') 444 | ..m(1, 'subscriptions', Subscription.create, Subscription.createRepeated) 445 | ..a(2, 'nextPageToken', GeneratedMessage.OS) 446 | ..hasRequiredFields = false 447 | ; 448 | 449 | ListSubscriptionsResponse() : super(); 450 | ListSubscriptionsResponse.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 451 | ListSubscriptionsResponse.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 452 | ListSubscriptionsResponse clone() => new ListSubscriptionsResponse()..mergeFromMessage(this); 453 | BuilderInfo get info_ => _i; 454 | static ListSubscriptionsResponse create() => new ListSubscriptionsResponse(); 455 | static PbList createRepeated() => new PbList(); 456 | 457 | List get subscriptions => getField(1); 458 | 459 | String get nextPageToken => getField(2); 460 | void set nextPageToken(String v) { setField(2, v); } 461 | bool hasNextPageToken() => hasField(2); 462 | void clearNextPageToken() => clearField(2); 463 | } 464 | 465 | class DeleteSubscriptionRequest extends GeneratedMessage { 466 | static final BuilderInfo _i = new BuilderInfo('DeleteSubscriptionRequest') 467 | ..a(1, 'subscription', GeneratedMessage.OS) 468 | ..hasRequiredFields = false 469 | ; 470 | 471 | DeleteSubscriptionRequest() : super(); 472 | DeleteSubscriptionRequest.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 473 | DeleteSubscriptionRequest.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 474 | DeleteSubscriptionRequest clone() => new DeleteSubscriptionRequest()..mergeFromMessage(this); 475 | BuilderInfo get info_ => _i; 476 | static DeleteSubscriptionRequest create() => new DeleteSubscriptionRequest(); 477 | static PbList createRepeated() => new PbList(); 478 | 479 | String get subscription => getField(1); 480 | void set subscription(String v) { setField(1, v); } 481 | bool hasSubscription() => hasField(1); 482 | void clearSubscription() => clearField(1); 483 | } 484 | 485 | class ModifyPushConfigRequest extends GeneratedMessage { 486 | static final BuilderInfo _i = new BuilderInfo('ModifyPushConfigRequest') 487 | ..a(1, 'subscription', GeneratedMessage.OS) 488 | ..a(2, 'pushConfig', GeneratedMessage.OM, PushConfig.create, PushConfig.create) 489 | ..hasRequiredFields = false 490 | ; 491 | 492 | ModifyPushConfigRequest() : super(); 493 | ModifyPushConfigRequest.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 494 | ModifyPushConfigRequest.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 495 | ModifyPushConfigRequest clone() => new ModifyPushConfigRequest()..mergeFromMessage(this); 496 | BuilderInfo get info_ => _i; 497 | static ModifyPushConfigRequest create() => new ModifyPushConfigRequest(); 498 | static PbList createRepeated() => new PbList(); 499 | 500 | String get subscription => getField(1); 501 | void set subscription(String v) { setField(1, v); } 502 | bool hasSubscription() => hasField(1); 503 | void clearSubscription() => clearField(1); 504 | 505 | PushConfig get pushConfig => getField(2); 506 | void set pushConfig(PushConfig v) { setField(2, v); } 507 | bool hasPushConfig() => hasField(2); 508 | void clearPushConfig() => clearField(2); 509 | } 510 | 511 | class PullRequest extends GeneratedMessage { 512 | static final BuilderInfo _i = new BuilderInfo('PullRequest') 513 | ..a(1, 'subscription', GeneratedMessage.OS) 514 | ..a(2, 'returnImmediately', GeneratedMessage.OB) 515 | ..a(3, 'maxMessages', GeneratedMessage.O3) 516 | ..hasRequiredFields = false 517 | ; 518 | 519 | PullRequest() : super(); 520 | PullRequest.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 521 | PullRequest.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 522 | PullRequest clone() => new PullRequest()..mergeFromMessage(this); 523 | BuilderInfo get info_ => _i; 524 | static PullRequest create() => new PullRequest(); 525 | static PbList createRepeated() => new PbList(); 526 | 527 | String get subscription => getField(1); 528 | void set subscription(String v) { setField(1, v); } 529 | bool hasSubscription() => hasField(1); 530 | void clearSubscription() => clearField(1); 531 | 532 | bool get returnImmediately => getField(2); 533 | void set returnImmediately(bool v) { setField(2, v); } 534 | bool hasReturnImmediately() => hasField(2); 535 | void clearReturnImmediately() => clearField(2); 536 | 537 | int get maxMessages => getField(3); 538 | void set maxMessages(int v) { setField(3, v); } 539 | bool hasMaxMessages() => hasField(3); 540 | void clearMaxMessages() => clearField(3); 541 | } 542 | 543 | class PullResponse extends GeneratedMessage { 544 | static final BuilderInfo _i = new BuilderInfo('PullResponse') 545 | ..m(1, 'receivedMessages', ReceivedMessage.create, ReceivedMessage.createRepeated) 546 | ..hasRequiredFields = false 547 | ; 548 | 549 | PullResponse() : super(); 550 | PullResponse.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 551 | PullResponse.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 552 | PullResponse clone() => new PullResponse()..mergeFromMessage(this); 553 | BuilderInfo get info_ => _i; 554 | static PullResponse create() => new PullResponse(); 555 | static PbList createRepeated() => new PbList(); 556 | 557 | List get receivedMessages => getField(1); 558 | } 559 | 560 | class ModifyAckDeadlineRequest extends GeneratedMessage { 561 | static final BuilderInfo _i = new BuilderInfo('ModifyAckDeadlineRequest') 562 | ..a(1, 'subscription', GeneratedMessage.OS) 563 | ..a(2, 'ackId', GeneratedMessage.OS) 564 | ..p(4, 'ackIds', GeneratedMessage.PS) 565 | ..a(3, 'ackDeadlineSeconds', GeneratedMessage.O3) 566 | ..hasRequiredFields = false 567 | ; 568 | 569 | ModifyAckDeadlineRequest() : super(); 570 | ModifyAckDeadlineRequest.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 571 | ModifyAckDeadlineRequest.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 572 | ModifyAckDeadlineRequest clone() => new ModifyAckDeadlineRequest()..mergeFromMessage(this); 573 | BuilderInfo get info_ => _i; 574 | static ModifyAckDeadlineRequest create() => new ModifyAckDeadlineRequest(); 575 | static PbList createRepeated() => new PbList(); 576 | 577 | String get subscription => getField(1); 578 | void set subscription(String v) { setField(1, v); } 579 | bool hasSubscription() => hasField(1); 580 | void clearSubscription() => clearField(1); 581 | 582 | String get ackId => getField(2); 583 | void set ackId(String v) { setField(2, v); } 584 | bool hasAckId() => hasField(2); 585 | void clearAckId() => clearField(2); 586 | 587 | List get ackIds => getField(4); 588 | 589 | int get ackDeadlineSeconds => getField(3); 590 | void set ackDeadlineSeconds(int v) { setField(3, v); } 591 | bool hasAckDeadlineSeconds() => hasField(3); 592 | void clearAckDeadlineSeconds() => clearField(3); 593 | } 594 | 595 | class AcknowledgeRequest extends GeneratedMessage { 596 | static final BuilderInfo _i = new BuilderInfo('AcknowledgeRequest') 597 | ..a(1, 'subscription', GeneratedMessage.OS) 598 | ..p(2, 'ackIds', GeneratedMessage.PS) 599 | ..hasRequiredFields = false 600 | ; 601 | 602 | AcknowledgeRequest() : super(); 603 | AcknowledgeRequest.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 604 | AcknowledgeRequest.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 605 | AcknowledgeRequest clone() => new AcknowledgeRequest()..mergeFromMessage(this); 606 | BuilderInfo get info_ => _i; 607 | static AcknowledgeRequest create() => new AcknowledgeRequest(); 608 | static PbList createRepeated() => new PbList(); 609 | 610 | String get subscription => getField(1); 611 | void set subscription(String v) { setField(1, v); } 612 | bool hasSubscription() => hasField(1); 613 | void clearSubscription() => clearField(1); 614 | 615 | List get ackIds => getField(2); 616 | } 617 | 618 | class ProcessPushMessageRequest extends GeneratedMessage { 619 | static final BuilderInfo _i = new BuilderInfo('ProcessPushMessageRequest') 620 | ..a(1, 'subscription', GeneratedMessage.OS) 621 | ..a(2, 'ackId', GeneratedMessage.OS) 622 | ..a(3, 'message', GeneratedMessage.OM, PubsubMessage.create, PubsubMessage.create) 623 | ..hasRequiredFields = false 624 | ; 625 | 626 | ProcessPushMessageRequest() : super(); 627 | ProcessPushMessageRequest.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 628 | ProcessPushMessageRequest.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 629 | ProcessPushMessageRequest clone() => new ProcessPushMessageRequest()..mergeFromMessage(this); 630 | BuilderInfo get info_ => _i; 631 | static ProcessPushMessageRequest create() => new ProcessPushMessageRequest(); 632 | static PbList createRepeated() => new PbList(); 633 | 634 | String get subscription => getField(1); 635 | void set subscription(String v) { setField(1, v); } 636 | bool hasSubscription() => hasField(1); 637 | void clearSubscription() => clearField(1); 638 | 639 | String get ackId => getField(2); 640 | void set ackId(String v) { setField(2, v); } 641 | bool hasAckId() => hasField(2); 642 | void clearAckId() => clearField(2); 643 | 644 | PubsubMessage get message => getField(3); 645 | void set message(PubsubMessage v) { setField(3, v); } 646 | bool hasMessage() => hasField(3); 647 | void clearMessage() => clearField(3); 648 | } 649 | 650 | class ProcessPushMessageResponse extends GeneratedMessage { 651 | static final BuilderInfo _i = new BuilderInfo('ProcessPushMessageResponse') 652 | ..a(1, 'acknowledgeExplicitly', GeneratedMessage.OB) 653 | ..hasRequiredFields = false 654 | ; 655 | 656 | ProcessPushMessageResponse() : super(); 657 | ProcessPushMessageResponse.fromBuffer(List i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r); 658 | ProcessPushMessageResponse.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY]) : super.fromJson(i, r); 659 | ProcessPushMessageResponse clone() => new ProcessPushMessageResponse()..mergeFromMessage(this); 660 | BuilderInfo get info_ => _i; 661 | static ProcessPushMessageResponse create() => new ProcessPushMessageResponse(); 662 | static PbList createRepeated() => new PbList(); 663 | 664 | bool get acknowledgeExplicitly => getField(1); 665 | void set acknowledgeExplicitly(bool v) { setField(1, v); } 666 | bool hasAcknowledgeExplicitly() => hasField(1); 667 | void clearAcknowledgeExplicitly() => clearField(1); 668 | } 669 | 670 | class PublisherApi { 671 | RpcClient _client; 672 | PublisherApi(this._client); 673 | 674 | Future createTopic(ClientContext ctx, Topic request) async { 675 | var emptyResponse = new Topic(); 676 | var result = await _client.invoke(ctx, 'Publisher', 'CreateTopic', request, emptyResponse); 677 | return result; 678 | } 679 | Future publish(ClientContext ctx, PublishRequest request) async { 680 | var emptyResponse = new PublishResponse(); 681 | var result = await _client.invoke(ctx, 'Publisher', 'Publish', request, emptyResponse); 682 | return result; 683 | } 684 | Future getTopic(ClientContext ctx, GetTopicRequest request) async { 685 | var emptyResponse = new Topic(); 686 | var result = await _client.invoke(ctx, 'Publisher', 'GetTopic', request, emptyResponse); 687 | return result; 688 | } 689 | Future listTopics(ClientContext ctx, ListTopicsRequest request) async { 690 | var emptyResponse = new ListTopicsResponse(); 691 | var result = await _client.invoke(ctx, 'Publisher', 'ListTopics', request, emptyResponse); 692 | return result; 693 | } 694 | Future listTopicSubscriptions(ClientContext ctx, ListTopicSubscriptionsRequest request) async { 695 | var emptyResponse = new ListTopicSubscriptionsResponse(); 696 | var result = await _client.invoke(ctx, 'Publisher', 'ListTopicSubscriptions', request, emptyResponse); 697 | return result; 698 | } 699 | Future deleteTopic(ClientContext ctx, DeleteTopicRequest request) async { 700 | var emptyResponse = new Empty(); 701 | var result = await _client.invoke(ctx, 'Publisher', 'DeleteTopic', request, emptyResponse); 702 | return result; 703 | } 704 | } 705 | 706 | class SubscriberApi { 707 | RpcClient _client; 708 | SubscriberApi(this._client); 709 | 710 | Future createSubscription(ClientContext ctx, Subscription request) async { 711 | var emptyResponse = new Subscription(); 712 | var result = await _client.invoke(ctx, 'Subscriber', 'CreateSubscription', request, emptyResponse); 713 | return result; 714 | } 715 | Future getSubscription(ClientContext ctx, GetSubscriptionRequest request) async { 716 | var emptyResponse = new Subscription(); 717 | var result = await _client.invoke(ctx, 'Subscriber', 'GetSubscription', request, emptyResponse); 718 | return result; 719 | } 720 | Future listSubscriptions(ClientContext ctx, ListSubscriptionsRequest request) async { 721 | var emptyResponse = new ListSubscriptionsResponse(); 722 | var result = await _client.invoke(ctx, 'Subscriber', 'ListSubscriptions', request, emptyResponse); 723 | return result; 724 | } 725 | Future deleteSubscription(ClientContext ctx, DeleteSubscriptionRequest request) async { 726 | var emptyResponse = new Empty(); 727 | var result = await _client.invoke(ctx, 'Subscriber', 'DeleteSubscription', request, emptyResponse); 728 | return result; 729 | } 730 | Future modifyAckDeadline(ClientContext ctx, ModifyAckDeadlineRequest request) async { 731 | var emptyResponse = new Empty(); 732 | var result = await _client.invoke(ctx, 'Subscriber', 'ModifyAckDeadline', request, emptyResponse); 733 | return result; 734 | } 735 | Future acknowledge(ClientContext ctx, AcknowledgeRequest request) async { 736 | var emptyResponse = new Empty(); 737 | var result = await _client.invoke(ctx, 'Subscriber', 'Acknowledge', request, emptyResponse); 738 | return result; 739 | } 740 | Future pull(ClientContext ctx, PullRequest request) async { 741 | var emptyResponse = new PullResponse(); 742 | var result = await _client.invoke(ctx, 'Subscriber', 'Pull', request, emptyResponse); 743 | return result; 744 | } 745 | Future modifyPushConfig(ClientContext ctx, ModifyPushConfigRequest request) async { 746 | var emptyResponse = new Empty(); 747 | var result = await _client.invoke(ctx, 'Subscriber', 'ModifyPushConfig', request, emptyResponse); 748 | return result; 749 | } 750 | } 751 | 752 | class PushEndpointApi { 753 | RpcClient _client; 754 | PushEndpointApi(this._client); 755 | 756 | Future processPushMessage(ClientContext ctx, ProcessPushMessageRequest request) async { 757 | var emptyResponse = new ProcessPushMessageResponse(); 758 | var result = await _client.invoke(ctx, 'PushEndpoint', 'ProcessPushMessage', request, emptyResponse); 759 | return result; 760 | } 761 | } 762 | 763 | abstract class PublisherServiceBase extends GeneratedService { 764 | Future createTopic(ServerContext ctx, Topic request); 765 | Future publish(ServerContext ctx, PublishRequest request); 766 | Future getTopic(ServerContext ctx, GetTopicRequest request); 767 | Future listTopics(ServerContext ctx, ListTopicsRequest request); 768 | Future listTopicSubscriptions(ServerContext ctx, ListTopicSubscriptionsRequest request); 769 | Future deleteTopic(ServerContext ctx, DeleteTopicRequest request); 770 | 771 | GeneratedMessage createRequest(String method) { 772 | switch (method) { 773 | case 'CreateTopic': return new Topic(); 774 | case 'Publish': return new PublishRequest(); 775 | case 'GetTopic': return new GetTopicRequest(); 776 | case 'ListTopics': return new ListTopicsRequest(); 777 | case 'ListTopicSubscriptions': return new ListTopicSubscriptionsRequest(); 778 | case 'DeleteTopic': return new DeleteTopicRequest(); 779 | default: throw new ArgumentError('Unknown method: $method'); 780 | } 781 | } 782 | 783 | Future handleCall(ServerContext ctx, String method, GeneratedMessage request) async { 784 | switch (method) { 785 | case 'CreateTopic': return await createTopic(ctx, request); 786 | case 'Publish': return await publish(ctx, request); 787 | case 'GetTopic': return await getTopic(ctx, request); 788 | case 'ListTopics': return await listTopics(ctx, request); 789 | case 'ListTopicSubscriptions': return await listTopicSubscriptions(ctx, request); 790 | case 'DeleteTopic': return await deleteTopic(ctx, request); 791 | default: throw new ArgumentError('Unknown method: $method'); 792 | } 793 | } 794 | } 795 | 796 | abstract class SubscriberServiceBase extends GeneratedService { 797 | Future createSubscription(ServerContext ctx, Subscription request); 798 | Future getSubscription(ServerContext ctx, GetSubscriptionRequest request); 799 | Future listSubscriptions(ServerContext ctx, ListSubscriptionsRequest request); 800 | Future deleteSubscription(ServerContext ctx, DeleteSubscriptionRequest request); 801 | Future modifyAckDeadline(ServerContext ctx, ModifyAckDeadlineRequest request); 802 | Future acknowledge(ServerContext ctx, AcknowledgeRequest request); 803 | Future pull(ServerContext ctx, PullRequest request); 804 | Future modifyPushConfig(ServerContext ctx, ModifyPushConfigRequest request); 805 | 806 | GeneratedMessage createRequest(String method) { 807 | switch (method) { 808 | case 'CreateSubscription': return new Subscription(); 809 | case 'GetSubscription': return new GetSubscriptionRequest(); 810 | case 'ListSubscriptions': return new ListSubscriptionsRequest(); 811 | case 'DeleteSubscription': return new DeleteSubscriptionRequest(); 812 | case 'ModifyAckDeadline': return new ModifyAckDeadlineRequest(); 813 | case 'Acknowledge': return new AcknowledgeRequest(); 814 | case 'Pull': return new PullRequest(); 815 | case 'ModifyPushConfig': return new ModifyPushConfigRequest(); 816 | default: throw new ArgumentError('Unknown method: $method'); 817 | } 818 | } 819 | 820 | Future handleCall(ServerContext ctx, String method, GeneratedMessage request) async { 821 | switch (method) { 822 | case 'CreateSubscription': return await createSubscription(ctx, request); 823 | case 'GetSubscription': return await getSubscription(ctx, request); 824 | case 'ListSubscriptions': return await listSubscriptions(ctx, request); 825 | case 'DeleteSubscription': return await deleteSubscription(ctx, request); 826 | case 'ModifyAckDeadline': return await modifyAckDeadline(ctx, request); 827 | case 'Acknowledge': return await acknowledge(ctx, request); 828 | case 'Pull': return await pull(ctx, request); 829 | case 'ModifyPushConfig': return await modifyPushConfig(ctx, request); 830 | default: throw new ArgumentError('Unknown method: $method'); 831 | } 832 | } 833 | } 834 | 835 | abstract class PushEndpointServiceBase extends GeneratedService { 836 | Future processPushMessage(ServerContext ctx, ProcessPushMessageRequest request); 837 | 838 | GeneratedMessage createRequest(String method) { 839 | switch (method) { 840 | case 'ProcessPushMessage': return new ProcessPushMessageRequest(); 841 | default: throw new ArgumentError('Unknown method: $method'); 842 | } 843 | } 844 | 845 | Future handleCall(ServerContext ctx, String method, GeneratedMessage request) async { 846 | switch (method) { 847 | case 'ProcessPushMessage': return await processPushMessage(ctx, request); 848 | default: throw new ArgumentError('Unknown method: $method'); 849 | } 850 | } 851 | } 852 | 853 | --------------------------------------------------------------------------------