diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 3cabe03bbadd..ea6d9fe94703 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.rb b/examples/v2/code-coverage/GetCodeCoverageBranchSummary.rb index 82eb6438ccfe..2275a039463b 100644 --- a/examples/v2/code-coverage/GetCodeCoverageBranchSummary.rb +++ b/examples/v2/code-coverage/GetCodeCoverageBranchSummary.rb @@ -1,9 +1,6 @@ # Get code coverage summary for a branch returns "OK" response require "datadog_api_client" -DatadogAPIClient.configure do |config| - config.unstable_operations["v2.get_code_coverage_branch_summary".to_sym] = true -end api_instance = DatadogAPIClient::V2::CodeCoverageAPI.new body = DatadogAPIClient::V2::BranchCoverageSummaryRequest.new({ diff --git a/examples/v2/code-coverage/GetCodeCoverageCommitSummary.rb b/examples/v2/code-coverage/GetCodeCoverageCommitSummary.rb index e2c7bdd0e378..6041f66f2061 100644 --- a/examples/v2/code-coverage/GetCodeCoverageCommitSummary.rb +++ b/examples/v2/code-coverage/GetCodeCoverageCommitSummary.rb @@ -1,9 +1,6 @@ # Get code coverage summary for a commit returns "OK" response require "datadog_api_client" -DatadogAPIClient.configure do |config| - config.unstable_operations["v2.get_code_coverage_commit_summary".to_sym] = true -end api_instance = DatadogAPIClient::V2::CodeCoverageAPI.new body = DatadogAPIClient::V2::CommitCoverageSummaryRequest.new({ diff --git a/examples/v2/code-coverage/GetCodeCoverageFiles.rb b/examples/v2/code-coverage/GetCodeCoverageFiles.rb new file mode 100644 index 000000000000..4221fbb50127 --- /dev/null +++ b/examples/v2/code-coverage/GetCodeCoverageFiles.rb @@ -0,0 +1,16 @@ +# Get per-file code coverage data returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::CodeCoverageAPI.new + +body = DatadogAPIClient::V2::FilesCoverageRequest.new({ + data: DatadogAPIClient::V2::FilesCoverageRequestData.new({ + attributes: DatadogAPIClient::V2::FilesCoverageRequestAttributes.new({ + changed_only: true, + commit_sha: "66adc9350f2cc9b250b69abddab733dd55e1a588", + repository_url: "https://github.com/datadog/shopist", + }), + type: DatadogAPIClient::V2::FilesCoverageRequestType::CI_APP_COVERAGE_FILES_REQUEST, + }), +}) +p api_instance.get_code_coverage_files(body) diff --git a/examples/v2/code-coverage/GetCodeCoveragePRSummary.rb b/examples/v2/code-coverage/GetCodeCoveragePRSummary.rb new file mode 100644 index 000000000000..8d573a0efd06 --- /dev/null +++ b/examples/v2/code-coverage/GetCodeCoveragePRSummary.rb @@ -0,0 +1,15 @@ +# Get code coverage summary for a pull request returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::CodeCoverageAPI.new + +body = DatadogAPIClient::V2::PRCoverageSummaryRequest.new({ + data: DatadogAPIClient::V2::PRCoverageSummaryRequestData.new({ + attributes: DatadogAPIClient::V2::PRCoverageSummaryRequestAttributes.new({ + pr_number: 42, + repository_url: "https://github.com/datadog/shopist", + }), + type: DatadogAPIClient::V2::PRCoverageSummaryRequestType::CI_APP_COVERAGE_PR_SUMMARY_REQUEST, + }), +}) +p api_instance.get_code_coverage_pr_summary(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 8184563745fd..3bc2898cf77c 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2677,6 +2677,12 @@ "v2.GetCodeCoverageCommitSummary" => { "body" => "CommitCoverageSummaryRequest", }, + "v2.GetCodeCoverageFiles" => { + "body" => "FilesCoverageRequest", + }, + "v2.GetCodeCoveragePRSummary" => { + "body" => "PRCoverageSummaryRequest", + }, "v2.GetRuleBasedView" => { "to" => "Integer", "framework" => "String", diff --git a/features/v2/code_coverage.feature b/features/v2/code_coverage.feature index a103acd210ae..217c50edf8c1 100644 --- a/features/v2/code_coverage.feature +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index df961ee10c84..57c7469dac58 100644 --- a/features/v2/undo.json +++ b/features/v2/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": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index ab4a0dc4daa4..3614a93a14e9 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -373,8 +373,6 @@ def initialize "v2.update_security_monitoring_integration_config": false, "v2.validate_security_monitoring_integration_config": false, "v2.validate_security_monitoring_integration_credentials": false, - "v2.get_code_coverage_branch_summary": false, - "v2.get_code_coverage_commit_summary": false, "v2.get_rule_based_view": false, "v2.get_commitments_commitment_list": false, "v2.get_commitments_coverage_scalar": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 8c9591985f8a..cea415d737b7 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3380,6 +3380,15 @@ def overrides "v2.feature_flags_pagination_meta" => "FeatureFlagsPaginationMeta", "v2.feature_flags_pagination_meta_page" => "FeatureFlagsPaginationMetaPage", "v2.feature_flag_status" => "FeatureFlagStatus", + "v2.file_coverage_lines" => "FileCoverageLines", + "v2.files_coverage_attributes" => "FilesCoverageAttributes", + "v2.files_coverage_data" => "FilesCoverageData", + "v2.files_coverage_request" => "FilesCoverageRequest", + "v2.files_coverage_request_attributes" => "FilesCoverageRequestAttributes", + "v2.files_coverage_request_data" => "FilesCoverageRequestData", + "v2.files_coverage_request_type" => "FilesCoverageRequestType", + "v2.files_coverage_response" => "FilesCoverageResponse", + "v2.files_coverage_response_type" => "FilesCoverageResponseType", "v2.filters_per_product" => "FiltersPerProduct", "v2.finding" => "Finding", "v2.finding_attributes" => "FindingAttributes", @@ -6104,6 +6113,10 @@ def overrides "v2.powerpacks_response_meta" => "PowerpacksResponseMeta", "v2.powerpacks_response_meta_pagination" => "PowerpacksResponseMetaPagination", "v2.powerpack_template_variable" => "PowerpackTemplateVariable", + "v2.pr_coverage_summary_request" => "PRCoverageSummaryRequest", + "v2.pr_coverage_summary_request_attributes" => "PRCoverageSummaryRequestAttributes", + "v2.pr_coverage_summary_request_data" => "PRCoverageSummaryRequestData", + "v2.pr_coverage_summary_request_type" => "PRCoverageSummaryRequestType", "v2.preview_entity_response_data" => "PreviewEntityResponseData", "v2.print_report_request" => "PrintReportRequest", "v2.print_report_request_attributes" => "PrintReportRequestAttributes", diff --git a/lib/datadog_api_client/v2/api/code_coverage_api.rb b/lib/datadog_api_client/v2/api/code_coverage_api.rb index 86e974616eaf..5d10dd6fe0de 100644 --- a/lib/datadog_api_client/v2/api/code_coverage_api.rb +++ b/lib/datadog_api_client/v2/api/code_coverage_api.rb @@ -41,12 +41,6 @@ def get_code_coverage_branch_summary(body, opts = {}) # @param opts [Hash] the optional parameters # @return [Array<(CoverageSummaryResponse, Integer, Hash)>] CoverageSummaryResponse data, response status code and response headers def get_code_coverage_branch_summary_with_http_info(body, opts = {}) - unstable_enabled = @api_client.config.unstable_operations["v2.get_code_coverage_branch_summary".to_sym] - if unstable_enabled - @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_code_coverage_branch_summary") - else - raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_code_coverage_branch_summary")) - end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CodeCoverageAPI.get_code_coverage_branch_summary ...' @@ -118,12 +112,6 @@ def get_code_coverage_commit_summary(body, opts = {}) # @param opts [Hash] the optional parameters # @return [Array<(CoverageSummaryResponse, Integer, Hash)>] CoverageSummaryResponse data, response status code and response headers def get_code_coverage_commit_summary_with_http_info(body, opts = {}) - unstable_enabled = @api_client.config.unstable_operations["v2.get_code_coverage_commit_summary".to_sym] - if unstable_enabled - @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_code_coverage_commit_summary") - else - raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_code_coverage_commit_summary")) - end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CodeCoverageAPI.get_code_coverage_commit_summary ...' @@ -174,5 +162,143 @@ def get_code_coverage_commit_summary_with_http_info(body, opts = {}) end return data, status_code, headers end + + # Get per-file code coverage data. + # + # @see #get_code_coverage_files_with_http_info + def get_code_coverage_files(body, opts = {}) + data, _status_code, _headers = get_code_coverage_files_with_http_info(body, opts) + data + end + + # Get per-file code coverage data. + # + # 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 [FilesCoverageRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(FilesCoverageResponse, Integer, Hash)>] FilesCoverageResponse data, response status code and response headers + def get_code_coverage_files_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CodeCoverageAPI.get_code_coverage_files ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling CodeCoverageAPI.get_code_coverage_files" + end + # resource path + local_var_path = '/api/v2/code-coverage/files' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'FilesCoverageResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_code_coverage_files, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CodeCoverageAPI#get_code_coverage_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get code coverage summary for a pull request. + # + # @see #get_code_coverage_pr_summary_with_http_info + def get_code_coverage_pr_summary(body, opts = {}) + data, _status_code, _headers = get_code_coverage_pr_summary_with_http_info(body, opts) + data + end + + # Get code coverage summary for a pull request. + # + # 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 [PRCoverageSummaryRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(CoverageSummaryResponse, Integer, Hash)>] CoverageSummaryResponse data, response status code and response headers + def get_code_coverage_pr_summary_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CodeCoverageAPI.get_code_coverage_pr_summary ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling CodeCoverageAPI.get_code_coverage_pr_summary" + end + # resource path + local_var_path = '/api/v2/code-coverage/pr/summary' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'CoverageSummaryResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_code_coverage_pr_summary, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CodeCoverageAPI#get_code_coverage_pr_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/models/file_coverage_lines.rb b/lib/datadog_api_client/v2/models/file_coverage_lines.rb new file mode 100644 index 000000000000..d2cc71dd4f88 --- /dev/null +++ b/lib/datadog_api_client/v2/models/file_coverage_lines.rb @@ -0,0 +1,131 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Per-file line coverage data including executable, covered, and added lines. + class FileCoverageLines + include BaseGenericModel + + # Line numbers that were added in the specified scope (for example, in a PR diff). + attr_accessor :added_lines + + # Line numbers that were covered by tests. + attr_accessor :covered_lines + + # Line numbers that are executable (can be covered). + attr_accessor :executable_lines + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'added_lines' => :'added_lines', + :'covered_lines' => :'covered_lines', + :'executable_lines' => :'executable_lines' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'added_lines' => :'Array', + :'covered_lines' => :'Array', + :'executable_lines' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FileCoverageLines` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'added_lines') + if (value = attributes[:'added_lines']).is_a?(Array) + self.added_lines = value + end + end + + if attributes.key?(:'covered_lines') + if (value = attributes[:'covered_lines']).is_a?(Array) + self.covered_lines = value + end + end + + if attributes.key?(:'executable_lines') + if (value = attributes[:'executable_lines']).is_a?(Array) + self.executable_lines = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + added_lines == o.added_lines && + covered_lines == o.covered_lines && + executable_lines == o.executable_lines && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [added_lines, covered_lines, executable_lines, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/files_coverage_attributes.rb b/lib/datadog_api_client/v2/models/files_coverage_attributes.rb new file mode 100644 index 000000000000..dbd5d75c0bd1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/files_coverage_attributes.rb @@ -0,0 +1,145 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the per-file code coverage response. + class FilesCoverageAttributes + include BaseGenericModel + + # The SHA of the base commit used for comparison (for example, the merge base for a PR). + attr_accessor :base_commit_sha + + # Unix timestamp (milliseconds) of the coverage event. + attr_accessor :event_timestamp + + # Map of file paths to per-file coverage line data. + attr_accessor :files + + # The SHA of the head commit for which coverage was evaluated. + attr_accessor :head_commit_sha + + # Number of coverage reports evaluated. + attr_accessor :report_count + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'base_commit_sha' => :'base_commit_sha', + :'event_timestamp' => :'event_timestamp', + :'files' => :'files', + :'head_commit_sha' => :'head_commit_sha', + :'report_count' => :'report_count' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'base_commit_sha' => :'String', + :'event_timestamp' => :'Integer', + :'files' => :'Hash', + :'head_commit_sha' => :'String', + :'report_count' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FilesCoverageAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'base_commit_sha') + self.base_commit_sha = attributes[:'base_commit_sha'] + end + + if attributes.key?(:'event_timestamp') + self.event_timestamp = attributes[:'event_timestamp'] + end + + if attributes.key?(:'files') + self.files = attributes[:'files'] + end + + if attributes.key?(:'head_commit_sha') + self.head_commit_sha = attributes[:'head_commit_sha'] + end + + if attributes.key?(:'report_count') + self.report_count = attributes[:'report_count'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + base_commit_sha == o.base_commit_sha && + event_timestamp == o.event_timestamp && + files == o.files && + head_commit_sha == o.head_commit_sha && + report_count == o.report_count && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [base_commit_sha, event_timestamp, files, head_commit_sha, report_count, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/files_coverage_data.rb b/lib/datadog_api_client/v2/models/files_coverage_data.rb new file mode 100644 index 000000000000..0a0c37179dec --- /dev/null +++ b/lib/datadog_api_client/v2/models/files_coverage_data.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object for files coverage response. + class FilesCoverageData + include BaseGenericModel + + # Attributes of the per-file code coverage response. + attr_accessor :attributes + + # Unique identifier for the files coverage response. + attr_accessor :id + + # JSON:API type for files coverage response. The value must always be `ci_app_coverage_files`. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'FilesCoverageAttributes', + :'id' => :'String', + :'type' => :'FilesCoverageResponseType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FilesCoverageData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/files_coverage_request.rb b/lib/datadog_api_client/v2/models/files_coverage_request.rb new file mode 100644 index 000000000000..3100b6f3b8ee --- /dev/null +++ b/lib/datadog_api_client/v2/models/files_coverage_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request object for getting per-file code coverage data. + class FilesCoverageRequest + include BaseGenericModel + + # Data object for files coverage request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'FilesCoverageRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FilesCoverageRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/files_coverage_request_attributes.rb b/lib/datadog_api_client/v2/models/files_coverage_request_attributes.rb new file mode 100644 index 000000000000..d4e3c5a213e2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/files_coverage_request_attributes.rb @@ -0,0 +1,238 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # 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. + class FilesCoverageRequestAttributes + include BaseGenericModel + + # The branch name. + attr_accessor :branch + + # When true, return coverage data only for files that were changed in the specified scope. + attr_accessor :changed_only + + # Filter coverage by code owner. At most one of `service`, `codeowner`, or `flag` may be provided. + attr_accessor :codeowner + + # The commit SHA (40-character hexadecimal string). + attr_reader :commit_sha + + # Filter coverage by coverage flag. At most one of `service`, `codeowner`, or `flag` may be provided. + attr_accessor :flag + + # The pull request number. Must be a positive integer. + attr_reader :pr_number + + # Deprecated: use `repository_url` instead. The repository URL. + attr_reader :repository_id + + # The repository URL. Accepts a full URL with or without a scheme (for example, `https://github.com/org/repo` or `github.com/org/repo`). + attr_reader :repository_url + + # Filter coverage by service name. At most one of `service`, `codeowner`, or `flag` may be provided. + attr_accessor :service + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'branch' => :'branch', + :'changed_only' => :'changed_only', + :'codeowner' => :'codeowner', + :'commit_sha' => :'commit_sha', + :'flag' => :'flag', + :'pr_number' => :'pr_number', + :'repository_id' => :'repository_id', + :'repository_url' => :'repository_url', + :'service' => :'service' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'branch' => :'String', + :'changed_only' => :'Boolean', + :'codeowner' => :'String', + :'commit_sha' => :'String', + :'flag' => :'String', + :'pr_number' => :'Integer', + :'repository_id' => :'String', + :'repository_url' => :'String', + :'service' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FilesCoverageRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'changed_only') + self.changed_only = attributes[:'changed_only'] + end + + if attributes.key?(:'codeowner') + self.codeowner = attributes[:'codeowner'] + end + + if attributes.key?(:'commit_sha') + self.commit_sha = attributes[:'commit_sha'] + end + + if attributes.key?(:'flag') + self.flag = attributes[:'flag'] + end + + if attributes.key?(:'pr_number') + self.pr_number = attributes[:'pr_number'] + end + + if attributes.key?(:'repository_id') + self.repository_id = attributes[:'repository_id'] + end + + if attributes.key?(:'repository_url') + self.repository_url = attributes[:'repository_url'] + end + + if attributes.key?(:'service') + self.service = attributes[:'service'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + pattern = Regexp.new(/^[a-fA-F0-9]{40}$/) + return false if !@commit_sha.nil? && @commit_sha !~ pattern + return false if !@pr_number.nil? && @pr_number < 1 + return false if !@repository_id.nil? && @repository_id.to_s.length < 1 + return false if !@repository_url.nil? && @repository_url.to_s.length < 1 + true + end + + # Custom attribute writer method with validation + # @param commit_sha [Object] Object to be assigned + # @!visibility private + def commit_sha=(commit_sha) + pattern = Regexp.new(/^[a-fA-F0-9]{40}$/) + if !commit_sha.nil? && commit_sha !~ pattern + fail ArgumentError, "invalid value for \"commit_sha\", must conform to the pattern #{pattern}." + end + @commit_sha = commit_sha + end + + # Custom attribute writer method with validation + # @param pr_number [Object] Object to be assigned + # @!visibility private + def pr_number=(pr_number) + if !pr_number.nil? && pr_number < 1 + fail ArgumentError, 'invalid value for "pr_number", must be greater than or equal to 1.' + end + @pr_number = pr_number + end + + # Custom attribute writer method with validation + # @param repository_id [Object] Object to be assigned + # @!visibility private + def repository_id=(repository_id) + if !repository_id.nil? && repository_id.to_s.length < 1 + fail ArgumentError, 'invalid value for "repository_id", the character length must be great than or equal to 1.' + end + @repository_id = repository_id + end + + # Custom attribute writer method with validation + # @param repository_url [Object] Object to be assigned + # @!visibility private + def repository_url=(repository_url) + if !repository_url.nil? && repository_url.to_s.length < 1 + fail ArgumentError, 'invalid value for "repository_url", the character length must be great than or equal to 1.' + end + @repository_url = repository_url + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + branch == o.branch && + changed_only == o.changed_only && + codeowner == o.codeowner && + commit_sha == o.commit_sha && + flag == o.flag && + pr_number == o.pr_number && + repository_id == o.repository_id && + repository_url == o.repository_url && + service == o.service && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [branch, changed_only, codeowner, commit_sha, flag, pr_number, repository_id, repository_url, service, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/files_coverage_request_data.rb b/lib/datadog_api_client/v2/models/files_coverage_request_data.rb new file mode 100644 index 000000000000..332074806303 --- /dev/null +++ b/lib/datadog_api_client/v2/models/files_coverage_request_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object for files coverage request. + class FilesCoverageRequestData + include BaseGenericModel + + # 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. + attr_reader :attributes + + # JSON:API type for files coverage request. The value must always be `ci_app_coverage_files_request`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'FilesCoverageRequestAttributes', + :'type' => :'FilesCoverageRequestType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FilesCoverageRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/files_coverage_request_type.rb b/lib/datadog_api_client/v2/models/files_coverage_request_type.rb new file mode 100644 index 000000000000..e00d88519aad --- /dev/null +++ b/lib/datadog_api_client/v2/models/files_coverage_request_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API type for files coverage request. The value must always be `ci_app_coverage_files_request`. + class FilesCoverageRequestType + include BaseEnumModel + + CI_APP_COVERAGE_FILES_REQUEST = "ci_app_coverage_files_request".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/files_coverage_response.rb b/lib/datadog_api_client/v2/models/files_coverage_response.rb new file mode 100644 index 000000000000..67d9833cbbf0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/files_coverage_response.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response object containing per-file code coverage data. + class FilesCoverageResponse + include BaseGenericModel + + # Data object for files coverage response. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'FilesCoverageData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FilesCoverageResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/files_coverage_response_type.rb b/lib/datadog_api_client/v2/models/files_coverage_response_type.rb new file mode 100644 index 000000000000..3d355157e0ad --- /dev/null +++ b/lib/datadog_api_client/v2/models/files_coverage_response_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API type for files coverage response. The value must always be `ci_app_coverage_files`. + class FilesCoverageResponseType + include BaseEnumModel + + CI_APP_COVERAGE_FILES = "ci_app_coverage_files".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/pr_coverage_summary_request.rb b/lib/datadog_api_client/v2/models/pr_coverage_summary_request.rb new file mode 100644 index 000000000000..807ef5ecd65f --- /dev/null +++ b/lib/datadog_api_client/v2/models/pr_coverage_summary_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request object for getting code coverage summary for a pull request. + class PRCoverageSummaryRequest + include BaseGenericModel + + # Data object for PR summary request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'PRCoverageSummaryRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PRCoverageSummaryRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/pr_coverage_summary_request_attributes.rb b/lib/datadog_api_client/v2/models/pr_coverage_summary_request_attributes.rb new file mode 100644 index 000000000000..c7b4362afeb0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/pr_coverage_summary_request_attributes.rb @@ -0,0 +1,152 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for requesting code coverage summary for a pull request. + class PRCoverageSummaryRequestAttributes + include BaseGenericModel + + # The pull request number. Must be a positive integer. + attr_reader :pr_number + + # The repository URL. Accepts a full URL with or without a scheme (for example, `https://github.com/org/repo` or `github.com/org/repo`). + attr_reader :repository_url + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'pr_number' => :'pr_number', + :'repository_url' => :'repository_url' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'pr_number' => :'Integer', + :'repository_url' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PRCoverageSummaryRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'pr_number') + self.pr_number = attributes[:'pr_number'] + end + + if attributes.key?(:'repository_url') + self.repository_url = attributes[:'repository_url'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @pr_number.nil? + return false if @pr_number < 1 + return false if @repository_url.nil? + return false if @repository_url.to_s.length < 1 + true + end + + # Custom attribute writer method with validation + # @param pr_number [Object] Object to be assigned + # @!visibility private + def pr_number=(pr_number) + if pr_number.nil? + fail ArgumentError, 'invalid value for "pr_number", pr_number cannot be nil.' + end + if pr_number < 1 + fail ArgumentError, 'invalid value for "pr_number", must be greater than or equal to 1.' + end + @pr_number = pr_number + end + + # Custom attribute writer method with validation + # @param repository_url [Object] Object to be assigned + # @!visibility private + def repository_url=(repository_url) + if repository_url.nil? + fail ArgumentError, 'invalid value for "repository_url", repository_url cannot be nil.' + end + if repository_url.to_s.length < 1 + fail ArgumentError, 'invalid value for "repository_url", the character length must be great than or equal to 1.' + end + @repository_url = repository_url + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + pr_number == o.pr_number && + repository_url == o.repository_url && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [pr_number, repository_url, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/pr_coverage_summary_request_data.rb b/lib/datadog_api_client/v2/models/pr_coverage_summary_request_data.rb new file mode 100644 index 000000000000..e99f0450f680 --- /dev/null +++ b/lib/datadog_api_client/v2/models/pr_coverage_summary_request_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object for PR summary request. + class PRCoverageSummaryRequestData + include BaseGenericModel + + # Attributes for requesting code coverage summary for a pull request. + attr_reader :attributes + + # JSON:API type for PR coverage summary request. The value must always be `ci_app_coverage_pr_summary_request`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'PRCoverageSummaryRequestAttributes', + :'type' => :'PRCoverageSummaryRequestType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PRCoverageSummaryRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/pr_coverage_summary_request_type.rb b/lib/datadog_api_client/v2/models/pr_coverage_summary_request_type.rb new file mode 100644 index 000000000000..3e596699fe8c --- /dev/null +++ b/lib/datadog_api_client/v2/models/pr_coverage_summary_request_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API type for PR coverage summary request. The value must always be `ci_app_coverage_pr_summary_request`. + class PRCoverageSummaryRequestType + include BaseEnumModel + + CI_APP_COVERAGE_PR_SUMMARY_REQUEST = "ci_app_coverage_pr_summary_request".freeze + end +end