com.katalon.testops.api.ExecutionRequestApi Maven / Gradle / Ivy
Show all versions of testops-client-openapi Show documentation
package com.katalon.testops.api;
import com.katalon.testops.ApiClient;
import com.katalon.testops.model.ExecutionRequestResource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
@Component("com.katalon.testops.api.ExecutionRequestApi")
public class ExecutionRequestApi {
private ApiClient apiClient;
public ExecutionRequestApi() {
this(new ApiClient());
}
@Autowired
public ExecutionRequestApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Downloads an Execution Request report. Returns the report file.
*
* 200 - OK
* @param id The id parameter
* @param fileType The fileType parameter
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void download(Long id, String fileType) throws RestClientException {
Object postBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'id' when calling download");
}
// create path and map variables
final Map uriVariables = new HashMap();
uriVariables.put("id", id);
String path = UriComponentsBuilder.fromPath("/api/v1/requests/{id}/download").buildAndExpand(uriVariables).toUriString();
final MultiValueMap queryParams = new LinkedMultiValueMap();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap formParams = new LinkedMultiValueMap();
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "fileType", fileType));
final String[] accepts = { };
final List accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "basicScheme" };
ParameterizedTypeReference returnType = new ParameterizedTypeReference() {};
apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Returns an Execution Request detail.
*
* 200 - OK
* @param id The id parameter
* @return ExecutionRequestResource
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ExecutionRequestResource getExecutionRequest(Long id) throws RestClientException {
Object postBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'id' when calling getExecutionRequest");
}
// create path and map variables
final Map uriVariables = new HashMap();
uriVariables.put("id", id);
String path = UriComponentsBuilder.fromPath("/api/v1/requests/{id}").buildAndExpand(uriVariables).toUriString();
final MultiValueMap queryParams = new LinkedMultiValueMap();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap formParams = new LinkedMultiValueMap();
final String[] accepts = {
"*/*"
};
final List accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "basicScheme" };
ParameterizedTypeReference returnType = new ParameterizedTypeReference() {};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
}