Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: generated/googleapis_beta/lib/pubsub/v1beta1.dart

Issue 559053002: Generate 0.1.0 version of googleapis/googleapis_beta (Closed) Base URL: git@github.com:dart-lang/googleapis.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 library googleapis_beta.pubsub.v1beta1;
2
3 import "dart:core" as core;
4 import "dart:collection" as collection;
5 import "dart:async" as async;
6 import "dart:convert" as convert;
7
8 import "package:crypto/crypto.dart" as crypto;
9 import 'package:http/http.dart' as http;
10 import '../src/common_internal.dart' as common_internal;
11 import '../common/common.dart' as common;
12
13 export '../common/common.dart' show ApiRequestError;
14 export '../common/common.dart' show DetailedApiRequestError;
15
16 /**
17 * Provides reliable, many-to-many, asynchronous messaging between applications.
18 */
19 class PubsubApi {
20 /** View and manage your data across Google Cloud Platform services */
21 static const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platf orm";
22
23 /** View and manage Pub/Sub topics and subscriptions */
24 static const PubsubScope = "https://www.googleapis.com/auth/pubsub";
25
26
27 final common_internal.ApiRequester _requester;
28
29 SubscriptionsResourceApi get subscriptions => new SubscriptionsResourceApi(_re quester);
30 TopicsResourceApi get topics => new TopicsResourceApi(_requester);
31
32 PubsubApi(http.Client client) :
33 _requester = new common_internal.ApiRequester(client, "https://www.googlea pis.com/", "/pubsub/v1beta1/");
34 }
35
36
37 /** Not documented yet. */
38 class SubscriptionsResourceApi {
39 final common_internal.ApiRequester _requester;
40
41 SubscriptionsResourceApi(common_internal.ApiRequester client) :
42 _requester = client;
43
44 /**
45 * Acknowledges a particular received message: the Pub/Sub system can remove
46 * the given message from the subscription. Acknowledging a message whose Ack
47 * deadline has expired may succeed, but the message could have been already
48 * redelivered. Acknowledging a message more than once will not result in an
49 * error. This is only used for messages received via pull.
50 *
51 * [request] - The metadata request object.
52 *
53 * Request parameters:
54 *
55 * Completes with a [common.ApiRequestError] if the API endpoint returned an
56 * error.
57 *
58 * If the used [http.Client] completes with an error when making a REST call,
59 * this method will complete with the same error.
60 */
61 async.Future acknowledge(AcknowledgeRequest request) {
62 var _url = null;
63 var _queryParams = new core.Map();
64 var _uploadMedia = null;
65 var _uploadOptions = null;
66 var _downloadOptions = common.DownloadOptions.Metadata;
67 var _body = null;
68
69 if (request != null) {
70 _body = convert.JSON.encode((request).toJson());
71 }
72
73 _downloadOptions = null;
74
75 _url = 'subscriptions/acknowledge';
76
77 var _response = _requester.request(_url,
78 "POST",
79 body: _body,
80 queryParams: _queryParams,
81 uploadOptions: _uploadOptions,
82 uploadMedia: _uploadMedia,
83 downloadOptions: _downloadOptions);
84 return _response.then((data) => null);
85 }
86
87 /**
88 * Creates a subscription on a given topic for a given subscriber. If the
89 * subscription already exists, returns ALREADY_EXISTS. If the corresponding
90 * topic doesn't exist, returns NOT_FOUND.
91 *
92 * [request] - The metadata request object.
93 *
94 * Request parameters:
95 *
96 * Completes with a [Subscription].
97 *
98 * Completes with a [common.ApiRequestError] if the API endpoint returned an
99 * error.
100 *
101 * If the used [http.Client] completes with an error when making a REST call,
102 * this method will complete with the same error.
103 */
104 async.Future<Subscription> create(Subscription request) {
105 var _url = null;
106 var _queryParams = new core.Map();
107 var _uploadMedia = null;
108 var _uploadOptions = null;
109 var _downloadOptions = common.DownloadOptions.Metadata;
110 var _body = null;
111
112 if (request != null) {
113 _body = convert.JSON.encode((request).toJson());
114 }
115
116
117 _url = 'subscriptions';
118
119 var _response = _requester.request(_url,
120 "POST",
121 body: _body,
122 queryParams: _queryParams,
123 uploadOptions: _uploadOptions,
124 uploadMedia: _uploadMedia,
125 downloadOptions: _downloadOptions);
126 return _response.then((data) => new Subscription.fromJson(data));
127 }
128
129 /**
130 * Deletes an existing subscription. All pending messages in the subscription
131 * are immediately dropped. Calls to Pull after deletion will return
132 * NOT_FOUND.
133 *
134 * Request parameters:
135 *
136 * [subscription] - The subscription to delete.
137 *
138 * Completes with a [common.ApiRequestError] if the API endpoint returned an
139 * error.
140 *
141 * If the used [http.Client] completes with an error when making a REST call,
142 * this method will complete with the same error.
143 */
144 async.Future delete(core.String subscription) {
145 var _url = null;
146 var _queryParams = new core.Map();
147 var _uploadMedia = null;
148 var _uploadOptions = null;
149 var _downloadOptions = common.DownloadOptions.Metadata;
150 var _body = null;
151
152 if (subscription == null) {
153 throw new core.ArgumentError("Parameter subscription is required.");
154 }
155
156 _downloadOptions = null;
157
158 _url = 'subscriptions/' + common_internal.Escaper.ecapeVariableReserved('$su bscription');
159
160 var _response = _requester.request(_url,
161 "DELETE",
162 body: _body,
163 queryParams: _queryParams,
164 uploadOptions: _uploadOptions,
165 uploadMedia: _uploadMedia,
166 downloadOptions: _downloadOptions);
167 return _response.then((data) => null);
168 }
169
170 /**
171 * Gets the configuration details of a subscription.
172 *
173 * Request parameters:
174 *
175 * [subscription] - The name of the subscription to get.
176 *
177 * Completes with a [Subscription].
178 *
179 * Completes with a [common.ApiRequestError] if the API endpoint returned an
180 * error.
181 *
182 * If the used [http.Client] completes with an error when making a REST call,
183 * this method will complete with the same error.
184 */
185 async.Future<Subscription> get(core.String subscription) {
186 var _url = null;
187 var _queryParams = new core.Map();
188 var _uploadMedia = null;
189 var _uploadOptions = null;
190 var _downloadOptions = common.DownloadOptions.Metadata;
191 var _body = null;
192
193 if (subscription == null) {
194 throw new core.ArgumentError("Parameter subscription is required.");
195 }
196
197
198 _url = 'subscriptions/' + common_internal.Escaper.ecapeVariableReserved('$su bscription');
199
200 var _response = _requester.request(_url,
201 "GET",
202 body: _body,
203 queryParams: _queryParams,
204 uploadOptions: _uploadOptions,
205 uploadMedia: _uploadMedia,
206 downloadOptions: _downloadOptions);
207 return _response.then((data) => new Subscription.fromJson(data));
208 }
209
210 /**
211 * Lists matching subscriptions.
212 *
213 * Request parameters:
214 *
215 * [maxResults] - Maximum number of subscriptions to return.
216 *
217 * [pageToken] - The value obtained in the last ListSubscriptionsResponse for
218 * continuation.
219 *
220 * [query] - A valid label query expression.
221 *
222 * Completes with a [ListSubscriptionsResponse].
223 *
224 * Completes with a [common.ApiRequestError] if the API endpoint returned an
225 * error.
226 *
227 * If the used [http.Client] completes with an error when making a REST call,
228 * this method will complete with the same error.
229 */
230 async.Future<ListSubscriptionsResponse> list({core.int maxResults, core.String pageToken, core.String query}) {
231 var _url = null;
232 var _queryParams = new core.Map();
233 var _uploadMedia = null;
234 var _uploadOptions = null;
235 var _downloadOptions = common.DownloadOptions.Metadata;
236 var _body = null;
237
238 if (maxResults != null) {
239 _queryParams["maxResults"] = ["${maxResults}"];
240 }
241 if (pageToken != null) {
242 _queryParams["pageToken"] = [pageToken];
243 }
244 if (query != null) {
245 _queryParams["query"] = [query];
246 }
247
248
249 _url = 'subscriptions';
250
251 var _response = _requester.request(_url,
252 "GET",
253 body: _body,
254 queryParams: _queryParams,
255 uploadOptions: _uploadOptions,
256 uploadMedia: _uploadMedia,
257 downloadOptions: _downloadOptions);
258 return _response.then((data) => new ListSubscriptionsResponse.fromJson(data) );
259 }
260
261 /**
262 * Modifies the Ack deadline for a message received from a pull request.
263 *
264 * [request] - The metadata request object.
265 *
266 * Request parameters:
267 *
268 * Completes with a [common.ApiRequestError] if the API endpoint returned an
269 * error.
270 *
271 * If the used [http.Client] completes with an error when making a REST call,
272 * this method will complete with the same error.
273 */
274 async.Future modifyAckDeadline(ModifyAckDeadlineRequest request) {
275 var _url = null;
276 var _queryParams = new core.Map();
277 var _uploadMedia = null;
278 var _uploadOptions = null;
279 var _downloadOptions = common.DownloadOptions.Metadata;
280 var _body = null;
281
282 if (request != null) {
283 _body = convert.JSON.encode((request).toJson());
284 }
285
286 _downloadOptions = null;
287
288 _url = 'subscriptions/modifyAckDeadline';
289
290 var _response = _requester.request(_url,
291 "POST",
292 body: _body,
293 queryParams: _queryParams,
294 uploadOptions: _uploadOptions,
295 uploadMedia: _uploadMedia,
296 downloadOptions: _downloadOptions);
297 return _response.then((data) => null);
298 }
299
300 /**
301 * Modifies the PushConfig for a specified subscription. This method can be
302 * used to suspend the flow of messages to an end point by clearing the
303 * PushConfig field in the request. Messages will be accumulated for delivery
304 * even if no push configuration is defined or while the configuration is
305 * modified.
306 *
307 * [request] - The metadata request object.
308 *
309 * Request parameters:
310 *
311 * Completes with a [common.ApiRequestError] if the API endpoint returned an
312 * error.
313 *
314 * If the used [http.Client] completes with an error when making a REST call,
315 * this method will complete with the same error.
316 */
317 async.Future modifyPushConfig(ModifyPushConfigRequest request) {
318 var _url = null;
319 var _queryParams = new core.Map();
320 var _uploadMedia = null;
321 var _uploadOptions = null;
322 var _downloadOptions = common.DownloadOptions.Metadata;
323 var _body = null;
324
325 if (request != null) {
326 _body = convert.JSON.encode((request).toJson());
327 }
328
329 _downloadOptions = null;
330
331 _url = 'subscriptions/modifyPushConfig';
332
333 var _response = _requester.request(_url,
334 "POST",
335 body: _body,
336 queryParams: _queryParams,
337 uploadOptions: _uploadOptions,
338 uploadMedia: _uploadMedia,
339 downloadOptions: _downloadOptions);
340 return _response.then((data) => null);
341 }
342
343 /**
344 * Pulls a single message from the server. If return_immediately is true, and
345 * no messages are available in the subscription, this method returns
346 * FAILED_PRECONDITION. The system is free to return an UNAVAILABLE error if
347 * no messages are available in a reasonable amount of time (to reduce system
348 * load).
349 *
350 * [request] - The metadata request object.
351 *
352 * Request parameters:
353 *
354 * Completes with a [PullResponse].
355 *
356 * Completes with a [common.ApiRequestError] if the API endpoint returned an
357 * error.
358 *
359 * If the used [http.Client] completes with an error when making a REST call,
360 * this method will complete with the same error.
361 */
362 async.Future<PullResponse> pull(PullRequest request) {
363 var _url = null;
364 var _queryParams = new core.Map();
365 var _uploadMedia = null;
366 var _uploadOptions = null;
367 var _downloadOptions = common.DownloadOptions.Metadata;
368 var _body = null;
369
370 if (request != null) {
371 _body = convert.JSON.encode((request).toJson());
372 }
373
374
375 _url = 'subscriptions/pull';
376
377 var _response = _requester.request(_url,
378 "POST",
379 body: _body,
380 queryParams: _queryParams,
381 uploadOptions: _uploadOptions,
382 uploadMedia: _uploadMedia,
383 downloadOptions: _downloadOptions);
384 return _response.then((data) => new PullResponse.fromJson(data));
385 }
386
387 }
388
389
390 /** Not documented yet. */
391 class TopicsResourceApi {
392 final common_internal.ApiRequester _requester;
393
394 TopicsResourceApi(common_internal.ApiRequester client) :
395 _requester = client;
396
397 /**
398 * Creates the given topic with the given name.
399 *
400 * [request] - The metadata request object.
401 *
402 * Request parameters:
403 *
404 * Completes with a [Topic].
405 *
406 * Completes with a [common.ApiRequestError] if the API endpoint returned an
407 * error.
408 *
409 * If the used [http.Client] completes with an error when making a REST call,
410 * this method will complete with the same error.
411 */
412 async.Future<Topic> create(Topic request) {
413 var _url = null;
414 var _queryParams = new core.Map();
415 var _uploadMedia = null;
416 var _uploadOptions = null;
417 var _downloadOptions = common.DownloadOptions.Metadata;
418 var _body = null;
419
420 if (request != null) {
421 _body = convert.JSON.encode((request).toJson());
422 }
423
424
425 _url = 'topics';
426
427 var _response = _requester.request(_url,
428 "POST",
429 body: _body,
430 queryParams: _queryParams,
431 uploadOptions: _uploadOptions,
432 uploadMedia: _uploadMedia,
433 downloadOptions: _downloadOptions);
434 return _response.then((data) => new Topic.fromJson(data));
435 }
436
437 /**
438 * Deletes the topic with the given name. All subscriptions to this topic are
439 * also deleted. Returns NOT_FOUND if the topic does not exist. After a topic
440 * is deleted, a new topic may be created with the same name.
441 *
442 * Request parameters:
443 *
444 * [topic] - Name of the topic to delete.
445 *
446 * Completes with a [common.ApiRequestError] if the API endpoint returned an
447 * error.
448 *
449 * If the used [http.Client] completes with an error when making a REST call,
450 * this method will complete with the same error.
451 */
452 async.Future delete(core.String topic) {
453 var _url = null;
454 var _queryParams = new core.Map();
455 var _uploadMedia = null;
456 var _uploadOptions = null;
457 var _downloadOptions = common.DownloadOptions.Metadata;
458 var _body = null;
459
460 if (topic == null) {
461 throw new core.ArgumentError("Parameter topic is required.");
462 }
463
464 _downloadOptions = null;
465
466 _url = 'topics/' + common_internal.Escaper.ecapeVariableReserved('$topic');
467
468 var _response = _requester.request(_url,
469 "DELETE",
470 body: _body,
471 queryParams: _queryParams,
472 uploadOptions: _uploadOptions,
473 uploadMedia: _uploadMedia,
474 downloadOptions: _downloadOptions);
475 return _response.then((data) => null);
476 }
477
478 /**
479 * Gets the configuration of a topic. Since the topic only has the name
480 * attribute, this method is only useful to check the existence of a topic. If
481 * other attributes are added in the future, they will be returned here.
482 *
483 * Request parameters:
484 *
485 * [topic] - The name of the topic to get.
486 *
487 * Completes with a [Topic].
488 *
489 * Completes with a [common.ApiRequestError] if the API endpoint returned an
490 * error.
491 *
492 * If the used [http.Client] completes with an error when making a REST call,
493 * this method will complete with the same error.
494 */
495 async.Future<Topic> get(core.String topic) {
496 var _url = null;
497 var _queryParams = new core.Map();
498 var _uploadMedia = null;
499 var _uploadOptions = null;
500 var _downloadOptions = common.DownloadOptions.Metadata;
501 var _body = null;
502
503 if (topic == null) {
504 throw new core.ArgumentError("Parameter topic is required.");
505 }
506
507
508 _url = 'topics/' + common_internal.Escaper.ecapeVariableReserved('$topic');
509
510 var _response = _requester.request(_url,
511 "GET",
512 body: _body,
513 queryParams: _queryParams,
514 uploadOptions: _uploadOptions,
515 uploadMedia: _uploadMedia,
516 downloadOptions: _downloadOptions);
517 return _response.then((data) => new Topic.fromJson(data));
518 }
519
520 /**
521 * Lists matching topics.
522 *
523 * Request parameters:
524 *
525 * [maxResults] - Maximum number of topics to return.
526 *
527 * [pageToken] - The value obtained in the last ListTopicsResponse for
528 * continuation.
529 *
530 * [query] - A valid label query expression.
531 *
532 * Completes with a [ListTopicsResponse].
533 *
534 * Completes with a [common.ApiRequestError] if the API endpoint returned an
535 * error.
536 *
537 * If the used [http.Client] completes with an error when making a REST call,
538 * this method will complete with the same error.
539 */
540 async.Future<ListTopicsResponse> list({core.int maxResults, core.String pageTo ken, core.String query}) {
541 var _url = null;
542 var _queryParams = new core.Map();
543 var _uploadMedia = null;
544 var _uploadOptions = null;
545 var _downloadOptions = common.DownloadOptions.Metadata;
546 var _body = null;
547
548 if (maxResults != null) {
549 _queryParams["maxResults"] = ["${maxResults}"];
550 }
551 if (pageToken != null) {
552 _queryParams["pageToken"] = [pageToken];
553 }
554 if (query != null) {
555 _queryParams["query"] = [query];
556 }
557
558
559 _url = 'topics';
560
561 var _response = _requester.request(_url,
562 "GET",
563 body: _body,
564 queryParams: _queryParams,
565 uploadOptions: _uploadOptions,
566 uploadMedia: _uploadMedia,
567 downloadOptions: _downloadOptions);
568 return _response.then((data) => new ListTopicsResponse.fromJson(data));
569 }
570
571 /**
572 * Adds a message to the topic. Returns NOT_FOUND if the topic does not exist.
573 *
574 * [request] - The metadata request object.
575 *
576 * Request parameters:
577 *
578 * Completes with a [common.ApiRequestError] if the API endpoint returned an
579 * error.
580 *
581 * If the used [http.Client] completes with an error when making a REST call,
582 * this method will complete with the same error.
583 */
584 async.Future publish(PublishRequest request) {
585 var _url = null;
586 var _queryParams = new core.Map();
587 var _uploadMedia = null;
588 var _uploadOptions = null;
589 var _downloadOptions = common.DownloadOptions.Metadata;
590 var _body = null;
591
592 if (request != null) {
593 _body = convert.JSON.encode((request).toJson());
594 }
595
596 _downloadOptions = null;
597
598 _url = 'topics/publish';
599
600 var _response = _requester.request(_url,
601 "POST",
602 body: _body,
603 queryParams: _queryParams,
604 uploadOptions: _uploadOptions,
605 uploadMedia: _uploadMedia,
606 downloadOptions: _downloadOptions);
607 return _response.then((data) => null);
608 }
609
610 }
611
612
613
614 /** Not documented yet. */
615 class AcknowledgeRequest {
616 /**
617 * The Ack ID for the message being acknowledged. This was returned by the
618 * Pub/Sub system in the Pull response.
619 */
620 core.List<core.String> ackId;
621
622 /** The subscription whose message is being acknowledged. */
623 core.String subscription;
624
625
626 AcknowledgeRequest();
627
628 AcknowledgeRequest.fromJson(core.Map _json) {
629 if (_json.containsKey("ackId")) {
630 ackId = _json["ackId"];
631 }
632 if (_json.containsKey("subscription")) {
633 subscription = _json["subscription"];
634 }
635 }
636
637 core.Map toJson() {
638 var _json = new core.Map();
639 if (ackId != null) {
640 _json["ackId"] = ackId;
641 }
642 if (subscription != null) {
643 _json["subscription"] = subscription;
644 }
645 return _json;
646 }
647 }
648
649
650 /** A key-value pair applied to a given object. */
651 class Label {
652 /**
653 * The key of a label is a syntactically valid URL (as per RFC 1738) with the
654 * "scheme" and initial slashes omitted and with the additional restrictions
655 * noted below. Each key should be globally unique. The "host" portion is
656 * called the "namespace" and is not necessarily resolvable to a network
657 * endpoint. Instead, the namespace indicates what system or entity defines
658 * the semantics of the label. Namespaces do not restrict the set of objects
659 * to which a label may be associated.
660 *
661 * Keys are defined by the following grammar:
662 *
663 * key = hostname "/" kpath kpath = ksegment *[ "/" ksegment ] ksegment =
664 * alphadigit | *[ alphadigit | "-" | "_" | "." ]
665 *
666 * where "hostname" and "alphadigit" are defined as in RFC 1738.
667 *
668 * Example key: spanner.google.com/universe
669 */
670 core.String key;
671
672 /** An integer value. */
673 core.String numValue;
674
675 /** A string value. */
676 core.String strValue;
677
678
679 Label();
680
681 Label.fromJson(core.Map _json) {
682 if (_json.containsKey("key")) {
683 key = _json["key"];
684 }
685 if (_json.containsKey("numValue")) {
686 numValue = _json["numValue"];
687 }
688 if (_json.containsKey("strValue")) {
689 strValue = _json["strValue"];
690 }
691 }
692
693 core.Map toJson() {
694 var _json = new core.Map();
695 if (key != null) {
696 _json["key"] = key;
697 }
698 if (numValue != null) {
699 _json["numValue"] = numValue;
700 }
701 if (strValue != null) {
702 _json["strValue"] = strValue;
703 }
704 return _json;
705 }
706 }
707
708
709 /** Not documented yet. */
710 class ListSubscriptionsResponse {
711 /**
712 * If not empty, indicates that there are more subscriptions that match the
713 * request and this value should be passed to the next
714 * ListSubscriptionsRequest to continue.
715 */
716 core.String nextPageToken;
717
718 /** The subscriptions that match the request. */
719 core.List<Subscription> subscription;
720
721
722 ListSubscriptionsResponse();
723
724 ListSubscriptionsResponse.fromJson(core.Map _json) {
725 if (_json.containsKey("nextPageToken")) {
726 nextPageToken = _json["nextPageToken"];
727 }
728 if (_json.containsKey("subscription")) {
729 subscription = _json["subscription"].map((value) => new Subscription.fromJ son(value)).toList();
730 }
731 }
732
733 core.Map toJson() {
734 var _json = new core.Map();
735 if (nextPageToken != null) {
736 _json["nextPageToken"] = nextPageToken;
737 }
738 if (subscription != null) {
739 _json["subscription"] = subscription.map((value) => (value).toJson()).toLi st();
740 }
741 return _json;
742 }
743 }
744
745
746 /** Not documented yet. */
747 class ListTopicsResponse {
748 /**
749 * If not empty, indicates that there are more topics that match the request,
750 * and this value should be passed to the next ListTopicsRequest to continue.
751 */
752 core.String nextPageToken;
753
754 /** The resulting topics. */
755 core.List<Topic> topic;
756
757
758 ListTopicsResponse();
759
760 ListTopicsResponse.fromJson(core.Map _json) {
761 if (_json.containsKey("nextPageToken")) {
762 nextPageToken = _json["nextPageToken"];
763 }
764 if (_json.containsKey("topic")) {
765 topic = _json["topic"].map((value) => new Topic.fromJson(value)).toList();
766 }
767 }
768
769 core.Map toJson() {
770 var _json = new core.Map();
771 if (nextPageToken != null) {
772 _json["nextPageToken"] = nextPageToken;
773 }
774 if (topic != null) {
775 _json["topic"] = topic.map((value) => (value).toJson()).toList();
776 }
777 return _json;
778 }
779 }
780
781
782 /** Not documented yet. */
783 class ModifyAckDeadlineRequest {
784 /** The new Ack deadline. Must be >= 1. */
785 core.int ackDeadlineSeconds;
786
787 /** The Ack ID. */
788 core.String ackId;
789
790 /** The name of the subscription from which messages are being pulled. */
791 core.String subscription;
792
793
794 ModifyAckDeadlineRequest();
795
796 ModifyAckDeadlineRequest.fromJson(core.Map _json) {
797 if (_json.containsKey("ackDeadlineSeconds")) {
798 ackDeadlineSeconds = _json["ackDeadlineSeconds"];
799 }
800 if (_json.containsKey("ackId")) {
801 ackId = _json["ackId"];
802 }
803 if (_json.containsKey("subscription")) {
804 subscription = _json["subscription"];
805 }
806 }
807
808 core.Map toJson() {
809 var _json = new core.Map();
810 if (ackDeadlineSeconds != null) {
811 _json["ackDeadlineSeconds"] = ackDeadlineSeconds;
812 }
813 if (ackId != null) {
814 _json["ackId"] = ackId;
815 }
816 if (subscription != null) {
817 _json["subscription"] = subscription;
818 }
819 return _json;
820 }
821 }
822
823
824 /** Not documented yet. */
825 class ModifyPushConfigRequest {
826 /**
827 * An empty push_config indicates that the Pub/Sub system should pause pushing
828 * messages from the given subscription.
829 */
830 PushConfig pushConfig;
831
832 /** The name of the subscription. */
833 core.String subscription;
834
835
836 ModifyPushConfigRequest();
837
838 ModifyPushConfigRequest.fromJson(core.Map _json) {
839 if (_json.containsKey("pushConfig")) {
840 pushConfig = new PushConfig.fromJson(_json["pushConfig"]);
841 }
842 if (_json.containsKey("subscription")) {
843 subscription = _json["subscription"];
844 }
845 }
846
847 core.Map toJson() {
848 var _json = new core.Map();
849 if (pushConfig != null) {
850 _json["pushConfig"] = (pushConfig).toJson();
851 }
852 if (subscription != null) {
853 _json["subscription"] = subscription;
854 }
855 return _json;
856 }
857 }
858
859
860 /** Not documented yet. */
861 class PublishRequest {
862 /** The message to publish. */
863 PubsubMessage message;
864
865 /** The name of the topic for which the message is being added. */
866 core.String topic;
867
868
869 PublishRequest();
870
871 PublishRequest.fromJson(core.Map _json) {
872 if (_json.containsKey("message")) {
873 message = new PubsubMessage.fromJson(_json["message"]);
874 }
875 if (_json.containsKey("topic")) {
876 topic = _json["topic"];
877 }
878 }
879
880 core.Map toJson() {
881 var _json = new core.Map();
882 if (message != null) {
883 _json["message"] = (message).toJson();
884 }
885 if (topic != null) {
886 _json["topic"] = topic;
887 }
888 return _json;
889 }
890 }
891
892
893 /** An event indicating a received message or truncation event. */
894 class PubsubEvent {
895 /**
896 * Indicates that this subscription has been deleted. (Note that pull
897 * subscribers will always receive NOT_FOUND in response in their pull request
898 * on the subscription, rather than seeing this boolean.)
899 */
900 core.bool deleted;
901
902 /** A received message. */
903 PubsubMessage message;
904
905 /** The subscription that received the event. */
906 core.String subscription;
907
908 /** Indicates that this subscription has been truncated. */
909 core.bool truncated;
910
911
912 PubsubEvent();
913
914 PubsubEvent.fromJson(core.Map _json) {
915 if (_json.containsKey("deleted")) {
916 deleted = _json["deleted"];
917 }
918 if (_json.containsKey("message")) {
919 message = new PubsubMessage.fromJson(_json["message"]);
920 }
921 if (_json.containsKey("subscription")) {
922 subscription = _json["subscription"];
923 }
924 if (_json.containsKey("truncated")) {
925 truncated = _json["truncated"];
926 }
927 }
928
929 core.Map toJson() {
930 var _json = new core.Map();
931 if (deleted != null) {
932 _json["deleted"] = deleted;
933 }
934 if (message != null) {
935 _json["message"] = (message).toJson();
936 }
937 if (subscription != null) {
938 _json["subscription"] = subscription;
939 }
940 if (truncated != null) {
941 _json["truncated"] = truncated;
942 }
943 return _json;
944 }
945 }
946
947
948 /** A message data and its labels. */
949 class PubsubMessage {
950 /** The message payload. */
951 core.String data;
952
953 core.List<core.int> get dataAsBytes {
954 return crypto.CryptoUtils.base64StringToBytes(data);
955 }
956
957 void set dataAsBytes(core.List<core.int> _bytes) {
958 data = crypto.CryptoUtils.bytesToBase64(_bytes, urlSafe: true);
959 }
960
961 /**
962 * Optional list of labels for this message. Keys in this collection must be
963 * unique.
964 */
965 core.List<Label> label;
966
967
968 PubsubMessage();
969
970 PubsubMessage.fromJson(core.Map _json) {
971 if (_json.containsKey("data")) {
972 data = _json["data"];
973 }
974 if (_json.containsKey("label")) {
975 label = _json["label"].map((value) => new Label.fromJson(value)).toList();
976 }
977 }
978
979 core.Map toJson() {
980 var _json = new core.Map();
981 if (data != null) {
982 _json["data"] = data;
983 }
984 if (label != null) {
985 _json["label"] = label.map((value) => (value).toJson()).toList();
986 }
987 return _json;
988 }
989 }
990
991
992 /** Not documented yet. */
993 class PullRequest {
994 /**
995 * If this is specified as true the system will respond immediately even if it
996 * is not able to return a message in the Pull response. Otherwise the system
997 * is allowed to wait until at least one message is available rather than
998 * returning FAILED_PRECONDITION. The client may cancel the request if it does
999 * not wish to wait any longer for the response.
1000 */
1001 core.bool returnImmediately;
1002
1003 /** The subscription from which a message should be pulled. */
1004 core.String subscription;
1005
1006
1007 PullRequest();
1008
1009 PullRequest.fromJson(core.Map _json) {
1010 if (_json.containsKey("returnImmediately")) {
1011 returnImmediately = _json["returnImmediately"];
1012 }
1013 if (_json.containsKey("subscription")) {
1014 subscription = _json["subscription"];
1015 }
1016 }
1017
1018 core.Map toJson() {
1019 var _json = new core.Map();
1020 if (returnImmediately != null) {
1021 _json["returnImmediately"] = returnImmediately;
1022 }
1023 if (subscription != null) {
1024 _json["subscription"] = subscription;
1025 }
1026 return _json;
1027 }
1028 }
1029
1030
1031 /**
1032 * Either a PubsubMessage or a truncation event. One of these two must be
1033 * populated.
1034 */
1035 class PullResponse {
1036 /** This ID must be used to acknowledge the received event or message. */
1037 core.String ackId;
1038
1039 /** A pubsub message or truncation event. */
1040 PubsubEvent pubsubEvent;
1041
1042
1043 PullResponse();
1044
1045 PullResponse.fromJson(core.Map _json) {
1046 if (_json.containsKey("ackId")) {
1047 ackId = _json["ackId"];
1048 }
1049 if (_json.containsKey("pubsubEvent")) {
1050 pubsubEvent = new PubsubEvent.fromJson(_json["pubsubEvent"]);
1051 }
1052 }
1053
1054 core.Map toJson() {
1055 var _json = new core.Map();
1056 if (ackId != null) {
1057 _json["ackId"] = ackId;
1058 }
1059 if (pubsubEvent != null) {
1060 _json["pubsubEvent"] = (pubsubEvent).toJson();
1061 }
1062 return _json;
1063 }
1064 }
1065
1066
1067 /** Configuration for a push delivery endpoint. */
1068 class PushConfig {
1069 /**
1070 * A URL locating the endpoint to which messages should be pushed. For
1071 * example, a Webhook endpoint might use "https://example.com/push".
1072 */
1073 core.String pushEndpoint;
1074
1075
1076 PushConfig();
1077
1078 PushConfig.fromJson(core.Map _json) {
1079 if (_json.containsKey("pushEndpoint")) {
1080 pushEndpoint = _json["pushEndpoint"];
1081 }
1082 }
1083
1084 core.Map toJson() {
1085 var _json = new core.Map();
1086 if (pushEndpoint != null) {
1087 _json["pushEndpoint"] = pushEndpoint;
1088 }
1089 return _json;
1090 }
1091 }
1092
1093
1094 /** A subscription resource. */
1095 class Subscription {
1096 /**
1097 * For either push or pull delivery, the value is the maximum time after a
1098 * subscriber receives a message before the subscriber should acknowledge or
1099 * Nack the message. If the Ack deadline for a message passes without an Ack
1100 * or a Nack, the Pub/Sub system will eventually redeliver the message. If a
1101 * subscriber acknowledges after the deadline, the Pub/Sub system may accept
1102 * the Ack, but it is possible that the message has been already delivered
1103 * again. Multiple Acks to the message are allowed and will succeed.
1104 *
1105 * For push delivery, this value is used to set the request timeout for the
1106 * call to the push endpoint.
1107 *
1108 * For pull delivery, this value is used as the initial value for the Ack
1109 * deadline. It may be overridden for a specific pull request (message) with
1110 * ModifyAckDeadline. While a message is outstanding (i.e. it has been
1111 * delivered to a pull subscriber and the subscriber has not yet Acked or
1112 * Nacked), the Pub/Sub system will not deliver that message to another pull
1113 * subscriber (on a best-effort basis).
1114 */
1115 core.int ackDeadlineSeconds;
1116
1117 /** Name of the subscription. */
1118 core.String name;
1119
1120 /**
1121 * If push delivery is used with this subscription, this field is used to
1122 * configure it.
1123 */
1124 PushConfig pushConfig;
1125
1126 /**
1127 * The name of the topic from which this subscription is receiving messages.
1128 */
1129 core.String topic;
1130
1131
1132 Subscription();
1133
1134 Subscription.fromJson(core.Map _json) {
1135 if (_json.containsKey("ackDeadlineSeconds")) {
1136 ackDeadlineSeconds = _json["ackDeadlineSeconds"];
1137 }
1138 if (_json.containsKey("name")) {
1139 name = _json["name"];
1140 }
1141 if (_json.containsKey("pushConfig")) {
1142 pushConfig = new PushConfig.fromJson(_json["pushConfig"]);
1143 }
1144 if (_json.containsKey("topic")) {
1145 topic = _json["topic"];
1146 }
1147 }
1148
1149 core.Map toJson() {
1150 var _json = new core.Map();
1151 if (ackDeadlineSeconds != null) {
1152 _json["ackDeadlineSeconds"] = ackDeadlineSeconds;
1153 }
1154 if (name != null) {
1155 _json["name"] = name;
1156 }
1157 if (pushConfig != null) {
1158 _json["pushConfig"] = (pushConfig).toJson();
1159 }
1160 if (topic != null) {
1161 _json["topic"] = topic;
1162 }
1163 return _json;
1164 }
1165 }
1166
1167
1168 /** A topic resource. */
1169 class Topic {
1170 /** Name of the topic. */
1171 core.String name;
1172
1173
1174 Topic();
1175
1176 Topic.fromJson(core.Map _json) {
1177 if (_json.containsKey("name")) {
1178 name = _json["name"];
1179 }
1180 }
1181
1182 core.Map toJson() {
1183 var _json = new core.Map();
1184 if (name != null) {
1185 _json["name"] = name;
1186 }
1187 return _json;
1188 }
1189 }
1190
1191
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698