/// <summary> /// Submit an leave (vacation) claim for a worker /// </summary> /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">ID of the worker</param> /// <param name="leaveClaim">Leave claim for a worker</param> /// <returns>Task of AsyncResponse</returns> public async System.Threading.Tasks.Task <AsyncResponse> SubmitAnnualLeaveClaimAsync(string id, LeaveClaim leaveClaim) { ASW.APIServices.Core.Client.ApiResponse <AsyncResponse> localVarResponse = await SubmitAnnualLeaveClaimAsyncWithHttpInfo(id, leaveClaim); return(localVarResponse.Data); }
/// <summary> /// Submit an leave (vacation) claim for a worker /// </summary> /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">ID of the worker</param> /// <param name="leaveClaim">Leave claim for a worker</param> /// <returns>Task of ApiResponse (AsyncResponse)</returns> public async System.Threading.Tasks.Task <ASW.APIServices.Core.Client.ApiResponse <AsyncResponse> > SubmitAnnualLeaveClaimAsyncWithHttpInfo(string id, LeaveClaim leaveClaim) { // verify the required parameter 'id' is set if (id == null) { throw new ASW.APIServices.Core.Client.ApiException(400, "Missing required parameter 'id' when calling WorkersApi->SubmitAnnualLeaveClaim"); } // verify the required parameter 'leaveClaim' is set if (leaveClaim == null) { throw new ASW.APIServices.Core.Client.ApiException(400, "Missing required parameter 'leaveClaim' when calling WorkersApi->SubmitAnnualLeaveClaim"); } ASW.APIServices.Core.Client.RequestOptions localVarRequestOptions = new ASW.APIServices.Core.Client.RequestOptions(); String[] _contentTypes = new String[] { "application/json" }; // to determine the Accept header String[] _accepts = new String[] { "application/json" }; foreach (var _contentType in _contentTypes) { localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType); } foreach (var _accept in _accepts) { localVarRequestOptions.HeaderParameters.Add("Accept", _accept); } if (id != null) { localVarRequestOptions.PathParameters.Add("id", ASW.APIServices.Core.Client.ClientUtils.ParameterToString(id)); // path parameter } localVarRequestOptions.Data = leaveClaim; // make the HTTP request var localVarResponse = await this.AsynchronousClient.PostAsync <AsyncResponse>("/worker/{id}/leave", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("SubmitAnnualLeaveClaim", localVarResponse); if (_exception != null) { throw _exception; } } return(localVarResponse); }
/// <summary> /// Submit an leave (vacation) claim for a worker /// </summary> /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">ID of the worker</param> /// <param name="leaveClaim">Leave claim for a worker</param> /// <returns>AsyncResponse</returns> public AsyncResponse SubmitAnnualLeaveClaim(string id, LeaveClaim leaveClaim) { ASW.APIServices.Core.Client.ApiResponse <AsyncResponse> localVarResponse = SubmitAnnualLeaveClaimWithHttpInfo(id, leaveClaim); return(localVarResponse.Data); }
public virtual IActionResult SubmitAnnualLeaveClaim([FromRoute][Required] string id, [FromBody] LeaveClaim leaveClaim) { //TODO: Uncomment the next line to return response 202 or use other options such as return this.NotFound(), return this.BadRequest(..), ... // return StatusCode(202, default(AsyncResponse)); string exampleJson = null; exampleJson = "{\n \"id\" : \"id\"\n}"; var example = exampleJson != null ? JsonConvert.DeserializeObject <AsyncResponse>(exampleJson) : default(AsyncResponse); //TODO: Change the data returned return(new ObjectResult(example)); }
/// <summary> /// Submit an leave (vacation) claim for a worker /// </summary> /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">ID of the worker</param> /// <param name="leaveClaim">Leave claim for a worker</param> /// <returns>Task of ApiResponse (AsyncResponse)</returns> public async System.Threading.Tasks.Task <ApiResponse <AsyncResponse> > SubmitAnnualLeaveClaimAsyncWithHttpInfo(string id, LeaveClaim leaveClaim) { // verify the required parameter 'id' is set if (id == null) { throw new ApiException(400, "Missing required parameter 'id' when calling WorkersApi->SubmitAnnualLeaveClaim"); } // verify the required parameter 'leaveClaim' is set if (leaveClaim == null) { throw new ApiException(400, "Missing required parameter 'leaveClaim' when calling WorkersApi->SubmitAnnualLeaveClaim"); } var localVarPath = "/worker/{id}/leave"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (id != null) { localVarPathParams.Add("id", this.Configuration.ApiClient.ParameterToString(id)); // path parameter } if (leaveClaim != null && leaveClaim.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(leaveClaim); // http body (model) parameter } else { localVarPostBody = leaveClaim; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("SubmitAnnualLeaveClaim", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <AsyncResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), (AsyncResponse)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(AsyncResponse)))); }
/// <summary> /// Submit an leave (vacation) claim for a worker /// </summary> /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">ID of the worker</param> /// <param name="leaveClaim">Leave claim for a worker</param> /// <returns>AsyncResponse</returns> public AsyncResponse SubmitAnnualLeaveClaim(string id, LeaveClaim leaveClaim) { ApiResponse <AsyncResponse> localVarResponse = SubmitAnnualLeaveClaimWithHttpInfo(id, leaveClaim); return(localVarResponse.Data); }
/// <summary> /// Submit an leave (vacation) claim for a worker /// </summary> /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">ID of the worker</param> /// <param name="leaveClaim">Leave claim for a worker</param> /// <returns>ApiResponse of AsyncResponse</returns> public ASW.APIServices.Core.Client.ApiResponse <AsyncResponse> SubmitAnnualLeaveClaimWithHttpInfo(string id, LeaveClaim leaveClaim) { // verify the required parameter 'id' is set if (id == null) { throw new ASW.APIServices.Core.Client.ApiException(400, "Missing required parameter 'id' when calling AnnualLeaveClaimsApi->SubmitAnnualLeaveClaim"); } // verify the required parameter 'leaveClaim' is set if (leaveClaim == null) { throw new ASW.APIServices.Core.Client.ApiException(400, "Missing required parameter 'leaveClaim' when calling AnnualLeaveClaimsApi->SubmitAnnualLeaveClaim"); } ASW.APIServices.Core.Client.RequestOptions localVarRequestOptions = new ASW.APIServices.Core.Client.RequestOptions(); String[] _contentTypes = new String[] { "application/json" }; // to determine the Accept header String[] _accepts = new String[] { "application/json" }; var localVarContentType = ASW.APIServices.Core.Client.ClientUtils.SelectHeaderContentType(_contentTypes); if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); } var localVarAccept = ASW.APIServices.Core.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) { localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); } if (id != null) { localVarRequestOptions.PathParameters.Add("id", ASW.APIServices.Core.Client.ClientUtils.ParameterToString(id)); // path parameter } localVarRequestOptions.Data = leaveClaim; // make the HTTP request var localVarResponse = this.Client.Post <AsyncResponse>("/worker/{id}/leave", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("SubmitAnnualLeaveClaim", localVarResponse); if (_exception != null) { throw _exception; } } return(localVarResponse); }