-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5be9a54
commit a4073a0
Showing
7 changed files
with
969 additions
and
0 deletions.
There are no files selected for viewing
117 changes: 117 additions & 0 deletions
117
...n-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/api/DetectorApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
package de.tum.in.www1.hephaestus.intelligenceservice.api; | ||
|
||
import de.tum.in.www1.hephaestus.intelligenceservice.ApiClient; | ||
import de.tum.in.www1.hephaestus.intelligenceservice.BaseApi; | ||
|
||
import de.tum.in.www1.hephaestus.intelligenceservice.model.DetectorRequest; | ||
import de.tum.in.www1.hephaestus.intelligenceservice.model.DetectorResponse; | ||
import de.tum.in.www1.hephaestus.intelligenceservice.model.HTTPValidationError; | ||
|
||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
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.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; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0") | ||
public class DetectorApi extends BaseApi { | ||
|
||
public DetectorApi() { | ||
super(new ApiClient()); | ||
} | ||
|
||
public DetectorApi(ApiClient apiClient) { | ||
super(apiClient); | ||
} | ||
|
||
/** | ||
* Detect bad practices given rules. | ||
* | ||
* <p><b>200</b> - Successful Response | ||
* <p><b>422</b> - Validation Error | ||
* @param detectorRequest (required) | ||
* @return DetectorResponse | ||
* @throws RestClientException if an error occurs while attempting to invoke the API | ||
*/ | ||
public DetectorResponse detectDetectorPost(DetectorRequest detectorRequest) throws RestClientException { | ||
return detectDetectorPostWithHttpInfo(detectorRequest).getBody(); | ||
} | ||
|
||
/** | ||
* Detect bad practices given rules. | ||
* | ||
* <p><b>200</b> - Successful Response | ||
* <p><b>422</b> - Validation Error | ||
* @param detectorRequest (required) | ||
* @return ResponseEntity<DetectorResponse> | ||
* @throws RestClientException if an error occurs while attempting to invoke the API | ||
*/ | ||
public ResponseEntity<DetectorResponse> detectDetectorPostWithHttpInfo(DetectorRequest detectorRequest) throws RestClientException { | ||
Object localVarPostBody = detectorRequest; | ||
|
||
// verify the required parameter 'detectorRequest' is set | ||
if (detectorRequest == null) { | ||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'detectorRequest' when calling detectDetectorPost"); | ||
} | ||
|
||
|
||
final MultiValueMap<String, String> localVarQueryParams = new LinkedMultiValueMap<String, String>(); | ||
final HttpHeaders localVarHeaderParams = new HttpHeaders(); | ||
final MultiValueMap<String, String> localVarCookieParams = new LinkedMultiValueMap<String, String>(); | ||
final MultiValueMap<String, Object> localVarFormParams = new LinkedMultiValueMap<String, Object>(); | ||
|
||
final String[] localVarAccepts = { | ||
"application/json" | ||
}; | ||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); | ||
final String[] localVarContentTypes = { | ||
"application/json" | ||
}; | ||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); | ||
|
||
String[] localVarAuthNames = new String[] { }; | ||
|
||
ParameterizedTypeReference<DetectorResponse> localReturnType = new ParameterizedTypeReference<DetectorResponse>() {}; | ||
return apiClient.invokeAPI("/detector/", HttpMethod.POST, Collections.<String, Object>emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); | ||
} | ||
|
||
@Override | ||
public <T> ResponseEntity<T> invokeAPI(String url, HttpMethod method, Object request, ParameterizedTypeReference<T> returnType) throws RestClientException { | ||
String localVarPath = url.replace(apiClient.getBasePath(), ""); | ||
Object localVarPostBody = request; | ||
|
||
final Map<String, Object> uriVariables = new HashMap<String, Object>(); | ||
final MultiValueMap<String, String> localVarQueryParams = new LinkedMultiValueMap<String, String>(); | ||
final HttpHeaders localVarHeaderParams = new HttpHeaders(); | ||
final MultiValueMap<String, String> localVarCookieParams = new LinkedMultiValueMap<String, String>(); | ||
final MultiValueMap<String, Object> localVarFormParams = new LinkedMultiValueMap<String, Object>(); | ||
|
||
final String[] localVarAccepts = { | ||
"application/json" | ||
}; | ||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); | ||
final String[] localVarContentTypes = { | ||
"application/json" | ||
}; | ||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); | ||
|
||
String[] localVarAuthNames = new String[] { }; | ||
|
||
return apiClient.invokeAPI(localVarPath, method, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, returnType); | ||
} | ||
} |
156 changes: 156 additions & 0 deletions
156
...er/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/DetectorRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
/* | ||
* Hephaestus Intelligence Service API | ||
* API documentation for the Hephaestus Intelligence Service. | ||
* | ||
* The version of the OpenAPI document: 0.0.1 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
package de.tum.in.www1.hephaestus.intelligenceservice.model; | ||
|
||
import java.util.Objects; | ||
import java.util.Arrays; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import de.tum.in.www1.hephaestus.intelligenceservice.model.PullRequest; | ||
import de.tum.in.www1.hephaestus.intelligenceservice.model.Rule; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import org.hibernate.validator.constraints.*; | ||
|
||
/** | ||
* DetectorRequest | ||
*/ | ||
@JsonPropertyOrder({ | ||
DetectorRequest.JSON_PROPERTY_PULL_REQUESTS, | ||
DetectorRequest.JSON_PROPERTY_RULES | ||
}) | ||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0") | ||
public class DetectorRequest { | ||
public static final String JSON_PROPERTY_PULL_REQUESTS = "pull_requests"; | ||
private List<PullRequest> pullRequests = new ArrayList<>(); | ||
|
||
public static final String JSON_PROPERTY_RULES = "rules"; | ||
private List<Rule> rules = new ArrayList<>(); | ||
|
||
public DetectorRequest() { | ||
} | ||
|
||
public DetectorRequest pullRequests(List<PullRequest> pullRequests) { | ||
|
||
this.pullRequests = pullRequests; | ||
return this; | ||
} | ||
|
||
public DetectorRequest addPullRequestsItem(PullRequest pullRequestsItem) { | ||
if (this.pullRequests == null) { | ||
this.pullRequests = new ArrayList<>(); | ||
} | ||
this.pullRequests.add(pullRequestsItem); | ||
return this; | ||
} | ||
|
||
/** | ||
* Get pullRequests | ||
* @return pullRequests | ||
*/ | ||
@jakarta.annotation.Nonnull | ||
@JsonProperty(JSON_PROPERTY_PULL_REQUESTS) | ||
@JsonInclude(value = JsonInclude.Include.ALWAYS) | ||
|
||
public List<PullRequest> getPullRequests() { | ||
return pullRequests; | ||
} | ||
|
||
|
||
@JsonProperty(JSON_PROPERTY_PULL_REQUESTS) | ||
@JsonInclude(value = JsonInclude.Include.ALWAYS) | ||
public void setPullRequests(List<PullRequest> pullRequests) { | ||
this.pullRequests = pullRequests; | ||
} | ||
|
||
public DetectorRequest rules(List<Rule> rules) { | ||
|
||
this.rules = rules; | ||
return this; | ||
} | ||
|
||
public DetectorRequest addRulesItem(Rule rulesItem) { | ||
if (this.rules == null) { | ||
this.rules = new ArrayList<>(); | ||
} | ||
this.rules.add(rulesItem); | ||
return this; | ||
} | ||
|
||
/** | ||
* Get rules | ||
* @return rules | ||
*/ | ||
@jakarta.annotation.Nonnull | ||
@JsonProperty(JSON_PROPERTY_RULES) | ||
@JsonInclude(value = JsonInclude.Include.ALWAYS) | ||
|
||
public List<Rule> getRules() { | ||
return rules; | ||
} | ||
|
||
|
||
@JsonProperty(JSON_PROPERTY_RULES) | ||
@JsonInclude(value = JsonInclude.Include.ALWAYS) | ||
public void setRules(List<Rule> rules) { | ||
this.rules = rules; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
DetectorRequest detectorRequest = (DetectorRequest) o; | ||
return Objects.equals(this.pullRequests, detectorRequest.pullRequests) && | ||
Objects.equals(this.rules, detectorRequest.rules); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(pullRequests, rules); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("class DetectorRequest {\n"); | ||
sb.append(" pullRequests: ").append(toIndentedString(pullRequests)).append("\n"); | ||
sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); | ||
sb.append("}"); | ||
return sb.toString(); | ||
} | ||
|
||
/** | ||
* Convert the given object to string with each line indented by 4 spaces | ||
* (except the first line). | ||
*/ | ||
private String toIndentedString(Object o) { | ||
if (o == null) { | ||
return "null"; | ||
} | ||
return o.toString().replace("\n", "\n "); | ||
} | ||
|
||
} | ||
|
116 changes: 116 additions & 0 deletions
116
...r/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/DetectorResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/* | ||
* Hephaestus Intelligence Service API | ||
* API documentation for the Hephaestus Intelligence Service. | ||
* | ||
* The version of the OpenAPI document: 0.0.1 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
package de.tum.in.www1.hephaestus.intelligenceservice.model; | ||
|
||
import java.util.Objects; | ||
import java.util.Arrays; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import de.tum.in.www1.hephaestus.intelligenceservice.model.PullRequestWithBadPractices; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import org.hibernate.validator.constraints.*; | ||
|
||
/** | ||
* DetectorResponse | ||
*/ | ||
@JsonPropertyOrder({ | ||
DetectorResponse.JSON_PROPERTY_DETECT_BAD_PRACTICES | ||
}) | ||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0") | ||
public class DetectorResponse { | ||
public static final String JSON_PROPERTY_DETECT_BAD_PRACTICES = "detectBadPractices"; | ||
private List<PullRequestWithBadPractices> detectBadPractices = new ArrayList<>(); | ||
|
||
public DetectorResponse() { | ||
} | ||
|
||
public DetectorResponse detectBadPractices(List<PullRequestWithBadPractices> detectBadPractices) { | ||
|
||
this.detectBadPractices = detectBadPractices; | ||
return this; | ||
} | ||
|
||
public DetectorResponse addDetectBadPracticesItem(PullRequestWithBadPractices detectBadPracticesItem) { | ||
if (this.detectBadPractices == null) { | ||
this.detectBadPractices = new ArrayList<>(); | ||
} | ||
this.detectBadPractices.add(detectBadPracticesItem); | ||
return this; | ||
} | ||
|
||
/** | ||
* Get detectBadPractices | ||
* @return detectBadPractices | ||
*/ | ||
@jakarta.annotation.Nonnull | ||
@JsonProperty(JSON_PROPERTY_DETECT_BAD_PRACTICES) | ||
@JsonInclude(value = JsonInclude.Include.ALWAYS) | ||
|
||
public List<PullRequestWithBadPractices> getDetectBadPractices() { | ||
return detectBadPractices; | ||
} | ||
|
||
|
||
@JsonProperty(JSON_PROPERTY_DETECT_BAD_PRACTICES) | ||
@JsonInclude(value = JsonInclude.Include.ALWAYS) | ||
public void setDetectBadPractices(List<PullRequestWithBadPractices> detectBadPractices) { | ||
this.detectBadPractices = detectBadPractices; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
DetectorResponse detectorResponse = (DetectorResponse) o; | ||
return Objects.equals(this.detectBadPractices, detectorResponse.detectBadPractices); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(detectBadPractices); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("class DetectorResponse {\n"); | ||
sb.append(" detectBadPractices: ").append(toIndentedString(detectBadPractices)).append("\n"); | ||
sb.append("}"); | ||
return sb.toString(); | ||
} | ||
|
||
/** | ||
* Convert the given object to string with each line indented by 4 spaces | ||
* (except the first line). | ||
*/ | ||
private String toIndentedString(Object o) { | ||
if (o == null) { | ||
return "null"; | ||
} | ||
return o.toString().replace("\n", "\n "); | ||
} | ||
|
||
} | ||
|
Oops, something went wrong.