| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of gcloud.pubsub; | 5 part of gcloud.pubsub; |
| 6 | 6 |
| 7 class _PubSubImpl implements PubSub { | 7 class _PubSubImpl implements PubSub { |
| 8 final http.Client _client; | 8 final http.Client _client; |
| 9 final String project; | 9 final String project; |
| 10 final pubsub.PubsubApi _api; | 10 final pubsub.PubsubApi _api; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 ..maxMessages = 1 | 100 ..maxMessages = 1 |
| 101 ..returnImmediately = returnImmediately; | 101 ..returnImmediately = returnImmediately; |
| 102 return _api.projects.subscriptions.pull(request, subscription); | 102 return _api.projects.subscriptions.pull(request, subscription); |
| 103 } | 103 } |
| 104 | 104 |
| 105 Future _ack(String ackId, String subscription) { | 105 Future _ack(String ackId, String subscription) { |
| 106 var request = new pubsub.AcknowledgeRequest() | 106 var request = new pubsub.AcknowledgeRequest() |
| 107 ..ackIds = [ ackId ]; | 107 ..ackIds = [ ackId ]; |
| 108 // The Pub/Sub acknowledge API returns an instance of Empty. | 108 // The Pub/Sub acknowledge API returns an instance of Empty. |
| 109 return _api.projects.subscriptions.acknowledge( | 109 return _api.projects.subscriptions.acknowledge( |
| 110 request, subscription).then((_) => null);; | 110 request, subscription).then((_) => null); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void _checkTopicName(name) { | 113 void _checkTopicName(name) { |
| 114 if (name.startsWith('projects/') && !name.contains('/topics/')) { | 114 if (name.startsWith('projects/') && !name.contains('/topics/')) { |
| 115 throw new ArgumentError( | 115 throw new ArgumentError( |
| 116 "Illegal topic name. Absolute topic names must have the form " | 116 "Illegal topic name. Absolute topic names must have the form " |
| 117 "'projects/[project-id]/topics/[topic-name]"); | 117 "'projects/[project-id]/topics/[topic-name]"); |
| 118 } | 118 } |
| 119 if (name.endsWith('/topics/')) { | 119 if (name.endsWith('/topics/')) { |
| 120 throw new ArgumentError( | 120 throw new ArgumentError( |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 Future<Page<Subscription>> next({int pageSize}) { | 470 Future<Page<Subscription>> next({int pageSize}) { |
| 471 if (_nextPageToken == null) return new Future.value(null); | 471 if (_nextPageToken == null) return new Future.value(null); |
| 472 if (pageSize == null) pageSize = this._pageSize; | 472 if (pageSize == null) pageSize = this._pageSize; |
| 473 | 473 |
| 474 return _api._listSubscriptions( | 474 return _api._listSubscriptions( |
| 475 _topic, pageSize, _nextPageToken).then((response) { | 475 _topic, pageSize, _nextPageToken).then((response) { |
| 476 return new _SubscriptionPageImpl(_api, _topic, pageSize, response); | 476 return new _SubscriptionPageImpl(_api, _topic, pageSize, response); |
| 477 }); | 477 }); |
| 478 } | 478 } |
| 479 } | 479 } |
| OLD | NEW |