/// <summary>
        /// Initiates the asynchronous execution of the GetProposal operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetProposal operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/managedblockchain-2018-09-24/GetProposal">REST API Reference for GetProposal Operation</seealso>
        public virtual Task <GetProposalResponse> GetProposalAsync(GetProposalRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetProposalRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetProposalResponseUnmarshaller.Instance;

            return(InvokeAsync <GetProposalResponse>(request, options, cancellationToken));
        }
        internal virtual GetProposalResponse GetProposal(GetProposalRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetProposalRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetProposalResponseUnmarshaller.Instance;

            return(Invoke <GetProposalResponse>(request, options));
        }
Esempio n. 3
0
        public async Task <IActionResult> GetProposal([FromBody] GetProposalRequest request)
        {
            var apiRequest    = new { Object = request, Authentication = new { Source = "SOMPO", Key = "77lTCSn41w" } };
            var client        = _httpClientFactory.CreateClient("Sompo");
            var bodyParamters = new StringContent(JsonConvert.SerializeObject(apiRequest), Encoding.UTF8, "application/json");
            var response      = await client.PostAsync("/sample/engine", bodyParamters);

            var stringResponse = await response.Content.ReadAsStringAsync();

            var proposalResponse = JsonConvert.DeserializeObject <GetProposalResponse>(stringResponse);

            return(Json(proposalResponse));
        }