pub struct MessageBuilder { /* private fields */ }Expand description
Builder for creating a message.
Implementations§
Source§impl MessageBuilder
impl MessageBuilder
Sourcepub fn new(role: impl Into<String>, content: impl Into<String>) -> Self
pub fn new(role: impl Into<String>, content: impl Into<String>) -> Self
Create a new message builder with role and content.
Sourcepub fn add_attachment(self, file_id: impl Into<String>) -> Self
pub fn add_attachment(self, file_id: impl Into<String>) -> Self
Add an attachment (file ID) to the message.
Sourcepub fn metadata(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn metadata(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add metadata to the message.
Sourcepub fn content_ref(&self) -> &str
pub fn content_ref(&self) -> &str
Get the content for this message.
Sourcepub fn attachments_ref(&self) -> &[String]
pub fn attachments_ref(&self) -> &[String]
Get the attachments for this message.
Sourcepub fn metadata_ref(&self) -> &HashMap<String, String>
pub fn metadata_ref(&self) -> &HashMap<String, String>
Get the metadata for this message.
Sourcepub fn build(self) -> Result<CreateMessageRequest>
pub fn build(self) -> Result<CreateMessageRequest>
Build a CreateMessageRequest from this builder.
Trait Implementations§
Source§impl Clone for MessageBuilder
impl Clone for MessageBuilder
Source§fn clone(&self) -> MessageBuilder
fn clone(&self) -> MessageBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MessageBuilder
impl RefUnwindSafe for MessageBuilder
impl Send for MessageBuilder
impl Sync for MessageBuilder
impl Unpin for MessageBuilder
impl UnwindSafe for MessageBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more