
software.amazon.awssdk.services.managedblockchainquery.model.ListTransactionsRequest Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.managedblockchainquery.model;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class ListTransactionsRequest extends ManagedBlockchainQueryRequest implements
ToCopyableBuilder {
private static final SdkField ADDRESS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("address")
.getter(getter(ListTransactionsRequest::address)).setter(setter(Builder::address))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("address").build()).build();
private static final SdkField NETWORK_FIELD = SdkField. builder(MarshallingType.STRING).memberName("network")
.getter(getter(ListTransactionsRequest::networkAsString)).setter(setter(Builder::network))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("network").build()).build();
private static final SdkField FROM_BLOCKCHAIN_INSTANT_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("fromBlockchainInstant")
.getter(getter(ListTransactionsRequest::fromBlockchainInstant)).setter(setter(Builder::fromBlockchainInstant))
.constructor(BlockchainInstant::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("fromBlockchainInstant").build())
.build();
private static final SdkField TO_BLOCKCHAIN_INSTANT_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("toBlockchainInstant")
.getter(getter(ListTransactionsRequest::toBlockchainInstant)).setter(setter(Builder::toBlockchainInstant))
.constructor(BlockchainInstant::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("toBlockchainInstant").build())
.build();
private static final SdkField SORT_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("sort")
.getter(getter(ListTransactionsRequest::sort)).setter(setter(Builder::sort))
.constructor(ListTransactionsSort::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sort").build()).build();
private static final SdkField NEXT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("nextToken").getter(getter(ListTransactionsRequest::nextToken)).setter(setter(Builder::nextToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("nextToken").build()).build();
private static final SdkField MAX_RESULTS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("maxResults").getter(getter(ListTransactionsRequest::maxResults)).setter(setter(Builder::maxResults))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("maxResults").build()).build();
private static final SdkField CONFIRMATION_STATUS_FILTER_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("confirmationStatusFilter")
.getter(getter(ListTransactionsRequest::confirmationStatusFilter)).setter(setter(Builder::confirmationStatusFilter))
.constructor(ConfirmationStatusFilter::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("confirmationStatusFilter").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ADDRESS_FIELD, NETWORK_FIELD,
FROM_BLOCKCHAIN_INSTANT_FIELD, TO_BLOCKCHAIN_INSTANT_FIELD, SORT_FIELD, NEXT_TOKEN_FIELD, MAX_RESULTS_FIELD,
CONFIRMATION_STATUS_FILTER_FIELD));
private final String address;
private final String network;
private final BlockchainInstant fromBlockchainInstant;
private final BlockchainInstant toBlockchainInstant;
private final ListTransactionsSort sort;
private final String nextToken;
private final Integer maxResults;
private final ConfirmationStatusFilter confirmationStatusFilter;
private ListTransactionsRequest(BuilderImpl builder) {
super(builder);
this.address = builder.address;
this.network = builder.network;
this.fromBlockchainInstant = builder.fromBlockchainInstant;
this.toBlockchainInstant = builder.toBlockchainInstant;
this.sort = builder.sort;
this.nextToken = builder.nextToken;
this.maxResults = builder.maxResults;
this.confirmationStatusFilter = builder.confirmationStatusFilter;
}
/**
*
* The address (either a contract or wallet), whose transactions are being requested.
*
*
* @return The address (either a contract or wallet), whose transactions are being requested.
*/
public final String address() {
return address;
}
/**
*
* The blockchain network where the transactions occurred.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #network} will
* return {@link QueryNetwork#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #networkAsString}.
*
*
* @return The blockchain network where the transactions occurred.
* @see QueryNetwork
*/
public final QueryNetwork network() {
return QueryNetwork.fromValue(network);
}
/**
*
* The blockchain network where the transactions occurred.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #network} will
* return {@link QueryNetwork#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #networkAsString}.
*
*
* @return The blockchain network where the transactions occurred.
* @see QueryNetwork
*/
public final String networkAsString() {
return network;
}
/**
* Returns the value of the FromBlockchainInstant property for this object.
*
* @return The value of the FromBlockchainInstant property for this object.
*/
public final BlockchainInstant fromBlockchainInstant() {
return fromBlockchainInstant;
}
/**
* Returns the value of the ToBlockchainInstant property for this object.
*
* @return The value of the ToBlockchainInstant property for this object.
*/
public final BlockchainInstant toBlockchainInstant() {
return toBlockchainInstant;
}
/**
*
* The order by which the results will be sorted.
*
*
* @return The order by which the results will be sorted.
*/
public final ListTransactionsSort sort() {
return sort;
}
/**
*
* The pagination token that indicates the next set of results to retrieve.
*
*
* @return The pagination token that indicates the next set of results to retrieve.
*/
public final String nextToken() {
return nextToken;
}
/**
*
* The maximum number of transactions to list.
*
*
* Default: 100
*
*
*
* Even if additional results can be retrieved, the request can return less results than maxResults
or
* an empty array of results.
*
*
* To retrieve the next set of results, make another request with the returned nextToken
value. The
* value of nextToken
is null
when there are no more results to return
*
*
*
* @return The maximum number of transactions to list.
*
* Default: 100
*
*
*
* Even if additional results can be retrieved, the request can return less results than
* maxResults
or an empty array of results.
*
*
* To retrieve the next set of results, make another request with the returned nextToken
value.
* The value of nextToken
is null
when there are no more results to return
*
*/
public final Integer maxResults() {
return maxResults;
}
/**
*
* This filter is used to include transactions in the response that haven't reached finality
* . Transactions that have reached finality are always part of the response.
*
*
* @return This filter is used to include transactions in the response that haven't reached
* finality . Transactions that have reached finality are always part of the response.
*/
public final ConfirmationStatusFilter confirmationStatusFilter() {
return confirmationStatusFilter;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(address());
hashCode = 31 * hashCode + Objects.hashCode(networkAsString());
hashCode = 31 * hashCode + Objects.hashCode(fromBlockchainInstant());
hashCode = 31 * hashCode + Objects.hashCode(toBlockchainInstant());
hashCode = 31 * hashCode + Objects.hashCode(sort());
hashCode = 31 * hashCode + Objects.hashCode(nextToken());
hashCode = 31 * hashCode + Objects.hashCode(maxResults());
hashCode = 31 * hashCode + Objects.hashCode(confirmationStatusFilter());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ListTransactionsRequest)) {
return false;
}
ListTransactionsRequest other = (ListTransactionsRequest) obj;
return Objects.equals(address(), other.address()) && Objects.equals(networkAsString(), other.networkAsString())
&& Objects.equals(fromBlockchainInstant(), other.fromBlockchainInstant())
&& Objects.equals(toBlockchainInstant(), other.toBlockchainInstant()) && Objects.equals(sort(), other.sort())
&& Objects.equals(nextToken(), other.nextToken()) && Objects.equals(maxResults(), other.maxResults())
&& Objects.equals(confirmationStatusFilter(), other.confirmationStatusFilter());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("ListTransactionsRequest").add("Address", address()).add("Network", networkAsString())
.add("FromBlockchainInstant", fromBlockchainInstant()).add("ToBlockchainInstant", toBlockchainInstant())
.add("Sort", sort()).add("NextToken", nextToken()).add("MaxResults", maxResults())
.add("ConfirmationStatusFilter", confirmationStatusFilter()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "address":
return Optional.ofNullable(clazz.cast(address()));
case "network":
return Optional.ofNullable(clazz.cast(networkAsString()));
case "fromBlockchainInstant":
return Optional.ofNullable(clazz.cast(fromBlockchainInstant()));
case "toBlockchainInstant":
return Optional.ofNullable(clazz.cast(toBlockchainInstant()));
case "sort":
return Optional.ofNullable(clazz.cast(sort()));
case "nextToken":
return Optional.ofNullable(clazz.cast(nextToken()));
case "maxResults":
return Optional.ofNullable(clazz.cast(maxResults()));
case "confirmationStatusFilter":
return Optional.ofNullable(clazz.cast(confirmationStatusFilter()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function