Search in sources :

Example 1 with QueryHeader

use of com.hederahashgraph.api.proto.java.QueryHeader in project hedera-services by hashgraph.

the class RequestBuilder method getFileGetContentBuilder.

public static Query getFileGetContentBuilder(Transaction payment, FileID fileID, ResponseType responseType) {
    QueryHeader queryHeader = QueryHeader.newBuilder().setPayment(payment).setResponseType(responseType).build();
    FileGetContentsQuery fileGetContentsQuery = FileGetContentsQuery.newBuilder().setHeader(queryHeader).setFileID(fileID).build();
    return Query.newBuilder().setFileGetContents(fileGetContentsQuery).build();
}
Also used : FileGetContentsQuery(com.hederahashgraph.api.proto.java.FileGetContentsQuery) QueryHeader(com.hederahashgraph.api.proto.java.QueryHeader)

Example 2 with QueryHeader

use of com.hederahashgraph.api.proto.java.QueryHeader in project hedera-services by hashgraph.

the class RequestBuilder method getFileGetInfoBuilder.

/**
 * Get file get info builder
 *
 * @param payment
 * 		payment
 * @param fileID
 * 		file ID
 * @param responseType
 * 		response type
 * @return query
 */
public static Query getFileGetInfoBuilder(Transaction payment, FileID fileID, ResponseType responseType) {
    QueryHeader queryHeader = QueryHeader.newBuilder().setPayment(payment).setResponseType(responseType).build();
    FileGetInfoQuery fileGetInfoQuery = FileGetInfoQuery.newBuilder().setHeader(queryHeader).setFileID(fileID).build();
    return Query.newBuilder().setFileGetInfo(fileGetInfoQuery).build();
}
Also used : FileGetInfoQuery(com.hederahashgraph.api.proto.java.FileGetInfoQuery) QueryHeader(com.hederahashgraph.api.proto.java.QueryHeader)

Example 3 with QueryHeader

use of com.hederahashgraph.api.proto.java.QueryHeader in project hedera-services by hashgraph.

the class HapiGetTxnRecord method getRecordQuery.

private Query getRecordQuery(HapiApiSpec spec, Transaction payment, boolean costOnly) {
    TransactionID txnId = useDefaultTxnId ? defaultTxnId : explicitTxnId.orElseGet(() -> spec.registry().getTxnId(txn));
    if (lookupScheduledFromRegistryId) {
        txnId = spec.registry().getTxnId(correspondingScheduledTxnId(creationName.get()));
    } else {
        if (scheduled) {
            txnId = txnId.toBuilder().setScheduled(true).build();
        }
    }
    QueryHeader header;
    if (costOnly && omitPaymentHeaderOnCostAnswer) {
        header = QueryHeader.newBuilder().setResponseType(COST_ANSWER).build();
    } else {
        header = costOnly ? answerCostHeader(payment) : answerHeader(payment);
    }
    TransactionGetRecordQuery getRecordQuery = TransactionGetRecordQuery.newBuilder().setHeader(header).setTransactionID(txnId).setIncludeDuplicates(requestDuplicates).setIncludeChildRecords(requestChildRecords).build();
    return Query.newBuilder().setTransactionGetRecord(getRecordQuery).build();
}
Also used : QueryHeader(com.hederahashgraph.api.proto.java.QueryHeader) TransactionGetRecordQuery(com.hederahashgraph.api.proto.java.TransactionGetRecordQuery) TransactionID(com.hederahashgraph.api.proto.java.TransactionID)

Aggregations

QueryHeader (com.hederahashgraph.api.proto.java.QueryHeader)3 FileGetContentsQuery (com.hederahashgraph.api.proto.java.FileGetContentsQuery)1 FileGetInfoQuery (com.hederahashgraph.api.proto.java.FileGetInfoQuery)1 TransactionGetRecordQuery (com.hederahashgraph.api.proto.java.TransactionGetRecordQuery)1 TransactionID (com.hederahashgraph.api.proto.java.TransactionID)1