diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 3cabe03bbad..ea6d9fe9470 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -38523,6 +38523,157 @@ components: format: int64 type: integer type: object + FileCoverageLines: + description: Per-file line coverage data including executable, covered, and added lines. + properties: + added_lines: + description: Line numbers that were added in the specified scope (for example, in a PR diff). + example: [11, 12] + items: + format: int64 + type: integer + type: array + covered_lines: + description: Line numbers that were covered by tests. + example: [10, 11, 15] + items: + format: int64 + type: integer + type: array + executable_lines: + description: Line numbers that are executable (can be covered). + example: [10, 11, 12, 15, 20] + items: + format: int64 + type: integer + type: array + type: object + FilesCoverageAttributes: + description: Attributes of the per-file code coverage response. + properties: + base_commit_sha: + description: The SHA of the base commit used for comparison (for example, the merge base for a PR). + example: abc1234567890abcdef1234567890abcdef12345 + type: string + event_timestamp: + description: Unix timestamp (milliseconds) of the coverage event. + example: 1709564000000 + format: int64 + type: integer + files: + additionalProperties: + $ref: "#/components/schemas/FileCoverageLines" + description: Map of file paths to per-file coverage line data. + type: object + head_commit_sha: + description: The SHA of the head commit for which coverage was evaluated. + example: 66adc9350f2cc9b250b69abddab733dd55e1a588 + type: string + report_count: + description: Number of coverage reports evaluated. + example: 3 + format: int64 + type: integer + type: object + FilesCoverageData: + description: Data object for files coverage response. + properties: + attributes: + $ref: "#/components/schemas/FilesCoverageAttributes" + id: + description: Unique identifier for the files coverage response. + example: ZGQxMjM0NV9tYWluXzE3MDk1NjQwMDA= + type: string + type: + $ref: "#/components/schemas/FilesCoverageResponseType" + type: object + FilesCoverageRequest: + description: Request object for getting per-file code coverage data. + properties: + data: + $ref: "#/components/schemas/FilesCoverageRequestData" + required: + - data + type: object + FilesCoverageRequestAttributes: + description: Attributes for requesting per-file code coverage data. Exactly one of `commit_sha`, `branch`, or `pr_number` must be provided. At most one of `service`, `codeowner`, or `flag` may be provided. + properties: + branch: + description: The branch name. + example: main + type: string + changed_only: + description: When true, return coverage data only for files that were changed in the specified scope. + example: true + type: boolean + codeowner: + description: Filter coverage by code owner. At most one of `service`, `codeowner`, or `flag` may be provided. + example: "@my-team" + type: string + commit_sha: + description: The commit SHA (40-character hexadecimal string). + example: 66adc9350f2cc9b250b69abddab733dd55e1a588 + pattern: "^[a-fA-F0-9]{40}$" + type: string + flag: + description: Filter coverage by coverage flag. At most one of `service`, `codeowner`, or `flag` may be provided. + example: unit-tests + type: string + pr_number: + description: The pull request number. Must be a positive integer. + example: 42 + format: int64 + minimum: 1 + type: integer + repository_id: + deprecated: true + description: "Deprecated: use `repository_url` instead. The repository URL." + example: github.com/datadog/shopist + minLength: 1 + type: string + repository_url: + description: The repository URL. Accepts a full URL with or without a scheme (for example, `https://github.com/org/repo` or `github.com/org/repo`). + example: https://github.com/datadog/shopist + minLength: 1 + type: string + service: + description: Filter coverage by service name. At most one of `service`, `codeowner`, or `flag` may be provided. + example: my-service + type: string + type: object + FilesCoverageRequestData: + description: Data object for files coverage request. + properties: + attributes: + $ref: "#/components/schemas/FilesCoverageRequestAttributes" + type: + $ref: "#/components/schemas/FilesCoverageRequestType" + required: + - type + - attributes + type: object + FilesCoverageRequestType: + description: JSON:API type for files coverage request. The value must always be `ci_app_coverage_files_request`. + enum: + - ci_app_coverage_files_request + example: ci_app_coverage_files_request + type: string + x-enum-varnames: + - CI_APP_COVERAGE_FILES_REQUEST + FilesCoverageResponse: + description: Response object containing per-file code coverage data. + properties: + data: + $ref: "#/components/schemas/FilesCoverageData" + type: object + FilesCoverageResponseType: + description: JSON:API type for files coverage response. The value must always be `ci_app_coverage_files`. + enum: + - ci_app_coverage_files + example: ci_app_coverage_files + type: string + x-enum-varnames: + - CI_APP_COVERAGE_FILES FiltersPerProduct: description: Product-specific filters for the dataset. properties: @@ -79919,6 +80070,51 @@ components: type: string x-enum-varnames: - OWNERSHIP_UNTAGGED_FINDINGS + PRCoverageSummaryRequest: + description: Request object for getting code coverage summary for a pull request. + properties: + data: + $ref: "#/components/schemas/PRCoverageSummaryRequestData" + required: + - data + type: object + PRCoverageSummaryRequestAttributes: + description: Attributes for requesting code coverage summary for a pull request. + properties: + pr_number: + description: The pull request number. Must be a positive integer. + example: 42 + format: int64 + minimum: 1 + type: integer + repository_url: + description: The repository URL. Accepts a full URL with or without a scheme (for example, `https://github.com/org/repo` or `github.com/org/repo`). + example: https://github.com/datadog/shopist + minLength: 1 + type: string + required: + - repository_url + - pr_number + type: object + PRCoverageSummaryRequestData: + description: Data object for PR summary request. + properties: + attributes: + $ref: "#/components/schemas/PRCoverageSummaryRequestAttributes" + type: + $ref: "#/components/schemas/PRCoverageSummaryRequestType" + required: + - type + - attributes + type: object + PRCoverageSummaryRequestType: + description: JSON:API type for PR coverage summary request. The value must always be `ci_app_coverage_pr_summary_request`. + enum: + - ci_app_coverage_pr_summary_request + example: ci_app_coverage_pr_summary_request + type: string + x-enum-varnames: + - CI_APP_COVERAGE_PR_SUMMARY_REQUEST PageAnnotationsAttributes: description: Attributes of the annotations on a page. properties: @@ -132319,9 +132515,6 @@ paths: operator: OR permissions: - code_coverage_read - x-unstable: |- - **Note**: This endpoint is in preview and may be subject to change. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/code-coverage/commit/summary: post: description: |- @@ -132389,9 +132582,142 @@ paths: operator: OR permissions: - code_coverage_read - x-unstable: |- - **Note**: This endpoint is in preview and may be subject to change. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/code-coverage/files: + post: + description: |- + Retrieve per-file code coverage data for a specific commit, branch, or pull request. + Exactly one of `commit_sha`, `branch`, or `pr_number` must be provided. + Optionally filter by `service`, `codeowner`, or `flag` (at most one). + operationId: GetCodeCoverageFiles + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + changed_only: true + commit_sha: 66adc9350f2cc9b250b69abddab733dd55e1a588 + repository_url: https://github.com/datadog/test-service + type: ci_app_coverage_files_request + schema: + $ref: "#/components/schemas/FilesCoverageRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + base_commit_sha: abc1234567890abcdef1234567890abcdef12345 + event_timestamp: 1709564000000 + files: + src/main.go: + added_lines: [11, 12] + covered_lines: [10, 11, 15] + executable_lines: [10, 11, 12, 15, 20] + head_commit_sha: 66adc9350f2cc9b250b69abddab733dd55e1a588 + report_count: 3 + id: ZGQxMjM0NV9tYWluXzE3MDk1NjQwMDA= + type: ci_app_coverage_files + schema: + $ref: "#/components/schemas/FilesCoverageResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Internal server error + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_coverage_read + summary: Get per-file code coverage data + tags: ["Code Coverage"] + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - code_coverage_read + /api/v2/code-coverage/pr/summary: + post: + description: |- + Retrieve aggregated code coverage statistics for a specific pull request in a repository. + This endpoint provides overall coverage metrics as well as breakdowns by service + and code owner. + operationId: GetCodeCoveragePRSummary + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + pr_number: 42 + repository_url: https://github.com/datadog/test-service + type: ci_app_coverage_pr_summary_request + schema: + $ref: "#/components/schemas/PRCoverageSummaryRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + evaluated_flags_count: 3 + evaluated_reports_count: 5 + patch_coverage: 65.2 + total_coverage: 78.6 + id: ZGQxMjM0NV9wcl80Ml8xNzA5NTY0MDAw + type: ci_app_coverage_summary + schema: + $ref: "#/components/schemas/CoverageSummaryResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Internal server error + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_coverage_read + summary: Get code coverage summary for a pull request + tags: ["Code Coverage"] + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - code_coverage_read /api/v2/compliance_findings/rule_based_view: get: deprecated: true diff --git a/examples/v2/code-coverage/GetCodeCoverageBranchSummary.java b/examples/v2/code-coverage/GetCodeCoverageBranchSummary.java index 466a6bf6cb7..c4e5f45667e 100644 --- a/examples/v2/code-coverage/GetCodeCoverageBranchSummary.java +++ b/examples/v2/code-coverage/GetCodeCoverageBranchSummary.java @@ -12,7 +12,6 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); - defaultClient.setUnstableOperationEnabled("v2.getCodeCoverageBranchSummary", true); CodeCoverageApi apiInstance = new CodeCoverageApi(defaultClient); BranchCoverageSummaryRequest body = diff --git a/examples/v2/code-coverage/GetCodeCoverageCommitSummary.java b/examples/v2/code-coverage/GetCodeCoverageCommitSummary.java index 028c94cfd3f..3384edd65f4 100644 --- a/examples/v2/code-coverage/GetCodeCoverageCommitSummary.java +++ b/examples/v2/code-coverage/GetCodeCoverageCommitSummary.java @@ -12,7 +12,6 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); - defaultClient.setUnstableOperationEnabled("v2.getCodeCoverageCommitSummary", true); CodeCoverageApi apiInstance = new CodeCoverageApi(defaultClient); CommitCoverageSummaryRequest body = diff --git a/examples/v2/code-coverage/GetCodeCoverageFiles.java b/examples/v2/code-coverage/GetCodeCoverageFiles.java new file mode 100644 index 00000000000..3f46537c58e --- /dev/null +++ b/examples/v2/code-coverage/GetCodeCoverageFiles.java @@ -0,0 +1,39 @@ +// Get per-file code coverage data returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CodeCoverageApi; +import com.datadog.api.client.v2.model.FilesCoverageRequest; +import com.datadog.api.client.v2.model.FilesCoverageRequestAttributes; +import com.datadog.api.client.v2.model.FilesCoverageRequestData; +import com.datadog.api.client.v2.model.FilesCoverageRequestType; +import com.datadog.api.client.v2.model.FilesCoverageResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CodeCoverageApi apiInstance = new CodeCoverageApi(defaultClient); + + FilesCoverageRequest body = + new FilesCoverageRequest() + .data( + new FilesCoverageRequestData() + .attributes( + new FilesCoverageRequestAttributes() + .changedOnly(true) + .commitSha("66adc9350f2cc9b250b69abddab733dd55e1a588") + .repositoryUrl("https://github.com/datadog/shopist")) + .type(FilesCoverageRequestType.CI_APP_COVERAGE_FILES_REQUEST)); + + try { + FilesCoverageResponse result = apiInstance.getCodeCoverageFiles(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CodeCoverageApi#getCodeCoverageFiles"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/code-coverage/GetCodeCoveragePRSummary.java b/examples/v2/code-coverage/GetCodeCoveragePRSummary.java new file mode 100644 index 00000000000..94505ecec50 --- /dev/null +++ b/examples/v2/code-coverage/GetCodeCoveragePRSummary.java @@ -0,0 +1,38 @@ +// Get code coverage summary for a pull request returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CodeCoverageApi; +import com.datadog.api.client.v2.model.CoverageSummaryResponse; +import com.datadog.api.client.v2.model.PRCoverageSummaryRequest; +import com.datadog.api.client.v2.model.PRCoverageSummaryRequestAttributes; +import com.datadog.api.client.v2.model.PRCoverageSummaryRequestData; +import com.datadog.api.client.v2.model.PRCoverageSummaryRequestType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CodeCoverageApi apiInstance = new CodeCoverageApi(defaultClient); + + PRCoverageSummaryRequest body = + new PRCoverageSummaryRequest() + .data( + new PRCoverageSummaryRequestData() + .attributes( + new PRCoverageSummaryRequestAttributes() + .prNumber(42L) + .repositoryUrl("https://github.com/datadog/shopist")) + .type(PRCoverageSummaryRequestType.CI_APP_COVERAGE_PR_SUMMARY_REQUEST)); + + try { + CoverageSummaryResponse result = apiInstance.getCodeCoveragePRSummary(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CodeCoverageApi#getCodeCoveragePRSummary"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 0d8443e0d1a..bc3ddd4cd3b 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1021,8 +1021,6 @@ public class ApiClient { put("v2.updateSecurityMonitoringIntegrationConfig", false); put("v2.validateSecurityMonitoringIntegrationConfig", false); put("v2.validateSecurityMonitoringIntegrationCredentials", false); - put("v2.getCodeCoverageBranchSummary", false); - put("v2.getCodeCoverageCommitSummary", false); put("v2.getRuleBasedView", false); put("v2.getCommitmentsCommitmentList", false); put("v2.getCommitmentsCoverageScalar", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/CodeCoverageApi.java b/src/main/java/com/datadog/api/client/v2/api/CodeCoverageApi.java index 7eecf3e6084..eccc050fbb4 100644 --- a/src/main/java/com/datadog/api/client/v2/api/CodeCoverageApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/CodeCoverageApi.java @@ -7,6 +7,9 @@ import com.datadog.api.client.v2.model.BranchCoverageSummaryRequest; import com.datadog.api.client.v2.model.CommitCoverageSummaryRequest; import com.datadog.api.client.v2.model.CoverageSummaryResponse; +import com.datadog.api.client.v2.model.FilesCoverageRequest; +import com.datadog.api.client.v2.model.FilesCoverageResponse; +import com.datadog.api.client.v2.model.PRCoverageSummaryRequest; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -97,13 +100,6 @@ public CompletableFuture getCodeCoverageBranchSummaryAs */ public ApiResponse getCodeCoverageBranchSummaryWithHttpInfo( BranchCoverageSummaryRequest body) throws ApiException { - // Check if unstable operation is enabled - String operationId = "getCodeCoverageBranchSummary"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); - } Object localVarPostBody = body; // verify the required parameter 'body' is set @@ -146,16 +142,6 @@ public ApiResponse getCodeCoverageBranchSummaryWithHttp */ public CompletableFuture> getCodeCoverageBranchSummaryWithHttpInfoAsync(BranchCoverageSummaryRequest body) { - // Check if unstable operation is enabled - String operationId = "getCodeCoverageBranchSummary"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); - return result; - } Object localVarPostBody = body; // verify the required parameter 'body' is set @@ -253,13 +239,6 @@ public CompletableFuture getCodeCoverageCommitSummaryAs */ public ApiResponse getCodeCoverageCommitSummaryWithHttpInfo( CommitCoverageSummaryRequest body) throws ApiException { - // Check if unstable operation is enabled - String operationId = "getCodeCoverageCommitSummary"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); - } Object localVarPostBody = body; // verify the required parameter 'body' is set @@ -302,16 +281,6 @@ public ApiResponse getCodeCoverageCommitSummaryWithHttp */ public CompletableFuture> getCodeCoverageCommitSummaryWithHttpInfoAsync(CommitCoverageSummaryRequest body) { - // Check if unstable operation is enabled - String operationId = "getCodeCoverageCommitSummary"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); - return result; - } Object localVarPostBody = body; // verify the required parameter 'body' is set @@ -354,4 +323,277 @@ public ApiResponse getCodeCoverageCommitSummaryWithHttp false, new GenericType() {}); } + + /** + * Get per-file code coverage data. + * + *

