示例#1
0
        public virtual IActionResult StockPrices([FromBody] InputStockPrices stockPrices)
        {
            //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
            // return StatusCode(200, default(OutputStockPrice));
            //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
            // return StatusCode(400, default(OutputString));
            string exampleJson = null;

            exampleJson = "{\n  \"result\" : [ {\n    \"open\" : 73.84,\n    \"high\" : 74.32,\n    \"low\" : 72.245,\n    \"last\" : 72.3,\n    \"close\" : 72.7,\n    \"volume\" : 15151304,\n    \"date\" : \"2020-10-07T00:00:00+0000\",\n    \"symbol\" : \"CVX\",\n    \"exchange\" : \"XNYS\"\n  } ]\n}";

            var example = exampleJson != null
            ? JsonConvert.DeserializeObject <OutputStockPrice>(exampleJson)
            : default(OutputStockPrice);

            //TODO: Change the data returned
            return(new ObjectResult(example));
        }
示例#2
0
        /// <summary>
        /// Finance - Stock prices Get current and historical stock price information
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="stockPrices"> (optional)</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (OutputStockPrice)</returns>
        public async System.Threading.Tasks.Task <Org.OpenAPITools.Client.ApiResponse <OutputStockPrice> > StockPricesWithHttpInfoAsync(InputStockPrices stockPrices = default(InputStockPrices), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();

            String[] _contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };


            var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.Data = stockPrices;

            // authentication (apiKeyHeader) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-IBM-Client-Id")))
            {
                localVarRequestOptions.HeaderParameters.Add("X-IBM-Client-Id", this.Configuration.GetApiKeyWithPrefix("X-IBM-Client-Id"));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PostAsync <OutputStockPrice>("/StockPrices", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("StockPrices", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
示例#3
0
        /// <summary>
        /// Finance - Stock prices Get current and historical stock price information
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="stockPrices"> (optional)</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of OutputStockPrice</returns>
        public async System.Threading.Tasks.Task <OutputStockPrice> StockPricesAsync(InputStockPrices stockPrices = default(InputStockPrices), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Org.OpenAPITools.Client.ApiResponse <OutputStockPrice> localVarResponse = await StockPricesWithHttpInfoAsync(stockPrices, cancellationToken).ConfigureAwait(false);

            return(localVarResponse.Data);
        }
示例#4
0
 /// <summary>
 /// Finance - Stock prices Get current and historical stock price information
 /// </summary>
 /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="stockPrices"> (optional)</param>
 /// <returns>OutputStockPrice</returns>
 public OutputStockPrice StockPrices(InputStockPrices stockPrices = default(InputStockPrices))
 {
     Org.OpenAPITools.Client.ApiResponse <OutputStockPrice> localVarResponse = StockPricesWithHttpInfo(stockPrices);
     return(localVarResponse.Data);
 }