Skip to main content

google_cloud_pubsub/generated/gapic_dataplane/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19
20mod debug;
21mod deserialize;
22mod serialize;
23
24/// A message that is published by publishers and consumed by subscribers. The
25/// message must contain either a non-empty data field or at least one attribute.
26/// Note that client libraries represent this object differently
27/// depending on the language. See the corresponding [client library
28/// documentation](https://cloud.google.com/pubsub/docs/reference/libraries) for
29/// more information. See [quotas and limits]
30/// (<https://cloud.google.com/pubsub/quotas>) for more information about message
31/// limits.
32#[derive(Clone, Default, PartialEq)]
33#[non_exhaustive]
34pub struct PubsubMessage {
35    /// Optional. The message data field. If this field is empty, the message must
36    /// contain at least one attribute.
37    pub data: ::bytes::Bytes,
38
39    /// Optional. Attributes for this message. If this field is empty, the message
40    /// must contain non-empty data. This can be used to filter messages on the
41    /// subscription.
42    pub attributes: std::collections::HashMap<std::string::String, std::string::String>,
43
44    /// ID of this message, assigned by the server when the message is published.
45    /// Guaranteed to be unique within the topic. This value may be read by a
46    /// subscriber that receives a `PubsubMessage` via a `Pull` call or a push
47    /// delivery. It must not be populated by the publisher in a `Publish` call.
48    pub message_id: std::string::String,
49
50    /// The time at which the message was published, populated by the server when
51    /// it receives the `Publish` call. It must not be populated by the
52    /// publisher in a `Publish` call.
53    pub publish_time: std::option::Option<wkt::Timestamp>,
54
55    /// Optional. If non-empty, identifies related messages for which publish order
56    /// should be respected. If a `Subscription` has `enable_message_ordering` set
57    /// to `true`, messages published with the same non-empty `ordering_key` value
58    /// will be delivered to subscribers in the order in which they are received by
59    /// the Pub/Sub system. All `PubsubMessage`s published in a given
60    /// `PublishRequest` must specify the same `ordering_key` value. For more
61    /// information, see [ordering
62    /// messages](https://cloud.google.com/pubsub/docs/ordering).
63    pub ordering_key: std::string::String,
64
65    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
66}
67
68impl PubsubMessage {
69    /// Creates a new default instance.
70    pub fn new() -> Self {
71        std::default::Default::default()
72    }
73
74    /// Sets the value of [data][crate::model::PubsubMessage::data].
75    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
76        self.data = v.into();
77        self
78    }
79
80    /// Sets the value of [attributes][crate::model::PubsubMessage::attributes].
81    pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
82    where
83        T: std::iter::IntoIterator<Item = (K, V)>,
84        K: std::convert::Into<std::string::String>,
85        V: std::convert::Into<std::string::String>,
86    {
87        use std::iter::Iterator;
88        self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
89        self
90    }
91
92    /// Sets the value of [message_id][crate::model::PubsubMessage::message_id].
93    pub fn set_message_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
94        self.message_id = v.into();
95        self
96    }
97
98    /// Sets the value of [publish_time][crate::model::PubsubMessage::publish_time].
99    pub fn set_publish_time<T>(mut self, v: T) -> Self
100    where
101        T: std::convert::Into<wkt::Timestamp>,
102    {
103        self.publish_time = std::option::Option::Some(v.into());
104        self
105    }
106
107    /// Sets or clears the value of [publish_time][crate::model::PubsubMessage::publish_time].
108    pub fn set_or_clear_publish_time<T>(mut self, v: std::option::Option<T>) -> Self
109    where
110        T: std::convert::Into<wkt::Timestamp>,
111    {
112        self.publish_time = v.map(|x| x.into());
113        self
114    }
115
116    /// Sets the value of [ordering_key][crate::model::PubsubMessage::ordering_key].
117    pub fn set_ordering_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
118        self.ordering_key = v.into();
119        self
120    }
121}
122
123impl wkt::message::Message for PubsubMessage {
124    fn typename() -> &'static str {
125        "type.googleapis.com/google.pubsub.v1.PubsubMessage"
126    }
127}
128
129/// Request for the Publish method.
130#[derive(Clone, Default, PartialEq)]
131#[non_exhaustive]
132pub struct PublishRequest {
133    /// Required. The messages in the request will be published on this topic.
134    /// Format is `projects/{project}/topics/{topic}`.
135    pub topic: std::string::String,
136
137    /// Required. The messages to publish.
138    pub messages: std::vec::Vec<crate::model::PubsubMessage>,
139
140    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
141}
142
143impl PublishRequest {
144    /// Creates a new default instance.
145    pub fn new() -> Self {
146        std::default::Default::default()
147    }
148
149    /// Sets the value of [topic][crate::model::PublishRequest::topic].
150    pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
151        self.topic = v.into();
152        self
153    }
154
155    /// Sets the value of [messages][crate::model::PublishRequest::messages].
156    pub fn set_messages<T, V>(mut self, v: T) -> Self
157    where
158        T: std::iter::IntoIterator<Item = V>,
159        V: std::convert::Into<crate::model::PubsubMessage>,
160    {
161        use std::iter::Iterator;
162        self.messages = v.into_iter().map(|i| i.into()).collect();
163        self
164    }
165}
166
167impl wkt::message::Message for PublishRequest {
168    fn typename() -> &'static str {
169        "type.googleapis.com/google.pubsub.v1.PublishRequest"
170    }
171}
172
173/// Response for the `Publish` method.
174#[derive(Clone, Default, PartialEq)]
175#[non_exhaustive]
176pub struct PublishResponse {
177    /// Optional. The server-assigned ID of each published message, in the same
178    /// order as the messages in the request. IDs are guaranteed to be unique
179    /// within the topic.
180    pub message_ids: std::vec::Vec<std::string::String>,
181
182    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
183}
184
185impl PublishResponse {
186    /// Creates a new default instance.
187    pub fn new() -> Self {
188        std::default::Default::default()
189    }
190
191    /// Sets the value of [message_ids][crate::model::PublishResponse::message_ids].
192    pub fn set_message_ids<T, V>(mut self, v: T) -> Self
193    where
194        T: std::iter::IntoIterator<Item = V>,
195        V: std::convert::Into<std::string::String>,
196    {
197        use std::iter::Iterator;
198        self.message_ids = v.into_iter().map(|i| i.into()).collect();
199        self
200    }
201}
202
203impl wkt::message::Message for PublishResponse {
204    fn typename() -> &'static str {
205        "type.googleapis.com/google.pubsub.v1.PublishResponse"
206    }
207}
208
209/// A message and its corresponding acknowledgment ID.
210#[derive(Clone, Default, PartialEq)]
211#[non_exhaustive]
212pub struct ReceivedMessage {
213    /// Optional. This ID can be used to acknowledge the received message.
214    pub ack_id: std::string::String,
215
216    /// Optional. The message.
217    pub message: std::option::Option<crate::model::PubsubMessage>,
218
219    /// Optional. The approximate number of times that Pub/Sub has attempted to
220    /// deliver the associated message to a subscriber.
221    ///
222    /// More precisely, this is 1 + (number of NACKs) +
223    /// (number of ack_deadline exceeds) for this message.
224    ///
225    /// A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline
226    /// exceeds event is whenever a message is not acknowledged within
227    /// ack_deadline. Note that ack_deadline is initially
228    /// Subscription.ackDeadlineSeconds, but may get extended automatically by
229    /// the client library.
230    ///
231    /// Upon the first delivery of a given message, `delivery_attempt` will have a
232    /// value of 1. The value is calculated at best effort and is approximate.
233    ///
234    /// If a DeadLetterPolicy is not set on the subscription, this will be 0.
235    pub delivery_attempt: i32,
236
237    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
238}
239
240impl ReceivedMessage {
241    /// Creates a new default instance.
242    pub fn new() -> Self {
243        std::default::Default::default()
244    }
245
246    /// Sets the value of [ack_id][crate::model::ReceivedMessage::ack_id].
247    pub fn set_ack_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
248        self.ack_id = v.into();
249        self
250    }
251
252    /// Sets the value of [message][crate::model::ReceivedMessage::message].
253    pub fn set_message<T>(mut self, v: T) -> Self
254    where
255        T: std::convert::Into<crate::model::PubsubMessage>,
256    {
257        self.message = std::option::Option::Some(v.into());
258        self
259    }
260
261    /// Sets or clears the value of [message][crate::model::ReceivedMessage::message].
262    pub fn set_or_clear_message<T>(mut self, v: std::option::Option<T>) -> Self
263    where
264        T: std::convert::Into<crate::model::PubsubMessage>,
265    {
266        self.message = v.map(|x| x.into());
267        self
268    }
269
270    /// Sets the value of [delivery_attempt][crate::model::ReceivedMessage::delivery_attempt].
271    pub fn set_delivery_attempt<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
272        self.delivery_attempt = v.into();
273        self
274    }
275}
276
277impl wkt::message::Message for ReceivedMessage {
278    fn typename() -> &'static str {
279        "type.googleapis.com/google.pubsub.v1.ReceivedMessage"
280    }
281}
282
283/// Request for the ModifyAckDeadline method.
284#[derive(Clone, Default, PartialEq)]
285#[non_exhaustive]
286pub struct ModifyAckDeadlineRequest {
287    /// Required. The name of the subscription.
288    /// Format is `projects/{project}/subscriptions/{sub}`.
289    pub subscription: std::string::String,
290
291    /// Required. List of acknowledgment IDs.
292    pub ack_ids: std::vec::Vec<std::string::String>,
293
294    /// Required. The new ack deadline with respect to the time this request was
295    /// sent to the Pub/Sub system. For example, if the value is 10, the new ack
296    /// deadline will expire 10 seconds after the `ModifyAckDeadline` call was
297    /// made. Specifying zero might immediately make the message available for
298    /// delivery to another subscriber client. This typically results in an
299    /// increase in the rate of message redeliveries (that is, duplicates).
300    /// The minimum deadline you can specify is 0 seconds.
301    /// The maximum deadline you can specify in a single request is 600 seconds
302    /// (10 minutes).
303    pub ack_deadline_seconds: i32,
304
305    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
306}
307
308impl ModifyAckDeadlineRequest {
309    /// Creates a new default instance.
310    pub fn new() -> Self {
311        std::default::Default::default()
312    }
313
314    /// Sets the value of [subscription][crate::model::ModifyAckDeadlineRequest::subscription].
315    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
316        self.subscription = v.into();
317        self
318    }
319
320    /// Sets the value of [ack_ids][crate::model::ModifyAckDeadlineRequest::ack_ids].
321    pub fn set_ack_ids<T, V>(mut self, v: T) -> Self
322    where
323        T: std::iter::IntoIterator<Item = V>,
324        V: std::convert::Into<std::string::String>,
325    {
326        use std::iter::Iterator;
327        self.ack_ids = v.into_iter().map(|i| i.into()).collect();
328        self
329    }
330
331    /// Sets the value of [ack_deadline_seconds][crate::model::ModifyAckDeadlineRequest::ack_deadline_seconds].
332    pub fn set_ack_deadline_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
333        self.ack_deadline_seconds = v.into();
334        self
335    }
336}
337
338impl wkt::message::Message for ModifyAckDeadlineRequest {
339    fn typename() -> &'static str {
340        "type.googleapis.com/google.pubsub.v1.ModifyAckDeadlineRequest"
341    }
342}
343
344/// Request for the Acknowledge method.
345#[derive(Clone, Default, PartialEq)]
346#[non_exhaustive]
347pub struct AcknowledgeRequest {
348    /// Required. The subscription whose message is being acknowledged.
349    /// Format is `projects/{project}/subscriptions/{sub}`.
350    pub subscription: std::string::String,
351
352    /// Required. The acknowledgment ID for the messages being acknowledged that
353    /// was returned by the Pub/Sub system in the `Pull` response. Must not be
354    /// empty.
355    pub ack_ids: std::vec::Vec<std::string::String>,
356
357    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
358}
359
360impl AcknowledgeRequest {
361    /// Creates a new default instance.
362    pub fn new() -> Self {
363        std::default::Default::default()
364    }
365
366    /// Sets the value of [subscription][crate::model::AcknowledgeRequest::subscription].
367    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
368        self.subscription = v.into();
369        self
370    }
371
372    /// Sets the value of [ack_ids][crate::model::AcknowledgeRequest::ack_ids].
373    pub fn set_ack_ids<T, V>(mut self, v: T) -> Self
374    where
375        T: std::iter::IntoIterator<Item = V>,
376        V: std::convert::Into<std::string::String>,
377    {
378        use std::iter::Iterator;
379        self.ack_ids = v.into_iter().map(|i| i.into()).collect();
380        self
381    }
382}
383
384impl wkt::message::Message for AcknowledgeRequest {
385    fn typename() -> &'static str {
386        "type.googleapis.com/google.pubsub.v1.AcknowledgeRequest"
387    }
388}
389
390/// Request for the `StreamingPull` streaming RPC method. This request is used to
391/// establish the initial stream as well as to stream acknowledgments and ack
392/// deadline modifications from the client to the server.
393#[derive(Clone, Default, PartialEq)]
394#[non_exhaustive]
395pub struct StreamingPullRequest {
396    /// Required. The subscription for which to initialize the new stream. This
397    /// must be provided in the first request on the stream, and must not be set in
398    /// subsequent requests from client to server.
399    /// Format is `projects/{project}/subscriptions/{sub}`.
400    pub subscription: std::string::String,
401
402    /// Optional. List of acknowledgment IDs for acknowledging previously received
403    /// messages (received on this stream or a different stream). If an ack ID has
404    /// expired, the corresponding message may be redelivered later. Acknowledging
405    /// a message more than once will not result in an error. If the acknowledgment
406    /// ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
407    pub ack_ids: std::vec::Vec<std::string::String>,
408
409    /// Optional. The list of new ack deadlines for the IDs listed in
410    /// `modify_deadline_ack_ids`. The size of this list must be the same as the
411    /// size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
412    /// with `INVALID_ARGUMENT`. Each element in this list is applied to the
413    /// element in the same position in `modify_deadline_ack_ids`. The new ack
414    /// deadline is with respect to the time this request was sent to the Pub/Sub
415    /// system. Must be >= 0. For example, if the value is 10, the new ack deadline
416    /// will expire 10 seconds after this request is received. If the value is 0,
417    /// the message is immediately made available for another streaming or
418    /// non-streaming pull request. If the value is < 0 (an error), the stream will
419    /// be aborted with status `INVALID_ARGUMENT`.
420    pub modify_deadline_seconds: std::vec::Vec<i32>,
421
422    /// Optional. List of acknowledgment IDs whose deadline will be modified based
423    /// on the corresponding element in `modify_deadline_seconds`. This field can
424    /// be used to indicate that more time is needed to process a message by the
425    /// subscriber, or to make the message available for redelivery if the
426    /// processing was interrupted.
427    pub modify_deadline_ack_ids: std::vec::Vec<std::string::String>,
428
429    /// Required. The ack deadline to use for the stream. This must be provided in
430    /// the first request on the stream, but it can also be updated on subsequent
431    /// requests from client to server. The minimum deadline you can specify is 10
432    /// seconds. The maximum deadline you can specify is 600 seconds (10 minutes).
433    pub stream_ack_deadline_seconds: i32,
434
435    /// Optional. A unique identifier that is used to distinguish client instances
436    /// from each other. Only needs to be provided on the initial request. When a
437    /// stream disconnects and reconnects for the same stream, the client_id should
438    /// be set to the same value so that state associated with the old stream can
439    /// be transferred to the new stream. The same client_id should not be used for
440    /// different client instances.
441    pub client_id: std::string::String,
442
443    /// Optional. Flow control settings for the maximum number of outstanding
444    /// messages. When there are `max_outstanding_messages` currently sent to the
445    /// streaming pull client that have not yet been acked or nacked, the server
446    /// stops sending more messages. The sending of messages resumes once the
447    /// number of outstanding messages is less than this value. If the value is
448    /// <= 0, there is no limit to the number of outstanding messages. This
449    /// property can only be set on the initial StreamingPullRequest. If it is set
450    /// on a subsequent request, the stream will be aborted with status
451    /// `INVALID_ARGUMENT`.
452    pub max_outstanding_messages: i64,
453
454    /// Optional. Flow control settings for the maximum number of outstanding
455    /// bytes. When there are `max_outstanding_bytes` or more worth of messages
456    /// currently sent to the streaming pull client that have not yet been acked or
457    /// nacked, the server will stop sending more messages. The sending of messages
458    /// resumes once the number of outstanding bytes is less than this value. If
459    /// the value is <= 0, there is no limit to the number of outstanding bytes.
460    /// This property can only be set on the initial StreamingPullRequest. If it is
461    /// set on a subsequent request, the stream will be aborted with status
462    /// `INVALID_ARGUMENT`.
463    pub max_outstanding_bytes: i64,
464
465    /// Optional. The protocol version used by the client. This property can only
466    /// be set on the initial StreamingPullRequest. If it is set on a subsequent
467    /// request, the stream will be aborted with status `INVALID_ARGUMENT`.
468    pub protocol_version: i64,
469
470    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
471}
472
473impl StreamingPullRequest {
474    /// Creates a new default instance.
475    pub fn new() -> Self {
476        std::default::Default::default()
477    }
478
479    /// Sets the value of [subscription][crate::model::StreamingPullRequest::subscription].
480    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
481        self.subscription = v.into();
482        self
483    }
484
485    /// Sets the value of [ack_ids][crate::model::StreamingPullRequest::ack_ids].
486    pub fn set_ack_ids<T, V>(mut self, v: T) -> Self
487    where
488        T: std::iter::IntoIterator<Item = V>,
489        V: std::convert::Into<std::string::String>,
490    {
491        use std::iter::Iterator;
492        self.ack_ids = v.into_iter().map(|i| i.into()).collect();
493        self
494    }
495
496    /// Sets the value of [modify_deadline_seconds][crate::model::StreamingPullRequest::modify_deadline_seconds].
497    pub fn set_modify_deadline_seconds<T, V>(mut self, v: T) -> Self
498    where
499        T: std::iter::IntoIterator<Item = V>,
500        V: std::convert::Into<i32>,
501    {
502        use std::iter::Iterator;
503        self.modify_deadline_seconds = v.into_iter().map(|i| i.into()).collect();
504        self
505    }
506
507    /// Sets the value of [modify_deadline_ack_ids][crate::model::StreamingPullRequest::modify_deadline_ack_ids].
508    pub fn set_modify_deadline_ack_ids<T, V>(mut self, v: T) -> Self
509    where
510        T: std::iter::IntoIterator<Item = V>,
511        V: std::convert::Into<std::string::String>,
512    {
513        use std::iter::Iterator;
514        self.modify_deadline_ack_ids = v.into_iter().map(|i| i.into()).collect();
515        self
516    }
517
518    /// Sets the value of [stream_ack_deadline_seconds][crate::model::StreamingPullRequest::stream_ack_deadline_seconds].
519    pub fn set_stream_ack_deadline_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
520        self.stream_ack_deadline_seconds = v.into();
521        self
522    }
523
524    /// Sets the value of [client_id][crate::model::StreamingPullRequest::client_id].
525    pub fn set_client_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
526        self.client_id = v.into();
527        self
528    }
529
530    /// Sets the value of [max_outstanding_messages][crate::model::StreamingPullRequest::max_outstanding_messages].
531    pub fn set_max_outstanding_messages<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
532        self.max_outstanding_messages = v.into();
533        self
534    }
535
536    /// Sets the value of [max_outstanding_bytes][crate::model::StreamingPullRequest::max_outstanding_bytes].
537    pub fn set_max_outstanding_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
538        self.max_outstanding_bytes = v.into();
539        self
540    }
541
542    /// Sets the value of [protocol_version][crate::model::StreamingPullRequest::protocol_version].
543    pub fn set_protocol_version<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
544        self.protocol_version = v.into();
545        self
546    }
547}
548
549impl wkt::message::Message for StreamingPullRequest {
550    fn typename() -> &'static str {
551        "type.googleapis.com/google.pubsub.v1.StreamingPullRequest"
552    }
553}
554
555/// Response for the `StreamingPull` method. This response is used to stream
556/// messages from the server to the client.
557#[derive(Clone, Default, PartialEq)]
558#[non_exhaustive]
559pub struct StreamingPullResponse {
560    /// Optional. Received Pub/Sub messages.
561    pub received_messages: std::vec::Vec<crate::model::ReceivedMessage>,
562
563    /// Optional. This field will only be set if `enable_exactly_once_delivery` is
564    /// set to `true` and is not guaranteed to be populated.
565    pub acknowledge_confirmation:
566        std::option::Option<crate::model::streaming_pull_response::AcknowledgeConfirmation>,
567
568    /// Optional. This field will only be set if `enable_exactly_once_delivery` is
569    /// set to `true` and is not guaranteed to be populated.
570    pub modify_ack_deadline_confirmation:
571        std::option::Option<crate::model::streaming_pull_response::ModifyAckDeadlineConfirmation>,
572
573    /// Optional. Properties associated with this subscription.
574    pub subscription_properties:
575        std::option::Option<crate::model::streaming_pull_response::SubscriptionProperties>,
576
577    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
578}
579
580impl StreamingPullResponse {
581    /// Creates a new default instance.
582    pub fn new() -> Self {
583        std::default::Default::default()
584    }
585
586    /// Sets the value of [received_messages][crate::model::StreamingPullResponse::received_messages].
587    pub fn set_received_messages<T, V>(mut self, v: T) -> Self
588    where
589        T: std::iter::IntoIterator<Item = V>,
590        V: std::convert::Into<crate::model::ReceivedMessage>,
591    {
592        use std::iter::Iterator;
593        self.received_messages = v.into_iter().map(|i| i.into()).collect();
594        self
595    }
596
597    /// Sets the value of [acknowledge_confirmation][crate::model::StreamingPullResponse::acknowledge_confirmation].
598    pub fn set_acknowledge_confirmation<T>(mut self, v: T) -> Self
599    where
600        T: std::convert::Into<crate::model::streaming_pull_response::AcknowledgeConfirmation>,
601    {
602        self.acknowledge_confirmation = std::option::Option::Some(v.into());
603        self
604    }
605
606    /// Sets or clears the value of [acknowledge_confirmation][crate::model::StreamingPullResponse::acknowledge_confirmation].
607    pub fn set_or_clear_acknowledge_confirmation<T>(mut self, v: std::option::Option<T>) -> Self
608    where
609        T: std::convert::Into<crate::model::streaming_pull_response::AcknowledgeConfirmation>,
610    {
611        self.acknowledge_confirmation = v.map(|x| x.into());
612        self
613    }
614
615    /// Sets the value of [modify_ack_deadline_confirmation][crate::model::StreamingPullResponse::modify_ack_deadline_confirmation].
616    pub fn set_modify_ack_deadline_confirmation<T>(mut self, v: T) -> Self
617    where
618        T: std::convert::Into<crate::model::streaming_pull_response::ModifyAckDeadlineConfirmation>,
619    {
620        self.modify_ack_deadline_confirmation = std::option::Option::Some(v.into());
621        self
622    }
623
624    /// Sets or clears the value of [modify_ack_deadline_confirmation][crate::model::StreamingPullResponse::modify_ack_deadline_confirmation].
625    pub fn set_or_clear_modify_ack_deadline_confirmation<T>(
626        mut self,
627        v: std::option::Option<T>,
628    ) -> Self
629    where
630        T: std::convert::Into<crate::model::streaming_pull_response::ModifyAckDeadlineConfirmation>,
631    {
632        self.modify_ack_deadline_confirmation = v.map(|x| x.into());
633        self
634    }
635
636    /// Sets the value of [subscription_properties][crate::model::StreamingPullResponse::subscription_properties].
637    pub fn set_subscription_properties<T>(mut self, v: T) -> Self
638    where
639        T: std::convert::Into<crate::model::streaming_pull_response::SubscriptionProperties>,
640    {
641        self.subscription_properties = std::option::Option::Some(v.into());
642        self
643    }
644
645    /// Sets or clears the value of [subscription_properties][crate::model::StreamingPullResponse::subscription_properties].
646    pub fn set_or_clear_subscription_properties<T>(mut self, v: std::option::Option<T>) -> Self
647    where
648        T: std::convert::Into<crate::model::streaming_pull_response::SubscriptionProperties>,
649    {
650        self.subscription_properties = v.map(|x| x.into());
651        self
652    }
653}
654
655impl wkt::message::Message for StreamingPullResponse {
656    fn typename() -> &'static str {
657        "type.googleapis.com/google.pubsub.v1.StreamingPullResponse"
658    }
659}
660
661/// Defines additional types related to [StreamingPullResponse].
662pub mod streaming_pull_response {
663    #[allow(unused_imports)]
664    use super::*;
665
666    /// Acknowledgment IDs sent in one or more previous requests to acknowledge a
667    /// previously received message.
668    #[derive(Clone, Default, PartialEq)]
669    #[non_exhaustive]
670    pub struct AcknowledgeConfirmation {
671        /// Optional. Successfully processed acknowledgment IDs.
672        pub ack_ids: std::vec::Vec<std::string::String>,
673
674        /// Optional. List of acknowledgment IDs that were malformed or whose
675        /// acknowledgment deadline has expired.
676        pub invalid_ack_ids: std::vec::Vec<std::string::String>,
677
678        /// Optional. List of acknowledgment IDs that were out of order.
679        pub unordered_ack_ids: std::vec::Vec<std::string::String>,
680
681        /// Optional. List of acknowledgment IDs that failed processing with
682        /// temporary issues.
683        pub temporary_failed_ack_ids: std::vec::Vec<std::string::String>,
684
685        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
686    }
687
688    impl AcknowledgeConfirmation {
689        /// Creates a new default instance.
690        pub fn new() -> Self {
691            std::default::Default::default()
692        }
693
694        /// Sets the value of [ack_ids][crate::model::streaming_pull_response::AcknowledgeConfirmation::ack_ids].
695        pub fn set_ack_ids<T, V>(mut self, v: T) -> Self
696        where
697            T: std::iter::IntoIterator<Item = V>,
698            V: std::convert::Into<std::string::String>,
699        {
700            use std::iter::Iterator;
701            self.ack_ids = v.into_iter().map(|i| i.into()).collect();
702            self
703        }
704
705        /// Sets the value of [invalid_ack_ids][crate::model::streaming_pull_response::AcknowledgeConfirmation::invalid_ack_ids].
706        pub fn set_invalid_ack_ids<T, V>(mut self, v: T) -> Self
707        where
708            T: std::iter::IntoIterator<Item = V>,
709            V: std::convert::Into<std::string::String>,
710        {
711            use std::iter::Iterator;
712            self.invalid_ack_ids = v.into_iter().map(|i| i.into()).collect();
713            self
714        }
715
716        /// Sets the value of [unordered_ack_ids][crate::model::streaming_pull_response::AcknowledgeConfirmation::unordered_ack_ids].
717        pub fn set_unordered_ack_ids<T, V>(mut self, v: T) -> Self
718        where
719            T: std::iter::IntoIterator<Item = V>,
720            V: std::convert::Into<std::string::String>,
721        {
722            use std::iter::Iterator;
723            self.unordered_ack_ids = v.into_iter().map(|i| i.into()).collect();
724            self
725        }
726
727        /// Sets the value of [temporary_failed_ack_ids][crate::model::streaming_pull_response::AcknowledgeConfirmation::temporary_failed_ack_ids].
728        pub fn set_temporary_failed_ack_ids<T, V>(mut self, v: T) -> Self
729        where
730            T: std::iter::IntoIterator<Item = V>,
731            V: std::convert::Into<std::string::String>,
732        {
733            use std::iter::Iterator;
734            self.temporary_failed_ack_ids = v.into_iter().map(|i| i.into()).collect();
735            self
736        }
737    }
738
739    impl wkt::message::Message for AcknowledgeConfirmation {
740        fn typename() -> &'static str {
741            "type.googleapis.com/google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation"
742        }
743    }
744
745    /// Acknowledgment IDs sent in one or more previous requests to modify the
746    /// deadline for a specific message.
747    #[derive(Clone, Default, PartialEq)]
748    #[non_exhaustive]
749    pub struct ModifyAckDeadlineConfirmation {
750        /// Optional. Successfully processed acknowledgment IDs.
751        pub ack_ids: std::vec::Vec<std::string::String>,
752
753        /// Optional. List of acknowledgment IDs that were malformed or whose
754        /// acknowledgment deadline has expired.
755        pub invalid_ack_ids: std::vec::Vec<std::string::String>,
756
757        /// Optional. List of acknowledgment IDs that failed processing with
758        /// temporary issues.
759        pub temporary_failed_ack_ids: std::vec::Vec<std::string::String>,
760
761        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
762    }
763
764    impl ModifyAckDeadlineConfirmation {
765        /// Creates a new default instance.
766        pub fn new() -> Self {
767            std::default::Default::default()
768        }
769
770        /// Sets the value of [ack_ids][crate::model::streaming_pull_response::ModifyAckDeadlineConfirmation::ack_ids].
771        pub fn set_ack_ids<T, V>(mut self, v: T) -> Self
772        where
773            T: std::iter::IntoIterator<Item = V>,
774            V: std::convert::Into<std::string::String>,
775        {
776            use std::iter::Iterator;
777            self.ack_ids = v.into_iter().map(|i| i.into()).collect();
778            self
779        }
780
781        /// Sets the value of [invalid_ack_ids][crate::model::streaming_pull_response::ModifyAckDeadlineConfirmation::invalid_ack_ids].
782        pub fn set_invalid_ack_ids<T, V>(mut self, v: T) -> Self
783        where
784            T: std::iter::IntoIterator<Item = V>,
785            V: std::convert::Into<std::string::String>,
786        {
787            use std::iter::Iterator;
788            self.invalid_ack_ids = v.into_iter().map(|i| i.into()).collect();
789            self
790        }
791
792        /// Sets the value of [temporary_failed_ack_ids][crate::model::streaming_pull_response::ModifyAckDeadlineConfirmation::temporary_failed_ack_ids].
793        pub fn set_temporary_failed_ack_ids<T, V>(mut self, v: T) -> Self
794        where
795            T: std::iter::IntoIterator<Item = V>,
796            V: std::convert::Into<std::string::String>,
797        {
798            use std::iter::Iterator;
799            self.temporary_failed_ack_ids = v.into_iter().map(|i| i.into()).collect();
800            self
801        }
802    }
803
804    impl wkt::message::Message for ModifyAckDeadlineConfirmation {
805        fn typename() -> &'static str {
806            "type.googleapis.com/google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation"
807        }
808    }
809
810    /// Subscription properties sent as part of the response.
811    #[derive(Clone, Default, PartialEq)]
812    #[non_exhaustive]
813    pub struct SubscriptionProperties {
814        /// Optional. True iff exactly once delivery is enabled for this
815        /// subscription.
816        pub exactly_once_delivery_enabled: bool,
817
818        /// Optional. True iff message ordering is enabled for this subscription.
819        pub message_ordering_enabled: bool,
820
821        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
822    }
823
824    impl SubscriptionProperties {
825        /// Creates a new default instance.
826        pub fn new() -> Self {
827            std::default::Default::default()
828        }
829
830        /// Sets the value of [exactly_once_delivery_enabled][crate::model::streaming_pull_response::SubscriptionProperties::exactly_once_delivery_enabled].
831        pub fn set_exactly_once_delivery_enabled<T: std::convert::Into<bool>>(
832            mut self,
833            v: T,
834        ) -> Self {
835            self.exactly_once_delivery_enabled = v.into();
836            self
837        }
838
839        /// Sets the value of [message_ordering_enabled][crate::model::streaming_pull_response::SubscriptionProperties::message_ordering_enabled].
840        pub fn set_message_ordering_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
841            self.message_ordering_enabled = v.into();
842            self
843        }
844    }
845
846    impl wkt::message::Message for SubscriptionProperties {
847        fn typename() -> &'static str {
848            "type.googleapis.com/google.pubsub.v1.StreamingPullResponse.SubscriptionProperties"
849        }
850    }
851}