public virtual IActionResult DateTimeDifference([FromBody] InputDateTimeDifference dateTimeDifference) { //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(OutputDateDifference)); //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 \"years\" : 1,\n \"months\" : 2,\n \"days\" : 14,\n \"hours\" : 1,\n \"minutes\" : 50,\n \"seconds\" : 30,\n \"milliseconds\" : 0,\n \"totalYears\" : 1.2,\n \"totalMonths\" : 14.39,\n \"totalDays\" : 438.08,\n \"totalHours\" : 10513.84,\n \"totalMinutes\" : 630830.5,\n \"totalSeconds\" : 37849830,\n \"totalMilliseconds\" : 37849830000,\n \"ticks\" : 378498300000000\n}"; var example = exampleJson != null ? JsonConvert.DeserializeObject <OutputDateDifference>(exampleJson) : default(OutputDateDifference); //TODO: Change the data returned return(new ObjectResult(example)); }
/// <summary> /// DateTime - DateTime difference Calculate the difference between two dates /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="dateTimeDifference"> (optional)</param> /// <param name="cancellationToken">Cancellation Token to cancel the request.</param> /// <returns>Task of OutputDateDifference</returns> public async System.Threading.Tasks.Task <OutputDateDifference> DateTimeDifferenceAsync(InputDateTimeDifference dateTimeDifference = default(InputDateTimeDifference), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { Org.OpenAPITools.Client.ApiResponse <OutputDateDifference> localVarResponse = await DateTimeDifferenceWithHttpInfoAsync(dateTimeDifference, cancellationToken).ConfigureAwait(false); return(localVarResponse.Data); }
/// <summary> /// DateTime - DateTime difference Calculate the difference between two dates /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="dateTimeDifference"> (optional)</param> /// <param name="cancellationToken">Cancellation Token to cancel the request.</param> /// <returns>Task of ApiResponse (OutputDateDifference)</returns> public async System.Threading.Tasks.Task <Org.OpenAPITools.Client.ApiResponse <OutputDateDifference> > DateTimeDifferenceWithHttpInfoAsync(InputDateTimeDifference dateTimeDifference = default(InputDateTimeDifference), 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 = dateTimeDifference; // 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 <OutputDateDifference>("/DateTimeDifference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("DateTimeDifference", localVarResponse); if (_exception != null) { throw _exception; } } return(localVarResponse); }
/// <summary> /// DateTime - DateTime difference Calculate the difference between two dates /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="dateTimeDifference"> (optional)</param> /// <returns>OutputDateDifference</returns> public OutputDateDifference DateTimeDifference(InputDateTimeDifference dateTimeDifference = default(InputDateTimeDifference)) { Org.OpenAPITools.Client.ApiResponse <OutputDateDifference> localVarResponse = DateTimeDifferenceWithHttpInfo(dateTimeDifference); return(localVarResponse.Data); }