aws_sdk_managedblockchainquery/operation/list_token_balances/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::list_token_balances::_list_token_balances_output::ListTokenBalancesOutputBuilder;
3
4pub use crate::operation::list_token_balances::_list_token_balances_input::ListTokenBalancesInputBuilder;
5
6impl crate::operation::list_token_balances::builders::ListTokenBalancesInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::list_token_balances::ListTokenBalancesOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::list_token_balances::ListTokenBalancesError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.list_token_balances();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `ListTokenBalances`.
24///
25/// <p>This action returns the following for a given blockchain network:</p>
26/// <ul>
27/// <li>
28/// <p>Lists all token balances owned by an address (either a contract address or a wallet address).</p></li>
29/// <li>
30/// <p>Lists all token balances for all tokens created by a contract.</p></li>
31/// <li>
32/// <p>Lists all token balances for a given token.</p></li>
33/// </ul><note>
34/// <p>You must always specify the network property of the <code>tokenFilter</code> when using this operation.</p>
35/// </note>
36#[derive(::std::clone::Clone, ::std::fmt::Debug)]
37pub struct ListTokenBalancesFluentBuilder {
38 handle: ::std::sync::Arc<crate::client::Handle>,
39 inner: crate::operation::list_token_balances::builders::ListTokenBalancesInputBuilder,
40 config_override: ::std::option::Option<crate::config::Builder>,
41}
42impl
43 crate::client::customize::internal::CustomizableSend<
44 crate::operation::list_token_balances::ListTokenBalancesOutput,
45 crate::operation::list_token_balances::ListTokenBalancesError,
46 > for ListTokenBalancesFluentBuilder
47{
48 fn send(
49 self,
50 config_override: crate::config::Builder,
51 ) -> crate::client::customize::internal::BoxFuture<
52 crate::client::customize::internal::SendResult<
53 crate::operation::list_token_balances::ListTokenBalancesOutput,
54 crate::operation::list_token_balances::ListTokenBalancesError,
55 >,
56 > {
57 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
58 }
59}
60impl ListTokenBalancesFluentBuilder {
61 /// Creates a new `ListTokenBalancesFluentBuilder`.
62 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
63 Self {
64 handle,
65 inner: ::std::default::Default::default(),
66 config_override: ::std::option::Option::None,
67 }
68 }
69 /// Access the ListTokenBalances as a reference.
70 pub fn as_input(&self) -> &crate::operation::list_token_balances::builders::ListTokenBalancesInputBuilder {
71 &self.inner
72 }
73 /// Sends the request and returns the response.
74 ///
75 /// If an error occurs, an `SdkError` will be returned with additional details that
76 /// can be matched against.
77 ///
78 /// By default, any retryable failures will be retried twice. Retry behavior
79 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
80 /// set when configuring the client.
81 pub async fn send(
82 self,
83 ) -> ::std::result::Result<
84 crate::operation::list_token_balances::ListTokenBalancesOutput,
85 ::aws_smithy_runtime_api::client::result::SdkError<
86 crate::operation::list_token_balances::ListTokenBalancesError,
87 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
88 >,
89 > {
90 let input = self
91 .inner
92 .build()
93 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
94 let runtime_plugins = crate::operation::list_token_balances::ListTokenBalances::operation_runtime_plugins(
95 self.handle.runtime_plugins.clone(),
96 &self.handle.conf,
97 self.config_override,
98 );
99 crate::operation::list_token_balances::ListTokenBalances::orchestrate(&runtime_plugins, input).await
100 }
101
102 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
103 pub fn customize(
104 self,
105 ) -> crate::client::customize::CustomizableOperation<
106 crate::operation::list_token_balances::ListTokenBalancesOutput,
107 crate::operation::list_token_balances::ListTokenBalancesError,
108 Self,
109 > {
110 crate::client::customize::CustomizableOperation::new(self)
111 }
112 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
113 self.set_config_override(::std::option::Option::Some(config_override.into()));
114 self
115 }
116
117 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
118 self.config_override = config_override;
119 self
120 }
121 /// Create a paginator for this request
122 ///
123 /// Paginators are used by calling [`send().await`](crate::operation::list_token_balances::paginator::ListTokenBalancesPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
124 pub fn into_paginator(self) -> crate::operation::list_token_balances::paginator::ListTokenBalancesPaginator {
125 crate::operation::list_token_balances::paginator::ListTokenBalancesPaginator::new(self.handle, self.inner)
126 }
127 /// <p>The contract or wallet address on the blockchain network by which to filter the request. You must specify the <code>address</code> property of the <code>ownerFilter</code> when listing balances of tokens owned by the address.</p>
128 pub fn owner_filter(mut self, input: crate::types::OwnerFilter) -> Self {
129 self.inner = self.inner.owner_filter(input);
130 self
131 }
132 /// <p>The contract or wallet address on the blockchain network by which to filter the request. You must specify the <code>address</code> property of the <code>ownerFilter</code> when listing balances of tokens owned by the address.</p>
133 pub fn set_owner_filter(mut self, input: ::std::option::Option<crate::types::OwnerFilter>) -> Self {
134 self.inner = self.inner.set_owner_filter(input);
135 self
136 }
137 /// <p>The contract or wallet address on the blockchain network by which to filter the request. You must specify the <code>address</code> property of the <code>ownerFilter</code> when listing balances of tokens owned by the address.</p>
138 pub fn get_owner_filter(&self) -> &::std::option::Option<crate::types::OwnerFilter> {
139 self.inner.get_owner_filter()
140 }
141 /// <p>The contract address or a token identifier on the blockchain network by which to filter the request. You must specify the <code>contractAddress</code> property of this container when listing tokens minted by a contract.</p><note>
142 /// <p>You must always specify the network property of this container when using this operation.</p>
143 /// </note>
144 pub fn token_filter(mut self, input: crate::types::TokenFilter) -> Self {
145 self.inner = self.inner.token_filter(input);
146 self
147 }
148 /// <p>The contract address or a token identifier on the blockchain network by which to filter the request. You must specify the <code>contractAddress</code> property of this container when listing tokens minted by a contract.</p><note>
149 /// <p>You must always specify the network property of this container when using this operation.</p>
150 /// </note>
151 pub fn set_token_filter(mut self, input: ::std::option::Option<crate::types::TokenFilter>) -> Self {
152 self.inner = self.inner.set_token_filter(input);
153 self
154 }
155 /// <p>The contract address or a token identifier on the blockchain network by which to filter the request. You must specify the <code>contractAddress</code> property of this container when listing tokens minted by a contract.</p><note>
156 /// <p>You must always specify the network property of this container when using this operation.</p>
157 /// </note>
158 pub fn get_token_filter(&self) -> &::std::option::Option<crate::types::TokenFilter> {
159 self.inner.get_token_filter()
160 }
161 /// <p>The pagination token that indicates the next set of results to retrieve.</p>
162 pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163 self.inner = self.inner.next_token(input.into());
164 self
165 }
166 /// <p>The pagination token that indicates the next set of results to retrieve.</p>
167 pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168 self.inner = self.inner.set_next_token(input);
169 self
170 }
171 /// <p>The pagination token that indicates the next set of results to retrieve.</p>
172 pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
173 self.inner.get_next_token()
174 }
175 /// <p>The maximum number of token balances to return.</p>
176 /// <p>Default: <code>100</code></p><note>
177 /// <p>Even if additional results can be retrieved, the request can return less results than <code>maxResults</code> or an empty array of results.</p>
178 /// <p>To retrieve the next set of results, make another request with the returned <code>nextToken</code> value. The value of <code>nextToken</code> is <code>null</code> when there are no more results to return</p>
179 /// </note>
180 pub fn max_results(mut self, input: i32) -> Self {
181 self.inner = self.inner.max_results(input);
182 self
183 }
184 /// <p>The maximum number of token balances to return.</p>
185 /// <p>Default: <code>100</code></p><note>
186 /// <p>Even if additional results can be retrieved, the request can return less results than <code>maxResults</code> or an empty array of results.</p>
187 /// <p>To retrieve the next set of results, make another request with the returned <code>nextToken</code> value. The value of <code>nextToken</code> is <code>null</code> when there are no more results to return</p>
188 /// </note>
189 pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
190 self.inner = self.inner.set_max_results(input);
191 self
192 }
193 /// <p>The maximum number of token balances to return.</p>
194 /// <p>Default: <code>100</code></p><note>
195 /// <p>Even if additional results can be retrieved, the request can return less results than <code>maxResults</code> or an empty array of results.</p>
196 /// <p>To retrieve the next set of results, make another request with the returned <code>nextToken</code> value. The value of <code>nextToken</code> is <code>null</code> when there are no more results to return</p>
197 /// </note>
198 pub fn get_max_results(&self) -> &::std::option::Option<i32> {
199 self.inner.get_max_results()
200 }
201}