| OLD | NEW |
| 1 library googleapis_beta.pubsub.v1beta1; | 1 library googleapis_beta.pubsub.v1beta1; |
| 2 | 2 |
| 3 import "dart:core" as core; | 3 import "dart:core" as core; |
| 4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
| 5 import "dart:async" as async; | 5 import "dart:async" as async; |
| 6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
| 7 | 7 |
| 8 import "package:crypto/crypto.dart" as crypto; | 8 import "package:crypto/crypto.dart" as crypto; |
| 9 import 'package:http/http.dart' as http; | 9 import 'package:http/http.dart' as http; |
| 10 import '../src/common_internal.dart' as common_internal; | 10 import '../src/common_internal.dart' as common_internal; |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 var _response = _requester.request(_url, | 380 var _response = _requester.request(_url, |
| 381 "POST", | 381 "POST", |
| 382 body: _body, | 382 body: _body, |
| 383 queryParams: _queryParams, | 383 queryParams: _queryParams, |
| 384 uploadOptions: _uploadOptions, | 384 uploadOptions: _uploadOptions, |
| 385 uploadMedia: _uploadMedia, | 385 uploadMedia: _uploadMedia, |
| 386 downloadOptions: _downloadOptions); | 386 downloadOptions: _downloadOptions); |
| 387 return _response.then((data) => new PullResponse.fromJson(data)); | 387 return _response.then((data) => new PullResponse.fromJson(data)); |
| 388 } | 388 } |
| 389 | 389 |
| 390 /** |
| 391 * Pulls messages from the server. Returns an empty list if there are no |
| 392 * messages available in the backlog. The system is free to return UNAVAILABLE |
| 393 * if there too many pull requests outstanding for a given subscription. |
| 394 * |
| 395 * [request] - The metadata request object. |
| 396 * |
| 397 * Request parameters: |
| 398 * |
| 399 * Completes with a [PullBatchResponse]. |
| 400 * |
| 401 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 402 * error. |
| 403 * |
| 404 * If the used [http.Client] completes with an error when making a REST call, |
| 405 * this method will complete with the same error. |
| 406 */ |
| 407 async.Future<PullBatchResponse> pullBatch(PullBatchRequest request) { |
| 408 var _url = null; |
| 409 var _queryParams = new core.Map(); |
| 410 var _uploadMedia = null; |
| 411 var _uploadOptions = null; |
| 412 var _downloadOptions = common.DownloadOptions.Metadata; |
| 413 var _body = null; |
| 414 |
| 415 if (request != null) { |
| 416 _body = convert.JSON.encode((request).toJson()); |
| 417 } |
| 418 |
| 419 |
| 420 _url = 'subscriptions/pullBatch'; |
| 421 |
| 422 var _response = _requester.request(_url, |
| 423 "POST", |
| 424 body: _body, |
| 425 queryParams: _queryParams, |
| 426 uploadOptions: _uploadOptions, |
| 427 uploadMedia: _uploadMedia, |
| 428 downloadOptions: _downloadOptions); |
| 429 return _response.then((data) => new PullBatchResponse.fromJson(data)); |
| 430 } |
| 431 |
| 390 } | 432 } |
| 391 | 433 |
| 392 | 434 |
| 393 /** Not documented yet. */ | 435 /** Not documented yet. */ |
| 394 class TopicsResourceApi { | 436 class TopicsResourceApi { |
| 395 final common_internal.ApiRequester _requester; | 437 final common_internal.ApiRequester _requester; |
| 396 | 438 |
| 397 TopicsResourceApi(common_internal.ApiRequester client) : | 439 TopicsResourceApi(common_internal.ApiRequester client) : |
| 398 _requester = client; | 440 _requester = client; |
| 399 | 441 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 var _response = _requester.request(_url, | 645 var _response = _requester.request(_url, |
| 604 "POST", | 646 "POST", |
| 605 body: _body, | 647 body: _body, |
| 606 queryParams: _queryParams, | 648 queryParams: _queryParams, |
| 607 uploadOptions: _uploadOptions, | 649 uploadOptions: _uploadOptions, |
| 608 uploadMedia: _uploadMedia, | 650 uploadMedia: _uploadMedia, |
| 609 downloadOptions: _downloadOptions); | 651 downloadOptions: _downloadOptions); |
| 610 return _response.then((data) => null); | 652 return _response.then((data) => null); |
| 611 } | 653 } |
| 612 | 654 |
| 655 /** |
| 656 * Adds one or more messages to the topic. Returns NOT_FOUND if the topic does |
| 657 * not exist. |
| 658 * |
| 659 * [request] - The metadata request object. |
| 660 * |
| 661 * Request parameters: |
| 662 * |
| 663 * Completes with a [PublishBatchResponse]. |
| 664 * |
| 665 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 666 * error. |
| 667 * |
| 668 * If the used [http.Client] completes with an error when making a REST call, |
| 669 * this method will complete with the same error. |
| 670 */ |
| 671 async.Future<PublishBatchResponse> publishBatch(PublishBatchRequest request) { |
| 672 var _url = null; |
| 673 var _queryParams = new core.Map(); |
| 674 var _uploadMedia = null; |
| 675 var _uploadOptions = null; |
| 676 var _downloadOptions = common.DownloadOptions.Metadata; |
| 677 var _body = null; |
| 678 |
| 679 if (request != null) { |
| 680 _body = convert.JSON.encode((request).toJson()); |
| 681 } |
| 682 |
| 683 |
| 684 _url = 'topics/publishBatch'; |
| 685 |
| 686 var _response = _requester.request(_url, |
| 687 "POST", |
| 688 body: _body, |
| 689 queryParams: _queryParams, |
| 690 uploadOptions: _uploadOptions, |
| 691 uploadMedia: _uploadMedia, |
| 692 downloadOptions: _downloadOptions); |
| 693 return _response.then((data) => new PublishBatchResponse.fromJson(data)); |
| 694 } |
| 695 |
| 613 } | 696 } |
| 614 | 697 |
| 615 | 698 |
| 616 | 699 |
| 617 /** Not documented yet. */ | 700 /** Request for the Acknowledge method. */ |
| 618 class AcknowledgeRequest { | 701 class AcknowledgeRequest { |
| 619 /** | 702 /** |
| 620 * The Ack ID for the message being acknowledged. This was returned by the | 703 * The Ack ID for the message being acknowledged. This was returned by the |
| 621 * Pub/Sub system in the Pull response. | 704 * Pub/Sub system in the Pull response. |
| 622 */ | 705 */ |
| 623 core.List<core.String> ackId; | 706 core.List<core.String> ackId; |
| 624 | 707 |
| 625 /** The subscription whose message is being acknowledged. */ | 708 /** The subscription whose message is being acknowledged. */ |
| 626 core.String subscription; | 709 core.String subscription; |
| 627 | 710 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 _json["numValue"] = numValue; | 785 _json["numValue"] = numValue; |
| 703 } | 786 } |
| 704 if (strValue != null) { | 787 if (strValue != null) { |
| 705 _json["strValue"] = strValue; | 788 _json["strValue"] = strValue; |
| 706 } | 789 } |
| 707 return _json; | 790 return _json; |
| 708 } | 791 } |
| 709 } | 792 } |
| 710 | 793 |
| 711 | 794 |
| 712 /** Not documented yet. */ | 795 /** Response for the ListSubscriptions method. */ |
| 713 class ListSubscriptionsResponse { | 796 class ListSubscriptionsResponse { |
| 714 /** | 797 /** |
| 715 * If not empty, indicates that there are more subscriptions that match the | 798 * If not empty, indicates that there are more subscriptions that match the |
| 716 * request and this value should be passed to the next | 799 * request and this value should be passed to the next |
| 717 * ListSubscriptionsRequest to continue. | 800 * ListSubscriptionsRequest to continue. |
| 718 */ | 801 */ |
| 719 core.String nextPageToken; | 802 core.String nextPageToken; |
| 720 | 803 |
| 721 /** The subscriptions that match the request. */ | 804 /** The subscriptions that match the request. */ |
| 722 core.List<Subscription> subscription; | 805 core.List<Subscription> subscription; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 739 _json["nextPageToken"] = nextPageToken; | 822 _json["nextPageToken"] = nextPageToken; |
| 740 } | 823 } |
| 741 if (subscription != null) { | 824 if (subscription != null) { |
| 742 _json["subscription"] = subscription.map((value) => (value).toJson()).toLi
st(); | 825 _json["subscription"] = subscription.map((value) => (value).toJson()).toLi
st(); |
| 743 } | 826 } |
| 744 return _json; | 827 return _json; |
| 745 } | 828 } |
| 746 } | 829 } |
| 747 | 830 |
| 748 | 831 |
| 749 /** Not documented yet. */ | 832 /** Response for the ListTopics method. */ |
| 750 class ListTopicsResponse { | 833 class ListTopicsResponse { |
| 751 /** | 834 /** |
| 752 * If not empty, indicates that there are more topics that match the request, | 835 * If not empty, indicates that there are more topics that match the request, |
| 753 * and this value should be passed to the next ListTopicsRequest to continue. | 836 * and this value should be passed to the next ListTopicsRequest to continue. |
| 754 */ | 837 */ |
| 755 core.String nextPageToken; | 838 core.String nextPageToken; |
| 756 | 839 |
| 757 /** The resulting topics. */ | 840 /** The resulting topics. */ |
| 758 core.List<Topic> topic; | 841 core.List<Topic> topic; |
| 759 | 842 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 775 _json["nextPageToken"] = nextPageToken; | 858 _json["nextPageToken"] = nextPageToken; |
| 776 } | 859 } |
| 777 if (topic != null) { | 860 if (topic != null) { |
| 778 _json["topic"] = topic.map((value) => (value).toJson()).toList(); | 861 _json["topic"] = topic.map((value) => (value).toJson()).toList(); |
| 779 } | 862 } |
| 780 return _json; | 863 return _json; |
| 781 } | 864 } |
| 782 } | 865 } |
| 783 | 866 |
| 784 | 867 |
| 785 /** Not documented yet. */ | 868 /** Request for the ModifyAckDeadline method. */ |
| 786 class ModifyAckDeadlineRequest { | 869 class ModifyAckDeadlineRequest { |
| 787 /** The new Ack deadline. Must be >= 0. */ | 870 /** The new Ack deadline. Must be >= 0. */ |
| 788 core.int ackDeadlineSeconds; | 871 core.int ackDeadlineSeconds; |
| 789 | 872 |
| 790 /** The Ack ID. */ | 873 /** The Ack ID. */ |
| 791 core.String ackId; | 874 core.String ackId; |
| 792 | 875 |
| 793 /** The name of the subscription from which messages are being pulled. */ | 876 /** The name of the subscription from which messages are being pulled. */ |
| 794 core.String subscription; | 877 core.String subscription; |
| 795 | 878 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 817 _json["ackId"] = ackId; | 900 _json["ackId"] = ackId; |
| 818 } | 901 } |
| 819 if (subscription != null) { | 902 if (subscription != null) { |
| 820 _json["subscription"] = subscription; | 903 _json["subscription"] = subscription; |
| 821 } | 904 } |
| 822 return _json; | 905 return _json; |
| 823 } | 906 } |
| 824 } | 907 } |
| 825 | 908 |
| 826 | 909 |
| 827 /** Not documented yet. */ | 910 /** Request for the ModifyPushConfig method. */ |
| 828 class ModifyPushConfigRequest { | 911 class ModifyPushConfigRequest { |
| 829 /** | 912 /** |
| 830 * An empty push_config indicates that the Pub/Sub system should pause pushing | 913 * An empty push_config indicates that the Pub/Sub system should pause pushing |
| 831 * messages from the given subscription. | 914 * messages from the given subscription. |
| 832 */ | 915 */ |
| 833 PushConfig pushConfig; | 916 PushConfig pushConfig; |
| 834 | 917 |
| 835 /** The name of the subscription. */ | 918 /** The name of the subscription. */ |
| 836 core.String subscription; | 919 core.String subscription; |
| 837 | 920 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 853 _json["pushConfig"] = (pushConfig).toJson(); | 936 _json["pushConfig"] = (pushConfig).toJson(); |
| 854 } | 937 } |
| 855 if (subscription != null) { | 938 if (subscription != null) { |
| 856 _json["subscription"] = subscription; | 939 _json["subscription"] = subscription; |
| 857 } | 940 } |
| 858 return _json; | 941 return _json; |
| 859 } | 942 } |
| 860 } | 943 } |
| 861 | 944 |
| 862 | 945 |
| 863 /** Not documented yet. */ | 946 /** Request for the PublishBatch method. */ |
| 947 class PublishBatchRequest { |
| 948 /** The messages to publish. */ |
| 949 core.List<PubsubMessage> messages; |
| 950 |
| 951 /** The messages in the request will be published on this topic. */ |
| 952 core.String topic; |
| 953 |
| 954 |
| 955 PublishBatchRequest(); |
| 956 |
| 957 PublishBatchRequest.fromJson(core.Map _json) { |
| 958 if (_json.containsKey("messages")) { |
| 959 messages = _json["messages"].map((value) => new PubsubMessage.fromJson(val
ue)).toList(); |
| 960 } |
| 961 if (_json.containsKey("topic")) { |
| 962 topic = _json["topic"]; |
| 963 } |
| 964 } |
| 965 |
| 966 core.Map toJson() { |
| 967 var _json = new core.Map(); |
| 968 if (messages != null) { |
| 969 _json["messages"] = messages.map((value) => (value).toJson()).toList(); |
| 970 } |
| 971 if (topic != null) { |
| 972 _json["topic"] = topic; |
| 973 } |
| 974 return _json; |
| 975 } |
| 976 } |
| 977 |
| 978 |
| 979 /** Response for the PublishBatch method. */ |
| 980 class PublishBatchResponse { |
| 981 /** |
| 982 * The server-assigned ID of each published message, in the same order as the |
| 983 * messages in the request. IDs are guaranteed to be unique within the topic. |
| 984 */ |
| 985 core.List<core.String> messageIds; |
| 986 |
| 987 |
| 988 PublishBatchResponse(); |
| 989 |
| 990 PublishBatchResponse.fromJson(core.Map _json) { |
| 991 if (_json.containsKey("messageIds")) { |
| 992 messageIds = _json["messageIds"]; |
| 993 } |
| 994 } |
| 995 |
| 996 core.Map toJson() { |
| 997 var _json = new core.Map(); |
| 998 if (messageIds != null) { |
| 999 _json["messageIds"] = messageIds; |
| 1000 } |
| 1001 return _json; |
| 1002 } |
| 1003 } |
| 1004 |
| 1005 |
| 1006 /** Request for the Publish method. */ |
| 864 class PublishRequest { | 1007 class PublishRequest { |
| 865 /** The message to publish. */ | 1008 /** The message to publish. */ |
| 866 PubsubMessage message; | 1009 PubsubMessage message; |
| 867 | 1010 |
| 868 /** The message in the request will be published on this topic. */ | 1011 /** The message in the request will be published on this topic. */ |
| 869 core.String topic; | 1012 core.String topic; |
| 870 | 1013 |
| 871 | 1014 |
| 872 PublishRequest(); | 1015 PublishRequest(); |
| 873 | 1016 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 void set dataAsBytes(core.List<core.int> _bytes) { | 1103 void set dataAsBytes(core.List<core.int> _bytes) { |
| 961 data = crypto.CryptoUtils.bytesToBase64(_bytes, urlSafe: true); | 1104 data = crypto.CryptoUtils.bytesToBase64(_bytes, urlSafe: true); |
| 962 } | 1105 } |
| 963 | 1106 |
| 964 /** | 1107 /** |
| 965 * Optional list of labels for this message. Keys in this collection must be | 1108 * Optional list of labels for this message. Keys in this collection must be |
| 966 * unique. | 1109 * unique. |
| 967 */ | 1110 */ |
| 968 core.List<Label> label; | 1111 core.List<Label> label; |
| 969 | 1112 |
| 1113 /** |
| 1114 * ID of this message assigned by the server at publication time. Guaranteed |
| 1115 * to be unique within the topic. This value may be read by a subscriber that |
| 1116 * receives a PubsubMessage via a Pull call or a push delivery. It must not be |
| 1117 * populated by a publisher in a Publish call. |
| 1118 */ |
| 1119 core.String messageId; |
| 1120 |
| 970 | 1121 |
| 971 PubsubMessage(); | 1122 PubsubMessage(); |
| 972 | 1123 |
| 973 PubsubMessage.fromJson(core.Map _json) { | 1124 PubsubMessage.fromJson(core.Map _json) { |
| 974 if (_json.containsKey("data")) { | 1125 if (_json.containsKey("data")) { |
| 975 data = _json["data"]; | 1126 data = _json["data"]; |
| 976 } | 1127 } |
| 977 if (_json.containsKey("label")) { | 1128 if (_json.containsKey("label")) { |
| 978 label = _json["label"].map((value) => new Label.fromJson(value)).toList(); | 1129 label = _json["label"].map((value) => new Label.fromJson(value)).toList(); |
| 979 } | 1130 } |
| 1131 if (_json.containsKey("messageId")) { |
| 1132 messageId = _json["messageId"]; |
| 1133 } |
| 980 } | 1134 } |
| 981 | 1135 |
| 982 core.Map toJson() { | 1136 core.Map toJson() { |
| 983 var _json = new core.Map(); | 1137 var _json = new core.Map(); |
| 984 if (data != null) { | 1138 if (data != null) { |
| 985 _json["data"] = data; | 1139 _json["data"] = data; |
| 986 } | 1140 } |
| 987 if (label != null) { | 1141 if (label != null) { |
| 988 _json["label"] = label.map((value) => (value).toJson()).toList(); | 1142 _json["label"] = label.map((value) => (value).toJson()).toList(); |
| 989 } | 1143 } |
| 1144 if (messageId != null) { |
| 1145 _json["messageId"] = messageId; |
| 1146 } |
| 990 return _json; | 1147 return _json; |
| 991 } | 1148 } |
| 992 } | 1149 } |
| 993 | 1150 |
| 994 | 1151 |
| 995 /** Not documented yet. */ | 1152 /** Request for the PullBatch method. */ |
| 1153 class PullBatchRequest { |
| 1154 /** |
| 1155 * The maximum number of PubsubEvents returned for this request. The Pub/Sub |
| 1156 * system may return fewer than the number of events specified. |
| 1157 */ |
| 1158 core.int maxEvents; |
| 1159 |
| 1160 /** |
| 1161 * If this is specified as true the system will respond immediately even if it |
| 1162 * is not able to return a message in the Pull response. Otherwise the system |
| 1163 * is allowed to wait until at least one message is available rather than |
| 1164 * returning no messages. The client may cancel the request if it does not |
| 1165 * wish to wait any longer for the response. |
| 1166 */ |
| 1167 core.bool returnImmediately; |
| 1168 |
| 1169 /** The subscription from which messages should be pulled. */ |
| 1170 core.String subscription; |
| 1171 |
| 1172 |
| 1173 PullBatchRequest(); |
| 1174 |
| 1175 PullBatchRequest.fromJson(core.Map _json) { |
| 1176 if (_json.containsKey("maxEvents")) { |
| 1177 maxEvents = _json["maxEvents"]; |
| 1178 } |
| 1179 if (_json.containsKey("returnImmediately")) { |
| 1180 returnImmediately = _json["returnImmediately"]; |
| 1181 } |
| 1182 if (_json.containsKey("subscription")) { |
| 1183 subscription = _json["subscription"]; |
| 1184 } |
| 1185 } |
| 1186 |
| 1187 core.Map toJson() { |
| 1188 var _json = new core.Map(); |
| 1189 if (maxEvents != null) { |
| 1190 _json["maxEvents"] = maxEvents; |
| 1191 } |
| 1192 if (returnImmediately != null) { |
| 1193 _json["returnImmediately"] = returnImmediately; |
| 1194 } |
| 1195 if (subscription != null) { |
| 1196 _json["subscription"] = subscription; |
| 1197 } |
| 1198 return _json; |
| 1199 } |
| 1200 } |
| 1201 |
| 1202 |
| 1203 /** Response for the PullBatch method. */ |
| 1204 class PullBatchResponse { |
| 1205 /** |
| 1206 * Received Pub/Sub messages or status events. The Pub/Sub system will return |
| 1207 * zero messages if there are no more messages available in the backlog. The |
| 1208 * Pub/Sub system may return fewer than the max_events requested even if there |
| 1209 * are more messages available in the backlog. |
| 1210 */ |
| 1211 core.List<PullResponse> pullResponses; |
| 1212 |
| 1213 |
| 1214 PullBatchResponse(); |
| 1215 |
| 1216 PullBatchResponse.fromJson(core.Map _json) { |
| 1217 if (_json.containsKey("pullResponses")) { |
| 1218 pullResponses = _json["pullResponses"].map((value) => new PullResponse.fro
mJson(value)).toList(); |
| 1219 } |
| 1220 } |
| 1221 |
| 1222 core.Map toJson() { |
| 1223 var _json = new core.Map(); |
| 1224 if (pullResponses != null) { |
| 1225 _json["pullResponses"] = pullResponses.map((value) => (value).toJson()).to
List(); |
| 1226 } |
| 1227 return _json; |
| 1228 } |
| 1229 } |
| 1230 |
| 1231 |
| 1232 /** Request for the Pull method. */ |
| 996 class PullRequest { | 1233 class PullRequest { |
| 997 /** | 1234 /** |
| 998 * If this is specified as true the system will respond immediately even if it | 1235 * If this is specified as true the system will respond immediately even if it |
| 999 * is not able to return a message in the Pull response. Otherwise the system | 1236 * is not able to return a message in the Pull response. Otherwise the system |
| 1000 * is allowed to wait until at least one message is available rather than | 1237 * is allowed to wait until at least one message is available rather than |
| 1001 * returning FAILED_PRECONDITION. The client may cancel the request if it does | 1238 * returning FAILED_PRECONDITION. The client may cancel the request if it does |
| 1002 * not wish to wait any longer for the response. | 1239 * not wish to wait any longer for the response. |
| 1003 */ | 1240 */ |
| 1004 core.bool returnImmediately; | 1241 core.bool returnImmediately; |
| 1005 | 1242 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 core.Map toJson() { | 1422 core.Map toJson() { |
| 1186 var _json = new core.Map(); | 1423 var _json = new core.Map(); |
| 1187 if (name != null) { | 1424 if (name != null) { |
| 1188 _json["name"] = name; | 1425 _json["name"] = name; |
| 1189 } | 1426 } |
| 1190 return _json; | 1427 return _json; |
| 1191 } | 1428 } |
| 1192 } | 1429 } |
| 1193 | 1430 |
| 1194 | 1431 |
| OLD | NEW |