/// <summary> /// Update Bonus by Bonus Updates a bonus that can be applied to a work order to increase the amount paid upon a condition being met /// </summary> /// <exception cref="FieldNation.SDK.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="bonusId">Bonus ID</param> /// <param name="json">JSON Model</param> /// <returns>Task of ApiResponse</returns> public async System.Threading.Tasks.Task <ApiResponse <Object> > UpdateBonusByBonusAsyncWithHttpInfo(int?bonusId, PayModifier json) { // verify the required parameter 'bonusId' is set if (bonusId == null) { throw new ApiException(400, "Missing required parameter 'bonusId' when calling BonusApi->UpdateBonusByBonus"); } // verify the required parameter 'json' is set if (json == null) { throw new ApiException(400, "Missing required parameter 'json' when calling BonusApi->UpdateBonusByBonus"); } var localVarPath = "/bonuses/{bonus_id}"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(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", "application/x-www-form-urlencoded", "multipart/form-data" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (bonusId != null) { localVarPathParams.Add("bonus_id", Configuration.ApiClient.ParameterToString(bonusId)); // path parameter } if (json != null && json.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(json); // http body (model) parameter } else { localVarPostBody = json; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("UpdateBonusByBonus", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <Object>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), null)); }
/// <summary> /// Add Bonus Adds a bonus that can be applied to a work order to increase the amount paid upon a condition being met /// </summary> /// <exception cref="FieldNation.SDK.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="bonus">JSON Model</param> /// <returns>ApiResponse of IdResponse</returns> public ApiResponse <IdResponse> AddBonusWithHttpInfo(PayModifier bonus) { // verify the required parameter 'bonus' is set if (bonus == null) { throw new ApiException(400, "Missing required parameter 'bonus' when calling BonusApi->AddBonus"); } var localVarPath = "/bonuses"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(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", "application/x-www-form-urlencoded", "multipart/form-data" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (bonus != null && bonus.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(bonus); // http body (model) parameter } else { localVarPostBody = bonus; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("AddBonus", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <IdResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (IdResponse)Configuration.ApiClient.Deserialize(localVarResponse, typeof(IdResponse)))); }