1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Contains citations for a part of an agent response.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Attribution {
/// <p>A list of citations and related information for a part of an agent response.</p>
pub citations: ::std::option::Option<::std::vec::Vec<crate::types::Citation>>,
}
impl Attribution {
/// <p>A list of citations and related information for a part of an agent response.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.citations.is_none()`.
pub fn citations(&self) -> &[crate::types::Citation] {
self.citations.as_deref().unwrap_or_default()
}
}
impl Attribution {
/// Creates a new builder-style object to manufacture [`Attribution`](crate::types::Attribution).
pub fn builder() -> crate::types::builders::AttributionBuilder {
crate::types::builders::AttributionBuilder::default()
}
}
/// A builder for [`Attribution`](crate::types::Attribution).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct AttributionBuilder {
pub(crate) citations: ::std::option::Option<::std::vec::Vec<crate::types::Citation>>,
}
impl AttributionBuilder {
/// Appends an item to `citations`.
///
/// To override the contents of this collection use [`set_citations`](Self::set_citations).
///
/// <p>A list of citations and related information for a part of an agent response.</p>
pub fn citations(mut self, input: crate::types::Citation) -> Self {
let mut v = self.citations.unwrap_or_default();
v.push(input);
self.citations = ::std::option::Option::Some(v);
self
}
/// <p>A list of citations and related information for a part of an agent response.</p>
pub fn set_citations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Citation>>) -> Self {
self.citations = input;
self
}
/// <p>A list of citations and related information for a part of an agent response.</p>
pub fn get_citations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Citation>> {
&self.citations
}
/// Consumes the builder and constructs a [`Attribution`](crate::types::Attribution).
pub fn build(self) -> crate::types::Attribution {
crate::types::Attribution { citations: self.citations }
}
}