#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
mod debug;
mod deserialize;
mod serialize;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PubsubMessage {
pub data: ::bytes::Bytes,
pub attributes: std::collections::HashMap<std::string::String, std::string::String>,
pub message_id: std::string::String,
pub publish_time: std::option::Option<wkt::Timestamp>,
pub ordering_key: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PubsubMessage {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.data = v.into();
self
}
pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_message_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.message_id = v.into();
self
}
pub fn set_publish_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.publish_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_publish_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.publish_time = v.map(|x| x.into());
self
}
pub fn set_ordering_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.ordering_key = v.into();
self
}
}
impl wkt::message::Message for PubsubMessage {
fn typename() -> &'static str {
"type.googleapis.com/google.pubsub.v1.PubsubMessage"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PublishRequest {
pub topic: std::string::String,
pub messages: std::vec::Vec<crate::model::PubsubMessage>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PublishRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.topic = v.into();
self
}
pub fn set_messages<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::PubsubMessage>,
{
use std::iter::Iterator;
self.messages = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for PublishRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.pubsub.v1.PublishRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PublishResponse {
pub message_ids: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PublishResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_message_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.message_ids = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for PublishResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.pubsub.v1.PublishResponse"
}
}