Struct aws_sdk_managedblockchainquery::client::Client
source · pub struct Client { /* private fields */ }Expand description
Client for Amazon Managed Blockchain Query
Client for invoking operations on Amazon Managed Blockchain Query. Each operation on Amazon Managed Blockchain Query is a method on this
this struct. .send() MUST be invoked on the generated operations to dispatch the request to the service.
Constructing a Client
A Config is required to construct a client. For most use cases, the aws-config
crate should be used to automatically resolve this config using
aws_config::load_from_env(), since this will resolve an SdkConfig which can be shared
across multiple different AWS SDK clients. This config resolution process can be customized
by calling aws_config::from_env() instead, which returns a ConfigLoader that uses
the builder pattern to customize the default config.
In the simplest case, creating a client looks as follows:
let config = aws_config::load_from_env().await;
let client = aws_sdk_managedblockchainquery::Client::new(&config);Occasionally, SDKs may have additional service-specific that can be set on the Config that
is absent from SdkConfig, or slightly different settings for a specific client may be desired.
The Config struct implements From<&SdkConfig>, so setting these specific settings can be
done as follows:
let sdk_config = ::aws_config::load_from_env().await;
let config = aws_sdk_managedblockchainquery::config::Builder::from(&sdk_config)
.some_service_specific_setting("value")
.build();See the aws-config docs and Config for more information on customizing configuration.
Note: Client construction is expensive due to connection thread pool initialization, and should be done once at application start-up.
Using the Client
A client has a function for every operation that can be performed by the service.
For example, the GetTransaction operation has
a Client::get_transaction, function which returns a builder for that operation.
The fluent builder ultimately has a send() function that returns an async future that
returns a result, as illustrated below:
let result = client.get_transaction()
.transaction_hash("example")
.send()
.await;The underlying HTTP requests that get made by this can be modified with the customize_operation
function on the fluent builder. See the customize module for more
information.
Implementations§
source§impl Client
impl Client
sourcepub fn batch_get_token_balance(&self) -> BatchGetTokenBalanceFluentBuilder
pub fn batch_get_token_balance(&self) -> BatchGetTokenBalanceFluentBuilder
Constructs a fluent builder for the BatchGetTokenBalance operation.
- The fluent builder is configurable:
get_token_balance_inputs(BatchGetTokenBalanceInputItem)/set_get_token_balance_inputs(Option<Vec<BatchGetTokenBalanceInputItem>>):An array of
GetTokenBalanceInputobjects whose balance is being requested.
- On success, responds with
BatchGetTokenBalanceOutputwith field(s):token_balances(Option<Vec<BatchGetTokenBalanceOutputItem>>):An array of
BatchGetTokenBalanceOutputItemobjects returned by the response.errors(Option<Vec<BatchGetTokenBalanceErrorItem>>):An array of
BatchGetTokenBalanceErrorItemobjects returned from the request.
- On failure, responds with
SdkError<BatchGetTokenBalanceError>
source§impl Client
impl Client
sourcepub fn get_token_balance(&self) -> GetTokenBalanceFluentBuilder
pub fn get_token_balance(&self) -> GetTokenBalanceFluentBuilder
Constructs a fluent builder for the GetTokenBalance operation.
- The fluent builder is configurable:
token_identifier(TokenIdentifier)/set_token_identifier(Option<TokenIdentifier>):The container for the identifier for the token, including the unique token ID and its blockchain network.
owner_identifier(OwnerIdentifier)/set_owner_identifier(Option<OwnerIdentifier>):The container for the identifier for the owner.
at_blockchain_instant(BlockchainInstant)/set_at_blockchain_instant(Option<BlockchainInstant>):The time for when the TokenBalance is requested or the current time if a time is not provided in the request.
This time will only be recorded up to the second.
- On success, responds with
GetTokenBalanceOutputwith field(s):owner_identifier(Option<OwnerIdentifier>):The container for the identifier of the owner.
token_identifier(Option<TokenIdentifier>):The container for the identifier for the token including the unique token ID and its blockchain network.
Only the native tokens BTC,ETH, and the ERC-20, ERC-721, and ERC 1155 token standards are supported.
balance(Option<String>):The container for the token balance.
at_blockchain_instant(Option<BlockchainInstant>):The container for time.
last_updated_time(Option<BlockchainInstant>):The container for time.
- On failure, responds with
SdkError<GetTokenBalanceError>
source§impl Client
impl Client
sourcepub fn get_transaction(&self) -> GetTransactionFluentBuilder
pub fn get_transaction(&self) -> GetTransactionFluentBuilder
Constructs a fluent builder for the GetTransaction operation.
- The fluent builder is configurable:
transaction_hash(impl Into<String>)/set_transaction_hash(Option<String>):The hash of the transaction. It is generated whenever a transaction is verified and added to the blockchain.
network(QueryNetwork)/set_network(Option<QueryNetwork>):The blockchain network where the transaction occurred.
- On success, responds with
GetTransactionOutputwith field(s):transaction(Option<Transaction>):Contains the details of the transaction.
- On failure, responds with
SdkError<GetTransactionError>
source§impl Client
impl Client
sourcepub fn list_token_balances(&self) -> ListTokenBalancesFluentBuilder
pub fn list_token_balances(&self) -> ListTokenBalancesFluentBuilder
Constructs a fluent builder for the ListTokenBalances operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
owner_filter(OwnerFilter)/set_owner_filter(Option<OwnerFilter>):The contract or wallet address on the blockchain network by which to filter the request. You must specify the
addressproperty of theownerFilterwhen listing balances of tokens owned by the address.token_filter(TokenFilter)/set_token_filter(Option<TokenFilter>):The contract address or a token identifier on the blockchain network by which to filter the request. You must specify the contractAddress property of this container when listing tokens minted by a contract.
You must always specify the network property of this container when using this operation.
next_token(impl Into<String>)/set_next_token(Option<String>):The pagination token that indicates the next set of results to retrieve.
max_results(i32)/set_max_results(Option<i32>):The maximum number of token balances to return.
- On success, responds with
ListTokenBalancesOutputwith field(s):token_balances(Option<Vec<TokenBalance>>):An array of
TokenBalanceobjects. Each object contains details about the token balance.next_token(Option<String>):The pagination token that indicates the next set of results to retrieve.
- On failure, responds with
SdkError<ListTokenBalancesError>
source§impl Client
impl Client
sourcepub fn list_transaction_events(&self) -> ListTransactionEventsFluentBuilder
pub fn list_transaction_events(&self) -> ListTransactionEventsFluentBuilder
Constructs a fluent builder for the ListTransactionEvents operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
transaction_hash(impl Into<String>)/set_transaction_hash(Option<String>):The hash of the transaction. It is generated whenever a transaction is verified and added to the blockchain.
network(QueryNetwork)/set_network(Option<QueryNetwork>):The blockchain network where the transaction events occurred.
next_token(impl Into<String>)/set_next_token(Option<String>):The pagination token that indicates the next set of results to retrieve.
max_results(i32)/set_max_results(Option<i32>):The maximum number of transaction events to list.
Even if additional results can be retrieved, the request can return less results than
maxResultsor an empty array of results.To retrieve the next set of results, make another request with the returned
nextTokenvalue. The value ofnextTokenisnullwhen there are no more results to return
- On success, responds with
ListTransactionEventsOutputwith field(s):events(Option<Vec<TransactionEvent>>):An array of
TransactionEventobjects. Each object contains details about the transaction events.next_token(Option<String>):The pagination token that indicates the next set of results to retrieve.
- On failure, responds with
SdkError<ListTransactionEventsError>
source§impl Client
impl Client
sourcepub fn list_transactions(&self) -> ListTransactionsFluentBuilder
pub fn list_transactions(&self) -> ListTransactionsFluentBuilder
Constructs a fluent builder for the ListTransactions operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
address(impl Into<String>)/set_address(Option<String>):The address (either a contract or wallet), whose transactions are being requested.
network(QueryNetwork)/set_network(Option<QueryNetwork>):The blockchain network where the transactions occurred.
from_blockchain_instant(BlockchainInstant)/set_from_blockchain_instant(Option<BlockchainInstant>):The container for time.
to_blockchain_instant(BlockchainInstant)/set_to_blockchain_instant(Option<BlockchainInstant>):The container for time.
sort(ListTransactionsSort)/set_sort(Option<ListTransactionsSort>):Sorts items in an ascending order if the first page starts at
fromTime. Sorts items in a descending order if the first page starts attoTime.next_token(impl Into<String>)/set_next_token(Option<String>):The pagination token that indicates the next set of results to retrieve.
max_results(i32)/set_max_results(Option<i32>):The maximum number of transactions to list.
Even if additional results can be retrieved, the request can return less results than
maxResultsor an empty array of results.To retrieve the next set of results, make another request with the returned
nextTokenvalue. The value ofnextTokenisnullwhen there are no more results to return
- On success, responds with
ListTransactionsOutputwith field(s):transactions(Option<Vec<TransactionOutputItem>>):The array of transactions returned by the request.
next_token(Option<String>):The pagination token that indicates the next set of results to retrieve.
- On failure, responds with
SdkError<ListTransactionsError>
source§impl Client
impl Client
sourcepub fn new(sdk_config: &SdkConfig) -> Self
pub fn new(sdk_config: &SdkConfig) -> Self
Creates a new client from an SDK Config.
Panics
- This method will panic if the
sdk_configis missing an async sleep implementation. If you experience this panic, set thesleep_implon the Config passed into this function to fix it. - This method will panic if the
sdk_configis missing an HTTP connector. If you experience this panic, set thehttp_connectoron the Config passed into this function to fix it.