/// <summary> /// Create a new pay rate for a particular user, archiving the previous pay rate. Requires the 'ManageOrganisationUsers' permission. /// </summary> /// <exception cref="ChronoSheetsAPI.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="xChronosheetsAuth">The ChronoSheets Auth Token</param> /// <param name="request">An Insert UserHourlyRate Request object containing values for the new UserHourlyRate to create</param> /// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param> /// <returns>Task of ApiResponseInt32</returns> public async System.Threading.Tasks.Task <ApiResponseInt32> UserPayRatesCreatePayRateAsync(string xChronosheetsAuth, InsertUserHourlyRateRequest request, CancellationToken cancellationToken = default(CancellationToken)) { ApiResponse <ApiResponseInt32> localVarResponse = await UserPayRatesCreatePayRateWithHttpInfoAsync(xChronosheetsAuth, request, cancellationToken); return(localVarResponse.Data); }
/// <summary> /// Create a new pay rate for a particular user, archiving the previous pay rate. Requires the 'ManageOrganisationUsers' permission. /// </summary> /// <exception cref="ChronoSheetsAPI.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="xChronosheetsAuth">The ChronoSheets Auth Token</param> /// <param name="request">An Insert UserHourlyRate Request object containing values for the new UserHourlyRate to create</param> /// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param> /// <returns>Task of ApiResponse (ApiResponseInt32)</returns> public async System.Threading.Tasks.Task <ApiResponse <ApiResponseInt32> > UserPayRatesCreatePayRateWithHttpInfoAsync(string xChronosheetsAuth, InsertUserHourlyRateRequest request, CancellationToken cancellationToken = default(CancellationToken)) { // verify the required parameter 'xChronosheetsAuth' is set if (xChronosheetsAuth == null) { throw new ApiException(400, "Missing required parameter 'xChronosheetsAuth' when calling UserPayRatesApi->UserPayRatesCreatePayRate"); } // verify the required parameter 'request' is set if (request == null) { throw new ApiException(400, "Missing required parameter 'request' when calling UserPayRatesApi->UserPayRatesCreatePayRate"); } var localVarPath = "/UserPayRates/CreatePayRate"; 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", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded", "multipart/form-data" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json", "text/json", "application/xml", "text/xml", "multipart/form-data" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (xChronosheetsAuth != null) { localVarHeaderParams.Add("x-chronosheets-auth", this.Configuration.ApiClient.ParameterToString(xChronosheetsAuth)); // header parameter } if (request != null && request.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(request); // http body (model) parameter } else { localVarPostBody = request; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType, cancellationToken); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("UserPayRatesCreatePayRate", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <ApiResponseInt32>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), (ApiResponseInt32)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponseInt32)))); }
/// <summary> /// Create a new pay rate for a particular user, archiving the previous pay rate. Requires the 'ManageOrganisationUsers' permission. /// </summary> /// <exception cref="ChronoSheetsAPI.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="xChronosheetsAuth">The ChronoSheets Auth Token</param> /// <param name="request">An Insert UserHourlyRate Request object containing values for the new UserHourlyRate to create</param> /// <returns>ApiResponseInt32</returns> public ApiResponseInt32 UserPayRatesCreatePayRate(string xChronosheetsAuth, InsertUserHourlyRateRequest request) { ApiResponse <ApiResponseInt32> localVarResponse = UserPayRatesCreatePayRateWithHttpInfo(xChronosheetsAuth, request); return(localVarResponse.Data); }