예제 #1
0
        internal virtual GetBlockResponse GetBlock(GetBlockRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetBlockRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetBlockResponseUnmarshaller.Instance;

            return(Invoke <GetBlockResponse>(request, options));
        }
예제 #2
0
        /// <summary>
        /// Returns a journal block object at a specified address in a ledger. Also returns a
        /// proof of the specified block for verification if <code>DigestTipAddress</code> is
        /// provided.
        ///
        ///
        /// <para>
        /// If the specified ledger doesn't exist or is in <code>DELETING</code> status, then
        /// throws <code>ResourceNotFoundException</code>.
        /// </para>
        ///
        /// <para>
        /// If the specified ledger is in <code>CREATING</code> status, then throws <code>ResourcePreconditionNotMetException</code>.
        /// </para>
        ///
        /// <para>
        /// If no block exists with the specified address, then throws <code>InvalidParameterException</code>.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the GetBlock service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the GetBlock service method, as returned by QLDB.</returns>
        /// <exception cref="Amazon.QLDB.Model.InvalidParameterException">
        /// One or more parameters in the request aren't valid.
        /// </exception>
        /// <exception cref="Amazon.QLDB.Model.ResourceNotFoundException">
        /// The specified resource doesn't exist.
        /// </exception>
        /// <exception cref="Amazon.QLDB.Model.ResourcePreconditionNotMetException">
        /// The operation failed because a condition wasn't satisfied in advance.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/qldb-2019-01-02/GetBlock">REST API Reference for GetBlock Operation</seealso>
        public virtual Task <GetBlockResponse> GetBlockAsync(GetBlockRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetBlockRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetBlockResponseUnmarshaller.Instance;

            return(InvokeAsync <GetBlockResponse>(request, options, cancellationToken));
        }
        public GetBlockResponse getBlock(GetBlockParameter parameter)
        {
            GetBlockRequest request = new GetBlockRequest();

            if (!string.IsNullOrEmpty(parameter.hash))
            {
                request.Hash = parameter.hash;
            }
            request.Height = parameter.height;
            return(coreClient.getBlock(request));
        }
예제 #4
0
 public Task <GetBlockResponse> GetBlockAsync(GetBlockRequest BlockRequest)
 => GetSimpleJsonAsync <GetBlockResponse, GetBlockRequest>(BlockRequest, Api.GetBlocksBlock);
예제 #5
0
 public GetBlockResponse GetBlock(GetBlockRequest BlockRequest)
 => GetBlockAsync(BlockRequest).ConfigureAwait(false).GetAwaiter().GetResult();