/// <summary> /// Create a Search Request Create a search request. /// </summary> /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="createSearchRequest"></param> /// <returns>Task of ApiResponse (TssV2TransactionsPost201Response)</returns> public async System.Threading.Tasks.Task <ApiResponse <TssV2TransactionsPost201Response> > CreateSearchAsyncWithHttpInfo(CreateSearchRequest createSearchRequest) { // verify the required parameter 'createSearchRequest' is set if (createSearchRequest == null) { throw new ApiException(400, "Missing required parameter 'createSearchRequest' when calling SearchTransactionsApi->CreateSearch"); } var localVarPath = $"/tss/v2/searches"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new Dictionary <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;charset=utf-8" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json;charset=utf-8" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (createSearchRequest != null && createSearchRequest.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(createSearchRequest); // http body (model) parameter } else { localVarPostBody = createSearchRequest; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("CreateSearch", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <TssV2TransactionsPost201Response>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (TssV2TransactionsPost201Response)Configuration.ApiClient.Deserialize(localVarResponse, typeof(TssV2TransactionsPost201Response)))); }
/// <summary> /// Create a Search Request Create a search request. /// </summary> /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="createSearchRequest"></param> /// <returns>ApiResponse of TssV2TransactionsPost201Response</returns> public ApiResponse <TssV2TransactionsPost201Response> CreateSearchWithHttpInfo(CreateSearchRequest createSearchRequest) { LogUtility logUtility = new LogUtility(); // verify the required parameter 'createSearchRequest' is set if (createSearchRequest == null) { logger.Error("ApiException : Missing required parameter 'createSearchRequest' when calling SearchTransactionsApi->CreateSearch"); throw new ApiException(400, "Missing required parameter 'createSearchRequest' when calling SearchTransactionsApi->CreateSearch"); } var localVarPath = $"/tss/v2/searches"; var localVarPathParams = new Dictionary <string, string>(); var localVarQueryParams = new Dictionary <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;charset=utf-8" }; string localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header string[] localVarHttpHeaderAccepts = new string[] { "application/json;charset=utf-8" }; string localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (createSearchRequest != null && createSearchRequest.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(createSearchRequest); // http body (model) parameter } else { localVarPostBody = createSearchRequest; // byte array } if (logUtility.IsMaskingEnabled(logger)) { logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); } else { logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); } // 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("CreateSearch", localVarResponse); if (exception != null) { logger.Error($"Exception : {exception.Message}"); throw exception; } } return(new ApiResponse <TssV2TransactionsPost201Response>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (TssV2TransactionsPost201Response)Configuration.ApiClient.Deserialize(localVarResponse, typeof(TssV2TransactionsPost201Response)))); // Return statement }