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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>The price per request for a payment network, specifying the amount and cryptocurrency.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Price {
/// <p>The price per request as a decimal string in the specified currency. Minimum: 0.001. Maximum: 999999999.999. Supports up to 3 decimal places.</p>
pub amount: ::std::string::String,
/// <p>The cryptocurrency for payment. Currently only <code>USDC</code> is supported.</p>
pub currency: crate::types::CryptoCurrency,
}
impl Price {
/// <p>The price per request as a decimal string in the specified currency. Minimum: 0.001. Maximum: 999999999.999. Supports up to 3 decimal places.</p>
pub fn amount(&self) -> &str {
use std::ops::Deref;
self.amount.deref()
}
/// <p>The cryptocurrency for payment. Currently only <code>USDC</code> is supported.</p>
pub fn currency(&self) -> &crate::types::CryptoCurrency {
&self.currency
}
}
impl Price {
/// Creates a new builder-style object to manufacture [`Price`](crate::types::Price).
pub fn builder() -> crate::types::builders::PriceBuilder {
crate::types::builders::PriceBuilder::default()
}
}
/// A builder for [`Price`](crate::types::Price).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PriceBuilder {
pub(crate) amount: ::std::option::Option<::std::string::String>,
pub(crate) currency: ::std::option::Option<crate::types::CryptoCurrency>,
}
impl PriceBuilder {
/// <p>The price per request as a decimal string in the specified currency. Minimum: 0.001. Maximum: 999999999.999. Supports up to 3 decimal places.</p>
/// This field is required.
pub fn amount(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.amount = ::std::option::Option::Some(input.into());
self
}
/// <p>The price per request as a decimal string in the specified currency. Minimum: 0.001. Maximum: 999999999.999. Supports up to 3 decimal places.</p>
pub fn set_amount(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.amount = input;
self
}
/// <p>The price per request as a decimal string in the specified currency. Minimum: 0.001. Maximum: 999999999.999. Supports up to 3 decimal places.</p>
pub fn get_amount(&self) -> &::std::option::Option<::std::string::String> {
&self.amount
}
/// <p>The cryptocurrency for payment. Currently only <code>USDC</code> is supported.</p>
/// This field is required.
pub fn currency(mut self, input: crate::types::CryptoCurrency) -> Self {
self.currency = ::std::option::Option::Some(input);
self
}
/// <p>The cryptocurrency for payment. Currently only <code>USDC</code> is supported.</p>
pub fn set_currency(mut self, input: ::std::option::Option<crate::types::CryptoCurrency>) -> Self {
self.currency = input;
self
}
/// <p>The cryptocurrency for payment. Currently only <code>USDC</code> is supported.</p>
pub fn get_currency(&self) -> &::std::option::Option<crate::types::CryptoCurrency> {
&self.currency
}
/// Consumes the builder and constructs a [`Price`](crate::types::Price).
/// This method will fail if any of the following fields are not set:
/// - [`amount`](crate::types::builders::PriceBuilder::amount)
/// - [`currency`](crate::types::builders::PriceBuilder::currency)
pub fn build(self) -> ::std::result::Result<crate::types::Price, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Price {
amount: self.amount.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"amount",
"amount was not specified but it is required when building Price",
)
})?,
currency: self.currency.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"currency",
"currency was not specified but it is required when building Price",
)
})?,
})
}
}