See {@link #getCodeCoverageFilesWithHttpInfo}. + * + * @param body (required) + * @return FilesCoverageResponse + * @throws ApiException if fails to make API call + */ + public FilesCoverageResponse getCodeCoverageFiles(FilesCoverageRequest body) throws ApiException { + return getCodeCoverageFilesWithHttpInfo(body).getData(); + } + + /** + * Get per-file code coverage data. + * + *

See {@link #getCodeCoverageFilesWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<FilesCoverageResponse> + */ + public CompletableFuture getCodeCoverageFilesAsync( + FilesCoverageRequest body) { + return getCodeCoverageFilesWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve per-file code coverage data for a specific commit, branch, or pull request. Exactly + * one of commit_sha, branch, or pr_number must be + * provided. Optionally filter by service, codeowner, or flag + * (at most one). + * + * @param body (required) + * @return ApiResponse<FilesCoverageResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Not Authorized -
404 Not Found -
429 Too many requests -
500 Internal server error -
+ */ + public ApiResponse getCodeCoverageFilesWithHttpInfo( + FilesCoverageRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling getCodeCoverageFiles"); + } + // create path and map variables + String localVarPath = "/api/v2/code-coverage/files"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CodeCoverageApi.getCodeCoverageFiles", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get per-file code coverage data. + * + *

See {@link #getCodeCoverageFilesWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<FilesCoverageResponse>> + */ + public CompletableFuture> + getCodeCoverageFilesWithHttpInfoAsync(FilesCoverageRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling getCodeCoverageFiles")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/code-coverage/files"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CodeCoverageApi.getCodeCoverageFiles", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get code coverage summary for a pull request. + * + *

See {@link #getCodeCoveragePRSummaryWithHttpInfo}. + * + * @param body (required) + * @return CoverageSummaryResponse + * @throws ApiException if fails to make API call + */ + public CoverageSummaryResponse getCodeCoveragePRSummary(PRCoverageSummaryRequest body) + throws ApiException { + return getCodeCoveragePRSummaryWithHttpInfo(body).getData(); + } + + /** + * Get code coverage summary for a pull request. + * + *

See {@link #getCodeCoveragePRSummaryWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<CoverageSummaryResponse> + */ + public CompletableFuture getCodeCoveragePRSummaryAsync( + PRCoverageSummaryRequest body) { + return getCodeCoveragePRSummaryWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve aggregated code coverage statistics for a specific pull request in a repository. This + * endpoint provides overall coverage metrics as well as breakdowns by service and code owner. + * + * @param body (required) + * @return ApiResponse<CoverageSummaryResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Not Authorized -
404 Not Found -
429 Too many requests -
500 Internal server error -
+ */ + public ApiResponse getCodeCoveragePRSummaryWithHttpInfo( + PRCoverageSummaryRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling getCodeCoveragePRSummary"); + } + // create path and map variables + String localVarPath = "/api/v2/code-coverage/pr/summary"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CodeCoverageApi.getCodeCoveragePRSummary", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get code coverage summary for a pull request. + * + *

See {@link #getCodeCoveragePRSummaryWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<CoverageSummaryResponse>> + */ + public CompletableFuture> + getCodeCoveragePRSummaryWithHttpInfoAsync(PRCoverageSummaryRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling getCodeCoveragePRSummary")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/code-coverage/pr/summary"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CodeCoverageApi.getCodeCoveragePRSummary", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/FileCoverageLines.java b/src/main/java/com/datadog/api/client/v2/model/FileCoverageLines.java new file mode 100644 index 00000000000..e6ff91923d8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FileCoverageLines.java @@ -0,0 +1,217 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Per-file line coverage data including executable, covered, and added lines. */ +@JsonPropertyOrder({ + FileCoverageLines.JSON_PROPERTY_ADDED_LINES, + FileCoverageLines.JSON_PROPERTY_COVERED_LINES, + FileCoverageLines.JSON_PROPERTY_EXECUTABLE_LINES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FileCoverageLines { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ADDED_LINES = "added_lines"; + private List addedLines = null; + + public static final String JSON_PROPERTY_COVERED_LINES = "covered_lines"; + private List coveredLines = null; + + public static final String JSON_PROPERTY_EXECUTABLE_LINES = "executable_lines"; + private List executableLines = null; + + public FileCoverageLines addedLines(List addedLines) { + this.addedLines = addedLines; + return this; + } + + public FileCoverageLines addAddedLinesItem(Long addedLinesItem) { + if (this.addedLines == null) { + this.addedLines = new ArrayList<>(); + } + this.addedLines.add(addedLinesItem); + return this; + } + + /** + * Line numbers that were added in the specified scope (for example, in a PR diff). + * + * @return addedLines + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ADDED_LINES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getAddedLines() { + return addedLines; + } + + public void setAddedLines(List addedLines) { + this.addedLines = addedLines; + } + + public FileCoverageLines coveredLines(List coveredLines) { + this.coveredLines = coveredLines; + return this; + } + + public FileCoverageLines addCoveredLinesItem(Long coveredLinesItem) { + if (this.coveredLines == null) { + this.coveredLines = new ArrayList<>(); + } + this.coveredLines.add(coveredLinesItem); + return this; + } + + /** + * Line numbers that were covered by tests. + * + * @return coveredLines + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COVERED_LINES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getCoveredLines() { + return coveredLines; + } + + public void setCoveredLines(List coveredLines) { + this.coveredLines = coveredLines; + } + + public FileCoverageLines executableLines(List executableLines) { + this.executableLines = executableLines; + return this; + } + + public FileCoverageLines addExecutableLinesItem(Long executableLinesItem) { + if (this.executableLines == null) { + this.executableLines = new ArrayList<>(); + } + this.executableLines.add(executableLinesItem); + return this; + } + + /** + * Line numbers that are executable (can be covered). + * + * @return executableLines + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXECUTABLE_LINES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getExecutableLines() { + return executableLines; + } + + public void setExecutableLines(List executableLines) { + this.executableLines = executableLines; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FileCoverageLines + */ + @JsonAnySetter + public FileCoverageLines putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FileCoverageLines object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileCoverageLines fileCoverageLines = (FileCoverageLines) o; + return Objects.equals(this.addedLines, fileCoverageLines.addedLines) + && Objects.equals(this.coveredLines, fileCoverageLines.coveredLines) + && Objects.equals(this.executableLines, fileCoverageLines.executableLines) + && Objects.equals(this.additionalProperties, fileCoverageLines.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(addedLines, coveredLines, executableLines, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileCoverageLines {\n"); + sb.append(" addedLines: ").append(toIndentedString(addedLines)).append("\n"); + sb.append(" coveredLines: ").append(toIndentedString(coveredLines)).append("\n"); + sb.append(" executableLines: ").append(toIndentedString(executableLines)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FilesCoverageAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageAttributes.java new file mode 100644 index 00000000000..d9f3fc3a622 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageAttributes.java @@ -0,0 +1,254 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes of the per-file code coverage response. */ +@JsonPropertyOrder({ + FilesCoverageAttributes.JSON_PROPERTY_BASE_COMMIT_SHA, + FilesCoverageAttributes.JSON_PROPERTY_EVENT_TIMESTAMP, + FilesCoverageAttributes.JSON_PROPERTY_FILES, + FilesCoverageAttributes.JSON_PROPERTY_HEAD_COMMIT_SHA, + FilesCoverageAttributes.JSON_PROPERTY_REPORT_COUNT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FilesCoverageAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BASE_COMMIT_SHA = "base_commit_sha"; + private String baseCommitSha; + + public static final String JSON_PROPERTY_EVENT_TIMESTAMP = "event_timestamp"; + private Long eventTimestamp; + + public static final String JSON_PROPERTY_FILES = "files"; + private Map files = null; + + public static final String JSON_PROPERTY_HEAD_COMMIT_SHA = "head_commit_sha"; + private String headCommitSha; + + public static final String JSON_PROPERTY_REPORT_COUNT = "report_count"; + private Long reportCount; + + public FilesCoverageAttributes baseCommitSha(String baseCommitSha) { + this.baseCommitSha = baseCommitSha; + return this; + } + + /** + * The SHA of the base commit used for comparison (for example, the merge base for a PR). + * + * @return baseCommitSha + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BASE_COMMIT_SHA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBaseCommitSha() { + return baseCommitSha; + } + + public void setBaseCommitSha(String baseCommitSha) { + this.baseCommitSha = baseCommitSha; + } + + public FilesCoverageAttributes eventTimestamp(Long eventTimestamp) { + this.eventTimestamp = eventTimestamp; + return this; + } + + /** + * Unix timestamp (milliseconds) of the coverage event. + * + * @return eventTimestamp + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVENT_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getEventTimestamp() { + return eventTimestamp; + } + + public void setEventTimestamp(Long eventTimestamp) { + this.eventTimestamp = eventTimestamp; + } + + public FilesCoverageAttributes files(Map files) { + this.files = files; + return this; + } + + public FilesCoverageAttributes putFilesItem(String key, FileCoverageLines filesItem) { + if (this.files == null) { + this.files = new HashMap<>(); + } + this.files.put(key, filesItem); + return this; + } + + /** + * Map of file paths to per-file coverage line data. + * + * @return files + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FILES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getFiles() { + return files; + } + + public void setFiles(Map files) { + this.files = files; + } + + public FilesCoverageAttributes headCommitSha(String headCommitSha) { + this.headCommitSha = headCommitSha; + return this; + } + + /** + * The SHA of the head commit for which coverage was evaluated. + * + * @return headCommitSha + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HEAD_COMMIT_SHA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getHeadCommitSha() { + return headCommitSha; + } + + public void setHeadCommitSha(String headCommitSha) { + this.headCommitSha = headCommitSha; + } + + public FilesCoverageAttributes reportCount(Long reportCount) { + this.reportCount = reportCount; + return this; + } + + /** + * Number of coverage reports evaluated. + * + * @return reportCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REPORT_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getReportCount() { + return reportCount; + } + + public void setReportCount(Long reportCount) { + this.reportCount = reportCount; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FilesCoverageAttributes + */ + @JsonAnySetter + public FilesCoverageAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FilesCoverageAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FilesCoverageAttributes filesCoverageAttributes = (FilesCoverageAttributes) o; + return Objects.equals(this.baseCommitSha, filesCoverageAttributes.baseCommitSha) + && Objects.equals(this.eventTimestamp, filesCoverageAttributes.eventTimestamp) + && Objects.equals(this.files, filesCoverageAttributes.files) + && Objects.equals(this.headCommitSha, filesCoverageAttributes.headCommitSha) + && Objects.equals(this.reportCount, filesCoverageAttributes.reportCount) + && Objects.equals(this.additionalProperties, filesCoverageAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + baseCommitSha, eventTimestamp, files, headCommitSha, reportCount, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FilesCoverageAttributes {\n"); + sb.append(" baseCommitSha: ").append(toIndentedString(baseCommitSha)).append("\n"); + sb.append(" eventTimestamp: ").append(toIndentedString(eventTimestamp)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).append("\n"); + sb.append(" headCommitSha: ").append(toIndentedString(headCommitSha)).append("\n"); + sb.append(" reportCount: ").append(toIndentedString(reportCount)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FilesCoverageData.java b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageData.java new file mode 100644 index 00000000000..a0939a7d481 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageData.java @@ -0,0 +1,200 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data object for files coverage response. */ +@JsonPropertyOrder({ + FilesCoverageData.JSON_PROPERTY_ATTRIBUTES, + FilesCoverageData.JSON_PROPERTY_ID, + FilesCoverageData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FilesCoverageData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private FilesCoverageAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FilesCoverageResponseType type; + + public FilesCoverageData attributes(FilesCoverageAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the per-file code coverage response. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FilesCoverageAttributes getAttributes() { + return attributes; + } + + public void setAttributes(FilesCoverageAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public FilesCoverageData id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier for the files coverage response. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public FilesCoverageData type(FilesCoverageResponseType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * JSON:API type for files coverage response. The value must always be ci_app_coverage_files + * . + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FilesCoverageResponseType getType() { + return type; + } + + public void setType(FilesCoverageResponseType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FilesCoverageData + */ + @JsonAnySetter + public FilesCoverageData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FilesCoverageData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FilesCoverageData filesCoverageData = (FilesCoverageData) o; + return Objects.equals(this.attributes, filesCoverageData.attributes) + && Objects.equals(this.id, filesCoverageData.id) + && Objects.equals(this.type, filesCoverageData.type) + && Objects.equals(this.additionalProperties, filesCoverageData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FilesCoverageData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FilesCoverageRequest.java b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageRequest.java new file mode 100644 index 00000000000..349fd583df6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageRequest.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request object for getting per-file code coverage data. */ +@JsonPropertyOrder({FilesCoverageRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FilesCoverageRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private FilesCoverageRequestData data; + + public FilesCoverageRequest() {} + + @JsonCreator + public FilesCoverageRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) FilesCoverageRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public FilesCoverageRequest data(FilesCoverageRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data object for files coverage request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FilesCoverageRequestData getData() { + return data; + } + + public void setData(FilesCoverageRequestData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FilesCoverageRequest + */ + @JsonAnySetter + public FilesCoverageRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FilesCoverageRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FilesCoverageRequest filesCoverageRequest = (FilesCoverageRequest) o; + return Objects.equals(this.data, filesCoverageRequest.data) + && Objects.equals(this.additionalProperties, filesCoverageRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FilesCoverageRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FilesCoverageRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageRequestAttributes.java new file mode 100644 index 00000000000..95d6021a553 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageRequestAttributes.java @@ -0,0 +1,376 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * Attributes for requesting per-file code coverage data. Exactly one of commit_sha, + * branch, or pr_number must be provided. At most one of service + * , codeowner, or flag may be provided. + */ +@JsonPropertyOrder({ + FilesCoverageRequestAttributes.JSON_PROPERTY_BRANCH, + FilesCoverageRequestAttributes.JSON_PROPERTY_CHANGED_ONLY, + FilesCoverageRequestAttributes.JSON_PROPERTY_CODEOWNER, + FilesCoverageRequestAttributes.JSON_PROPERTY_COMMIT_SHA, + FilesCoverageRequestAttributes.JSON_PROPERTY_FLAG, + FilesCoverageRequestAttributes.JSON_PROPERTY_PR_NUMBER, + FilesCoverageRequestAttributes.JSON_PROPERTY_REPOSITORY_ID, + FilesCoverageRequestAttributes.JSON_PROPERTY_REPOSITORY_URL, + FilesCoverageRequestAttributes.JSON_PROPERTY_SERVICE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FilesCoverageRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BRANCH = "branch"; + private String branch; + + public static final String JSON_PROPERTY_CHANGED_ONLY = "changed_only"; + private Boolean changedOnly; + + public static final String JSON_PROPERTY_CODEOWNER = "codeowner"; + private String codeowner; + + public static final String JSON_PROPERTY_COMMIT_SHA = "commit_sha"; + private String commitSha; + + public static final String JSON_PROPERTY_FLAG = "flag"; + private String flag; + + public static final String JSON_PROPERTY_PR_NUMBER = "pr_number"; + private Long prNumber; + + public static final String JSON_PROPERTY_REPOSITORY_ID = "repository_id"; + private String repositoryId; + + public static final String JSON_PROPERTY_REPOSITORY_URL = "repository_url"; + private String repositoryUrl; + + public static final String JSON_PROPERTY_SERVICE = "service"; + private String service; + + public FilesCoverageRequestAttributes branch(String branch) { + this.branch = branch; + return this; + } + + /** + * The branch name. + * + * @return branch + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BRANCH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBranch() { + return branch; + } + + public void setBranch(String branch) { + this.branch = branch; + } + + public FilesCoverageRequestAttributes changedOnly(Boolean changedOnly) { + this.changedOnly = changedOnly; + return this; + } + + /** + * When true, return coverage data only for files that were changed in the specified scope. + * + * @return changedOnly + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CHANGED_ONLY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getChangedOnly() { + return changedOnly; + } + + public void setChangedOnly(Boolean changedOnly) { + this.changedOnly = changedOnly; + } + + public FilesCoverageRequestAttributes codeowner(String codeowner) { + this.codeowner = codeowner; + return this; + } + + /** + * Filter coverage by code owner. At most one of service, codeowner, or + * flag may be provided. + * + * @return codeowner + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CODEOWNER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCodeowner() { + return codeowner; + } + + public void setCodeowner(String codeowner) { + this.codeowner = codeowner; + } + + public FilesCoverageRequestAttributes commitSha(String commitSha) { + this.commitSha = commitSha; + return this; + } + + /** + * The commit SHA (40-character hexadecimal string). + * + * @return commitSha + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMMIT_SHA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCommitSha() { + return commitSha; + } + + public void setCommitSha(String commitSha) { + this.commitSha = commitSha; + } + + public FilesCoverageRequestAttributes flag(String flag) { + this.flag = flag; + return this; + } + + /** + * Filter coverage by coverage flag. At most one of service, codeowner, + * or flag may be provided. + * + * @return flag + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FLAG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFlag() { + return flag; + } + + public void setFlag(String flag) { + this.flag = flag; + } + + public FilesCoverageRequestAttributes prNumber(Long prNumber) { + this.prNumber = prNumber; + return this; + } + + /** + * The pull request number. Must be a positive integer. minimum: 1 + * + * @return prNumber + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PR_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getPrNumber() { + return prNumber; + } + + public void setPrNumber(Long prNumber) { + this.prNumber = prNumber; + } + + public FilesCoverageRequestAttributes repositoryId(String repositoryId) { + this.repositoryId = repositoryId; + return this; + } + + /** + * Deprecated: use repository_url instead. The repository URL. + * + * @return repositoryId + * @deprecated + */ + @Deprecated + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REPOSITORY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRepositoryId() { + return repositoryId; + } + + @Deprecated + public void setRepositoryId(String repositoryId) { + this.repositoryId = repositoryId; + } + + public FilesCoverageRequestAttributes repositoryUrl(String repositoryUrl) { + this.repositoryUrl = repositoryUrl; + return this; + } + + /** + * The repository URL. Accepts a full URL with or without a scheme (for example, + * https://github.com/org/repo or github.com/org/repo). + * + * @return repositoryUrl + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REPOSITORY_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRepositoryUrl() { + return repositoryUrl; + } + + public void setRepositoryUrl(String repositoryUrl) { + this.repositoryUrl = repositoryUrl; + } + + public FilesCoverageRequestAttributes service(String service) { + this.service = service; + return this; + } + + /** + * Filter coverage by service name. At most one of service, codeowner, + * or flag may be provided. + * + * @return service + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SERVICE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getService() { + return service; + } + + public void setService(String service) { + this.service = service; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FilesCoverageRequestAttributes + */ + @JsonAnySetter + public FilesCoverageRequestAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FilesCoverageRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FilesCoverageRequestAttributes filesCoverageRequestAttributes = + (FilesCoverageRequestAttributes) o; + return Objects.equals(this.branch, filesCoverageRequestAttributes.branch) + && Objects.equals(this.changedOnly, filesCoverageRequestAttributes.changedOnly) + && Objects.equals(this.codeowner, filesCoverageRequestAttributes.codeowner) + && Objects.equals(this.commitSha, filesCoverageRequestAttributes.commitSha) + && Objects.equals(this.flag, filesCoverageRequestAttributes.flag) + && Objects.equals(this.prNumber, filesCoverageRequestAttributes.prNumber) + && Objects.equals(this.repositoryId, filesCoverageRequestAttributes.repositoryId) + && Objects.equals(this.repositoryUrl, filesCoverageRequestAttributes.repositoryUrl) + && Objects.equals(this.service, filesCoverageRequestAttributes.service) + && Objects.equals( + this.additionalProperties, filesCoverageRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + branch, + changedOnly, + codeowner, + commitSha, + flag, + prNumber, + repositoryId, + repositoryUrl, + service, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FilesCoverageRequestAttributes {\n"); + sb.append(" branch: ").append(toIndentedString(branch)).append("\n"); + sb.append(" changedOnly: ").append(toIndentedString(changedOnly)).append("\n"); + sb.append(" codeowner: ").append(toIndentedString(codeowner)).append("\n"); + sb.append(" commitSha: ").append(toIndentedString(commitSha)).append("\n"); + sb.append(" flag: ").append(toIndentedString(flag)).append("\n"); + sb.append(" prNumber: ").append(toIndentedString(prNumber)).append("\n"); + sb.append(" repositoryId: ").append(toIndentedString(repositoryId)).append("\n"); + sb.append(" repositoryUrl: ").append(toIndentedString(repositoryUrl)).append("\n"); + sb.append(" service: ").append(toIndentedString(service)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FilesCoverageRequestData.java b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageRequestData.java new file mode 100644 index 00000000000..aeec5880ea2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageRequestData.java @@ -0,0 +1,187 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data object for files coverage request. */ +@JsonPropertyOrder({ + FilesCoverageRequestData.JSON_PROPERTY_ATTRIBUTES, + FilesCoverageRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FilesCoverageRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private FilesCoverageRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FilesCoverageRequestType type; + + public FilesCoverageRequestData() {} + + @JsonCreator + public FilesCoverageRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + FilesCoverageRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FilesCoverageRequestType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FilesCoverageRequestData attributes(FilesCoverageRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for requesting per-file code coverage data. Exactly one of commit_sha, + * branch, or pr_number must be provided. At most one of service + * , codeowner, or flag may be provided. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FilesCoverageRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(FilesCoverageRequestAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public FilesCoverageRequestData type(FilesCoverageRequestType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * JSON:API type for files coverage request. The value must always be + * ci_app_coverage_files_request. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FilesCoverageRequestType getType() { + return type; + } + + public void setType(FilesCoverageRequestType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FilesCoverageRequestData + */ + @JsonAnySetter + public FilesCoverageRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FilesCoverageRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FilesCoverageRequestData filesCoverageRequestData = (FilesCoverageRequestData) o; + return Objects.equals(this.attributes, filesCoverageRequestData.attributes) + && Objects.equals(this.type, filesCoverageRequestData.type) + && Objects.equals(this.additionalProperties, filesCoverageRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FilesCoverageRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FilesCoverageRequestType.java b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageRequestType.java new file mode 100644 index 00000000000..55006f789b8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageRequestType.java @@ -0,0 +1,60 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * JSON:API type for files coverage request. The value must always be + * ci_app_coverage_files_request. + */ +@JsonSerialize(using = FilesCoverageRequestType.FilesCoverageRequestTypeSerializer.class) +public class FilesCoverageRequestType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ci_app_coverage_files_request")); + + public static final FilesCoverageRequestType CI_APP_COVERAGE_FILES_REQUEST = + new FilesCoverageRequestType("ci_app_coverage_files_request"); + + FilesCoverageRequestType(String value) { + super(value, allowedValues); + } + + public static class FilesCoverageRequestTypeSerializer + extends StdSerializer { + public FilesCoverageRequestTypeSerializer(Class t) { + super(t); + } + + public FilesCoverageRequestTypeSerializer() { + this(null); + } + + @Override + public void serialize( + FilesCoverageRequestType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FilesCoverageRequestType fromValue(String value) { + return new FilesCoverageRequestType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FilesCoverageResponse.java b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageResponse.java new file mode 100644 index 00000000000..0e04a61e012 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageResponse.java @@ -0,0 +1,139 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response object containing per-file code coverage data. */ +@JsonPropertyOrder({FilesCoverageResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FilesCoverageResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private FilesCoverageData data; + + public FilesCoverageResponse data(FilesCoverageData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data object for files coverage response. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FilesCoverageData getData() { + return data; + } + + public void setData(FilesCoverageData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FilesCoverageResponse + */ + @JsonAnySetter + public FilesCoverageResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FilesCoverageResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FilesCoverageResponse filesCoverageResponse = (FilesCoverageResponse) o; + return Objects.equals(this.data, filesCoverageResponse.data) + && Objects.equals(this.additionalProperties, filesCoverageResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FilesCoverageResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FilesCoverageResponseType.java b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageResponseType.java new file mode 100644 index 00000000000..ce0646a68b4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FilesCoverageResponseType.java @@ -0,0 +1,60 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * JSON:API type for files coverage response. The value must always be ci_app_coverage_files + * . + */ +@JsonSerialize(using = FilesCoverageResponseType.FilesCoverageResponseTypeSerializer.class) +public class FilesCoverageResponseType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ci_app_coverage_files")); + + public static final FilesCoverageResponseType CI_APP_COVERAGE_FILES = + new FilesCoverageResponseType("ci_app_coverage_files"); + + FilesCoverageResponseType(String value) { + super(value, allowedValues); + } + + public static class FilesCoverageResponseTypeSerializer + extends StdSerializer { + public FilesCoverageResponseTypeSerializer(Class t) { + super(t); + } + + public FilesCoverageResponseTypeSerializer() { + this(null); + } + + @Override + public void serialize( + FilesCoverageResponseType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FilesCoverageResponseType fromValue(String value) { + return new FilesCoverageResponseType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/PRCoverageSummaryRequest.java b/src/main/java/com/datadog/api/client/v2/model/PRCoverageSummaryRequest.java new file mode 100644 index 00000000000..72dda609ac5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PRCoverageSummaryRequest.java @@ -0,0 +1,149 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request object for getting code coverage summary for a pull request. */ +@JsonPropertyOrder({PRCoverageSummaryRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PRCoverageSummaryRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private PRCoverageSummaryRequestData data; + + public PRCoverageSummaryRequest() {} + + @JsonCreator + public PRCoverageSummaryRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + PRCoverageSummaryRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public PRCoverageSummaryRequest data(PRCoverageSummaryRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data object for PR summary request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PRCoverageSummaryRequestData getData() { + return data; + } + + public void setData(PRCoverageSummaryRequestData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return PRCoverageSummaryRequest + */ + @JsonAnySetter + public PRCoverageSummaryRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this PRCoverageSummaryRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PRCoverageSummaryRequest prCoverageSummaryRequest = (PRCoverageSummaryRequest) o; + return Objects.equals(this.data, prCoverageSummaryRequest.data) + && Objects.equals(this.additionalProperties, prCoverageSummaryRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PRCoverageSummaryRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/PRCoverageSummaryRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/PRCoverageSummaryRequestAttributes.java new file mode 100644 index 00000000000..6a0c65ce6a6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PRCoverageSummaryRequestAttributes.java @@ -0,0 +1,176 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes for requesting code coverage summary for a pull request. */ +@JsonPropertyOrder({ + PRCoverageSummaryRequestAttributes.JSON_PROPERTY_PR_NUMBER, + PRCoverageSummaryRequestAttributes.JSON_PROPERTY_REPOSITORY_URL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PRCoverageSummaryRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PR_NUMBER = "pr_number"; + private Long prNumber; + + public static final String JSON_PROPERTY_REPOSITORY_URL = "repository_url"; + private String repositoryUrl; + + public PRCoverageSummaryRequestAttributes() {} + + @JsonCreator + public PRCoverageSummaryRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_PR_NUMBER) Long prNumber, + @JsonProperty(required = true, value = JSON_PROPERTY_REPOSITORY_URL) String repositoryUrl) { + this.prNumber = prNumber; + this.repositoryUrl = repositoryUrl; + } + + public PRCoverageSummaryRequestAttributes prNumber(Long prNumber) { + this.prNumber = prNumber; + return this; + } + + /** + * The pull request number. Must be a positive integer. minimum: 1 + * + * @return prNumber + */ + @JsonProperty(JSON_PROPERTY_PR_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getPrNumber() { + return prNumber; + } + + public void setPrNumber(Long prNumber) { + this.prNumber = prNumber; + } + + public PRCoverageSummaryRequestAttributes repositoryUrl(String repositoryUrl) { + this.repositoryUrl = repositoryUrl; + return this; + } + + /** + * The repository URL. Accepts a full URL with or without a scheme (for example, + * https://github.com/org/repo or github.com/org/repo). + * + * @return repositoryUrl + */ + @JsonProperty(JSON_PROPERTY_REPOSITORY_URL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRepositoryUrl() { + return repositoryUrl; + } + + public void setRepositoryUrl(String repositoryUrl) { + this.repositoryUrl = repositoryUrl; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return PRCoverageSummaryRequestAttributes + */ + @JsonAnySetter + public PRCoverageSummaryRequestAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this PRCoverageSummaryRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PRCoverageSummaryRequestAttributes prCoverageSummaryRequestAttributes = + (PRCoverageSummaryRequestAttributes) o; + return Objects.equals(this.prNumber, prCoverageSummaryRequestAttributes.prNumber) + && Objects.equals(this.repositoryUrl, prCoverageSummaryRequestAttributes.repositoryUrl) + && Objects.equals( + this.additionalProperties, prCoverageSummaryRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(prNumber, repositoryUrl, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PRCoverageSummaryRequestAttributes {\n"); + sb.append(" prNumber: ").append(toIndentedString(prNumber)).append("\n"); + sb.append(" repositoryUrl: ").append(toIndentedString(repositoryUrl)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/PRCoverageSummaryRequestData.java b/src/main/java/com/datadog/api/client/v2/model/PRCoverageSummaryRequestData.java new file mode 100644 index 00000000000..ae950a583a9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PRCoverageSummaryRequestData.java @@ -0,0 +1,187 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data object for PR summary request. */ +@JsonPropertyOrder({ + PRCoverageSummaryRequestData.JSON_PROPERTY_ATTRIBUTES, + PRCoverageSummaryRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PRCoverageSummaryRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private PRCoverageSummaryRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private PRCoverageSummaryRequestType type; + + public PRCoverageSummaryRequestData() {} + + @JsonCreator + public PRCoverageSummaryRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + PRCoverageSummaryRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + PRCoverageSummaryRequestType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public PRCoverageSummaryRequestData attributes(PRCoverageSummaryRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for requesting code coverage summary for a pull request. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PRCoverageSummaryRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(PRCoverageSummaryRequestAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public PRCoverageSummaryRequestData type(PRCoverageSummaryRequestType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * JSON:API type for PR coverage summary request. The value must always be + * ci_app_coverage_pr_summary_request. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PRCoverageSummaryRequestType getType() { + return type; + } + + public void setType(PRCoverageSummaryRequestType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return PRCoverageSummaryRequestData + */ + @JsonAnySetter + public PRCoverageSummaryRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this PRCoverageSummaryRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PRCoverageSummaryRequestData prCoverageSummaryRequestData = (PRCoverageSummaryRequestData) o; + return Objects.equals(this.attributes, prCoverageSummaryRequestData.attributes) + && Objects.equals(this.type, prCoverageSummaryRequestData.type) + && Objects.equals( + this.additionalProperties, prCoverageSummaryRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PRCoverageSummaryRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/PRCoverageSummaryRequestType.java b/src/main/java/com/datadog/api/client/v2/model/PRCoverageSummaryRequestType.java new file mode 100644 index 00000000000..69b1278d896 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PRCoverageSummaryRequestType.java @@ -0,0 +1,60 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * JSON:API type for PR coverage summary request. The value must always be + * ci_app_coverage_pr_summary_request. + */ +@JsonSerialize(using = PRCoverageSummaryRequestType.PRCoverageSummaryRequestTypeSerializer.class) +public class PRCoverageSummaryRequestType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ci_app_coverage_pr_summary_request")); + + public static final PRCoverageSummaryRequestType CI_APP_COVERAGE_PR_SUMMARY_REQUEST = + new PRCoverageSummaryRequestType("ci_app_coverage_pr_summary_request"); + + PRCoverageSummaryRequestType(String value) { + super(value, allowedValues); + } + + public static class PRCoverageSummaryRequestTypeSerializer + extends StdSerializer { + public PRCoverageSummaryRequestTypeSerializer(Class t) { + super(t); + } + + public PRCoverageSummaryRequestTypeSerializer() { + this(null); + } + + @Override + public void serialize( + PRCoverageSummaryRequestType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static PRCoverageSummaryRequestType fromValue(String value) { + return new PRCoverageSummaryRequestType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/code_coverage.feature b/src/test/resources/com/datadog/api/client/v2/api/code_coverage.feature index a103acd210a..217c50edf8c 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/code_coverage.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/code_coverage.feature @@ -11,24 +11,21 @@ Feature: Code Coverage @generated @skip @team:DataDog/ci-app-backend Scenario: Get code coverage summary for a branch returns "Bad Request" response - Given operation "GetCodeCoverageBranchSummary" enabled - And new "GetCodeCoverageBranchSummary" request + Given new "GetCodeCoverageBranchSummary" request And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/ci-app-backend Scenario: Get code coverage summary for a branch returns "Not Found" response - Given operation "GetCodeCoverageBranchSummary" enabled - And new "GetCodeCoverageBranchSummary" request + Given new "GetCodeCoverageBranchSummary" request And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}} When the request is sent Then the response status is 404 Not Found @generated @skip @team:DataDog/ci-app-backend Scenario: Get code coverage summary for a branch returns "OK" response - Given operation "GetCodeCoverageBranchSummary" enabled - And new "GetCodeCoverageBranchSummary" request + Given new "GetCodeCoverageBranchSummary" request And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}} When the request is sent Then the response status is 200 OK @@ -59,24 +56,21 @@ Feature: Code Coverage @generated @skip @team:DataDog/ci-app-backend Scenario: Get code coverage summary for a commit returns "Bad Request" response - Given operation "GetCodeCoverageCommitSummary" enabled - And new "GetCodeCoverageCommitSummary" request + Given new "GetCodeCoverageCommitSummary" request And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/ci-app-backend Scenario: Get code coverage summary for a commit returns "Not Found" response - Given operation "GetCodeCoverageCommitSummary" enabled - And new "GetCodeCoverageCommitSummary" request + Given new "GetCodeCoverageCommitSummary" request And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}} When the request is sent Then the response status is 404 Not Found @generated @skip @team:DataDog/ci-app-backend Scenario: Get code coverage summary for a commit returns "OK" response - Given operation "GetCodeCoverageCommitSummary" enabled - And new "GetCodeCoverageCommitSummary" request + Given new "GetCodeCoverageCommitSummary" request And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}} When the request is sent Then the response status is 200 OK @@ -129,6 +123,27 @@ Feature: Code Coverage When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a pull request returns "Bad Request" response + Given new "GetCodeCoveragePRSummary" request + And body with value {"data": {"attributes": {"pr_number": 42, "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_pr_summary_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a pull request returns "Not Found" response + Given new "GetCodeCoveragePRSummary" request + And body with value {"data": {"attributes": {"pr_number": 42, "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_pr_summary_request"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a pull request returns "OK" response + Given new "GetCodeCoveragePRSummary" request + And body with value {"data": {"attributes": {"pr_number": 42, "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_pr_summary_request"}} + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/ci-app-backend Scenario: Get code coverage summary for an existing branch with valid repository Given operation "GetCodeCoverageBranchSummary" enabled @@ -154,3 +169,24 @@ Feature: Code Coverage And the response "data.attributes" has field "patch_coverage" And the response "data.attributes" has field "evaluated_reports_count" And the response "data.attributes" has field "evaluated_flags_count" + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get per-file code coverage data returns "Bad Request" response + Given new "GetCodeCoverageFiles" request + And body with value {"data": {"attributes": {"branch": "main", "changed_only": true, "codeowner": "@my-team", "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "flag": "unit-tests", "pr_number": 42, "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist", "service": "my-service"}, "type": "ci_app_coverage_files_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/ci-app-backend + Scenario: Get per-file code coverage data returns "Not Found" response + Given new "GetCodeCoverageFiles" request + And body with value {"data": {"attributes": {"changed_only": true, "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_files_request"}} + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/ci-app-backend + Scenario: Get per-file code coverage data returns "OK" response + Given new "GetCodeCoverageFiles" request + And body with value {"data": {"attributes": {"changed_only": true, "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_files_request"}} + When the request is sent + Then the response status is 200 OK diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index df961ee10c8..57c7469dac5 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -1548,6 +1548,18 @@ "type": "safe" } }, + "GetCodeCoverageFiles": { + "tag": "Code Coverage", + "undo": { + "type": "safe" + } + }, + "GetCodeCoveragePRSummary": { + "tag": "Code Coverage", + "undo": { + "type": "safe" + } + }, "GetRuleBasedView": { "tag": "Compliance", "undo": {